From 6ac9d01b6ecc7eb9ffc733d08c4f18c3dc1fe5e1 Mon Sep 17 00:00:00 2001 From: Robert Field Date: Thu, 4 Jul 2024 16:05:22 +0100 Subject: [PATCH 01/30] feat: init generate of pim --- .../sdks/openapi-ts-error-1720105320904.log | 5 + packages/sdks/openapi-ts.config.ts | 6 + packages/sdks/package.json | 15 + packages/sdks/specs/pim.yaml | 7664 +++++++++++++++++ packages/sdks/src/client/core/ApiError.ts | 21 + .../sdks/src/client/core/ApiRequestOptions.ts | 14 + packages/sdks/src/client/core/ApiResult.ts | 7 + .../sdks/src/client/core/CancelablePromise.ts | 126 + packages/sdks/src/client/core/OpenAPI.ts | 56 + packages/sdks/src/client/core/request.ts | 350 + packages/sdks/src/client/index.ts | 7 + packages/sdks/src/client/schemas.gen.ts | 2996 +++++++ packages/sdks/src/client/services.gen.ts | 1968 +++++ packages/sdks/src/client/types.gen.ts | 4864 +++++++++++ packages/sdks/tsconfig.json | 103 + 15 files changed, 18202 insertions(+) create mode 100644 packages/sdks/openapi-ts-error-1720105320904.log create mode 100644 packages/sdks/openapi-ts.config.ts create mode 100644 packages/sdks/package.json create mode 100644 packages/sdks/specs/pim.yaml create mode 100644 packages/sdks/src/client/core/ApiError.ts create mode 100644 packages/sdks/src/client/core/ApiRequestOptions.ts create mode 100644 packages/sdks/src/client/core/ApiResult.ts create mode 100644 packages/sdks/src/client/core/CancelablePromise.ts create mode 100644 packages/sdks/src/client/core/OpenAPI.ts create mode 100644 packages/sdks/src/client/core/request.ts create mode 100644 packages/sdks/src/client/index.ts create mode 100644 packages/sdks/src/client/schemas.gen.ts create mode 100644 packages/sdks/src/client/services.gen.ts create mode 100644 packages/sdks/src/client/types.gen.ts create mode 100644 packages/sdks/tsconfig.json diff --git a/packages/sdks/openapi-ts-error-1720105320904.log b/packages/sdks/openapi-ts-error-1720105320904.log new file mode 100644 index 00000000..c264bc2a --- /dev/null +++ b/packages/sdks/openapi-ts-error-1720105320904.log @@ -0,0 +1,5 @@ +Error opening file "/Users/robert.field/Documents/Projects/EP/muse/composable-frontend/packages/sdks/path/to/openapi.json" +ENOENT: no such file or directory, open '/Users/robert.field/Documents/Projects/EP/muse/composable-frontend/packages/sdks/path/to/openapi.json' +JSONParserError: Error opening file "/Users/robert.field/Documents/Projects/EP/muse/composable-frontend/packages/sdks/path/to/openapi.json" +ENOENT: no such file or directory, open '/Users/robert.field/Documents/Projects/EP/muse/composable-frontend/packages/sdks/path/to/openapi.json' + at Object.read (/Users/robert.field/Documents/Projects/EP/muse/composable-frontend/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.6.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolvers/file.js:61:19) \ No newline at end of file diff --git a/packages/sdks/openapi-ts.config.ts b/packages/sdks/openapi-ts.config.ts new file mode 100644 index 00000000..8ebcb7a8 --- /dev/null +++ b/packages/sdks/openapi-ts.config.ts @@ -0,0 +1,6 @@ +import { defineConfig } from "@hey-api/openapi-ts" + +export default defineConfig({ + input: "./specs/pim.yaml", + output: "src/client", +}) diff --git a/packages/sdks/package.json b/packages/sdks/package.json new file mode 100644 index 00000000..113fff20 --- /dev/null +++ b/packages/sdks/package.json @@ -0,0 +1,15 @@ +{ + "name": "@field123/sdks-temp", + "version": "0.0.1", + "description": "", + "main": "index.js", + "scripts": { + "openapi-ts": "openapi-ts" + }, + "keywords": [], + "author": "Robert Field", + "license": "ISC", + "devDependencies": { + "@hey-api/openapi-ts": "^0.48.2" + } +} diff --git a/packages/sdks/specs/pim.yaml b/packages/sdks/specs/pim.yaml new file mode 100644 index 00000000..27804715 --- /dev/null +++ b/packages/sdks/specs/pim.yaml @@ -0,0 +1,7664 @@ +# GENERATED FILE - DO NOT EDIT +openapi: 3.0.3 +info: + title: Product Experience Manager Introduction + description: | + + Product Experience Manager uses the PIM service to manage product information, hierarchies, and price books. Ideally, Product Experience Manager becomes the single source of truth for product data across your organization. + + In Commerce, the product data is stored separately from pricing, catalogs, and inventory. This separation means that you retrieve all product data only when you are managing product data and assets. Otherwise, when setting prices or managing inventory, you retrieve a reference to the product rather than the entire product, which makes the response times very fast. + + You also have the flexibility to create catalogs for different scenarios by combining hierarchies of products with a price book. Scenarios might include: + + - **Multiple geographical regions**. Display different catalogs in different regions with suitable pricing or combine product hierarchies from two different regions to display in a third region. + - **Multiple channels**. Display different catalogs based on how a shopper accesses your store, such as through a mobile app or a web storefront. + - **Direct to business versus direct to customers**. Offer different products and prices for business customers versus retail customers. + - **Preferred customers**. Offer special pricing to preferred customers while displaying a standard price catalog to all other shoppers. + - **Reward programs**. Enable reward programs where catalog prices drop after a certain spending level is reached. + - **Product sales**. Offer sale items for a limited time. + + Scenarios are created by defining the context within which a catalog is displays. Contexts can be a customer ID, a channel, or any other user-defined tag that can be passed to the APIs from the front-end shopper experiences. + version: 1.0.0 +servers: + - url: https://euwest.api.elasticpath.com + description: EU West Production Server + - url: https://useast.api.elasticpath.com + description: US East Production Server +security: + - bearerAuth: [] +tags: + - name: Products + description: | + Products are the items or services that you might want to sell in your store. In Product Experience Manager, a product has a name, description, ID, and SKU. Products can also have additional attributes and associated rich media assets, such as product images or a file containing additional product details. If your store supports multiple languages, you can localize product names and descriptions. + + Product data is stored in a database. After you add products, you can update product information, add images and other assets, and associate products with one or more hierarchy nodes. You can export the updated product information back to other business systems so that your organization sees a consistent view of products. + + While defining products, the products are in a draft state. Your organization can develop the criteria and business processes to help determine when a product is ready to go live and appear in a catalog. + + To appear in a catalog, a product must meet the following criteria: + + - The product is live. + - The product is associated with at least one hierarchy. + - The catalog references a hierarchy that includes the product. + + ### Product Types + + Commerce automatically assigns types to the products you create. In Commerce Manager, you can see at a glance the product types in a list of a products. In addition, you can filter on product types in both the API and Commerce Manager. + + Product types can also be used in catalogs. For example, in your catalog, you can filter on `parent` so that only your parent products are displayed in your storefront. + + Products have one of the following types: + + * `standard` - Standard products are a standalone products. + * `parent` - A parent product is a product that has child products that have been built using the [**Build Child Products**](/docs/api/pxm/products/build-child-products) endpoint. + * `child` - When you configure product variations and variation options for parent products, the child products derived from the parent products are automatically created in Commerce. + * `bundle` - A bundle is a purchasable product, comprising one or more standalone products (in other words, `components`) to be sold together. See [**Bundle Components and Options**](#bundle-components-and-options). + + :::note + In Commerce Manager, `standard` products are called **Product**. + ::: + + ### Product Tags + + You can use product tags to store or assign a key word against a product or service that you sell in your store. The product tag can then be used to describe or label that product. Product tags represent similarities between products who do not share the same attributes. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. + + See [**Product Tags**](/docs/api/pxm/products/product-tags). + + ### Personalizing Products + + You can allow your shoppers to add custom text to a product when adding product items to their carts. This is useful, for example, if you have a product like a T-shirt that can be personalized or you sell greetings cards that can be printed with your shoppers personalized messages. You can do this by configuring the the `custom_inputs` attribute. See [**Create a product**](/docs/api/pxm/products/create-product). + + ### Bundles + + With Product Experience Manager, you can use the products API to create and manage bundles. A bundle is a purchasable product, comprising of one or more products that you want to sell together. + + You can use bundles in different ways. For example, a consumer electronics and video game company, *Playtend Games* can sell a *Playtend* video game console as a bundle that includes the console, controller, and game. The price of the bundle might be different from the total of the individual products. + + Alternatively, you may have a fixed, marketable banner product featuring only one item, such as a 'product of the week.' In this use case, the banner bundle description remains constant, while the product within the bundle can be easily swapped in and out. + + You must not assign a product to a bundle if the product is in draft status as this invalidates the bundle. + + You can have: + + - Dynamic bundles. Dynamic bundles allow your shoppers to choose their own options in a bundle. See [**Dynamic Bundles**](#dynamic-bundles). + - Bundles of bundles. Your bundle consists of child bundles. See [**Bundles of Bundles**](#bundles-of-bundles). + + #### Bundle Components and Options + + You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. + + :::caution + + You cannot have more than 1500 options in a bundle. + + ::: + + For example, *Playtend Games* can create a bundle where the total bundle price is calculated based on the options that the buyers choose. Shoppers can select a base console option, two games options, and a controller option as in the following example: + + 1. Select one of the following options in the gaming console component. + + - Gaming Console 512 MB Storage. Regular price is $500, selling for $475. + - Gaming Console 1 GB Storage. Regular price is $750, selling for $725. + + 1. From each component, select an option: + + - Component 1: + + - Playtend Roboselect Game, selling for $50 + - Playtend Burndown Game, selling for $45 + - Playtend Invaders Game, selling for $50 + + - Component 2: + + - Playtend Doomsday Game, selling for $35 + - Playtend Happyday Game, selling for $35 + - Playtend Birthday Game, selling for $40 + + 1. Select one of the following options in the controllers component: + + - Red Controller, selling for $40 + - Blue Controller, selling for $40 + - Green Controller, selling for $40 + - Invaders Controller, selling for $75 + + If the shopper chooses the following options for their bundle, the total is $885: + + - Gaming Console 1 GB Storage ($725) + - Playtend Burndown Game ($45) + - Playtend Birthday Game ($40) + - Invaders Controller ($75) + + #### Bundle Pricing + + Bundles can have: + + - Fixed pricing - enables you to assign a fixed price for all products in a bundle. + - Automatic/cumulative pricing - the price of a bundle is generated automatically based on the sum of the component products. + + The following table describes the capabilities and pricing that bundles can have. + + | Pricing | Requires SKU? | Price Book Entry | Capabilities | + |:----|:----- |:---- |:------ | + | **Fixed** - enables you to assign a fixed price for all the products in a bundle. The bundle can contain items that are available for individual purchase, however, when purchased in a fixed-price bundle, are offered at a discounted price. | Yes | Mandatory | **[Sale Pricing](#sale-pricing)** - defines reduced pricing for the total price of the bundle. **[Volume Pricing](#volume-pricing)** - offers promotional prices for products bought in bulk. [**Bundle Inventory Management**](#bundle-inventory) - bundle inventory can be tracked based on the availability of individual items in the bundle. In this case, the maximum number of bundles you can sell is equal to the number of the option that is least available. | + | **Automatic/cumulative** - the price of a bundle can be generated automatically based on the sum of the component products. Ensure that you set a price for each product within the bundle. If a component product does not have a price, the bundle price cannot be set and customers cannot purchase the bundle. | Optional | Not available when SKU is present | **[Sale Pricing](#sale-pricing)** - define reduced pricing for the total price of the bundle. | + + #### Examples of Bundles + + The following table describes some examples of bundles. + + | Bundle Type | Pricing | Description | + |:--------------------------|:----------------------------|:-------------------| + | **Pure bundles** | Fixed | Products are available only as a bundle. | + | **Joint bundles** | Fixed, Automatic/cumulative | A bundled price offered for two or more products. | + | **Gift sets** | Fixed, Automatic/cumulative | A bundle created from a set of predefined items. | + | **Leader bundle** | Automatic/cumulative | A popular product is offered for a discount if you buy it with another less popular product. | + | **Mix and Match bundles** | Automatic/cumulative | Bundle products are selected from a predetermined list of items that you can bundle together. | + | **Upsell bundles** | Automatic/cumulative | Discounted price for the current product when bought together with an accessory as a related item. | + + For example, *Playtend Games* has a bundle that consists of a game console, the Playtend Invaders Game, and the Invaders Controller, and the bundle is available for purchase at $500. The individual price of the products in the bundle are $500 for the game console, $50 for the Playtend Invaders Game, and $75 for the Invaders Controller. This makes the total of the products $625 when bought individually. The price of the bundle is defined in the price books associated with the bundle SKU and the sale price depends on the pricing configuration for the SKU. + + #### Sale Pricing + + You can set a sale price for an item within a bundle so that the product is sold at the sale price when sold as a part of the bundle. For example, if you have a bundle consisting of four items, you can apply a discounted price to an item within the bundle to get a bundle sales price. Both list and sale price (or was/is prices) are available in the catalog response, enabling you to display slash pricing on your storefront, depending on your requirements. + + | Product | Regular product price | Bundle sales price | + |:----------|:----------------------|:-------------------| + | Product A | $100 | $80 | + | Product B | $50 | $50 | + | Product C | $30 | $30 | + | Product D | $130 | $130 | + | **Total** | **$310** | **$290** | + + #### Volume Pricing + + You can configure volume pricing for minimum quantities of products. When a customer adds sufficient quantity of an item and meets the minimum required quantity for different pricing, all products with that item SKU are discounted in the cart. You can define the price range for different quantities of different items, as explained in the following example. + + | Quantity | Price/Each | + |:---------|:-----------| + | 1-5 | $10.50 | + | 6-10 | $10.00 | + | 11-20 | $9.50 | + | 21-50 | $8.50 | + | 51+ | $7.90 | + + #### Dynamic Bundles + + A dynamic bundle allows you to create a bundle where shoppers can choose products from a list of options. For example, a shopper can select 0 or more products from a list of 10. You can also configure some products as default options. A shopper can either select the bundle with the default products or choose products from all the components. Shoppers must either select products for all components or use the default options for all components; they cannot choose products for only one component and leave the others with default options. + + For example, a shopper can select 0 or more product options from a list of 10. When purchasing a monitor, you might want to offer additional optional items that a shopper can select like monitor lamps, extendable arms, or screen wipes. + + You can do this by configuring minimum and/or maximum values for the product options in a component. For example, to sell 4 books for a fixed price from a list of 10, set both minimum and maximum selections to 4. + + When minimum is 0, it means that component product lists are optional for your shoppers. + + If you do not specify any minimum or maximum values for the product options in your components, your shoppers can select any combination of product options. + + To configure default product options, add `"default": true` to all the product options in the bundle that you want to be the defaults. Each component in the bundle must have a default product option. For example, you may have some products in a bundle that are performing better than others. For the products that are not performing as well, you can promote them above the rest by configuring a default product option. Moreover, you may have a default set of products that make sense for a given context. For example, when adding a new fragrance to a fragrance bundle, you may want the new addition to appear as the default option. + + :::caution + + Your shoppers cannot change the quantities of a product. They must purchase the quantity of products that you have specified when you created your components and options. + + ::: + + #### Bundle configuration + + Dynamic bundles have a `bundle_configuration` which describe the options selected. + + 1. Once your bundles are [published in a catalog](/docs/api/pxm/catalog/publish-release), a shopper can select the products they want. + 1. Use [Get a product in a catalog release](/docs/api/pxm/catalog/get-by-context-all-products) to check a `bundle_configuration`. + 1. Use the [configure a shopper bundle](/docs/api/pxm/catalog/configure-by-context-product) endpoint to store a shopper's selections. The response from the [configure a shopper bundle](/docs/api/pxm/catalog/configure-by-context-product) endpoint updates the `bundle_configuration` with the product options a shopper selects. In your storefront, you can display this as a summary of the product options a shopper has selected. + + #### Creating Dynamic Bundles: An Overview + + The following steps are an overview of how to use dynamic bundles. + + 1. Create your products using [**create a product**](/docs/api/pxm/products/create-product). + 1. Create a bundle using [**create a bundle**](/docs/api/pxm/products/create-product). + 1. Specify minimum and/or maximum values for the number of product options that can be selected within the bundle. For example, if you want the shopper to select exactly 4 out of 10 options, set both the minimum and maximum values to 4 for each of the 10 product options. + 1. For each product option in the bundle, specify if it is a default option by adding `"default": true` to the product options that you want to be pre-selected for the shopper. + 1. Publish the bundle to your catalog using the [Publish a catalog](/docs/api/pxm/catalog/publish-release) endpoint so you can display the products to your shoppers in your storefront. + 1. When a shopper interacts with the bundle on your storefront, they can select the products they want from the list of options. Use the [configure a shopper bundle](/docs/api/pxm/catalog/configure-by-context-product) endpoint to capture the shoppers selections. This updates the `bundle_configuration` with the product options chosen by a shopper. + 1. Once a shopper has configured their bundle, use the add a product to a cart endpoint to add the selected bundle to the shopper’s cart. + 1. When the shopper proceeds to checkout, the selected product options from the bundle are included in the order. + + #### Bundles of Bundles + + Your bundle can consist of child bundles. This is useful if you have a base product that is made-up of child products and the pricing of the base product changes, depending on the child products a customer chooses. This can be represented by creating a parent bundle that is made-up of other child bundles. + + ![Bundle of bundles](/assets/bundle-of-bundles.png) + + For example, you may sell sofas. For each sofa that you sell, your customers can choose a fabric, a sofa size, and a leg color. The sofas are the parent bundle. The sofa size, fabric, and leg color are the child bundles. If a customer chooses a large sofa, then the cost of the fabric increases. + + ![sofa bundle](/assets/sofa-bundle.png) + + You create a bundle of bundles by adding a child bundle as an option of a component of another bundle. + + - You cannot have more than one level of child bundles. In other words, a child bundle cannot have a child bundle as a component. + - A parent bundle can contain both bundle and product components. + - Both parent and child bundles can be either [**fixed**](#bundles) or [**dynamic**](#dynamic-bundles) in a bundle of bundles. + + #### Adding Products From Bundles of Bundles to Carts + + When using bundles of bundles, only products from child bundles should be added to a cart. This is because if you add a parent bundle to a cart and call the cart, the cart returns information about the parent bundle and the name of the child bundle, but no child bundle components are returned. + + When designing your storefront, you must only allow child bundles to be added to carts. + + #### Creating bundles of bundles: an overview + + To create a bundle of bundles, simply add a bundle as a component to another bundle. + + 1. Create your products using [**create a product**](/docs/api/pxm/products/create-product). + 1. Create all your child bundles using [**create a bundle**](/docs/api/pxm/products/create-product). + 1. [**Create a parent bundle**](/docs/api/pxm/products/create-product) and specify the product ID of your child bundle as an option of a component in your bundle. You cannot have more than 1500 options in a bundle. + + #### Bundle inventory + + The Inventory service allows you and your business to keep track of inventory, including a transaction-historic log. + + You can track the number of bundles by SKU, if you set the number of bundles available in store. Bundle inventory can be tracked based on the availability of individual items in the bundle. In this case, the maximum number of bundles you can sell is equal to the number of the option that is least available. + + You cannot track the inventory of a bundle without a SKU. However, you can track the inventory based on the availability of individual items. + + Whether your bundle has a SKU or is SKU-less depends on your bundle's pricing. See [**Bundle Pricing**](#bundle-pricing). + - name: Product Tags + description: | + You can use product tags to store or assign a key word against a product or service that you sell in your store. The product tag can then be used to describe or label that product. Product tags represent similarities between products who do not share the same attributes. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. For example, a 3rd party manufacturer may sell cases for Apple iPads whose products would not be returned when filtering on the **Apple** brand. However, merchandizers can tag the cases with **Apple** so that the cases are returned along with other **Apple** products. + + - As a merchandizer, you can enhance your product list using tags, enabling you to refine your product list and run targeted promotions. Using the example above, you can have a clearance sale of **Apple** accessories, by tagging your products accordingly. + - As developers, you can use tags to enrich your search solution, reducing the amount of time and effort needed to keep your search solution up to date. + + A typical use case for product tags is to categorize your products based on color. For example, you could tag the products that you sell in your storefront with a color. Your shoppers can then search your products by color, enabling shoppers to quickly find what they are looking for, increasing the likelihood of a purchase, and boosting conversion rates. + + ### Characteristics of Product Tags + + Product tags have the following characteristics: + + - A product can have up to 20 tags. + - A product tag can be up to 255 characters. + - Product tags must not contain any spaces or commas. + - name: Extending Products with Templates + description: | + With extension templates, you can attach a specific set of custom fields to your products in Product Experience Manager. You can create templates for your products at both the organization and store level. + + ### Product Templates + + Templates are a collection of attributes. Attributes are grouped together to match a particular product type or to provide an input for other purposes, such as Search Engine Optimization (SEO) or product specification. For example, a *Book* template might contain the attributes, such as *ISBN*, *Author*, *Number of pages*, *Year Published*, or *Condition (New/Used)*. + + You can create product templates for both organization and store. However, stores can use organization templates for store level products. + + ### Product Attributes + + Use attributes to define the characteristics of products in a store. For example, you can assign attributes such as, *care instructions* or *fabric*, to a shirt. When a shopper searches for a specific item, attributes help stores to return the products that match the search criteria. For example, when a shopper searches for a large blue shirt, all shirts that are large and blue are returned as the search result. + - name: Bundle Component Products Relationships + description: | + With Product Experience Manager, you can create and manage bundles. A bundle is a purchasable product, comprising of one or more products that you want to sell together. + + You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. + - name: Variations + description: | + Product variations are the product options available for a base product that your shoppers can choose. As a merchandiser, you want to be able to present all the options you have available for your products to make it easier for your shoppers to visualize them and influence a potential sale. Product Variations allow you to create and manage up to 10,000 unique combinations of options for variations of a product. You can then use PXM Catalogs to build different catalogs for different users, giving you greater flexibility with your product data and making it easier for your shoppers to interact with your products. + + For example, a product has two variations size and color. The size variation has three options, such as small, medium, and large and the color variation has three options, such as green, red, and blue. This creates a variation matrix with nine possible unique combinations or child products as shown in the following example: + + ![The sizes are across the top row and the colors are in the first column.](/assets/product-variations-1.png) + + You can create additional variations or options and attach them to a product to increase the number of combinations. Using the previous example, if you add a third variation with three options, you can build child products with 27 unique combinations of variations and options. + + ### Reusability + + Variations are reusable, and you can attach the same variation to any number of products. You can also create a link between the existing variation and a new product. The following scenario provides an example: + + 1. Create a variation `shoe size` and add five options in the variation. + 1. Create a product `shoe 1` and link the variation `shoe size` to the product. + 1. Create second product, `shoe 2` and link the variation `shoe size` to this product as well. + 1. Create a third product `shoe 3` and do not link any variation to this product. + + `shoe 1` and `shoe 2` inherit the properties of `shoe size` variation, and you can build the child products with the options. However, you cannot build child products for `shoe 3` unless you assign a variation with at-least one option to the product. + + ### Child Products + + Child products inherit attributes from their parent products. When you make changes to the attributes of the parent products, you can rebuild your child products, ensuring that changes to the parent products are propagated to the child products. + + Alternatively, you can modify a child product independently, without impacting its parent product. For example, you may prefer the status of your child product to be `live`, while keeping the parent product's status as `draft`. When you directly update a child product, it becomes independent of its parent product. In other words, any subsequent changes made to the parent product are not automatically reflected in the child product when you rebuild the parent product and its child products. Once a child product is independent of its parent, you cannot recreate the association between the child product and its parent. You must delete the child product and rebuild the parent to recreate the child product. + + Following on from that, if you add the same flow to both a parent and child product, the child flow values are not affected by changes to the parent flow values in a rebuild. + + In addition, when building your child products, you can choose to exclude or include certain combinations of variation options. This is useful, for example, if you have a variation option that you do not sell. This makes managing and building your child products quick and easy. See [**Build child products**](/docs/api/pxm/products/build-child-products). + + Re-building child products after adding or removing a new variation changes the total number of child products that you can generate from a base product. When you rebuild the child products after updating variations associated with the base product, all existing child products that belong to a base product are deleted. New child products are created with new product IDs. + + If you have any bundles that reference child products directly, then you must update the bundles with the new child product IDs. + + However, re-building child products after adding or removing an option does not change the existing product IDs. + + ### Sorting the Order of Variations and Options + + The `variation_matrix` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. The `variation_matrix` can then be added to your catalogs. + + The order of the variations in the `variation_matrix` is the order of the variations in the array when the variations were linked to the product. For example, the first variation in the `variation_matrix` corresponds to the first variation in the array, and so on. You can use the `sort_order`attribute to sort the order of your variation and variation options in the `variation_matrix` object. The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variations and variation options in the order that you want. + + Add the `sort_order` attribute to the body of your request and specify a `sort_order` value. A `sort_order` value must be a number. You can specify any numbers that you want. + + - 1, 2, 3, or 100, 90, 80, and so on. + - Zero or negative numbers. + + You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + + :::caution + + - Commerce does not sort variations and variation options. You must program your storefront to sort the variations and variation options in the order that you want. + - You must rebuild your products for the sort order changes to take effect. See [**Build Child Products**](#build-child-products). + + ::: + + ### Product Modifiers + + Use modifiers to change the properties of child products that are inherited from a base product. With modifiers, you only need to have one base product with a variation attached to the product. + + Modifiers attached to a variation option are applied to a base product to create child products. For example, instead of creating three base products for three different shirt colors, you can do the following: + + 1. [**Create a parent product**](/docs/api/pxm/products/create-product), *shirt*, with the variation, *color*, attached to it. + 1. Create three options for the *color* variation. See [**Create a variation option**](/docs/api/pxm/products/create-variation-option). + 1. [**Create a modifier**](/docs/api/pxm/products/create-modifier) for each option to change the properties of each child product. For example, attach a *description append* modifier to each option so that each child product has different description based on the color of the child product. + 1. [**Build the child products**](/docs/api/pxm/products/build-child-products). + + This screenshot provides an example of a child product of *shirt* which has a specific description associated with it because of the *description append* modifier setting for the option *yellow*: + + ![Child products with different descriptions](/assets/modifier-description-append.png) + + ### Price Modifiers + + You can use price modifiers to change the price property of child products. By default, child products inherit the same price as their base products. Using price modifiers, you can enable child products to inherit a different price. This enables you to configure the price of child products, for example, to be lower than its base product, without having to individually update the price of your child products. There are three types of price modifier. + + Modifier | Data Type | Effect | + | :--- | :--- | :--- | + | `price_increment` | `string` | Increases the price of a product. | + | `price_decrement` | `string` | Decreases the price of a product. | + | `price_equals` | `string` | Sets the price of a product to the amount you specify. | + + The following is an overview of the steps you need to follow to use price modifiers. + + 1. Create a price modifier. You must give the price modifier a unique name, for example, tax_modifier. + 1. Create a product modifier that uses the same name as the price modifier. + 1. [**Build your child products**](/docs/api/pxm/products/build-child-products) with the new product modifier. + - name: Product File Relationships + description: | + Products are the items or services that you might want to sell in your store. In Product Experience Manager, products can also have associated rich media assets, such as product images or a file containing additional product details. + + You can do this using [Files API](/docs/api/pxm/files). + + Once you have created your files, you associate files with your products using the [Create Product-File Relationships API](/docs/api/pxm/products/create-product-file-relationships). + - name: Product Image Relationships + description: | + Products are the items or services that you might want to sell in your store. In Product Experience Manager, products can also have associated rich media assets, such as product images or a file containing additional product details. + + You can do this using [Files API](/docs/api/pxm/files). + + Once you have created your files, you associate files with your products using the [Create Product Main Image Relationships API](/docs/api/pxm/products/create-product-main-image-relationships). + - name: Product Import/Bulk Update + description: | + You can use the Product Import API to: + + - Add new products. + - Add new: + + - main image files. See [**Importing Main Image Files**](#using-imported-main-image-files). + - custom data. See [**Importing custom data**](#importing-custom-data-flows). + - Make bulk updates to existing products, main image files, and custom data. + + You cannot use product import to: + + - Delete existing products. + - Import product bundles. + + The Product Import API uses a [**Comma Separated Values (CSV)**](#characteristics-of-csv-import-files) file to import/update products, main image files, and custom extension data. + + When you send a product import request, a job is created. Jobs are processed one at a time. You can continue to send product import requests, but those jobs are queued. In other words, Commerce looks for any jobs that have a status of PENDING and starts the job with the earliest created date. This process is repeated until all jobs are processed. See [**Jobs**](/docs/api/pxm/products/jobs). + + We recommend that you include the maximum allowed number of products in each `csv`file (for example, up to 50,000 rows or a file size of 50 megabytes, see [**Characteristics of CSV Import File**](#characteristics-of-csv-import-files)) to minimize the number of files you submit. This helps prevent extended waiting times for processing jobs. + + #### Using Imported Main Image Files + + You can use the main images that you have previously uploaded to Commerce and assign them to your products when importing products to Commerce. You can do this by adding a `main_image_id` header to your `.csv` file. The ID you provide in `main_image_id` is the ID of a file that has already been uploaded to Commerce using create a file. + + #### Importing Custom Data (Flows) + + You can also create/update custom extension data in a `.csv` file by creating a header that includes the flow `ID` and the field `slug` in the following format: + + template:*flowID*:*fieldSlug*. + + where: + + - `template` must be `template`. + - `flowID` is the ID of the flow that contains the field whose data you want to create/update. + - `fieldSlug` is the slug of the field whose data you want to create/update. + + In the following example, for a flow with ID `82c10a02-1851-4992-8ecb-d44f2782d09b` and a field with the slug `condition`: + + - the header is `template:82c10a02-1851-4992-8ecb-d44f2782d09b:condition`. + - the updated custom data is `as-new`. + + | name | slug | sku | status | template:82c10a02-1851-4992-8ecb-d44f2782d09b:condition | + | :--- | :--- | :--- | :--- | :--- | + | BestEver Range | bestever-range-1a1a-30 | BE-Range-1a1a-30 | draft | as-new | + + #### Characteristics of CSV Import Files + + Product Import uses a [**Comma Separated Values (CSV)**](#characteristics-of-csv-import-files) file to import/update products, main image files, and custom extension data. + + - Each row in a `.csv` file represents a product you want to create/update. + - Each file: + - must not be larger than 50 megabytes. If a `.csv` file is larger than 50 megabytes, a `503 client read error` is displayed. + - must not have more than 50,000 rows, including the header. If a CSV file exceeds 50,000 rows, an error is displayed, and the products are not imported. + In other words, if you have a file with 50,000 rows that is larger than 50 megabytes, an error is displayed, and the products are not imported. + - If you want to create/update more than 50,000 products or your `.csv` file is larger than 50 megabytes, you must have a separate `.csv` file and import each `.csv` file one at a time. + - You can update existing products, including images, templates/flow fields, and entries. The entry in the `.csv` file must have a unique `id` and/or `external_ref` that matches the `id` and `external_ref` of the existing product you want to update. You may have both a unique `id` and `external_ref`, but you must have at least one. + - You can add new products. For new products that you want to add, the entry in the `.csv` file must have an `external_ref` that does not match any existing products. + + The following table describes the headers that are supported. + + | Header | Required | Description | + |:---- |:---------|:--| + | id | Optional | A unique product ID that is generated when you create the product. The `id` is used to look up products in the `.csv` file and matches them to the products in your storefront that you want to update. | + | external_ref | Optional | A unique attribute associated with a product. This could be an external reference from a separate company system, for example. The maximum length is 2048 characters. | + | name | Required | The name of a product. | + | description | Required | A description for a product. You can include quotes in your product description, if you want to emphasize a word, for example. To do this, put quotes around the product description. For example, "This product description describes my "product" and the product "version"." | + | slug | Required | A label for the product that is used in the URL paths. A slug can contain any combination of letters, numbers, periods, hyphens, and underscores. NO spaces or other characters are allowed. By default, the product name is used as the slug. | + | status | Required | The status of a product, either `Draft` or `Live`. | + | commodity_type | Required | The commodity type, either `physical` or `digital`. | + | upc_ean | Optional | The universal product code or european article number of the product. | + | mpn | Optional | The manufacturer part number of a product. | + | sku | Optional | The unique stock keeping unit of the product. | + | tags | Optional | The product tags used to store or assign a key word against a product. A product can have up to 20 product tags. A product tag can be up to 255 characters. See [**Product Tags**](/docs/api/pxm/products/product-tags). + | main_image_id | Optional | Specifies a unique ID of a main image file for a product. You can include a `main_image_id` for your products for images that are already uploaded to Commerce. See [**Using Main Image Files**](#importing-custom-data-flows). | + | `template::` | Optional | You can also specify custom extension data in the CSV by specifying the flow `ID` or `slug` and the field `name`. For example, `template::` format. See [**Importing Custom Data (Flows)**](#importing-custom-data-flows). | + - name: Product Export + description: | + The Export API allows you to import/update products, main image files, and custom extension data. + + Using the Export API builds a `.csv` file containing the product entries. A `.csv` file can contain up to 10,000 product entries. If you have more than 10,000 product entries, then another `.csv` file is created and so on, until all your products are exported. + + You might have specified custom extension data in a `.csv` file when you imported the products. These modifications are all exported. So, when you send a request to the Export API, the `.csv` file, included in the Job endpoint response, reflects any changes that you have made. For more information, see [Importing Custom Data (Flows)](/docs/pxm/products/importing-products/product-importer-csv#importing-custom-data-flows). + + After the files are exported, you get a link to the location where the `.csv` files are stored. You can then make any changes to the product fields (modify product information, add main image files, and custom extension data) in your exported `.csv` files. See [**Product Export CSV File**](/docs/api/pxm/products/product-export#product-export-csv-file). + + Once you are happy with your changes, you can import the updated `.csv` files using product import. See [**Product Import/Bulk Update**](/docs/api/pxm/products/product-import-bulk-update). + + ### Characteristics of Exporting Products + + - Product exports are an asynchronous operation. When you send a request to the Export API, it triggers an asynchronous job to build the `.csv` file containing the product entries. + - Jobs are processed one at a time. You can continue to send product export requests, but those jobs are queued. In other words, Commerce looks for any jobs that have a status of PENDING and starts the job with the earliest created date. This process is repeated until all jobs are processed. See [**Jobs**](/docs/api/pxm/products/jobs). + - The Export API response includes a job resource. In the response, you can verify the job status; if the status is successful, the response includes a link to the location where the `.csv` file is stored. See [**Product Export CSV File**](#product-export-csv-file). A single CSV file contains 10,000 rows, excluding the header. If you are exporting 50,000 products, the job endpoint response contains links to five `.csv` files; each `.csv` file including 10,000 products. + - You might have specified custom extension data in a `.csv` file when you imported the products. These modifications are all exported. So, when you send a request to the Export API, the `.csv` file, included in the Job endpoint response, reflects any changes that you have made. + - You cannot export product bundles. + + ### Product Export CSV File + + The Product Export API generates a Comma Separated Values (CSV) file that you can use to import/update products, main image files, and custom extension data. + + The `.csv` file is: + + - Comma-separated. + - Header-based. + - Header attributes must be the same as the product attributes. + - Header names can be in any order. + - Each row after the first line represents a single product. + + The following table describes the headers that are supported. + + | Header | Required | Description | + |:---------------------------------|:---------|:-----------------------------------------------------| + | id | Optional | A unique product ID that is generated when you create the product. The `id` is used to look up products in the `.csv` file and matches them to the products in your storefront that you want to update. | + | external_ref | Optional | A unique attribute associated with a product. This could be an external reference from a separate company system, for example. The maximum length is 2048 characters. | + | name | Required | The name of a product. | + | description | Required | A description for a product. You can include quotes in your product description, if you want to emphasize a word, for example. To do this, put quotes around the product description. For example, "This product description describes my "product" and the product "version"." | + | slug | Required | A label for the product that is used in the URL paths. A slug can contain any combination of letters, numbers, periods, hyphens, and underscores. NO spaces or other characters are allowed. By default, the product name is used as the slug. | + | status | Required | The status of a product, either `Draft` or `Live`. | + | commodity_type | Required | The commodity type, either `physical` or `digital`. | + | upc_ean | Optional | The universal product code or european article number of the product. | + | mpn | Optional | The manufacturer part number of a product. | + | sku | Optional | The unique stock keeping unit of the product. | + | tags | Optional | The product tags used to store or assign a key word against a product. A product can have up to 20 product tags. A product tag can be up to 255 characters. See [**Product Tags**](/docs/api/pxm/products/product-tags + ). | + | main_image_id | Optional | Specifies a unique ID of a main image file for a product. See [Exporting Main Image Files](#exporting-main-image-files). | + | `_created_at` | Optional| The date and time a product was created. **Note**: This field does not populate any data; it is provided solely for informational purposes. | + | `_updated_at` | Optional | The date and time a product was updated. **Note**: This field does not populate any data; it is provided solely for informational purposes. | + | `template::created_at` | Optional | The date and time a template was created. **Note**: This field does not populate any data; it is provided solely for informational purposes. | + | `template::updated_at` | Optional | The date and time a template was updated. **Note**: This field does not populate any data; it is provided solely for informational purposes. | + | `template::` | Optional | Custom extension data includes the flow `ID` or `slug` and the field `name`. See [Exporting Custom Data (Flows)](#exporting-custom-data-flows). | + + ### Exporting Main Image Files + + The main images that you have previously uploaded Commerce are exported. A `main_image_id` header is added to your `.csv` file. The ID in `main_image_id` is the ID of a file that has already been uploaded to Commerce using [create a file](/docs/pxm/products/product-assets/create-a-file). + + ### Exporting Custom Data (Flows) + + Custom extension data is exported in a `.csv` file by creating a header that includes the flow `ID` or `slug` and the field `name` as shown below: + + - `template::` + - `template::` + + where: + + - `template` must be `template`. + - one of the following for the template that contains the field whose data you want to export: + - `flowID` is the ID of the flow. + - `flowSlug` is the flow slug. + - `fieldName` is the name of the field whose data you want to export. + + In the following example, for a flow with ID `82c10a02-1851-4992-8ecb-d44f2782d09b` and a field with the name `condition`: + + - the header is `template:82c10a02-1851-4992-8ecb-d44f2782d09b:condition`. + - the updated custom data is `as-new`. + + | name | slug | sku | status | template:82c10a02-1851-4992-8ecb-d44f2782d09b:condition | + | :--- | :--- | :--- | :--- | :--- | + | BestEver Range | bestever-range-1a1a-30 | BE-Range-1a1a-30 | draft | as-new | + - name: Hierarchies + description: | + Use hierarchies to organize your products into categories and sub-categories. Define hierarchies that work for the products in your store. + + A hierarchy is a tree structure that consists of a root node with 1 or more parent nodes. Each parent node can also have one or more children nodes, and so on, creating a parent-child relationship between nodes. + + A product can belong to multiple nodes in multiple hierarchies. + + ![Hierarchy Nodes](/assets/heirarchynodes.png) + + - Sibling nodes are nodes with the same parent. Sibling nodes must have unique names and unique slugs. + - Nodes that are in different locations in a hierarchy, or across multiple hierarchies, do not need unique names and slugs. + + ![Hierarchy Example](/assets/hierarchexample.png) + + - If you move the **Electric Ranges** node to the **Built-in** node, all the children of the **Electric Ranges** node also move to the **Built-in** node. + - The nodes **Electric Ranges** and **Gas Ranges** are siblings. They must have unique names and slugs. + - The **Double Oven** nodes can have the same name because they have different parents. + + You can create the **Major Appliances** hierarchy by performing the following steps. + + 1. Using [**Create a Hierarchy**](/docs/api/pxm/products/create-hierarchy), create a hierarchy whose name is **Major Appliances**. Each hierarchy has a hierarchy ID. In other words, the hierarchy ID is the ID of the root node. + 1. Using [**Create a Node in a hierarchy**](/docs/api/pxm/products/create-node), create the following child nodes. When you create a node in a hierarchy, by default, the node is a child of the root node. Specify `sort_order` to configure the order of the nodes. + - **Ranges** + - **Refrigerators** + - **Dishwashers** + 1. Using [**Create a Node in a hierarchy**](/docs/api/pxm/products/create-node), create the **Electric Ranges** node, specifying **Ranges** as the parent node. + 1. Using [**Create a Node in a hierarchy**](/docs/api/pxm/products/create-node), create the following nodes, specifying **Electric Ranges** as the parent node. + - **Electric Ranges 24ˮ** + - **Electric Ranges 30ˮ** + - **Double Oven** + 1. Using [**Create a Node in a hierarchy**](/docs/api/pxm/products/create-node), create the **Gas Ranges** node, specifying **Ranges** as the parent node. + 1. Using [**Create a Node in a hierarchy**](/docs/api/pxm/products/create-node), create the following nodes, specifying **Gas Ranges** as the parent node. + - **Gas Ranges 24ˮ** + - **Gas Ranges 30ˮ** + - **Gas Ranges 32"** + - **Double Oven** + 1. Using [**Create a Node in a hierarchy**](/docs/api/pxm/products/create-node), create the following nodes, specifying **Dishwashers** as the parent node. + - **Built-in** + - **Standalone** + + Once you have created your products, (for more information, see [**Products API**](/docs/api/pxm/products/create-product)), you can use the Hierarchies API to organize your products. + + - You can associate products with nodes. You cannot associate a product with the root node. For more information, see [**Create Node Product Relationships**](/docs/api/pxm/products/create-node-product-relationship). + - You can duplicate an existing hierarchy. This is useful because it enables you to quickly and easily create multiple hierarchies with the same node structure. Any nodes in the existing hierarchy are also created in the duplicated hierarchy. In addition, you can optionally specify whether you want products associated with the nodes in an existing hierarchy to be associated with the nodes in the duplicated hierarchy. See [**Duplicate a Hierarchy**](/docs/api/pxm/products/duplicate-hierarchy). + - You can move an existing node to a different location within the same hierarchy by changing its parent node. If the node has child nodes, they retain their relationship with the moved node. In other words, the node and all its children move to the new location in the hierarchy. For more information, see [**Create a Node in a hierarchy**](/docs/api/pxm/products/create-node). + - If your store supports multiple languages, you can localize new and existing hierarchies and nodes. + + #### Hierarchies and Catalogs + + The hierarchies determine which products appear in the catalog. When you create a catalog, you specify one or more hierarchies. Only the products that are associated with the selected hierarchies are included in the catalog. Your Front-end developers use the hierarchies to create and populate navigation menus in your storefront. You can improve how your customers search your store using the Catalog View API. + + You can also specify the order you want your hierarchies to display in a published catalog. You can order your hierarchies on a catalog-by-catalog basis. + + ![Hierarchy_sorting](/assets/hierarchy_sorting.png) + + For more information, see Update a Catalog. + - name: Jobs + description: | + Several Product Experience Manager endpoints function as jobs. When any of these endpoints are run, a job is automatically created. + + - product [**import**](/docs/api/pxm/products/import-products). + - product [**export**](/docs/api/pxm/products/export-products). + - price book import + - [**duplicating hierarchies**](/docs/api/pxm/products/duplicate-hierarchy). + - [**building child products**](/docs/api/pxm/products/build-child-products). + + #### Characteristics of Jobs + + Jobs have the following characteristics. + + - Jobs are asynchronous. + - Jobs have a different status, depending on where a job is in its lifecycle. See [**Job Lifecycle**](#job-lifecycle). + - Jobs include the data used when an endpoint is run. + - Jobs are processed one at a time. You can continue to send requests using endpoints that function as jobs, but those jobs are queued. In other words, Commerce looks for any jobs that have a status of PENDING and starts the job with the earliest created date. This process is repeated until all jobs are processed. + - Jobs report messages and/or errors to help you understand: + + - what changes a job implemented in Commerce. + - the reasons for any failed jobs. + + #### Job Lifecycle + + A job has the following lifecycle. + + ![job lifecycle](/assets/job-lifecycle.png) + + - **PENDING** - Commerce has received the request but is currently busy processing other requests. + - **STARTED** - Commerce has started processing the job. + - **SUCCESS** - The job has successfully completed. + - **FAILED** - The job has failed. See [**Get job errors**](/docs/api/pxm/products/get-all-jobs). +paths: + /pcm/jobs: + get: + summary: Get All Jobs + description: The jobs endpoints displays the status of a number of endpoints that function as jobs, for example, product import and export, price book import, building child products, and duplicating hierarchies. + operationId: getAllJobs + tags: + - Jobs + responses: + '200': + description: Returns all the jobs. + content: + application/json: + schema: + $ref: '#/components/schemas/multi' + examples: + completed: + summary: Get all jobs + $ref: '#/components/examples/multi' + '400': + $ref: '#/components/responses/bad_request' + '404': + $ref: '#/components/responses/not_found' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + /pcm/jobs/{jobID}: + get: + summary: Get a Job + operationId: getJob + tags: + - Jobs + parameters: + - $ref: '#/components/parameters/job_id' + responses: + '200': + description: Returns a job with the following attributes. + content: + application/json: + schema: + $ref: '#/components/schemas/single' + examples: + started: + summary: Started Job + $ref: '#/components/examples/started' + successful: + summary: Product Import Job + $ref: '#/components/examples/successful' + product-export: + summary: Product Export Job + $ref: '#/components/examples/product-export' + hierarchy-duplicate: + summary: Hierarchy Duplicate Job + $ref: '#/components/examples/hierarchy-duplicate' + build-child-products: + summary: Build Child Products Job + $ref: '#/components/examples/build-child-products' + '400': + $ref: '#/components/responses/bad_request' + '404': + $ref: '#/components/responses/not_found' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + /pcm/jobs/{jobID}/cancel: + post: + summary: Cancel a Job + description: | + The jobs endpoints display the status of a number of endpoints that function as jobs, for example, product import and export, and duplicating hierarchies. + + Jobs are processed one at a time. You can continue to send job requests, but those jobs are queued. In other words, Commerce looks for any jobs that have a status of PENDING and starts the job with the earliest created date. If you decide that a specific job needs to be prioritized over another, you can cancel the less critical job using the `Cancel a job` endpoint. You can only cancel jobs whose status is PENDING. + operationId: cancelJob + tags: + - Jobs + requestBody: + content: + application/json: + schema: + type: object + parameters: + - $ref: '#/components/parameters/job_id' + responses: + '200': + description: Successfully cancelled job + content: + application/json: + schema: + $ref: '#/components/schemas/single' + examples: + cancelled: + summary: Cancelled Job + $ref: '#/components/examples/cancelled' + '400': + $ref: '#/components/responses/bad_request' + '404': + $ref: '#/components/responses/not_found' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + /pcm/jobs/{jobID}/errors: + get: + summary: Get Job Errors + operationId: getJobErrors + tags: + - Jobs + parameters: + - $ref: '#/components/parameters/job_id' + responses: + '200': + description: Successful + content: + application/json: + schema: + $ref: '#/components/schemas/errors' + examples: + errors: + summary: Errors Returned + $ref: '#/components/examples/errors' + '400': + $ref: '#/components/responses/bad_request' + '404': + $ref: '#/components/responses/not_found' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + /pcm/products: + post: + summary: Create a product or bundle + description: | + Creates a product or bundle with the attributes that are defined in the body. + + #### Product Types + + Commerce automatically assigns types to the products you create. In Commerce Manager, you can see at a glance the product types in a list of a products. In addition, you can filter on product types in both the API and Commerce Manager. + + Product types can also be used in catalogs. For example, in your catalog, you can filter on `parent` so that only your parent products are displayed in your storefront. + + See [**Product Types**](/docs/api/pxm/products/products#product-types). + + #### Product Tags + + You can use product tags to store or assign a key word against a product or service that you sell in your store. The product tag can then be used to describe or label that product. Product tags represent similarities between products who do not share the same attributes. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. + + See [**Product Tags**](/docs/api/pxm/products/product-tags). + + #### Personalizing products + + You can allow your shoppers to add custom text to a product when adding product items to their carts. This is useful, for example, if you have a product like a T-shirt that can be personalized or you sell greetings cards that can be printed with your shoppers personalized messages. You can do this by configuring the the `custom_inputs` attribute. + + When configuring the `custom_inputs` attribute: + + - You can rename `input` to something more representative of the input that shoppers are adding, for example, `message` or `front`. + - `name` is the name that is displayed in your storefront. + - You can add validation rules. For example, the input field must be a `string` and/or up to 255 characters in length. The limit is 255 characters. + - You can specify if the input field is required. + + #### Curating Products + + You can curate the products in a node. Product curation allows you to promote specific products within each node of your hierarchies, enabling you to create unique product collections in your storefront. For example, you may find you have an abundance of cotton T-Shirts and you want to promote these products to the top of the product list. When a shopper navigates to T-shirts, the cotton T-Shirts are displayed first. See [**Update a node**](/docs/api/pxm/products/update-node). + + #### Bundles + + With Product Experience Manager, you can use the products API to create and manage bundles. A bundle is a purchasable product, comprising of one or more products that you want to sell together. + + See [**Bundles**](/docs/api/pxm/products/products#bundles). + operationId: createProduct + tags: + - Products + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/create_product_request' + examples: + create-product: + summary: Create a base product + $ref: '#/components/examples/product_request' + build-rules: + summary: Create a base product, associate variations, configure build rules + $ref: '#/components/examples/build_rules_request' + sku-bundles: + summary: SKU-based bundles + $ref: '#/components/examples/bundle_sku_based_request' + sku-less-bundles: + summary: SKU-less bundles + $ref: '#/components/examples/bundle_sku_less_request' + responses: + '201': + description: Creates a product with the following attributes. + content: + application/json: + schema: + $ref: '#/components/schemas/single_product_response' + examples: + created-product: + summary: Create a base product + $ref: '#/components/examples/create_single_product_response' + build-rules: + summary: Create a base product, associate variations, configure build rules + $ref: '#/components/examples/create_build_rules_response' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + get: + summary: Get all products + description: | + Retrieves a list of all your products in the Product Experience Manager system. + + You can also use `include` to retrieve top-level resources, such as files or images, and key attribute data, such as SKU or slug for component products in a product bundle. With this option, you can get more information about the products in a product bundle in your store front, improving the buying experience for your shoppers. + + #### Filtering + + Many Commerce API endpoints support filtering. The general syntax is described in [**Filtering**](/docs/commerce-cloud/api-overview/filtering). + + The following attributes and operators are supported. + + | Operator | Attribute | Description | Example | + | :--- |:------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------| + | `eq` | `sku`, `slug`,`upc_ean`, `mpn`, `name`, `templates`, `commodity_type`, `owner`, `product_types`, `tags` | Equals. Checks if the values of two operands are equal. If they are, the condition is true. For `product_types`, you can only specify one product type. For example, `filter=eq(product_types,child)` | `filter=eq(name,some-name)` | + | `like` | `sku`, `slug`,`upc_ean`, `mpn`, `name`, `tags` | Like. Checks if the operand contains the specified string. Wildcards are supported. | `filter=like(name,*some-name*)` | + | `In` | `id`, `name`, `SKU`, `slug`, `upc_ean`, `mpn`, `product_types`, `tags` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `filter=in(id,some-id)` | + operationId: getAllProducts + tags: + - Products + parameters: + - $ref: '#/components/parameters/page_offset' + - $ref: '#/components/parameters/page_limit' + - $ref: '#/components/parameters/filterproduct' + - $ref: '#/components/parameters/include' + responses: + '200': + description: Returns a list of all products. + content: + application/json: + schema: + $ref: '#/components/schemas/multi_product_response' + examples: + list-products: + $ref: '#/components/examples/multi_product_response' + '400': + $ref: '#/components/responses/bad_request' + '500': + $ref: '#/components/responses/internal' + /pcm/products/import: + post: + summary: Import Products + description: | + + You can use the Product Import API to: + + - Add new products, including: + + - main image files. See [Importing Main Image Files](/docs/api/pxm/products/product-import-bulk-update#using-imported-main-image-files). + - custom data. See [Importing custom data](/docs/api/pxm/products/product-import-bulk-update#importing-custom-data-flows). + - Make bulk updates to existing products. + + You cannot use product import to: + + - Delete existing products. + - Import product bundles. + + The Product Import API uses a Comma Separated Values (CSV) file to import products, main image files and custom extension data. Each row in a .csv file represents a product you want to create/update. + + Each file can have 50,000 rows, including the header. If a CSV file exceeds 50,000 rows, an error is displayed, and the products are not imported. A CSV file must not be larger than 50 megabytes. If a CSV file is larger than 50 megabytes, a `503 client read` error is displayed. + + If you want to create/update more than 50,000 products or your CSV file is larger than 50 megabytes, you must have a separate CSV file and import each CSV file one at a time. + + See [**Characteristics of CSV Files**](/docs/api/pxm/products/product-import-bulk-update#characteristics-of-csv-import-files). + operationId: importProducts + tags: + - Product Import/Bulk Update + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + file: + description: The file you want to upload. Ensure that the file format is Comma Separated Values (CSV). + type: string + format: binary + example: UploadFile + examples: + upload_image: + summary: Upload Image + value: + file: '@path/to/file' + responses: + '201': + description: Import started + content: + application/json: + schema: + $ref: '#/components/schemas/single' + examples: + pending: + summary: Successful Job + $ref: '#/components/examples/import' + '400': + $ref: '#/components/responses/bad_request' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + /pcm/products/export: + post: + summary: Export Products + description: | + + The Export API is available to make bulk updates to products in Product Experience Manager. You might also export products for your personal requirements. + + The Export API builds a CSV file containing the product entries. A CSV file can contain up to 50,000 product entries. If you have more than 50,000 product entries, then another CSV file is created and so on, until all your products are exported. + + The Job endpoint response specifies the location where the CSV file is stored. See [Characteristics of CSV Files](/docs/api/pxm/products/product-export#characteristics-of-exporting-products). + + ### Filtering + + The following attributes and operators are supported. + + | Operator | Attribute | Description | Example | + | :--- |:-------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------| :--- | + | `eq` | `sku`, `slug`, `upc_ean`, `mpn`, `name`, `description`, `tags` | Equals. Checks if the values of two operands are equal. If they are, the condition is true. When filtering on tags, you can only specify one product tag. | `filter=eq(name,some-name)` | + | `In` | `sku`, `tags` | Checks if the values are included in the specified string. If they are, the condition is true. When filtering on tags, you can specify a list of product tags. | `filter=in(id,some-id)` | + | `like` | `sku`, `slug`, `upc_ean`, `mpn`, `name`, `description` | Like. Checks if the operand contains the specified string. Wildcards are supported. | `filter=like(name,some-name)` | + operationId: exportProducts + tags: + - Product Export + requestBody: + content: + application/json: + schema: + type: object + responses: + '201': + description: Export started + content: + application/json: + schema: + $ref: '#/components/schemas/single' + examples: + pending: + summary: Successful Job + $ref: '#/components/examples/export' + '400': + $ref: '#/components/responses/bad_request' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + parameters: + - $ref: '#/components/parameters/useTemplateSlugs' + - $ref: '#/components/parameters/filterexport' + /pcm/products/{productID}: + get: + summary: Get a product + description: | + Returns a product by its identifier. + + You can also use `include=component_products` to retrieve top-level resources, such as files or images, and key attribute data, such as SKU or slug for component products in a product bundle. With this option, you can get more information about the products in a product bundle in your store front, improving the buying experience for your shoppers. + operationId: getProduct + parameters: + - $ref: '#/components/parameters/product_id' + - $ref: '#/components/parameters/include' + tags: + - Products + responses: + '200': + description: Returns a product by its identifier. + content: + application/json: + schema: + $ref: '#/components/schemas/single_product_response' + examples: + get-product: + summary: Product + $ref: '#/components/examples/get_single_product_response' + get-product-bundle: + summary: Bundle + $ref: '#/components/examples/get_bundle_response' + get-product-component-parent: + summary: Parent Product + $ref: '#/components/examples/get_parent_product_response' + get-product-component-child: + summary: Child Product + $ref: '#/components/examples/get_child_product_response' + get-product-component-products: + summary: Component Product + $ref: '#/components/examples/get_component_product_response' + '400': + $ref: '#/components/responses/bad_request' + '404': + $ref: '#/components/responses/not_found' + '500': + $ref: '#/components/responses/internal' + put: + summary: Update a product or bundle + description: Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the product or bundle is not updated. + operationId: updateProduct + parameters: + - $ref: '#/components/parameters/product_id' + tags: + - Products + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/update_product_request' + examples: + update-product: + summary: Update a base product + $ref: '#/components/examples/update_product_request' + update-product-build-rules: + summary: Update a base product and build rules + $ref: '#/components/examples/update_build_rules_request' + update-product-custom-inputs: + summary: Update using custom_inputs + description: You can allow your shoppers to add custom text to a product when checking out their carts. This is useful, for example, if you have a product like a T-shirt that can be personalized. You can do this using the custom_inputs attribute when creating your products. + $ref: '#/components/examples/update_custom_inputs_request' + update-product-bundle: + summary: Update a bundle + $ref: '#/components/examples/update_bundle_request' + responses: + '200': + description: Updates a product with the following attributes. + content: + application/json: + schema: + $ref: '#/components/schemas/single_product_response' + examples: + updated-product: + summary: Update a base product + $ref: '#/components/examples/update_single_product_response' + build-rules: + summary: Update a base product, configure build rules + $ref: '#/components/examples/update_build_rules_response' + update-product-custom-inputs: + summary: Update using custom_inputs + $ref: '#/components/examples/update_custom_inputs_response' + update-product-bundle: + summary: Update a bundle + $ref: '#/components/examples/update_bundle_response' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/not_found' + '409': + $ref: '#/components/responses/write_conflict' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + delete: + summary: Delete a product + description: | + Deletes the specified product. + + You cannot delete a product if it is part of a bundle. You must first delete the bundle before you delete the product. + operationId: deleteProduct + parameters: + - $ref: '#/components/parameters/product_id' + tags: + - Products + responses: + '204': + description: Deletes the specified product. + '403': + $ref: '#/components/responses/forbidden' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + /pcm/products/attach_nodes: + post: + summary: Attach multiple nodes + description: | + Assigns products to multiple hierarchies and their children nodes. You can apply a filter to search for the appropriate products to attach to a node. For general filtering syntax, see [**Filtering**](/docs/commerce-cloud/api-overview/filtering). + + The following attributes and operators are supported. + + | Operator | Attribute | Description | Example | + | :--- |:------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------| + | `eq` | `sku`, `slug`,`upc_ean`, `mpn`, `name`, `templates`, `commodity_type`, `owner`, `product_types` | Equals. Checks if the values of two operands are equal. If they are, the condition is true. For `product_types`, you can only specify one product type. For example, `filter=eq(product_types,child)` | `filter=eq(name,some-name)` | + | `like` | `sku`, `slug`,`upc_ean`, `mpn`, `name` | Like. Checks if the operand contains the specified string. Wildcards are supported. | `filter=like(name,*some-name*)` | + | `In` | `id`, `name`, `SKU`, `slug`, `upc_ean`, `mpn`, `product_types` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `filter=in(id,some-id)` | + + operationId: attachNodes + tags: + - Products + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + type: object + required: + - filter + - node_ids + properties: + filter: + type: string + description: | + Filters applied to search for appropriate products to attach to a node. See [Attach multiple nodes](/docs/api/pxm/products/attach-nodes). + example: eq(sku,book) + node_ids: + type: array + description: A list of node unique identifiers that you want to assign to the products. + example: + - '123' + items: + type: string + examples: + product-attach-nodes: + summary: Attach multiple nodes + value: + data: + filter: eq(sku,book) + node_ids: + - '123' + responses: + '200': + description: This request assigns the products that you have selected to multiple hierarchies and their children nodes and returns the following. + content: + application/json: + schema: + type: object + properties: + meta: + type: object + properties: + nodes_attached: + description: Number of nodes assigned to the products. + type: integer + nodes_not_found: + type: array + description: A list of node unique identifiers that could not be identified. + example: + - '123' + items: + type: string + examples: + created-product: + summary: Attach multiple nodes + value: + meta: + nodes_attached: 3 + nodes_not_found: [] + '400': + $ref: '#/components/responses/bad_request' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + /pcm/products/detach_nodes: + post: + summary: Detach multiple nodes + description: | + Dissociates products from multiple hierarchies and their children nodes. You can apply filters to search for the appropriate products to detach. For general filtering syntax, see [**Filtering**](/docs/commerce-cloud/api-overview/filtering). + + The following attributes and operators are supported. + + | Operator | Attribute | Description | Example | + | :--- |:------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------| + | `eq` | `sku`, `slug`,`upc_ean`, `mpn`, `name`, `templates`, `commodity_type`, `owner`, `product_types` | Equals. Checks if the values of two operands are equal. If they are, the condition is true. For `product_types`, you can only specify one product type. For example, `filter=eq(product_types,child)` | `filter=eq(name,some-name)` | + | `like` | `sku`, `slug`,`upc_ean`, `mpn`, `name` | Like. Checks if the operand contains the specified string. Wildcards are supported. | `filter=like(name,*some-name*)` | + | `In` | `id`, `name`, `SKU`, `slug`, `upc_ean`, `mpn`, `product_types` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `filter=in(id,some-id)` | + operationId: detachNodes + tags: + - Products + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + type: object + required: + - filter + - node_ids + properties: + filter: + type: string + description: | + You can apply filters to search for the appropriate products to detach. See [Detach multiple nodes](/docs/api/pxm/products/detach-nodes). + example: eq(sku,book) + node_ids: + type: array + description: A list of node unique identifiers that you want to assign to the products. + example: + - '123' + items: + type: string + examples: + product-attach-nodes: + summary: Attach multiple nodes + value: + data: + filter: eq(sku,book) + node_ids: + - '123' + responses: + '200': + description: The request dissociates the products that you have selected from multiple hierarchies and their children and returns the following. + content: + application/json: + schema: + type: object + properties: + meta: + type: object + properties: + nodes_detached: + description: Number of nodes dissociated from the products. + type: integer + nodes_not_found: + type: array + description: A list of node unique identifiers that could not be identified. + example: + - '123' + items: + type: string + examples: + created-product: + summary: Detach multiple nodes + value: + meta: + nodes_detached: 1 + nodes_not_found: [] + '400': + $ref: '#/components/responses/bad_request' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + /pcm/products/{productID}/nodes: + get: + summary: Get a product's nodes + description: Returns the nodes associated with the product. Products must be in a `live` status. + operationId: getProductsNodes + tags: + - Products + responses: + '200': + description: Successfully returns the product's nodes. + content: + application/json: + schema: + $ref: '#/components/schemas/multi_nodes' + examples: + get-product-nodes: + $ref: '#/components/examples/resp_multi_nodes' + '400': + $ref: '#/components/responses/bad_request' + '404': + $ref: '#/components/responses/not_found' + '500': + $ref: '#/components/responses/internal' + parameters: + - $ref: '#/components/parameters/page_offset' + - $ref: '#/components/parameters/page_limit' + - $ref: '#/components/parameters/product_id' + /pcm/products/{productID}/build: + post: + summary: Build child products + description: | + With product variations in Product Experience Manager, you can create product variations and different options for each variation and use both to create child products for a product. Each child product is a unique combination of options associated with the product. + + Child products inherit attributes from their parent products. When you make changes to the attributes of the parent products, you can rebuild your child products, ensuring that changes to the parent products are propagated to the child products. + + Alternatively, you can modify a child product independently, without impacting its parent product. For example, you may prefer the status of your child product to be `live`, while keeping the parent product's status as `draft`. When you directly update a child product, it becomes independent of its parent product. In other words, any subsequent changes made to the parent product are not automatically reflected in the child product when you rebuild the parent product and its child products. Once a child product is independent of its parent, you cannot recreate the association between the child product and its parent. You must delete the child product and rebuild the parent to recreate the child product. + + Following on from that, if you add the same flow to both a parent and child product, the child flow values are not affected by changes to the parent flow values in a rebuild. + + ### Using Build Rules + + When building your child products, you can build all products related to a product. + + Alternatively, you can build a combination of child products associated with a product, based on build rules that you specify. This is useful, for example, if you have a variation option that you do not sell. This makes managing and building your child products quick and easy. You can do this using `build_rules`. `build_rules` are combinations of variation option IDs that you wish to include or exclude when building your child products. + + :::note + + You do not need to configure any `build_rules` in the following scenarios: + + - Child products must be built with all variation options. Simply, use the `Create a product` or `Update a product` endpoints with no `build_rules` specified. + - Child products must be built apart from all options for a specific variation. In this case, you must remove the variation and use the `Create a product` or `Update a product` endpoints with no `build_rules` specified. In other words, using our example, if none of the `size` options should be included, then remove the `size` variation. + + ::: + + The `build_rules` contain: + + - (Required) `default`: specifies the default behavior. + - (Optional) `include`: specifies the option IDs to include when the child products are built. Each combination consists of a nested array of option IDs from one or more variations. Combinations of option IDs in the nested arrays must come from different variations. See [**Invalid Build Rules**](#invalid-build-rules). + - (Optional) `exclude`: specifies the option IDs to exclude when the child products are built. Each combination consists of a nested array of option IDs from one or more variations. Combinations of option IDs in the nested arrays must come from different variations. See [**Invalid build rules**](#invalid-build-rules). + + When building child products, Commerce compares each combination of option IDs to these rules to determine how your child products should be built, depending on how you have configured the `build_rules`. It depends on your requirements how you configure your `build_rules`. + + #### Invalid Build Rules + + The `build_rules` are invalid if both the option IDs come from the same variation. Combinations of option IDs in the nested arrays must come from different variations. + + If Commerce cannot resolve the `build_rules` a `could not determine whether to include or exclude a child product due to ambiguous rules` error is returned. This error can occur, for example, if you have the same number of variation option IDs in both the `include` and `exclude` arrays and the variation option IDs match. + + ### Building Child Products + + Building child products is an asynchronous operation. When you build child products, a job is created. The jobId of the job is displayed in the response. When the job is complete, the build child products operation is also complete. You can use the jobId to see the status of your job using the `Get a Job` endpoint. + + Jobs are processed one at a time. You can continue to send build child product requests, but those jobs are queued. In other words, Commerce looks for any jobs that have a status of PENDING and starts the job with the earliest created date. This process is repeated until all jobs are processed. See Jobs. + + Re-building child products after adding or removing a new variation changes the total number of child products that you can generate from a parent product. When you rebuild the child products after updating variations associated with the parent product, all existing child products that belong to a parent product are deleted. New child products are created with new product IDs. + + If you have any bundles that reference child products directly, then you must update the bundles with the new child product IDs. + + However, re-building child products after adding or removing an option does not change the existing product IDs. + operationId: buildChildProducts + tags: + - Variations + requestBody: + content: + application/json: + schema: + type: object + responses: + '201': + description: Successfully started building child products + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/not_found' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + parameters: + - $ref: '#/components/parameters/product_id' + /pcm/products/{productID}/children: + get: + summary: Get child products + operationId: getChildProducts + tags: + - Variations + responses: + '200': + description: Returns a list of child products for the specified parent product ID. + content: + application/json: + schema: + $ref: '#/components/schemas/multi_product_response' + examples: + list-products: + $ref: '#/components/examples/multi_get_child_response' + '400': + $ref: '#/components/responses/bad_request' + '500': + $ref: '#/components/responses/internal' + parameters: + - $ref: '#/components/parameters/product_id' + /pcm/products/{productID}/relationships/templates: + post: + summary: Create a product template relationship + description: Retrieves all the templates that are associated with the specified product. + operationId: createProductTemplateRelationship + parameters: + - $ref: '#/components/parameters/product_id' + tags: + - Extending Products with Templates + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/product_templates_request' + examples: + create-product-template-relationship: + $ref: '#/components/examples/templates_relationship_request' + responses: + '201': + description: Returns a created product template relationship. + content: + application/json: + schema: + $ref: '#/components/schemas/template_response' + examples: + product-templates: + $ref: '#/components/examples/template_response' + '400': + $ref: '#/components/responses/bad_request' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/not_found' + '409': + $ref: '#/components/responses/write_conflict' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + get: + summary: Get all product template relationships + operationId: getProductTemplateRelationships + parameters: + - $ref: '#/components/parameters/product_id' + tags: + - Extending Products with Templates + responses: + '200': + description: Returns all product template relationships + content: + application/json: + schema: + $ref: '#/components/schemas/template_response' + examples: + product-template-relationships: + $ref: '#/components/examples/template_response' + '400': + $ref: '#/components/responses/bad_request' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/not_found' + '409': + $ref: '#/components/responses/write_conflict' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + delete: + summary: Delete a product template relationship + operationId: deleteProductTemplateRelationship + parameters: + - $ref: '#/components/parameters/product_id' + tags: + - Extending Products with Templates + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/product_templates_request' + examples: + delete-product-template-relationship: + $ref: '#/components/examples/templates_relationship_request' + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/bad_request' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/not_found' + '409': + $ref: '#/components/responses/write_conflict' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + /pcm/products/{productID}/relationships/component_products: + get: + summary: Get Bundle Component Product Relationships + description: Retrieves all the products included in the specified bundle product. + operationId: getProductComponentProductsRelationships + tags: + - Bundle Component Products Relationships + responses: + '200': + description: Returns all Component Products relationships + content: + application/json: + schema: + $ref: '#/components/schemas/component_products_response' + examples: + product-template-relationships: + $ref: '#/components/examples/component_products_relationship_response' + '400': + $ref: '#/components/responses/bad_request' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/not_found' + '409': + $ref: '#/components/responses/write_conflict' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + parameters: + - $ref: '#/components/parameters/product_id' + /pcm/products/{productID}/relationships/files: + get: + summary: Get all product file relationships + description: Retrieves all files that are associated with the specified product. + operationId: getProductFileRelationships + tags: + - Product File Relationships + parameters: + - $ref: '#/components/parameters/product_id' + responses: + '200': + description: Returns all product file relationships. + content: + application/json: + schema: + $ref: '#/components/schemas/file_response' + examples: + product-file-relationships: + $ref: '#/components/examples/file_relationship_response' + '400': + $ref: '#/components/responses/bad_request' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/not_found' + '409': + $ref: '#/components/responses/write_conflict' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + post: + summary: Create a product file relationship + operationId: createProductFileRelationships + tags: + - Product File Relationships + parameters: + - $ref: '#/components/parameters/product_id' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/product_files_request' + examples: + create-product-file-relationship: + $ref: '#/components/examples/file_relationship_request' + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/bad_request' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/not_found' + '409': + $ref: '#/components/responses/write_conflict' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + put: + summary: Replace a product file relationship + operationId: updateProductFileRelationships + tags: + - Product File Relationships + parameters: + - $ref: '#/components/parameters/product_id' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/product_files_request' + examples: + replace-product-file-relationship: + $ref: '#/components/examples/file_relationship_request' + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/bad_request' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/not_found' + '409': + $ref: '#/components/responses/write_conflict' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + delete: + summary: Delete a product file relationships + operationId: deleteProductFileRelationships + tags: + - Product File Relationships + parameters: + - $ref: '#/components/parameters/product_id' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/product_files_request' + examples: + delete-product-file-relationships: + $ref: '#/components/examples/file_relationship_request' + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/bad_request' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/not_found' + '409': + $ref: '#/components/responses/write_conflict' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + /pcm/products/{productID}/relationships/variations: + post: + summary: Create a product variation relationship + operationId: createProductVariationRelationships + tags: + - Variations + parameters: + - $ref: '#/components/parameters/product_id' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/product_variations_request' + examples: + create-product-variation-relationship: + $ref: '#/components/examples/product_variations_relationship_request' + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/bad_request' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/not_found' + '409': + $ref: '#/components/responses/write_conflict' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + get: + summary: Get all product variation relationships + operationId: getProductVariationRelationships + tags: + - Variations + parameters: + - $ref: '#/components/parameters/product_id' + responses: + '200': + description: Returns all product variation relationships + content: + application/json: + schema: + $ref: '#/components/schemas/variations_response' + examples: + product-variation-relationships: + $ref: '#/components/examples/variations_response' + '400': + $ref: '#/components/responses/bad_request' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/not_found' + '409': + $ref: '#/components/responses/write_conflict' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + put: + summary: Replace a product variation relationship + operationId: updateProductVariationRelationships + tags: + - Variations + parameters: + - $ref: '#/components/parameters/product_id' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/product_variations_request' + examples: + replace-product-variation-relationship: + $ref: '#/components/examples/product_variations_relationship_request' + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/bad_request' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/not_found' + '409': + $ref: '#/components/responses/write_conflict' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + delete: + summary: Delete a product variation relationships + operationId: deleteProductVariationRelationships + tags: + - Variations + parameters: + - $ref: '#/components/parameters/product_id' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/product_variations_request' + examples: + delete-product-variation-relationships: + $ref: '#/components/examples/product_variations_relationship_request' + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/bad_request' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/not_found' + '409': + $ref: '#/components/responses/write_conflict' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + /pcm/products/{productID}/relationships/main_image: + post: + summary: Create main image relationships + description: Associates a main image with the specified product. + operationId: createProductMainImageRelationships + tags: + - Product Image Relationships + parameters: + - $ref: '#/components/parameters/product_id' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/main_image_request' + examples: + create-product-main-image-relationship: + value: + data: + type: file + id: 3ab3deca-1f11-47b7-a409-24ea3234d72c + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/bad_request' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/not_found' + '409': + $ref: '#/components/responses/write_conflict' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + get: + summary: Get Main Image Relationships + operationId: getProductMainImageRelationships + tags: + - Product Image Relationships + parameters: + - $ref: '#/components/parameters/product_id' + responses: + '200': + description: Returns all product variation relationships + content: + application/json: + schema: + $ref: '#/components/schemas/main_image_response' + examples: + product-main-image-relationships: + value: + data: + - type: file + id: file-1 + '400': + $ref: '#/components/responses/bad_request' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/not_found' + '409': + $ref: '#/components/responses/write_conflict' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + put: + summary: Replace Main Image Relationships + operationId: updateProductMainImageRelationships + tags: + - Product Image Relationships + parameters: + - $ref: '#/components/parameters/product_id' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/replace_main_image_request' + examples: + replace-main-image-relationship: + value: + data: + - type: file + id: 3ab3deca-1f11-47b7-a409-24ea3234d72c + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/bad_request' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/not_found' + '409': + $ref: '#/components/responses/write_conflict' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + delete: + summary: Delete Main Image Relationships + operationId: deleteProductMainImageRelationships + tags: + - Product Image Relationships + parameters: + - $ref: '#/components/parameters/product_id' + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/bad_request' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/not_found' + '409': + $ref: '#/components/responses/write_conflict' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + /pcm/variations: + post: + summary: Create a variation + operationId: createVariation + tags: + - Variations + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/create_variation' + examples: + create-variation: + summary: Create a variation + $ref: '#/components/examples/create_variation' + responses: + '201': + description: Returns a created variation with the following attributes. + content: + application/json: + schema: + $ref: '#/components/schemas/created_variation' + examples: + created-variation: + $ref: '#/components/examples/created_variation' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + get: + summary: Get all variations + operationId: getAllVariations + parameters: + - $ref: '#/components/parameters/page_offset' + - $ref: '#/components/parameters/page_limit' + tags: + - Variations + responses: + '200': + description: Returns all variations. + content: + application/json: + schema: + $ref: '#/components/schemas/multi_variations' + examples: + list-variations: + $ref: '#/components/examples/multi_variations' + '400': + $ref: '#/components/responses/bad_request' + '500': + $ref: '#/components/responses/internal' + /pcm/variations/{variationID}: + get: + summary: Get a variation + operationId: getVariation + parameters: + - $ref: '#/components/parameters/variation_id' + tags: + - Variations + responses: + '200': + description: Returns the specified variation. + content: + application/json: + schema: + $ref: '#/components/schemas/single_variation' + examples: + get-variation: + $ref: '#/components/examples/single_variation' + '400': + $ref: '#/components/responses/bad_request' + '404': + $ref: '#/components/responses/not_found' + '500': + $ref: '#/components/responses/internal' + put: + summary: Update a variation + description: Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the variation is not updated. + operationId: updateVariation + parameters: + - $ref: '#/components/parameters/variation_id' + tags: + - Variations + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/update_variation' + examples: + update-variation: + $ref: '#/components/examples/update_variation' + responses: + '200': + description: Returns an updated variation with the following attributes. + content: + application/json: + schema: + $ref: '#/components/schemas/single_variation' + examples: + update-variation: + $ref: '#/components/examples/single_variation' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/not_found' + '409': + $ref: '#/components/responses/write_conflict' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + delete: + summary: Delete a variation and all it's associated options + operationId: deleteVariation + parameters: + - $ref: '#/components/parameters/variation_id' + tags: + - Variations + responses: + '204': + description: No Content + '403': + $ref: '#/components/responses/forbidden' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + /pcm/variations/{variationID}/options: + post: + summary: Create a variation option + operationId: createVariationOption + parameters: + - $ref: '#/components/parameters/variation_id' + tags: + - Variations + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/create_option' + examples: + create-variation-option: + $ref: '#/components/examples/create_option' + responses: + '201': + description: Successfully returns the created variation option + content: + application/json: + schema: + $ref: '#/components/schemas/created_option' + examples: + created-variation-option: + $ref: '#/components/examples/created_option' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + get: + summary: Get all variation options + operationId: getAllVariationOptions + parameters: + - $ref: '#/components/parameters/variation_id' + - $ref: '#/components/parameters/page_offset' + - $ref: '#/components/parameters/page_limit' + tags: + - Variations + responses: + '200': + description: Successfully returns all variation options + content: + application/json: + schema: + $ref: '#/components/schemas/multi_options' + examples: + list-variations: + $ref: '#/components/examples/multi_options' + '400': + $ref: '#/components/responses/bad_request' + '500': + $ref: '#/components/responses/internal' + /pcm/variations/{variationID}/options/{optionID}: + get: + summary: Get a variation option + operationId: getVariationOption + parameters: + - $ref: '#/components/parameters/variation_id' + - $ref: '#/components/parameters/option_id' + tags: + - Variations + responses: + '200': + description: Successfully returns the variation option + content: + application/json: + schema: + $ref: '#/components/schemas/single_option' + examples: + get-variation-option: + $ref: '#/components/examples/single_option' + '400': + $ref: '#/components/responses/bad_request' + '404': + $ref: '#/components/responses/not_found' + '500': + $ref: '#/components/responses/internal' + put: + summary: Update a variation option + operationId: updateVariationOption + parameters: + - $ref: '#/components/parameters/variation_id' + - $ref: '#/components/parameters/option_id' + tags: + - Variations + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/update_option' + examples: + update-variation-option: + $ref: '#/components/examples/update_option' + responses: + '200': + description: Successfully returns the updated variation option + content: + application/json: + schema: + $ref: '#/components/schemas/single_option' + examples: + updated-variation-option: + $ref: '#/components/examples/single_option' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/not_found' + '409': + $ref: '#/components/responses/write_conflict' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + delete: + summary: Delete a variation option + operationId: deleteVariationOption + parameters: + - $ref: '#/components/parameters/variation_id' + - $ref: '#/components/parameters/option_id' + tags: + - Variations + responses: + '204': + description: No Content + '403': + $ref: '#/components/responses/forbidden' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + /pcm/variations/{variationID}/options/{optionID}/modifiers: + post: + summary: Create a modifier + operationId: createModifier + parameters: + - $ref: '#/components/parameters/variation_id' + - $ref: '#/components/parameters/option_id' + tags: + - Variations + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/create_modifier' + examples: + create-variation-modifier: + $ref: '#/components/examples/create_modifier' + responses: + '201': + description: Successfully returns the created modifier + content: + application/json: + schema: + $ref: '#/components/schemas/created_modifier' + examples: + created-variation-modifier: + $ref: '#/components/examples/created_modifier' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + get: + summary: Get all modifiers + operationId: getAllModifiers + tags: + - Variations + parameters: + - $ref: '#/components/parameters/variation_id' + - $ref: '#/components/parameters/option_id' + - $ref: '#/components/parameters/page_offset' + - $ref: '#/components/parameters/page_limit' + responses: + '200': + description: Successfully returns all variation modifiers + content: + application/json: + schema: + $ref: '#/components/schemas/multi_modifiers' + examples: + list-variations: + $ref: '#/components/examples/multi_modifiers' + '400': + $ref: '#/components/responses/bad_request' + '500': + $ref: '#/components/responses/internal' + /pcm/variations/{variationID}/options/{optionID}/modifiers/{modifierID}: + get: + summary: Get a modifier + operationId: getModifier + parameters: + - $ref: '#/components/parameters/variation_id' + - $ref: '#/components/parameters/option_id' + - $ref: '#/components/parameters/modifier_id' + tags: + - Variations + responses: + '200': + description: Returns the specified modifier. + content: + application/json: + schema: + $ref: '#/components/schemas/single_modifier' + examples: + get-variation-modifier: + $ref: '#/components/examples/single_modifier' + '400': + $ref: '#/components/responses/bad_request' + '404': + $ref: '#/components/responses/not_found' + '500': + $ref: '#/components/responses/internal' + put: + summary: Update a modifier + description: Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the modifier is not updated. + operationId: updateModifier + parameters: + - $ref: '#/components/parameters/variation_id' + - $ref: '#/components/parameters/option_id' + - $ref: '#/components/parameters/modifier_id' + tags: + - Variations + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/update_modifier' + examples: + update-variation-modifier: + $ref: '#/components/examples/update_modifier' + responses: + '200': + description: Successfully returns the updated modifier + content: + application/json: + schema: + $ref: '#/components/schemas/single_modifier' + examples: + updated-variation-modifier: + $ref: '#/components/examples/single_modifier' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/not_found' + '409': + $ref: '#/components/responses/write_conflict' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + delete: + summary: Delete a modifier + description: You cannot delete a modifier if it is in use. Deleting a modifier in us returns a `422 Failed Validation` error. + operationId: deleteModifier + parameters: + - $ref: '#/components/parameters/variation_id' + - $ref: '#/components/parameters/option_id' + - $ref: '#/components/parameters/modifier_id' + tags: + - Variations + responses: + '204': + description: No Content + '403': + $ref: '#/components/responses/forbidden' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + /pcm/hierarchies: + post: + summary: Create a hierarchy + description: Create a hierarchy + operationId: createHierarchy + tags: + - Hierarchies + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/create_hierarchy' + examples: + create-hierarchy: + $ref: '#/components/examples/create_hierarchy' + required: true + responses: + '201': + description: Returns a created hierarchy with the following attributes. + content: + application/json: + schema: + $ref: '#/components/schemas/single_hierarchy' + examples: + created-hierarchy: + $ref: '#/components/examples/hierarchy_created' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + get: + operationId: getHierarchy + parameters: + - $ref: '#/components/parameters/page_offset' + - $ref: '#/components/parameters/page_limit' + summary: Get all hierarchies + description: Get all hierarchies + tags: + - Hierarchies + responses: + '200': + description: Returns a list of all hierarchies. + content: + application/json: + schema: + $ref: '#/components/schemas/multi_hierarchy' + examples: + list-hierarchies: + $ref: '#/components/examples/resp_multi_hierarchy' + '400': + $ref: '#/components/responses/bad_request' + '500': + $ref: '#/components/responses/internal' + /pcm/hierarchies/{hierarchyID}: + get: + parameters: + - $ref: '#/components/parameters/hierarchy_id' + summary: Get a hierarchy + description: Retrieves the specified hierarchy. + operationId: getHierarchyChild + tags: + - Hierarchies + responses: + '200': + description: Returns a hierarchy with the following attributes. + content: + application/json: + schema: + $ref: '#/components/schemas/single_hierarchy' + examples: + get-hierarchy: + $ref: '#/components/examples/hierarchy_created' + '400': + $ref: '#/components/responses/bad_request' + '404': + $ref: '#/components/responses/not_found' + '500': + $ref: '#/components/responses/internal' + put: + operationId: updateHierarchy + parameters: + - $ref: '#/components/parameters/hierarchy_id' + summary: Update a hierarchy + description: Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the hierarchy is not updated. + tags: + - Hierarchies + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/update_hierarchy' + examples: + update-hierarchy: + $ref: '#/components/examples/update_hierarchy' + required: true + responses: + '200': + description: Successfully returns the updated hierarchy + content: + application/json: + schema: + $ref: '#/components/schemas/single_hierarchy' + examples: + updated-hierarchy: + $ref: '#/components/examples/hierarchy_updated' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/not_found' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + delete: + operationId: deleteHierarchy + parameters: + - $ref: '#/components/parameters/hierarchy_id' + summary: Delete a hierarchy + description: Deletes the specified hierarchy and all its children. + tags: + - Hierarchies + responses: + '204': + description: No Content + '403': + $ref: '#/components/responses/forbidden' + '500': + $ref: '#/components/responses/internal' + /pcm/hierarchies/{hierarchyID}/nodes: + post: + parameters: + - $ref: '#/components/parameters/hierarchy_id' + summary: Create a node + description: | + Creates a node in the specified hierarchy. + + ### Sorting Nodes in a Hierarchy + + You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. + + You can do this by adding a `meta` object to the body of your request and specifying a `sort_order` value. + + The node with the highest value of `sort_order` is displayed first. For example, a node with a `sort_order` value of `3` appears before a node with a `sort_order` value of `2`. + + - If you don’t provide `sort_order` when creating nodes, all child nodes in the response for Get a Node’s Children request are ordered by the `updated_at` time in descending order, with the most recently updated child node first. + - If you set `sort_order` for only a few child nodes, the child nodes with a `sort_order` value appear first and then other child nodes appear in the order of `updated_at` time. + + You can also specify a `sort_order` when creating a node relationship. + + - If you create a node (**Node A**) with a `sort_order` and then you create a relationship for **Node A** with another node (**Node B**), the `sort_order` you specified when creating **Node A** is overwritten. + - If you create **Node A** and then you create a relationship with **Node B** but do not configure a `sort_order`, the `sort_order` you specified when you created **Node A** is not overwritten. + + ### Curating Products in a node + + You can curate the products in a node. Product curation allows you to promote specific products within each node of your hierarchies, enabling you to create unique product collections in your storefront. For example, you may find you have an abundance of cotton T-Shirts and you want to promote these products to the top of the product list. When a shopper navigates to T-shirts, the cotton T-Shirts are displayed first. + + You can do this by adding a `curated_products` attribute to the body of your request and adding an array of product IDs to the attribute. You should add the products IDs in the order you want them to be displayed in your node. The first product ID is displayed first in the product list. + + You can only curate 20 products or less. You cannot have more than 20 curated products. + + - The product IDs you provide must exist in the specified node. + - If a curated product is removed from a node, the product is also removed from the curated_products list. + - Once you have curated the products in a node, you can use the get node products endpoint to retrieve a list of curated products. + + You can then display your curated products in your catalogs using the following catalog endpoints. + + - Get a node in your latest catalog release. + - Get a node in a catalog. + - Get all nodes in your latest catalog release. + - Get all nodes in a catalog. + - Get node children in your latest catalog release. + - Get node children in a catalog. + operationId: createNode + tags: + - Hierarchies + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/create_node' + examples: + create-node: + $ref: '#/components/examples/create_node' + responses: + '201': + description: Successfully returns the created node + content: + application/json: + schema: + $ref: '#/components/schemas/single_node' + examples: + created-node: + $ref: '#/components/examples/node_created' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/not_found' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + get: + parameters: + - $ref: '#/components/parameters/hierarchy_id' + - $ref: '#/components/parameters/page_offset' + - $ref: '#/components/parameters/page_limit' + summary: Get all nodes in a hierarchy + description: A fully paginated view of all nodes in a hierarchy regardless of depth. + operationId: getAllNodesInHierarchy + tags: + - Hierarchies + responses: + '200': + description: Successfully returns the node's children + content: + application/json: + schema: + $ref: '#/components/schemas/multi_nodes' + examples: + get-all-nodes: + $ref: '#/components/examples/resp_multi_nodes' + '400': + $ref: '#/components/responses/bad_request' + '404': + $ref: '#/components/responses/not_found' + '500': + $ref: '#/components/responses/internal' + /pcm/hierarchies/{hierarchyID}/nodes/{nodeID}: + get: + parameters: + - $ref: '#/components/parameters/hierarchy_id' + - $ref: '#/components/parameters/node_id' + summary: Get a node + description: Retrieves a node from a hierarchy. + operationId: getHierarchyNode + tags: + - Hierarchies + responses: + '200': + description: Returns a node with the following attributes. + content: + application/json: + schema: + $ref: '#/components/schemas/single_node' + examples: + get-node: + $ref: '#/components/examples/node_created' + '400': + $ref: '#/components/responses/bad_request' + '404': + $ref: '#/components/responses/not_found' + '500': + $ref: '#/components/responses/internal' + put: + parameters: + - $ref: '#/components/parameters/hierarchy_id' + - $ref: '#/components/parameters/node_id' + summary: Update a node + description: | + Updates the specified node in a hierarchy. You can do a partial update, where you specify only the field value to change. + + ### Sorting Nodes in a hierarchy + + You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. + + The node with the highest value of sort_order is displayed first. For example, a node with a `sort_order` value of `3` appears before a node with a `sort_order` value of `2`. + + - If you don’t provide `sort_order` when creating nodes, all child nodes in the response for Get a Node’s Children request are ordered by the `updated_at` time in descending order, with the most recently updated child node first. + - If you set `sort_order` for only a few child nodes or not all, the child nodes with a `sort_order` value appear first and then other child nodes appear in the order of `updated_at` time. + + You can also specify a sort_order when creating a node relationship. + + - If you update a node (**Node A**) with a `sort_order` and then you create a relationship for **Node A** with another node (**Node B**), the `sort_order` you specified when updating **Node A** is overwritten. + - If you have updated **Node A** and then you create a relationship with **Node B** but do not configure a `sort_order`, the `sort_order` you specified when you updated **Node A** is not overwritten. + + ### Curating Products in a node + + You can curate the products in a node. Product curation allows you to promote specific products within each node of your hierarchies, enabling you to create unique product collections in your storefront. For example, you may find you have an abundance of cotton T-Shirts and you want to promote these products to the top of the product list. When a shopper navigates to T-shirts, the cotton T-Shirts are displayed first. + + You can do this by adding a `curated_products` attribute to the body of your request and adding an array of product IDs to the attribute. You should add the products IDs in the order you want them to be displayed in your node. The first product ID is displayed first in the product list. + + You can only curate 20 products or less. You cannot have more than 20 curated products. + + - The product IDs you provide must exist in the specified node. + - If a curated product is removed from a node, the product is also removed from the curated_products list. + - Once you have curated the products in a node, you can use the get node products endpoint to retrieve a list of curated products. + + You can then display your curated products in your catalogs using the following catalog endpoints. + + - Get a node in your latest catalog release. + - Get a node in a catalog. + - Get all nodes in your latest catalog release. + - Get all nodes in a catalog. + - Get node children in your latest catalog release. + - Get node children in a catalog. + operationId: updateNode + tags: + - Hierarchies + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/update_node' + examples: + update-node: + $ref: '#/components/examples/update_node' + responses: + '200': + description: Successfully returns the updated node + content: + application/json: + schema: + $ref: '#/components/schemas/single_node' + examples: + updated-node: + $ref: '#/components/examples/node_updated' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/not_found' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + delete: + parameters: + - $ref: '#/components/parameters/hierarchy_id' + - $ref: '#/components/parameters/node_id' + summary: Deletes a node + description: Deletes a node by the node ID + operationId: deleteNode + tags: + - Hierarchies + responses: + '204': + description: No Content + '403': + $ref: '#/components/responses/forbidden' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + /pcm/hierarchies/{hierarchyID}/children: + get: + parameters: + - $ref: '#/components/parameters/hierarchy_id' + - $ref: '#/components/parameters/page_offset' + - $ref: '#/components/parameters/page_limit' + summary: Get a hierarchy's children + description: Get a hierarchy's children + operationId: getAllChildren + tags: + - Hierarchies + responses: + '200': + description: Returns the hierarchy's children. + content: + application/json: + schema: + $ref: '#/components/schemas/multi_nodes' + examples: + get-hierarchy-children: + $ref: '#/components/examples/resp_multi_nodes' + '400': + $ref: '#/components/responses/bad_request' + '404': + $ref: '#/components/responses/not_found' + '500': + $ref: '#/components/responses/internal' + /pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/children: + post: + parameters: + - $ref: '#/components/parameters/hierarchy_id' + - $ref: '#/components/parameters/node_id' + summary: Create relationships between a node and child nodes + description: | + Use this endpoint to create relationships between a single parent node and one or more child nodes. You can create a relationship only if: + + - The parent node already exists. + - All child nodes already exist. + - Every child node in the body of the request exists in the same hierarchy as the parent node. + - A node is not a parent of itself. An array of child nodes request body must not contain the ID of the parent node in the path. + - All siblings in a hierarchy must have a unique `slug`. Siblings are the child nodes that are related to the same parent. + + ### Sort Order + + You can also provide `sort_order` information when you create a relationship by adding a `meta` object to the array of node reference objects for each child node that requires sorting. + + The node with the highest value of `sort_order` appears at the top of the response. For example, a node with a `sort_order` value of `3` appears before a node with a `sort_order` value of `2`. + + - If you don’t provide `sort_order` when creating relationships, all child nodes in the response for Get a Node’s Children request are ordered by the `updated_at` time in descending order. The most recently updated child node appears at the top of the response. + - If you set `sort_order` for only a few child nodes or not all, the child nodes with `sort_order` value appear first in the response and then other child nodes appear in the order of `updated_at` time. + + You can also specify a `sort_order` when creating and updating a node. + + - If you create or update a node (**Node A**) with a `sort_order` and then you create a relationship for **Node A** with another node (**Node B**), the `sort_order` you specified when creating\updating **Node A** is overwritten. + - If you create\update **Node A** and then you create a relationship with **Node B** but do not configure a `sort_order`, the `sort_order` you specified when you created\updated **Node A** is not overwritten. + operationId: createNodeChildRelationships + tags: + - Hierarchies + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/node_children' + examples: + set-node-children: + $ref: '#/components/examples/node_children' + responses: + '200': + description: Successfully returns the node's children + content: + application/json: + schema: + $ref: '#/components/schemas/single_node' + examples: + set-node-children: + $ref: '#/components/examples/node_updated' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/not_found' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + /pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/children: + get: + parameters: + - $ref: '#/components/parameters/hierarchy_id' + - $ref: '#/components/parameters/node_id' + - $ref: '#/components/parameters/page_offset' + - $ref: '#/components/parameters/page_limit' + summary: Get a node's children + description: Retrieves the child nodes for a specified node. + operationId: getAllNodeChildren + tags: + - Hierarchies + responses: + '200': + description: Successfully returns the node's children + content: + application/json: + schema: + $ref: '#/components/schemas/multi_nodes' + examples: + get-node-children: + $ref: '#/components/examples/resp_multi_nodes' + '400': + $ref: '#/components/responses/bad_request' + '404': + $ref: '#/components/responses/not_found' + '500': + $ref: '#/components/responses/internal' + /pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/parent: + put: + parameters: + - $ref: '#/components/parameters/hierarchy_id' + - $ref: '#/components/parameters/node_id' + summary: Update a node's parent + description: | + Changes the parent of the specified node. The new parent node must be located within the same hierarchy as the specified node. + + You cannot move a node to another hierarchy. If you want to put the specified node into another hierarchy, create the node in the target hierarchy and delete it from the current hierarchy. + operationId: updateNodeParent + tags: + - Hierarchies + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/node_parent' + examples: + update-node-parent: + $ref: '#/components/examples/node_parent' + responses: + '204': + description: No Content + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/not_found' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + delete: + parameters: + - $ref: '#/components/parameters/hierarchy_id' + - $ref: '#/components/parameters/node_id' + summary: Delete a node's parent + operationId: deleteNodeParent + tags: + - Hierarchies + responses: + '204': + description: No Content + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/not_found' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + /pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/products: + post: + parameters: + - $ref: '#/components/parameters/hierarchy_id' + - $ref: '#/components/parameters/node_id' + summary: Create a node's product relationships + description: Creates relationships between the specified node and one or more products in a specified hierarchy. + operationId: createNodeProductRelationship + tags: + - Hierarchies + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/node_products' + examples: + create-node-product-relationships: + $ref: '#/components/examples/node_products' + responses: + '201': + description: Successfully returns the updated node + content: + application/json: + schema: + $ref: '#/components/schemas/single_node' + examples: + created-node-product-relationships: + $ref: '#/components/examples/node_updated' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/not_found' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + delete: + parameters: + - $ref: '#/components/parameters/hierarchy_id' + - $ref: '#/components/parameters/node_id' + summary: Deletes a node's product relationships + operationId: deleteNodeProductRelationships + tags: + - Hierarchies + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/node_products' + examples: + delete-node-product-relationships: + $ref: '#/components/examples/node_products' + responses: + '200': + description: Successfully returns the updated node + content: + application/json: + schema: + $ref: '#/components/schemas/single_node' + examples: + created-node-product-relationships: + $ref: '#/components/examples/node_updated' + '404': + $ref: '#/components/responses/not_found' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + /pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/products: + get: + parameters: + - $ref: '#/components/parameters/hierarchy_id' + - $ref: '#/components/parameters/node_id' + - $ref: '#/components/parameters/page_offset' + - $ref: '#/components/parameters/page_limit' + summary: Get a node's products + description: | + Returns the products associated with the specified hierarchy node from a published catalog. Products must be in a live status. If the products have been curated using the update a hierarchy node endpoint, then the products are returned in the order specified in the `curated_products` attribute in the body of the update a hierarchy node request. A product that is curated has the "curated_product": true attribute displayed. + operationId: getNodeProducts + tags: + - Hierarchies + responses: + '200': + description: Successfully returns the node's products + content: + application/json: + schema: + $ref: '#/components/schemas/multi_product_response' + examples: + get-node-products: + $ref: '#/components/examples/multi_product_response' + '400': + $ref: '#/components/responses/bad_request' + '404': + $ref: '#/components/responses/not_found' + '500': + $ref: '#/components/responses/internal' + /pcm/hierarchies/{hierarchyID}/duplicate_job: + post: + parameters: + - $ref: '#/components/parameters/hierarchy_id' + summary: Duplicate a hierarchy + description: | + Using this option, you can duplicate an existing hierarchy. This is useful because it enables you to quickly and easily create multiple hierarchies with the same node structure. + + When you duplicate a hierarchy, you can specify a new name and/or a new description for the duplicated hierarchy. All other attributes, such as slug and locales, stay the same. + + Any nodes in the existing hierarchy are also replicated in the duplicated hierarchy. In addition, you can optionally use the `include_products` attribute to specify whether you want products associated with the nodes in an existing hierarchy to be associated with the nodes in the duplicated hierarchy. By default, product associations in an existing hierarchy are not duplicated in a duplicate hierarchy. + + Duplicating a hierarchy is an asynchronous operation. When you duplicate a hierarchy, a job is created. The jobId of the job is displayed in the response. When the job is complete, the duplicate hierarchy operation is also complete. You can use the jobId to see the status of your job using Get a Job. + + Jobs are processed one at a time. You can continue to send duplicate hierarchy requests, but those jobs are queued. In other words, Commerce looks for any jobs that have a status of PENDING and starts the job with the earliest created date. This process is repeated until all jobs are processed. + + Once the job is complete, run: + + - Get all hierarchies to retrieve the HierarchyId of your duplicated hierarchy. + - Get a hierarchy to retrieve the nodes and (if applicable) products associated with the duplicated hierarchy. + operationId: duplicateHierarchy + tags: + - Hierarchies + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/duplicate_job' + examples: + duplicate-hierarchy: + $ref: '#/components/examples/duplicate_job' + required: true + responses: + '201': + description: Successfully returns the duplicate hierarchy job ID + content: + application/json: + schema: + $ref: '#/components/schemas/single' + examples: + duplicated-hierarchy: + $ref: '#/components/examples/duplicate_hierarchy_job_created' + '404': + $ref: '#/components/responses/not_found' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + /pcm/tags: + get: + summary: Get All Product Tags + description: | + Retrieves all product tags for a store. A store can view the tags associated with the organization to which the store belongs. However, an organization can only view the tags associated with the organization. + + operationId: getAllProductTags + tags: + - Product Tags + responses: + '200': + description: Returns all the product tags. + content: + application/json: + schema: + $ref: '#/components/schemas/multi_tag' + examples: + list-tags: + summary: Get all tags + $ref: '#/components/examples/resp_multi_tags' + '400': + $ref: '#/components/responses/bad_request' + '404': + $ref: '#/components/responses/not_found' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + /pcm/tags/{tagID}: + get: + summary: Get a Product Tag + description: Retrieves a product tag for a store. A store can view the tags associated with the organization to which the store belongs. However, an organization can only view the tags associated with the organization. + operationId: getProductTag + tags: + - Product Tags + parameters: + - $ref: '#/components/parameters/tag_id' + responses: + '200': + description: Returns a product tag with the following attributes. + content: + application/json: + schema: + $ref: '#/components/schemas/single_tag' + examples: + get-tag: + summary: Get a tag + $ref: '#/components/examples/resp_single_tag' + '400': + $ref: '#/components/responses/bad_request' + '404': + $ref: '#/components/responses/not_found' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + /pcm/custom_relationships: + post: + summary: Create a custom relationship + description: Create a custom relationship + operationId: createCustomRelationship + tags: + - Custom Relationships + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/create_custom_relationship' + examples: + create-custom-relationship: + $ref: '#/components/examples/create_custom_relationship' + required: true + responses: + '201': + description: Returns a created custom relationship with the following attributes. + content: + application/json: + schema: + $ref: '#/components/schemas/single_custom_relationship' + examples: + created-custom-relationship: + $ref: '#/components/examples/custom_relationship_created' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' + /pcm/custom_relationships/{customRelationshipSlug}: + put: + operationId: updateCustomRelationship + parameters: + - $ref: '#/components/parameters/custom_relationship_slug' + summary: Update a custom relationship + description: Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the custom relationship is not updated. + tags: + - Custom Relationships + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/update_custom_relationship' + examples: + update-custom-relationship: + $ref: '#/components/examples/update_custom_relationship' + required: true + responses: + '200': + description: Successfully returns the updated custom relationship + content: + application/json: + schema: + $ref: '#/components/schemas/single_custom_relationship' + examples: + updated-custom-relationship: + $ref: '#/components/examples/custom_relationship_updated' + '403': + $ref: '#/components/responses/forbidden' + '404': + $ref: '#/components/responses/not_found' + '422': + $ref: '#/components/responses/unprocessable_entity' + '500': + $ref: '#/components/responses/internal' +components: + securitySchemes: + bearerAuth: + type: http + scheme: bearer + schemas: + job: + type: object + properties: + id: + description: A unique identifier generated when a job is created. + type: string + type: + description: This represents the type of resource object being returned. Always `pim-job`. + type: string + enum: + - pim-job + attributes: + type: object + properties: + started_at: + description: The date and time a job is started. + type: string + example: '2020-09-22T09:00:00' + format: date-time + nullable: true + completed_at: + type: string + example: '2020-09-22T09:00:00' + format: date-time + nullable: true + description: The date and time a job is completed. + created_at: + type: string + description: The date and time a job is created. + example: '2020-09-22T09:00:00' + format: date-time + updated_at: + type: string + description: The date and time a job is updated. + example: '2020-09-22T09:00:00' + format: date-time + type: + type: string + description: | + The status of a job. + + * `pending` - Commerce has received the request but is currently busy processing other requests. + * `started` - Commerce has started processing the job. + * `success` - The job has successfully completed. + * `failed` - The job has failed. + enum: + - child-products + - product-import + - product-export + - hierarchy-duplicate + - price-import + status: + type: string + enum: + - pending + - cancelled + - started + - success + - failed + meta: + type: object + properties: + x_request_id: + type: string + description: Applies to all job types. A unique request ID is generated when a job is created. + copied_from: + type: string + description: Applies to `hierarchy-duplicate` job types. The ID of the original hierarchy that you duplicated. + hierarchy_id: + type: string + description: Applies to `hierarchy-duplicate` job types. The duplicated hierarchy ID. + file_locations: + type: array + nullable: true + description: If the job type is `product_export`, a link to the file is created when running a job. + items: + type: string + filter: + type: string + description: The entities included in the job. For example, if the job type is `product-export`, the PXM products included in the export. + multi: + type: object + properties: + data: + description: An array of jobs. + type: array + items: + $ref: '#/components/schemas/job' + meta: + type: object + properties: + results: + description: Contains the results for the entire collection. + type: object + properties: + total: + description: Total number of results for the entire collection. + type: integer + example: 2 + error: + required: + - errors + properties: + errors: + type: array + items: + required: + - status + - title + properties: + status: + type: string + description: The HTTP response code of the error. + example: '500' + title: + type: string + description: A brief summary of the error. + example: Internal server error + detail: + type: string + description: Optional additional detail about the error. + example: An internal error has occurred. + request_id: + type: string + description: Internal request ID. + example: 00000000-0000-0000-0000-000000000000 + meta: + type: object + description: Additional supporting meta data for the error. + example: + missing_ids: + - e7d50bd5-1833-43c0-9848-f9d325b08be8 + single: + type: object + properties: + data: + $ref: '#/components/schemas/job' + errors: + type: object + properties: + data: + type: array + description: An array of job errors. + items: + type: object + properties: + type: + description: This represents the type of resource object being returned. Always `pim-job-error`. + type: string + example: pim-job-error + enum: + - pim-job-error + id: + description: A unique identifier for a job error generated when a job error is created. + type: string + attributes: + type: object + properties: + message: + description: A description of an error message. + type: string + example: 'data.attributes.sku: Must be unique amongst products.' + product_custom_inputs: + type: object + description: You use the `custom_inputs` attribute to allow your shoppers to add custom text to a product when adding product items to their carts. This is useful, for example, if you have a product like a T-shirt that can be personalized or you sell greetings cards that can be printed with your shoppers personalized messages. See [Personalizing Products](/docs/api/pxm/products/create-product#personalizing-products). + additionalProperties: + description: A name for the custom text field. You can rename this to something more representative of the input that shoppers are adding, for example, `message` or `front`. + type: object + properties: + name: + type: string + description: A name for the custom text field. + validation_rules: + type: array + description: The validation rules for the custom text. + type: + description: This represents the type of the resource being returned. + type: string + options: + type: object + description: The length of the custom input text field. + max_length: + type: integer + description: The number of characters the custom text field can be. You can specify a maximum length up to 255 characters, as the limit is 255 characters. + required: + type: boolean + description: '`true` or `false` depending on whether the custom text is required.' + product_build_rules: + type: object + description: You can build a combination of child products associated with a product, based on build rules that you specify. This is useful, for example, if you have a variation option that you do not sell. This makes managing and building your child products quick and easy. See [Using Build Rules](/docs/api/pxm/products/build-child-products#using-build-rules). + properties: + default: + description: Specifies the default behaviour, either `include` or `exclude`. + type: string + enum: + - include + - exclude + include: + description: An array of option IDs to include when child products are built. Each combination consists of a nested array of option IDs from one or more variations. Combinations of option IDs in the nested arrays must come from different variations. + type: array + items: + type: array + items: + type: string + exclude: + description: An array of option IDs to exclude when child products are built. Each combination consists of a nested array of option IDs from one or more variations. Combinations of option IDs in the nested arrays must come from different variations. + type: array + items: + type: array + items: + type: string + product_bundle_components: + type: object + description: With Product Experience Manager, you can create and manage bundles. A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. See [Bundles](/docs/api/pxm/products/products#bundles). + additionalProperties: + description: The name of the component, such as `games`. The `bundle_configuration` uses the component name to reference a component. A component name should be relatively short and must not contain any special characters. + type: object + properties: + name: + type: string + description: The component name. The component name is the name that is displayed in your storefront. + options: + type: array + description: The product options included in a component. This can be the ID of another bundle. + items: + type: object + properties: + id: + type: string + description: The unique ID of the product you want to add to a component. + type: + type: string + description: This represents the type of object being returned. Always `product`. + quantity: + type: integer + description: The number of this product option that a shopper must purchase. + sort_order: + type: integer + description: The sort order of the options. The `create a bundle` and `update a bundle` endpoints do not sort the options. You can use the `sort_order` attribute when programming your storefront to display the options in the order that you want. + default: + description: Whether the product option is a default option in a bundle. Shoppers can select a bundle that specifies a default list of product options. See [Dynamic Bundles](/docs/api/pxm/products/products#dynamic-bundles). + type: boolean + min: + type: integer + description: The minimum number of product options a shopper can select from this component. + max: + type: integer + description: The maximum number of product options a shopper can select from this component. + sort_order: + type: integer + description: The sort order of the components. The `create a bundle` and `update a bundle` endpoints do not sort the components. You can use the `sort_order` attribute when programming your storefront to display the components in the order that you want. + product_response: + type: object + properties: + id: + description: A unique product ID that is generated when you create the product. + type: string + type: + description: This represents the type of resource object being returned. Always `product`. + type: string + enum: + - product + attributes: + type: object + additionalProperties: false + properties: + name: + description: A name for the product. + type: string + description: + description: A description for the product. + type: string + slug: + description: A label for the product that is used in the URL paths. A slug can contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. By default, the product name is used as the slug. + type: string + sku: + description: The unique stock keeping unit of the product. + type: string + status: + description: The status for the product, either `draft` or `live`. + type: string + enum: + - live + - draft + commodity_type: + description: The commodity type, either `physical` or `digital`. + type: string + enum: + - physical + - digital + upc_ean: + description: The universal product code or european article number of the product. + type: string + mpn: + description: The manufacturer part number of the product. + type: string + external_ref: + description: The unique attribute associated with the product. This could be an external reference from a separate company system, for example. The maximum length is 2048 characters. + type: string + locales: + description: Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. + type: object + tags: + description: You can use product tags to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. A product can have up to 20 tags. A product tag can be up to 255 characters. Product tags must not contain any spaces or commas. + type: array + items: + type: string + extensions: + type: object + additionalProperties: + type: object + additionalProperties: + oneOf: + - type: string + nullable: true + - type: integer + - type: boolean + custom_inputs: + $ref: '#/components/schemas/product_custom_inputs' + build_rules: + $ref: '#/components/schemas/product_build_rules' + components: + $ref: '#/components/schemas/product_bundle_components' + meta: + type: object + properties: + created_at: + description: The date and time a product is created. + type: string + example: '2020-09-22T09:00:00' + format: date-time + updated_at: + description: The date and time a product is updated. + type: string + example: '2020-09-22T09:00:00' + format: date-time + owner: + description: The resource owner, either `organization` or `store`. + type: string + enum: + - organization + - store + variations: + description: A product's variations and the options defined for each variation. If you have specified `build_rules`, only the child products included in the `build_rules` are specified. + type: array + items: + type: object + properties: + id: + type: string + description: A unique ID generated when a variation is created. + name: + type: string + description: The name of a variation. + options: + type: array + items: + type: object + description: The options available for this variation. + properties: + id: + type: string + description: A unique ID that is generated an option is created. + name: + type: string + description: The name of an option. + description: + type: string + description: A description of an option. + product_types: + description: | + One of the following product types: + + - `standard` - A `standard` product is a standalone product. + - `parent` - A `parent` product is a product that has child products that have been built using the `Build Child Products` endpoint. + - `child` - When you configure product variations and variation options for `parent` products, the `child` products derived from the `parent` products are automatically created in Commerce. + - `bundle` - A `bundle` is a purchasable product, comprising one or more standalone products (in other words, components) to be sold together. + type: array + items: + type: string + enum: + - parent + - child + - bundle + - standard + variation_matrix: + description: The child products defined for a product. The order of the variations in the `variation_matrix` is the order of the variations in the array when the variations were linked to the product. For example, the first variation in the `variation_matrix` corresponds to the first variation in the array, and so on. You can use the `sort_order`attribute to sort the order of your variation and variation options in the `variation_matrix` object. See [Sorting the Order of Variations and Options](/docs/api/pxm/products/variations#sorting-the-order-of-variations-and-options) If no variations are defined for a product, the `variation_matrix` is empty. + type: object + relationships: + description: Relationships are established between different product entities. For example, a `bundle` product and a `child` product are related to a `parent` product, as both are associated with it. + type: object + additionalProperties: + type: object + properties: + data: + oneOf: + - type: array + items: + type: object + properties: + id: + description: A unique identifier for a resource. + type: string + type: + description: This represents the type of resource object being returned. + type: string + - type: object + nullable: true + properties: + id: + description: A unique identifier for a resource. + type: string + type: + description: This represents the type of resource object being returned. + type: string + links: + description: | + Links are used to allow you to move between requests. Single entities use a `self` parameter with a link to that specific resource. Sometimes, there are not enough entities for a project to fill multiple pages. In this situation, we return some defaults. + + | Property | Description | + | :--- | :--- | + | `current` | Always the current page. | + | `first` | Always the first page. | + | `last` | `null` if there is only one page. | + | `prev` | `null` if the user is on the first page. | + | `next` | `null` if there is only one page. | + type: object + additionalProperties: + type: string + multi_product_response: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/product_response' + included: + type: object + description: Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. + properties: + component_products: + description: Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. + type: array + items: + $ref: '#/components/schemas/product_response' + meta: + type: object + properties: + results: + description: Contains the results for the entire collection. + type: object + properties: + total: + description: Total number of results for the entire collection. + type: integer + example: 2 + product_locales: + type: object + description: Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. + additionalProperties: + description: A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used. + type: object + required: + - name + properties: + name: + type: string + description: A localized name for the product. + description: + type: string + description: A localized description for the product. + product_attributes: + type: object + additionalProperties: false + properties: + external_ref: + type: string + description: The unique attribute associated with the product. This could be an external reference from a separate company system, for example. The maximum length is 2048 characters. + name: + type: string + description: The product name to display to customers. + description: + description: A description for the product. + type: string + slug: + type: string + description: The unique slug of the product. A slug can contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + sku: + type: string + description: The unique stock keeping unit of the product. + status: + type: string + enum: + - live + - draft + description: The status for the product, either `draft` or `live`. Default is `draft`. + commodity_type: + description: The commodity type, either `physical` or `digital`. + type: string + enum: + - physical + - digital + upc_ean: + type: string + description: The universal product code or european article number of the product. + mpn: + type: string + description: The manufacturer part number of the product. + tags: + type: array + description: You can use product tags to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. A product can have up to 20 tags. A product tag can be up to 255 characters. Product tags must not contain any spaces or commas. See [Product Tags](/docs/api/pxm/products/product-tags). + items: + type: string + build_rules: + $ref: '#/components/schemas/product_build_rules' + locales: + $ref: '#/components/schemas/product_locales' + custom_inputs: + $ref: '#/components/schemas/product_custom_inputs' + components: + $ref: '#/components/schemas/product_bundle_components' + create_product_request: + type: object + required: + - data + properties: + data: + type: object + required: + - type + - attributes + properties: + type: + description: This represents the type of resource being returned. Always `product`. + type: string + enum: + - product + example: product + attributes: + $ref: '#/components/schemas/product_attributes' + relationships: + description: Relationships are established between different product entities. + type: object + properties: + variations: + type: object + properties: + data: + type: array + items: + type: object + properties: + id: + description: A unique identifier for a resource. + type: string + type: + description: This represents the type of resource object being returned. + type: string + single_product_response: + type: object + properties: + data: + $ref: '#/components/schemas/product_response' + included: + type: object + description: Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. + properties: + component_products: + description: A list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. + type: array + items: + $ref: '#/components/schemas/product_response' + update_product_request: + type: object + required: + - data + properties: + data: + type: object + required: + - type + - attributes + - id + properties: + type: + description: This represents the type of resource object being returned. Always `product`. + type: string + enum: + - product + example: product + id: + type: string + description: The unique identifier of the product. Must match the product ID specified in the request path. + example: 00000000-0000-0000-0000-000000000000 + attributes: + $ref: '#/components/schemas/product_attributes' + attributes: + type: object + properties: + name: + description: The name of the node, such as `Ranges` or `Refrigerators`. Names must be unique among sibling nodes in the hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies. + type: string + description: + description: A description for a node. + type: string + slug: + description: A slug for the node. Slugs must be unique among sibling nodes in the hierarchy. Otherwise, a slug can be non-unique within the hierarchy and across multiple hierarchies. + type: string + curated_products: + description: You can curate your products in your nodes product lists. Product curation allows you to promote specific products within each node in a hierarchy, enabling you to create unique product collections in your storefront. + type: array + items: + description: A list of product IDs whose products you want to curate. + type: string + locales: + description: Product Experience Manager supports localization of hierarchies and nodes. If you store supports multiple languages, you can localize hierarchy and node names and descriptions. + type: object + additionalProperties: + description: A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used. + type: object + additionalProperties: false + properties: + name: + description: A localized hierarchy or node name. + type: string + description: + description: A localized hierarchy or node description. + type: string + relationships: + type: object + description: Relationships allow you to move between requests. Includes links to the child nodes and products associated with a hierarchy or node. + properties: + children: + description: The child nodes related to the resource. + type: object + properties: + data: + description: An array of child nodes. + type: array + required: [] + links: + description: Links allow you to move between requests. + type: object + properties: + related: + description: A link to a related resource. + type: string + parent: + description: The parent node related to the resource + type: object + properties: + data: + description: The parent node + type: object + required: + - id + - type + properties: + type: + description: This represents the type of resource object being returned. Always `node`. + type: string + enum: + - node + id: + description: The unique identifier of a node. + type: string + products: + type: object + description: The products related to the resource. + properties: + data: + description: An array of products. + type: array + required: [] + links: + type: object + description: Links allow you to move between requests. + properties: + related: + description: A link to a related resource. + type: string + node: + type: object + properties: + id: + description: The unique identifier of a node. + type: string + type: + description: This represents the type of resource object being returned. Always `node`. + type: string + enum: + - node + attributes: + $ref: '#/components/schemas/attributes' + relationships: + $ref: '#/components/schemas/relationships' + meta: + type: object + properties: + sort_order: + description: The sort order value. The node with the highest value of `sort_order` is displayed first. For example, a node with a `sort_order` value of `3` appears before a node with a `sort_order` value of `2`. See [Sorting Nodes in a hierarchy](/docs/api/pxm/products/create-node#sorting-nodes-in-a-hierarchy). + type: integer + created_at: + description: The date and time a node is created. + type: string + example: '2020-09-22T09:00:00' + format: date-time + updated_at: + description: The date and time a node was updated. + type: string + example: '2020-09-22T09:00:00' + format: date-time + parent_name: + description: The name of the parent of the node if one exists. + type: string + owner: + description: The node owner, either `organization` or `store`. + type: string + enum: + - store + - organization + multi_meta: + type: object + properties: + results: + description: Contains the results for the entire collection. + type: object + properties: + total: + description: Total number of results for the entire collection. + type: integer + example: 30 + minimum: 0 + multi_links: + type: object + description: Links are used to allow you to move between requests. + properties: + first: + description: Always the first page. + type: string + example: /pcm/hierarchies?page[offset]=0&page[limit]=10 + last: + description: This is `null` if there is only one page. + type: string + example: /pcm/hierarchies?page[offset]=20&page[limit]=10 + next: + description: This is `null` if there is only one page. + type: string + example: /pcm/hierarchies?page[offset]=10&page[limit]=10 + prev: + description: This is `null` if you on the first page. + type: string + example: /pcm/hierarchies?page[offset]=8&page[limit]=10 + multi_nodes: + type: object + properties: + data: + description: An array of nodes. + type: array + items: + $ref: '#/components/schemas/node' + meta: + $ref: '#/components/schemas/multi_meta' + links: + $ref: '#/components/schemas/multi_links' + template_response: + type: object + properties: + data: + type: array + items: + type: object + properties: + id: + description: A unique identifier for a template generated when a template is created. + type: string + type: + description: This represents the type of resource object being returned. Always `template`. + type: string + enum: + - template + product_templates_request: + type: object + properties: + data: + type: array + items: + type: object + properties: + id: + type: string + description: The unique identifier of a template. + type: + type: string + enum: + - template + description: This represents the type of resource object being returned. Always `template'. + component_products_response: + type: object + properties: + data: + type: array + items: + type: object + properties: + id: + type: string + description: The unique identifier of a product component generated when a product is created. + type: + type: string + enum: + - product + description: This represents the type of resource object being returned. Always `product`. + file_response: + type: object + properties: + data: + type: array + items: + type: object + properties: + id: + type: string + description: The unique identifier of the new file. + type: + type: string + description: This represents the type of resource object being returned. Always `file`. + enum: + - file + product_files_request: + type: object + properties: + data: + type: array + items: + type: object + properties: + id: + description: A unique identifier for a file generated when a file is created. + type: string + type: + description: This represents the type of resource being returned. Always `file`. + type: string + enum: + - file + meta: + type: object + properties: + tags: + description: The files associated with a product. + type: array + items: + type: string + additionalProperties: false + variations_response: + type: object + properties: + data: + type: array + items: + type: object + properties: + id: + description: A unique identifier generated when a variation is created. + type: string + type: + description: This represents the type of resource object being returned. Always `product-variation`. + type: string + enum: + - product-variation + meta: + type: object + properties: + created_at: + description: The date and time a resource is created. + type: string + example: '2020-09-22T09:00:00' + format: date-time + product_variations_request: + type: object + properties: + data: + type: array + items: + type: object + properties: + id: + type: string + description: The ID of the product variation. + type: + type: string + enum: + - product-variation + description: This represents the type of resource being returned. Always `product-variation`. + main_image_response: + type: object + properties: + data: + type: array + items: + type: object + properties: + id: + description: A unique identifier for the image file generated automatically when a file is created. + type: string + type: + description: This represents the type of resource object being returned. Always `file`. + type: string + replace_main_image_request: + type: object + properties: + data: + type: array + items: + type: object + properties: + id: + type: string + description: The ID of the new image file. + example: 00000000-0000-0000-0000-000000000000 + type: + type: string + enum: + - file + main_image_request: + type: object + properties: + data: + type: object + properties: + id: + type: string + description: The ID of the image file. + example: 00000000-0000-0000-0000-000000000000 + type: + description: This represents the type of resource being returned. Always `file`. + type: string + enum: + - file + multi_variations: + type: object + properties: + data: + type: array + items: + type: object + properties: + id: + description: A unique identifier for a variation. + type: string + type: + description: This represents the type of resource object being returned. Always `product-variation`. + type: string + enum: + - product-variation + attributes: + type: object + additionalProperties: false + properties: + name: + description: The name of a variation. + type: string + sort_order: + description: The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + type: integer + meta: + type: object + properties: + options: + type: array + items: + type: object + description: The options available for this variation. + properties: + id: + type: string + description: A unique ID that is generated when an option is created. + name: + type: string + description: A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + description: + type: string + description: A human recognizable description of the option. + created_at: + type: string + description: The date and time an option is created. + example: '2020-09-22T09:00:00' + format: date-time + updated_at: + type: string + description: The date and time an option is updated. + example: '2020-09-22T09:00:00' + format: date-time + sort_order: + description: The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + type: integer + owner: + type: string + description: The owner of the resource, either `organization` or `store`. + enum: + - organization + - store + created_at: + type: string + description: The date and time a variation is created. + example: '2020-09-22T09:00:00' + format: date-time + updated_at: + type: string + description: The date and time a variation is updated. + example: '2020-09-22T09:00:00' + format: date-time + meta: + type: object + properties: + results: + description: Contains the results for the entire collection. + type: object + properties: + total: + description: Total number of results for the entire collection. + type: integer + example: 3 + create_variation: + type: object + required: + - data + properties: + data: + type: object + required: + - type + - attributes + properties: + type: + description: This represents the type of resource object being returned. Always `product-variation`. + type: string + enum: + - product-variation + attributes: + type: object + additionalProperties: false + properties: + name: + description: The variation name. + type: string + sort_order: + description: | + The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. + + The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. + + You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + + You must rebuild your products for the sort order changes to take effect. + type: integer + created_variation: + type: object + required: + - data + properties: + data: + type: object + required: + - id + - type + - attributes + - meta + properties: + id: + description: A unique identifier generated when a variation is created. + type: string + type: + description: This represents the type of resource object being returned. Always `product-variation`. + type: string + enum: + - product-variation + attributes: + type: object + additionalProperties: false + properties: + name: + description: A human-recognizable identifier for a variation. + type: string + sort_order: + description: The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + type: integer + meta: + type: object + properties: + owner: + description: The owner of the resource, either `organization` or `store`. + type: string + enum: + - organization + - store + created_at: + type: string + description: The date and time a variation is created. + example: '2020-09-22T09:00:00' + format: date-time + updated_at: + type: string + description: The date and time a variation is updated. + example: '2020-09-22T09:00:00' + format: date-time + single_variation: + type: object + required: + - data + properties: + data: + type: object + required: + - id + - type + - attributes + - meta + properties: + id: + description: A unique identifier for a variation. + type: string + type: + description: This represents the type of resource object being returned. Always `product-variation`. + type: string + enum: + - product-variation + attributes: + type: object + additionalProperties: false + properties: + name: + description: The name for a variation. + type: string + sort_order: + description: The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + type: integer + meta: + type: object + properties: + options: + description: A variation option represents an option for selection for a single product-variation. For example, if your variation is `color`, you might have three possible options; red, green, and blue. + type: array + items: + type: object + description: The options available for this variation + properties: + id: + type: string + description: A unique ID that is generated an option is created. + name: + type: string + description: A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + description: + type: string + description: A description for an option. + created_at: + type: string + description: The date and time an option is created. + example: '2020-09-22T09:00:00' + format: date-time + updated_at: + type: string + description: The date and time an option is updated. + example: '2020-09-22T09:00:00' + format: date-time + sort_order: + description: The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + type: integer + owner: + description: The owner of the resource, either `organization` or `store`. + type: string + enum: + - organization + - store + created_at: + type: string + description: The date and time a variation is created. + updated_at: + type: string + description: The date and time a variation is updated. + update_variation: + type: object + required: + - data + properties: + data: + type: object + required: + - type + - attributes + - id + properties: + type: + description: This represents the type of resource object being returned. Always `product-variation`. + type: string + enum: + - product-variation + attributes: + type: object + additionalProperties: false + properties: + name: + description: The variation name. + type: string + sort_order: + description: | + The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. + + The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. + + You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + + You must rebuild your products for the sort order changes to take effect. + type: integer + id: + type: string + description: The unique identifier of the variation. Must match the variation ID specified in the request path. + example: 00000000-0000-0000-0000-000000000000 + multi_options: + type: object + properties: + data: + type: array + items: + type: object + properties: + id: + description: A unique identifier generated when an option is created. + type: string + type: + description: This represents the type of resource object being returned. Always `product-variation-option`. + type: string + enum: + - product-variation-option + attributes: + type: object + additionalProperties: false + properties: + name: + description: A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + type: string + description: + description: A human-recognizable description for the option. + type: string + sort_order: + description: The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + type: integer + meta: + type: object + properties: + owner: + description: The owner of a resource, either `organization` or `store`. + type: string + enum: + - organization + - store + created_at: + type: string + description: The date and time an option is created. + example: '2020-09-22T09:00:00' + format: date-time + updated_at: + type: string + description: The date and time an option is updated. + example: '2020-09-22T09:00:00' + format: date-time + meta: + type: object + properties: + results: + description: Contains the results for the entire collection. + type: object + properties: + total: + description: Total number of results for the entire collection. + type: integer + example: 3 + create_option: + type: object + required: + - data + properties: + data: + type: object + required: + - type + - attributes + properties: + type: + description: This represents the type of resource object being returned. Always `product-variation-option`. + type: string + enum: + - product-variation-option + attributes: + type: object + additionalProperties: false + properties: + name: + description: A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + type: string + sort_order: + description: | + By default, variations and variation options are sorted alphabetically. You can use the `sort_order` attribute to sort the order of your variation and variation options in the `variation_matrix`. + + The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. + + The variation option with the highest value of `sort_order` is displayed first. For example, a variation option with a `sort_order` value of `3` appears before a variation option with a `sort_order` value of `2`. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, and so on, zero or negative numbers. + + You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + + You must rebuild your products for the sort order changes to take effect. + type: integer + description: + description: A description of a product variation option. + type: string + created_option: + type: object + required: + - data + properties: + data: + type: object + required: + - type + - attributes + properties: + id: + description: A unique identifier that is generated when an option is created. + type: string + type: + description: This represents the type of resource object being returned. Always `product-variation-option`. + type: string + enum: + - product-variation-option + attributes: + type: object + additionalProperties: false + properties: + name: + description: A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + type: string + description: + description: A human-recognizable description for the option. + type: string + sort_order: + description: The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + type: integer + meta: + type: object + properties: + owner: + description: The owner of a resource, either `organization` or `store`. + type: string + enum: + - organization + - store + created_at: + type: string + description: The date and time an option is created. + example: '2020-09-22T09:00:00' + format: date-time + updated_at: + type: string + description: The date and time an option is updated. + example: '2020-09-22T09:00:00' + format: date-time + single_option: + type: object + required: + - data + properties: + data: + type: object + required: + - id + - type + - attributes + - meta + properties: + id: + description: The unique identifier generated when an option is created. + type: string + type: + description: This represents the type of resource object being returned. Always `product-variation-option`. + type: string + enum: + - product-variation-option + attributes: + type: object + description: A variation option represents an option for selection for a single product-variation. For example, if your variation is `color`, you might have three possible options; red, green, and blue. + additionalProperties: false + properties: + name: + description: A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + type: string + description: + description: A human-recognizable description for the option. + type: string + sort_order: + description: The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + type: integer + meta: + type: object + properties: + owner: + description: The owner of a resource, either `organization` or `store`. + type: string + enum: + - organization + - store + created_at: + type: string + description: The date and time an option is created. + example: '2020-09-22T09:00:00' + format: date-time + updated_at: + type: string + description: The date and time an option is updated. + example: '2020-09-22T09:00:00' + format: date-time + update_option: + type: object + required: + - data + properties: + data: + type: object + required: + - type + - attributes + - id + properties: + type: + description: This represents the type of resource object being returned. Always `product-variation-option`. + type: string + enum: + - product-variation-option + attributes: + type: object + additionalProperties: false + properties: + name: + description: A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + type: string + description: + description: The description of the option. + type: string + sort_order: + description: | + By default, variations and variation options are sorted alphabetically. You can use the `sort_order` attribute to sort the order of your variation and variation options in the `variation_matrix`. The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. + + The variation option with the highest value of `sort_order` is displayed first. For example, a variation option with a `sort_order` value of `3` appears before a variation option with a `sort_order` value of `2`. + + You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, and so on, zero or negative numbers. + + You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + + You must rebuild your products for the sort order changes to take effect. + type: integer + id: + type: string + description: The unique identifier of the option. Must match the option ID specified in the request path. + example: 00000000-0000-0000-0000-000000000000 + multi_modifiers: + type: object + properties: + data: + type: array + items: + type: object + properties: + id: + description: A unique identifier for a modifier that is generated automatically when a modifier is created. + type: string + type: + description: This represents the type of resource object being returned. Always `product-variation-modifier'. + type: string + enum: + - product-variation-modifier + attributes: + type: object + additionalProperties: false + properties: + type: + description: | + You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + + | Modifier | Data Type | Effect | + | :--- | :--- | :--- | + | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | + | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | + | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | + | `description_equals` | `string` | Overrides the description of the child product. | + | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | + | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | + | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | + | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | + | `price_increment` | `string` | Increases the price of the child product. | + | `price_decrement` | `string` | Decreases the price of the child product. | + | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | + | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + | `sku_equals` | `string` | Sets the SKU of the child product. | + | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | + | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | + | `sku_builder` | `string` | Sets a part of the SKU of the child product. | + | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | + type: string + enum: + - commodity_type + - status + - price + - name_append + - name_prepend + - name_equals + - sku_append + - sku_prepend + - sku_equals + - sku_builder + - slug_append + - slug_prepend + - slug_equals + - slug_builder + - description_append + - description_prepend + - description_equals + - custom_inputs_equals + - build_rules_equals + - locales_equals + - upc_ean_equals + - mpn_equals + - external_ref_equals + value: + description: Required for non-builder modifiers. The value of the modifier type. + type: string + seek: + description: Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. + type: string + set: + description: Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. + type: string + reference_name: + description: The name of the modifier. + type: string + meta: + type: object + properties: + owner: + description: The owner of a resource, either `organization` or `store`. + type: string + enum: + - store + - organization + meta: + type: object + properties: + results: + type: object + description: Contains the results for the entire collection. + properties: + total: + description: Total number of results for the entire collection. + type: integer + example: 3 + create_modifier: + type: object + description: Use modifiers to change the properties of child products that are inherited from a parent product. With modifiers, you only need to have one parent product with a variation attached to the product. + required: + - data + properties: + data: + type: object + required: + - type + - attributes + properties: + type: + description: This represents the type of resource object being returned. Always `product-variation-modifier`. + type: string + enum: + - product-variation-modifier + attributes: + type: object + required: + - type + additionalProperties: false + properties: + type: + type: string + description: | + You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + + | Modifier | Data Type | Effect | + | :--- | :--- | :--- | + | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | + | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | + | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | + | `description_equals` | `string` | Overrides the description of the child product. | + | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | + | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | + | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | + | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | + | `price_increment` | `string` | Increases the price of the child product. | + | `price_decrement` | `string` | Decreases the price of the child product. | + | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | + | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + | `sku_equals` | `string` | Sets the SKU of the child product. | + | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | + | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | + | `sku_builder` | `string` | Sets a part of the SKU of the child product. | + | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | + enum: + - commodity_type + - status + - price + - name_append + - name_prepend + - name_equals + - sku_append + - sku_prepend + - sku_equals + - sku_builder + - slug_append + - slug_prepend + - slug_equals + - slug_builder + - description_append + - description_prepend + - description_equals + - custom_inputs_equals + - build_rules_equals + - locales_equals + - upc_ean_equals + - mpn_equals + - external_ref_equals + value: + description: Required for non-builder modifiers. The value of the modifier type. + type: string + seek: + description: Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. + type: string + set: + description: Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. + type: string + reference_name: + description: A name for the modifier. + type: string + created_modifier: + type: object + properties: + data: + type: object + properties: + id: + description: A unique identifier for a modifier that is generated automatically when a modifier is created. + type: string + type: + description: This represents the type of resource object being returned. Always `product-variation-modifier'. + type: string + enum: + - product-variation-modifier + attributes: + type: object + additionalProperties: false + properties: + type: + description: | + You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + + | Modifier | Data Type | Effect | + | :--- | :--- | :--- | + | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | + | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | + | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | + | `description_equals` | `string` | Overrides the description of the child product. | + | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | + | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | + | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | + | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | + | `price_increment` | `string` | Increases the price of the child product. | + | `price_decrement` | `string` | Decreases the price of the child product. | + | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | + | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + | `sku_equals` | `string` | Sets the SKU of the child product. | + | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | + | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | + | `sku_builder` | `string` | Sets a part of the SKU of the child product. | + | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | + type: string + enum: + - commodity_type + - status + - price + - name_append + - name_prepend + - name_equals + - sku_append + - sku_prepend + - sku_equals + - sku_builder + - slug_append + - slug_prepend + - slug_equals + - slug_builder + - description_append + - description_prepend + - description_equals + - custom_inputs_equals + - build_rules_equals + - locales_equals + - upc_ean_equals + - mpn_equals + - external_ref_equals + value: + description: Required for non-builder modifiers. The value of the modifier type. + type: string + seek: + description: Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. + type: string + set: + description: Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. + type: string + reference_name: + description: The name of the modifier. + type: string + meta: + type: object + properties: + owner: + description: The owner of the resource, either `organization` or `store`. + type: string + enum: + - organization + - store + single_modifier: + type: object + properties: + data: + type: object + properties: + id: + description: A unique identifier for a modifier that is generated automatically when a modifier is created. + type: string + type: + description: This represents the type of resource object being returned. Always `product-variation-modifier'. + type: string + enum: + - product-variation-modifier + attributes: + type: object + additionalProperties: false + properties: + type: + description: | + You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + + | Modifier | Data Type | Effect | + | :--- | :--- | :--- | + | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | + | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | + | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | + | `description_equals` | `string` | Overrides the description of the child product. | + | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | + | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | + | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | + | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | + | `price_increment` | `string` | Increases the price of the child product. | + | `price_decrement` | `string` | Decreases the price of the child product. | + | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | + | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + | `sku_equals` | `string` | Sets the SKU of the child product. | + | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | + | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | + | `sku_builder` | `string` | Sets a part of the SKU of the child product. | + | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | + type: string + enum: + - commodity_type + - status + - price + - name_append + - name_prepend + - name_equals + - sku_append + - sku_prepend + - sku_equals + - sku_builder + - slug_append + - slug_prepend + - slug_equals + - slug_builder + - description_append + - description_prepend + - description_equals + - custom_inputs_equals + - build_rules_equals + - locales_equals + - upc_ean_equals + - mpn_equals + - external_ref_equals + value: + description: Required for non-builder modifiers. The value of the modifier type. + type: string + seek: + description: Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. + type: string + set: + description: Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. + type: string + reference_name: + description: The name of the modifier. + type: string + meta: + type: object + description: The owner of the resource, either `organization` or `store`. + properties: + owner: + type: string + enum: + - organization + - store + update_modifier: + type: object + required: + - data + properties: + data: + type: object + required: + - type + - attributes + - id + properties: + type: + description: This represents the type of resource object being returned. Always `product-variation-modifier`. + type: string + enum: + - product-variation-modifier + attributes: + type: object + required: + - type + additionalProperties: false + properties: + type: + description: | + You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + + | Modifier | Data Type | Effect | + | :--- | :--- | :--- | + | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | + | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | + | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | + | `description_equals` | `string` | Overrides the description of the child product. | + | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | + | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | + | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | + | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | + | `price_increment` | `string` | Increases the price of the child product. | + | `price_decrement` | `string` | Decreases the price of the child product. | + | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | + | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + | `sku_equals` | `string` | Sets the SKU of the child product. | + | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | + | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | + | `sku_builder` | `string` | Sets a part of the SKU of the child product. | + | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | + type: string + enum: + - commodity_type + - status + - price + - name_append + - name_prepend + - name_equals + - sku_append + - sku_prepend + - sku_equals + - sku_builder + - slug_append + - slug_prepend + - slug_equals + - slug_builder + - description_append + - description_prepend + - description_equals + - custom_inputs_equals + - build_rules_equals + - locales_equals + - upc_ean_equals + - mpn_equals + - external_ref_equals + value: + description: Required for non-builder modifiers. The value of the modifier type. + type: string + seek: + description: Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. + type: string + set: + description: Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. + type: string + reference_name: + description: The name of the modifier. + type: string + id: + type: string + description: The unique identifier of the modifier. Must match the modifier ID specified in the request path. + example: 00000000-0000-0000-0000-000000000000 + attributes_hierarchy: + type: object + properties: + name: + description: The name of a hierarchy, such as `Major Appliances`. + type: string + description: + description: A description for a hierarchy. + type: string + slug: + description: A unique slug for a hierarchy. + type: string + locales: + description: Product Experience Manager supports localization of hierarchies and nodes. If you store supports multiple languages, you can localize hierarchy and node names and descriptions. + type: object + additionalProperties: + description: A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used. + type: object + additionalProperties: false + properties: + name: + description: A localized hierarchy or node name. + type: string + description: + description: A localized hierarchy or node description. + type: string + relationships_hierarchy: + type: object + properties: + children: + description: The child nodes related to the hierarchy. + type: object + properties: + data: + description: An array of child nodes. + type: array + required: [] + links: + description: Links allow you to move between requests. + type: object + properties: + related: + description: A link to a related resource. + type: string + hierarchy: + type: object + properties: + id: + description: A unique identifier generated when a hierarchy is created. + type: string + type: + description: This represents the type of resource object being returned. Always `hierarchy`. + type: string + enum: + - hierarchy + attributes: + $ref: '#/components/schemas/attributes_hierarchy' + relationships: + $ref: '#/components/schemas/relationships_hierarchy' + meta: + type: object + properties: + created_at: + description: The date and time a hierarchy is created. + type: string + example: '2020-09-22T09:00:00' + format: date-time + updated_at: + description: The date and time a hierarchy is updated. + type: string + example: '2020-09-22T09:00:00' + format: date-time + owner: + description: The owner of a resource, either `organization` or `store`. + type: string + enum: + - store + - organization + multi_hierarchy: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/hierarchy' + links: + $ref: '#/components/schemas/multi_links' + meta: + $ref: '#/components/schemas/multi_meta' + req_attributes_hierarchy: + type: object + additionalProperties: false + properties: + name: + description: The name of the hierarchy, such as `Major Appliances`. + type: string + description: + description: A description of the hierarchy. + type: string + slug: + description: A unique slug for the hierarchy. + type: string + locales: + description: Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. + type: object + additionalProperties: + description: A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used. + type: object + additionalProperties: false + properties: + name: + description: A localized name for the hierarchy. + type: string + description: + description: A localized description for the hierarchy. + type: string + create_hierarchy: + type: object + properties: + data: + type: object + required: + - type + - attributes + properties: + type: + description: This represents the type of resource object being returned. Always `hierarchy`. + type: string + enum: + - hierarchy + attributes: + $ref: '#/components/schemas/req_attributes_hierarchy' + single_hierarchy: + type: object + properties: + data: + $ref: '#/components/schemas/hierarchy' + update_hierarchy: + type: object + required: + - data + properties: + data: + type: object + required: + - id + - type + - attributes + properties: + id: + type: string + description: The unique identifier of the hierarchy. Must match the hierarchy ID specified in the request path. + example: 00000000-0000-0000-0000-000000000000 + type: + description: This represents the type of resource object being returned. Always `hierarchy`. + type: string + enum: + - hierarchy + example: hierarchy + attributes: + $ref: '#/components/schemas/req_attributes_hierarchy' + attributes_nodes: + type: object + additionalProperties: false + properties: + name: + description: The name of the node, such as `Ranges` or `Refrigerators`. Names must be unique among sibling nodes in the hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies. + type: string + description: + description: A description of the node. + type: string + slug: + description: A slug for the node. Slugs must be unique among sibling nodes in the hierarchy. Otherwise, a slug can be non-unique within the hierarchy and across multiple hierarchies. + type: string + curated_products: + description: You can curate your products in your nodes product lists. Product curation allows you to promote specific products within each node in a hierarchy, enabling you to create unique product collections in your storefront. See [Curating Products in a node](/docs/api/pxm/products/create-node#curating-products-in-a-node). + type: array + items: + description: A list of product IDs for the products that you want to curate in a node. + type: string + locales: + description: Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. + type: object + additionalProperties: + description: A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used. + type: object + additionalProperties: false + properties: + name: + description: A localized name for the node. + type: string + description: + description: A localized description for the node. + type: string + create_node: + type: object + properties: + data: + type: object + required: + - type + - attributes + properties: + type: + description: This represents the type of resource object being returned. Always `node`. + type: string + enum: + - node + attributes: + $ref: '#/components/schemas/attributes_nodes' + meta: + type: object + additionalProperties: false + properties: + sort_order: + description: | + You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. The `sort_order` for each node. This value determines the order of nodes in the response for the `Get a Node’s Children` request. The node with the highest value of sort_order is displayed first. For example, a node with a sort_order value of 3 appears before a node with a sort_order value of 2. + + - If you don’t provide `sort_order` when creating nodes, all child nodes in the response for `Get a Node’s Children` request are ordered by the `updated_at` time in descending order, with the most recently updated child node first. + - If you set `sort_order` for only a few child nodes or not all, the child nodes with a `sort_order` value appear first and then other child nodes appear in the order of `updated_at` time. See [Sorting Nodes in a hierarchy](). + type: integer + single_node: + type: object + properties: + data: + $ref: '#/components/schemas/node' + update_node: + type: object + properties: + data: + type: object + required: + - id + - type + - attributes + properties: + id: + type: string + description: The unique identifier of the node. Must match the node ID specified in the request path. + example: 00000000-0000-0000-0000-000000000000 + type: + description: This represents the type of resource object being returned. Always `node`. + type: string + enum: + - node + attributes: + $ref: '#/components/schemas/attributes_nodes' + meta: + type: object + additionalProperties: false + properties: + sort_order: + description: | + You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. The `sort_order` for each node. This value determines the order of nodes in the response for the `Get a Node’s Children` request. The node with the highest value of sort_order is displayed first. For example, a node with a sort_order value of 3 appears before a node with a sort_order value of 2. + + - If you don’t provide `sort_order` when creating nodes, all child nodes in the response for `Get a Node’s Children` request are ordered by the `updated_at` time in descending order, with the most recently updated child node first. + - If you set `sort_order` for only a few child nodes or not all, the child nodes with a `sort_order` value appear first and then other child nodes appear in the order of `updated_at` time. + type: integer + node_children: + type: object + properties: + data: + type: array + items: + type: object + required: + - id + - type + properties: + id: + type: string + description: The unique identifier of the child node. Must not match the node ID specified in the request path. + example: 00000000-0000-0000-0000-000000000000 + type: + description: This represents the type of resource object being returned. Always `node`. + type: string + enum: + - node + node_parent: + type: object + properties: + data: + type: object + required: + - id + - type + properties: + id: + type: string + description: The unique identifier of the new parent node. Must not match the node ID specified in the request path. + example: 00000000-0000-0000-0000-000000000000 + type: + description: This represents the type of resource object being returned. Always `node`. + type: string + enum: + - node + node_products: + type: object + properties: + data: + type: array + items: + type: object + required: + - id + - type + properties: + id: + type: string + description: The unique identifier of the product to be attached to the node. + example: 00000000-0000-0000-0000-000000000000 + type: + description: This represents the type of resource object being returned. Always `product`. + type: string + enum: + - product + duplicate_job: + type: object + properties: + data: + type: object + properties: + type: + description: This represents the type of resource object being returned. Always `hierarchy`. + type: string + enum: + - hierarchy + attributes: + type: object + additionalProperties: false + properties: + name: + description: The name of the duplicate hierarchy. The maximum length is 1000 characters. + type: string + description: + description: A description of the duplicate hierarchy. + type: string + include_products: + description: Specify `true` if you want the product associations in the existing nodes associated in your duplicated hierarchy. If not, specify `false`. + type: boolean + tag: + type: object + properties: + id: + description: A unique identifier generated when a tag is created. + type: string + type: + description: This represents the type of resource object being returned. Always `tag`. + type: string + enum: + - tag + attributes: + type: object + properties: + value: + type: string + description: The text value of the tag. + meta: + type: object + properties: + x_request_id: + type: string + description: A unique request ID is generated when a tag is created. + created_at: + type: string + description: The date and time a tag is created. + example: '2020-09-22T09:00:00' + format: date-time + updated_at: + type: string + description: The date and time a tag is updated. + example: '2020-09-22T09:00:00' + format: date-time + owner: + description: The owner of a resource, either `organization` or `store`. + type: string + enum: + - store + - organization + multi_tag: + type: object + properties: + data: + description: An array of tags. + type: array + items: + $ref: '#/components/schemas/tag' + meta: + type: object + properties: + results: + description: Contains the results for the entire collection. + type: object + properties: + total: + description: Total number of results for the entire collection. + type: integer + example: 2 + single_tag: + type: object + properties: + data: + $ref: '#/components/schemas/tag' + req_attributes_custom_relationship: + type: object + additionalProperties: false + properties: + name: + description: The name of the custom relationship, such as `Kitchen electrics`. + type: string + description: + description: A description of the custom relationship. + type: string + slug: + description: A unique slug for the custom relationship. Must match the slug specified in the request path. + type: string + create_custom_relationship: + type: object + properties: + data: + type: object + required: + - type + - attributes + properties: + type: + description: This represents the type of resource object being returned. Always `custom-relationship`. + type: string + enum: + - custom-relationship + attributes: + $ref: '#/components/schemas/req_attributes_custom_relationship' + attributes_custom_relationship: + type: object + additionalProperties: false + properties: + name: + description: The name of the custom relationship, such as `Kitchen electrics`. + type: string + description: + description: A description of the custom relationship. + type: string + slug: + description: A unique slug for the custom relationship. + type: string + custom_relationship: + type: object + properties: + id: + description: A unique identifier generated when a custom relationship is created. + type: string + type: + description: This represents the type of resource object being returned. Always `hierarchy`. + type: string + enum: + - custom-relationship + attributes: + $ref: '#/components/schemas/attributes_custom_relationship' + meta: + type: object + properties: + owner: + description: The owner of the resource. + type: string + example: store + timestamps: + type: object + properties: + created_at: + description: The date and time the resource is created. + type: string + example: '2024-01-10T20:16:35.343Z' + format: date-time + updated_at: + description: The date and time the resource is updated. + type: string + example: '2024-01-10T20:16:35.343Z' + format: date-time + single_custom_relationship: + type: object + properties: + data: + $ref: '#/components/schemas/custom_relationship' + update_custom_relationship: + type: object + required: + - data + properties: + data: + type: object + required: + - id + - type + - attributes + properties: + id: + type: string + description: The unique identifier of the custom relationship. + example: 00000000-0000-0000-0000-000000000000 + type: + description: This represents the type of resource object being returned. Always `custom-relationship`. + type: string + enum: + - custom-relationship + example: custom-relationship + attributes: + $ref: '#/components/schemas/req_attributes_custom_relationship' + examples: + multi: + value: + data: + - type: pim-job + id: 1ea62172-57f6-45e5-a708-ab5bd634e3f9 + attributes: + completed_at: '2024-01-05T13:46:42.142Z' + created_at: '2024-01-05T13:46:41.695Z' + started_at: '2024-01-05T13:46:42.07Z' + status: success + type: product-import + updated_at: '2024-01-05T13:46:42.07Z' + meta: + x_request_id: 7e832a26-d615-4305-b26a-e33c9c2fc06a + - type: pim-job + id: 3ab3deca-1f11-47b7-a409-24ea3234d72c + attributes: + created_at: '2024-01-05T13:42:41.695Z' + status: started + type: product-import + updated_at: '2024-01-05T13:42:42.07Z' + meta: + x_request_id: 9ac00140-0037-4c6a-913c-b812196a2de6 + - type: pim-job + id: 7e1b9ba1-c844-4556-9b16-4ae3f0988b0f + attributes: + completed_at: '2024-01-05T15:27:23.663Z' + created_at: '2024-01-05T15:27:23.161Z' + started_at: '2024-01-05T15:27:23.65Z' + status: success + type: product-export + updated_at: '2024-01-05T15:27:23.65Z' + meta: + file_locations: [] + filter: eq(sku,product-1) + x_request_id: fad8c5c0-9546-4e0c-b68e-8a2d809891e5 + meta: + results: + total: 1 + started: + value: + data: + type: pim-job + id: 1ea62172-57f6-45e5-a708-ab5bd634e3f9 + attributes: + started_at: null + completed_at: null + created_at: '2024-01-05T13:46:41.695Z' + status: started + type: product-import + updated_at: '2024-01-05T13:46:42.07Z' + meta: + x_request_id: 7e832a26-d615-4305-b26a-e33c9c2fc06a + successful: + value: + data: + type: pim-job + id: 1ea62172-57f6-45e5-a708-ab5bd634e3f9 + attributes: + completed_at: '2024-01-05T13:46:42.142Z' + created_at: '2024-01-05T13:46:41.695Z' + started_at: '2024-01-05T13:46:42.07Z' + status: success + type: product-import + updated_at: '2024-01-05T13:46:42.07Z' + meta: + x_request_id: 7e832a26-d615-4305-b26a-e33c9c2fc06a + product-export: + value: + data: + type: pim-job + id: 7e1b9ba1-c844-4556-9b16-4ae3f0988b0f + attributes: + completed_at: '2024-01-05T15:27:23.663Z' + created_at: '2024-01-05T15:27:23.161Z' + started_at: '2024-01-05T15:27:23.65Z' + status: success + type: product-export + updated_at: '2024-01-05T15:27:23.65Z' + meta: + file_locations: [] + filter: eq(sku,product-1) + x_request_id: fad8c5c0-9546-4e0c-b68e-8a2d809891e5 + hierarchy-duplicate: + value: + data: + type: pim-job + id: 5ba1c98d-87b8-4d63-b2ed-3d3c6c876523 + attributes: + completed_at: '2024-01-08T11:56:29.257Z' + created_at: '2024-01-08T11:56:27.553Z' + started_at: '2024-01-08T11:56:29.222Z' + status: success + type: hierarchy-duplicate + updated_at: '2024-01-08T11:56:29.237Z' + meta: + copied_from: 5b912d00-db5a-4e18-86f2-3a652967ee48 + hierarchy_id: c05bfefc-8de4-43ea-858b-eb8984ad9f8f + x_request_id: an-x-request-id + build-child-products: + value: + data: + type: pim-job + id: 14a0a190-cd03-4d7f-a449-e2051ac539ea + attributes: + completed_at: '2024-01-08T11:58:19.113Z' + created_at: '2024-01-08T11:58:04.416Z' + started_at: '2024-01-08T11:58:19.067Z' + status: success + type: child-products + updated_at: '2024-01-08T11:58:19.067Z' + meta: + x_request_id: an-x-request-id + cancelled: + value: + data: + type: pim-job + id: 1e5da4bf-b2c0-4619-bb3d-f749875b15bb + attributes: + started_at: null + completed_at: null + created_at: '2023-11-14T15:37:13.589Z' + status: cancelled + type: product-import + updated_at: '2023-11-14T15:37:13.589Z' + meta: + x_request_id: 4fde01c1-95ba-4dd6-948e-b9d5763ff9c2 + errors: + value: + data: + - type: pim-job-error + id: 2950cae3-1050-4c43-9fbd-2aa60dc5c249 + attributes: + message: 'data.attributes.sku: Must be unique amongst products.' + multi_product_response: + value: + data: + - type: product + id: 9c85b276-09b4-488e-a59c-c561bae14c9e + attributes: + commodity_type: physical + custom_inputs: + back: + name: T-Shirt Back + validation_rules: + - type: string + options: + max_length: 50 + required: false + front: + name: T-Shirt Front + validation_rules: + - type: string + options: + max_length: 50 + required: false + description: T-shirt. + mpn: 1234-5678-TTTT + name: T-Shirt + sku: '97805' + slug: '97805' + status: live + upc_ean: '12345656' + tags: + - tag1 + - tag2 + extensions: + products(size): + widthMM: 600 + fuelType: electric + hasUKPlug: true + online: null + relationships: + children: + data: [] + links: + self: /products/9c85b276-09b4-488e-a59c-c561bae14c9e/children + component_products: + data: [] + links: + self: /products/9c85b276-09b4-488e-a59c-c561bae14c9e/relationships/component_products + files: + data: [] + links: + self: /products/9c85b276-09b4-488e-a59c-c561bae14c9e/relationships/files + main_image: + data: null + templates: + data: [] + links: + self: /products/9c85b276-09b4-488e-a59c-c561bae14c9e/relationships/templates + variations: + data: [] + links: + self: /products/9c85b276-09b4-488e-a59c-c561bae14c9e/relationships/variations + meta: + created_at: '2022-08-18T14:25:57.391Z' + owner: store + product_types: + - standard + updated_at: '2022-08-18T14:25:57.391Z' + meta: + results: + total: 1 + product_request: + value: + data: + type: product + attributes: + external_ref: d0ddf10c-402c-4e0f-b421-94e7f682c603 + name: T-Shirt + sku: '97805' + slug: '97805' + description: T-shirt. + status: live + commodity_type: physical + mpn: 1234-5678-TTTT + upc_ean: '12345656' + tags: + - tag1 + - tag2 + custom_inputs: + front: + name: T-Shirt Front + validation_rules: + - type: string + options: + max_length: 50 + required: false + back: + name: T-Shirt Back + validation_rules: + - type: string + options: + max_length: 50 + required: false + locales: + fr-FR: + name: T_Shirt + description: T-Shirt. + build_rules_request: + value: + data: + type: product + attributes: + name: Shirt + sku: '978055216732567' + slug: '978055216732567' + description: T-shirt. + status: live + commodity_type: physical + mpn: 1234-5678-SSSS + upc_ean: '135623456' + build_rules: + default: include + exclude: + - - cbde9096-e0e1-43d8-a1aa-cb66cf1d299f + - 0b261f7d-753d-4af6-b9f4-62b436cca37d + include: + - - cf9e99f1-33dc-4991-88a1-3718678e9453 + - 1592377e-ced8-452e-a025-e50272488b11 + relationships: + variations: + data: + - type: product-variation + id: 6c4b5caa-3819-4366-a14e-c5b85009544b + - type: product-variation + id: f192e114-9f8a-4284-99d0-4d9ccd8a0275 + - type: product-variation + id: b1ae545e-3375-455f-b5ea-09669b60996f + bundle_sku_based_request: + value: + data: + type: product + attributes: + name: Favourite games bundle + description: All of your favourite DOOM games in one bundle + sku: doom-franchise + mpn: 1234-5678-ABCD + upc_ean: '123456' + commodity_type: digital + components: + games: + name: Game 1 + max: 1 + min: 1 + sort_order: 5 + options: + - id: 7c0aa6df-0bd3-4d1f-b6f9-fd9358868869 + type: product + quantity: 1 + default: true + posters: + name: Game 2 + max: 1 + min: 1 + sort_order: 4 + options: + - id: f0ec8088-13e1-4a53-8b5d-3f4d973e05c9 + type: product + quantity: 1 + default: false + bundle_sku_less_request: + value: + data: + type: product + attributes: + name: Shower bundle + description: A bundle of shower products + commodity_type: physical + components: + shampoo: + name: Shampoo + max: 1 + min: 1 + sort_order: 1 + options: + - id: shampooProductID + type: product + quantity: 1 + default: true + conditioner: + name: Conditioner + max: 1 + min: 1 + sort_order: 2 + options: + - id: conditionerProductID + type: product + quantity: 1 + default: false + create_single_product_response: + value: + data: + type: product + id: 9c85b276-09b4-488e-a59c-c561bae14c9e + attributes: + commodity_type: physical + custom_inputs: + back: + name: T-Shirt Back + validation_rules: + - type: string + options: + max_length: 50 + required: false + front: + name: T-Shirt Front + validation_rules: + - type: string + options: + max_length: 50 + required: false + description: T-shirt. + external_ref: d0ddf10c-402c-4e0f-b421-94e7f682c603 + locales: + fr-FR: + name: T-Shirt + description: T-Shirt. + mpn: 1234-5678-TTTT + name: T-Shirt + sku: '97805' + slug: '97805' + status: live + upc_ean: '12345656' + tags: + - tag1 + - tag2 + relationships: + children: + data: [] + links: + self: /products/9c85b276-09b4-488e-a59c-c561bae14c9e/children + component_products: + data: [] + links: + self: /products/9c85b276-09b4-488e-a59c-c561bae14c9e/relationships/component_products + files: + data: [] + links: + self: /products/9c85b276-09b4-488e-a59c-c561bae14c9e/relationships/files + main_image: + data: null + templates: + data: [] + links: + self: /products/9c85b276-09b4-488e-a59c-c561bae14c9e/relationships/templates + variations: + data: [] + links: + self: /products/9c85b276-09b4-488e-a59c-c561bae14c9e/relationships/variations + meta: + created_at: '2022-08-18T14:25:57.391Z' + owner: store + product_types: + - standard + updated_at: '2022-08-18T14:25:57.391Z' + create_build_rules_response: + value: + data: + type: product + id: 9214719b-17fe-4ea7-896c-d61e60fc0d05 + attributes: + build_rules: + default: include + exclude: + - - cbde9096-e0e1-43d8-a1aa-cb66cf1d299f + - 0b261f7d-753d-4af6-b9f4-62b436cca37d + commodity_type: physical + description: T-shirt. + locales: + fr-FR: + name: shirt + description: T-shirt. + mpn: 1234-5678-SSSS + name: Shirt + sku: '978055216732567' + slug: '978055216732567' + status: live + upc_ean: '135623456' + relationships: + children: + data: [] + links: + self: /products/9214719b-17fe-4ea7-896c-d61e60fc0d05/children + component_products: + data: [] + links: + self: /products/9214719b-17fe-4ea7-896c-d61e60fc0d05/relationships/component_products + files: + data: [] + links: + self: /products/9214719b-17fe-4ea7-896c-d61e60fc0d05/relationships/files + main_image: + data: null + templates: + data: [] + links: + self: /products/9214719b-17fe-4ea7-896c-d61e60fc0d05/relationships/templates + variations: + data: [] + links: + self: /products/9214719b-17fe-4ea7-896c-d61e60fc0d05/relationships/variations + meta: + created_at: '2022-08-18T12:14:52.782Z' + owner: store + product_types: + - standard + updated_at: '2022-08-18T12:14:52.782Z' + variations: + - id: 6c4b5caa-3819-4366-a14e-c5b85009544b + name: Shirt Size + options: + - id: cbde9096-e0e1-43d8-a1aa-cb66cf1d299f + name: Small + description: Size Small + - id: da9d88d0-8ea6-434c-a0dd-059caf595687 + name: Medium + description: Size Medium + - id: 07493fea-74b0-40a2-972a-cd7e1d6561bd + name: Large + description: Size Large + - id: b1ae545e-3375-455f-b5ea-09669b60996f + name: Shirt Material + options: + - id: 994c2029-519c-43d9-9c54-14f3af4e3efd + name: Cotton + description: Material Cotton + - id: 7951f3d9-f628-49f8-8a43-7749d28153d6 + name: Denim + description: Material Denim + - id: 58115bff-589a-4287-98d8-373112102617 + name: Wool + description: Material Wool + - id: f192e114-9f8a-4284-99d0-4d9ccd8a0275 + name: Shirt Color + options: + - id: 0b261f7d-753d-4af6-b9f4-62b436cca37d + name: Red + description: Color Red + - id: 55d6d785-cc52-453a-bff6-2cf9add8a580 + name: Green + description: Color Green + - id: a43d8b6f-b411-49aa-adaa-36a1a025051e + name: Blue + description: Color Blue + import: + value: + data: + type: pim-job + id: 7e1b9ba1-c844-4556-9b16-4ae3f0988b0f + attributes: + completed_at: null + created_at: '2024-01-05T15:27:23.161Z' + started_at: null + status: pending + type: product-import + updated_at: '2024-01-05T15:27:23.161Z' + meta: + x_request_id: fad8c5c0-9546-4e0c-b68e-8a2d809891e5 + export: + value: + data: + type: pim-job + id: 7e1b9ba1-c844-4556-9b16-4ae3f0988b0f + attributes: + completed_at: null + created_at: '2024-01-05T15:27:23.161Z' + started_at: null + status: pending + type: product-export + updated_at: '2024-01-05T15:27:23.161Z' + meta: + file_locations: null + filter: eq(sku,product-1) + x_request_id: fad8c5c0-9546-4e0c-b68e-8a2d809891e5 + get_single_product_response: + value: + data: + type: product + id: f5bd4e59-a95f-4bda-bfe6-0f34f47ac94b + attributes: + commodity_type: physical + description: This electric model offers an induction heating element and convection oven. + mpn: BE-R-1111-aaaa-1a1a + name: BestEver Range, Model 1a1a + sku: BE-Range-1a1a + slug: bestever-range-1a1a + status: draft + upc_ean: '111122223333' + tags: + - tag1 + - tag2 + extensions: + products(size): + widthMM: 600 + fuelType: electric + hasUKPlug: true + online: null + relationships: + files: + data: [] + links: + self: /products/f5bd4e59-a95f-4bda-bfe6-0f34f47ac94b/relationships/files + templates: + data: [] + links: + self: /products/f5bd4e59-a95f-4bda-bfe6-0f34f47ac94b/relationships/templates + meta: + created_at: '2023-09-28T10:43:41.72Z' + owner: organization + product_types: + - standard + updated_at: '2023-09-28T10:43:41.72Z' + variation_matrix: {} + get_bundle_response: + value: + data: + type: product + id: 495f5c48-c747-4540-86fd-40380bf2df91 + attributes: + commodity_type: physical + components: + games: + name: Games + options: + - id: 1a499918-2ec0-468d-b7b9-f09eab2f6ad8 + type: product + quantity: 2 + sort_order: 15 + default: true + sort_order: 10 + name: DOOM Bundle + status: draft + relationships: + children: + data: [] + links: + self: /products/495f5c48-c747-4540-86fd-40380bf2df91/children + component_products: + data: [] + links: + self: /products/495f5c48-c747-4540-86fd-40380bf2df91/relationships/component_products + files: + data: [] + links: + self: /products/495f5c48-c747-4540-86fd-40380bf2df91/relationships/files + main_image: + data: null + templates: + data: [] + links: + self: /products/495f5c48-c747-4540-86fd-40380bf2df91/relationships/templates + variations: + data: [] + links: + self: /products/495f5c48-c747-4540-86fd-40380bf2df91/relationships/variations + meta: + created_at: '2024-01-08T13:36:53.658Z' + owner: organization + product_types: + - bundle + updated_at: '2024-01-08T13:36:53.658Z' + variation_matrix: {} + get_parent_product_response: + value: + data: + type: product + id: 571e366f-17e6-4e51-8239-b3cc8ee1144d + attributes: + commodity_type: physical + name: Jeans + sku: jeans + slug: jeans + status: live + relationships: + children: + data: [] + links: + self: /products/571e366f-17e6-4e51-8239-b3cc8ee1144d/children + component_products: + data: [] + links: + self: /products/571e366f-17e6-4e51-8239-b3cc8ee1144d/relationships/component_products + files: + data: [] + links: + self: /products/571e366f-17e6-4e51-8239-b3cc8ee1144d/relationships/files + main_image: + data: null + templates: + data: [] + links: + self: /products/571e366f-17e6-4e51-8239-b3cc8ee1144d/relationships/templates + variations: + data: [] + links: + self: /products/571e366f-17e6-4e51-8239-b3cc8ee1144d/relationships/variations + meta: + created_at: '2024-01-05T10:29:44.214Z' + owner: store + product_types: + - parent + updated_at: '2024-01-05T10:29:45.212Z' + variation_matrix: + 46fff1c9-668b-461a-9344-e7a8cbbbf931: 4d32b816-4397-4a71-b875-4e4ea3ce6745 + 843868fc-2440-44d1-8ce7-dc474f79ad1c: cf501150-f02d-49ad-b7d7-33ed15417b76 + variations: + - id: ec2bcebd-f42e-4725-8715-c338589e33ea + name: Paint colour + options: + - id: 843868fc-2440-44d1-8ce7-dc474f79ad1c + name: Blue + description: This is a colour. + - id: 46fff1c9-668b-461a-9344-e7a8cbbbf931 + name: Red + description: This is a colour. + get_child_product_response: + value: + data: + type: product + id: 4d32b816-4397-4a71-b875-4e4ea3ce6745 + attributes: + commodity_type: physical + name: Jeans + sku: jeansRed + slug: jeansRed + status: live + relationships: + base_product: + data: + type: product + id: 571e366f-17e6-4e51-8239-b3cc8ee1144d + children: + data: [] + component_products: + data: [] + links: + self: /products/4d32b816-4397-4a71-b875-4e4ea3ce6745/relationships/component_products + files: + data: [] + links: + self: /products/4d32b816-4397-4a71-b875-4e4ea3ce6745/relationships/files + main_image: + data: null + templates: + data: [] + links: + self: /products/4d32b816-4397-4a71-b875-4e4ea3ce6745/relationships/templates + variations: + data: [] + links: + self: /products/4d32b816-4397-4a71-b875-4e4ea3ce6745/relationships/variations + meta: + created_at: '2024-01-05T10:29:44.603Z' + owner: store + product_types: + - child + updated_at: '2024-01-05T10:29:45.155Z' + variation_matrix: {} + get_component_product_response: + value: + data: + type: product + id: 4ca7de77-994d-4e7c-b834-4cb2ae156f57 + attributes: + commodity_type: physical + components: + Apples: + name: Apples + options: + - id: f809fe4f-83f7-4db4-8175-e467a0d1974a + type: product + quantity: 12 + Oranges: + name: Oranges + options: + - id: 7f8f596a-2dc0-4e78-ba0d-3810eac6f86a + type: product + quantity: 12 + description: fruit + name: fruit Bundle + slug: 45-b + status: live + relationships: + children: + data: [] + links: + self: /products/4ca7de77-994d-4e7c-b834-4cb2ae156f57/children + component_products: + data: [] + links: + self: /products/4ca7de77-994d-4e7c-b834-4cb2ae156f57/relationships/component_products + files: + data: [] + links: + self: /products/4ca7de77-994d-4e7c-b834-4cb2ae156f57/relationships/files + main_image: + data: null + templates: + data: [] + links: + self: /products/4ca7de77-994d-4e7c-b834-4cb2ae156f57/relationships/templates + variations: + data: [] + links: + self: /products/4ca7de77-994d-4e7c-b834-4cb2ae156f57/relationships/variations + meta: + created_at: '2022-02-01T12:51:51.132Z' + owner: store + product_types: + - bundle + updated_at: '2022-02-01T12:51:51.132Z' + variation_matrix: {} + included: + component_products: + - type: product + id: f809fe4f-83f7-4db4-8175-e467a0d1974a + attributes: + commodity_type: physical + description: fruit + name: Apples + sku: '45' + status: live + relationships: + children: + data: [] + links: + self: /products/f809fe4f-83f7-4db4-8175-e467a0d1974a/children + component_products: + data: [] + links: + self: /products/f809fe4f-83f7-4db4-8175-e467a0d1974a/relationships/component_products + files: + data: [] + links: + self: /products/f809fe4f-83f7-4db4-8175-e467a0d1974a/relationships/files + main_image: + data: null + templates: + data: [] + links: + self: /products/f809fe4f-83f7-4db4-8175-e467a0d1974a/relationships/templates + variations: + data: [] + links: + self: /products/f809fe4f-83f7-4db4-8175-e467a0d1974a/relationships/variations + meta: + created_at: '2022-02-01T12:50:33.347Z' + owner: store + product_types: + - standard + updated_at: '2022-02-01T12:50:33.347Z' + variation_matrix: {} + - type: product + id: 7f8f596a-2dc0-4e78-ba0d-3810eac6f86a + attributes: + commodity_type: physical + description: fruit + name: Oranges + sku: '46' + status: live + relationships: + children: + data: [] + links: + self: /products/7f8f596a-2dc0-4e78-ba0d-3810eac6f86a/children + component_products: + data: [] + links: + self: /products/7f8f596a-2dc0-4e78-ba0d-3810eac6f86a/relationships/component_products + files: + data: [] + links: + self: /products/7f8f596a-2dc0-4e78-ba0d-3810eac6f86a/relationships/files + main_image: + data: null + templates: + data: [] + links: + self: /products/7f8f596a-2dc0-4e78-ba0d-3810eac6f86a/relationships/templates + variations: + data: [] + links: + self: /products/7f8f596a-2dc0-4e78-ba0d-3810eac6f86a/relationships/variations + meta: + created_at: '2022-02-01T12:49:19.298Z' + owner: store + product_types: + - standard + updated_at: '2022-02-01T12:49:19.298Z' + variation_matrix: {} + update_product_request: + value: + data: + type: product + id: 60afe403-a191-455e-b771-c510c928a308 + attributes: + name: UPDATED BestEver Range, Model 1a1a + update_build_rules_request: + value: + data: + type: product + id: 9214719b-17fe-4ea7-896c-d61e60fc0d05 + attributes: + build_rules: + default: include + exclude: + - - cbde9096-e0e1-43d8-a1aa-cb66cf1d299f + - 0b261f7d-753d-4af6-b9f4-62b436cca37d + - 994c2029-519c-43d9-9c54-14f3af4e3efd + update_custom_inputs_request: + value: + data: + type: product + id: 9214719b-17fe-4ea7-896c-d61e60fc0d05 + attributes: + custom_inputs: + front: + name: T-Shirt Front + validation_rules: + - type: string + options: + max_length: 50 + required: false + back: + name: T-Shirt Back + validation_rules: + - type: string + options: + max_length: 50 + required: false + update_bundle_request: + value: + data: + id: 8a0072c0-cedf-4e53-bdc4-a14a5d6389d5 + type: product + attributes: + name: Favourite games bundle + description: Favourite DOOM games in one bundle - Select one from four choices + sku: fav23455 + mpn: 1234-5678-ABCD00 + upc_ean: '123456' + commodity_type: digital + status: live + components: + List 1: + name: PS5 + sort_order: 1 + options: + - id: c7cf43f3-24c6-4523-8a24-3663b49b81aa + type: product + quantity: 1 + default: true + List 2: + name: Controller + sort_order: 2 + options: + - id: e59ca559-37c7-4dc9-8a91-df94cd5700d3 + type: product + quantity: 1 + default: true + List 3: + name: PS+ + sort_order: 3 + options: + - id: 8ae2a7ea-f767-4af0-8486-ae203947ecc4 + type: product + quantity: 1 + default: true + List 4: + min: 1 + max: 1 + sort_order: 4 + options: + - id: 549a291f-669c-47d0-bc04-60a3f18fc55c + type: product + quantity: 1 + default: true + sort_order: 2 + - id: 071e461c-22a2-42e0-9604-c345bbc9b85c + type: product + quantity: 1 + default: false + sort_order: 1 + - id: 633b8172-8aa9-4dbd-aa07-0dcefca3de74 + type: product + quantity: 1 + default: false + - id: 549a291f-669c-47d0-bc04-60a3f18fc55c + type: product + quantity: 1 + default: false + sort_order: 3 + update_single_product_response: + value: + data: + type: product + id: 60afe403-a191-455e-b771-c510c928a308 + attributes: + commodity_type: physical + description: The 30 inch version of this popular electric range. + mpn: BE-R-1111-aaaa-1a1a-30 + name: UPDATED BestEver Range 30 inch, Model 1a1a-30 + sku: BE-Range-1a1a-30 + slug: bestever-range-1a1a-30 + status: draft + upc_ean: '111130303030' + locales: + fr-FR: + name: MISE À JOUR de la gamme BestEver 30 pouces, modèle 1a1a-30 + description: La version 30 pouces de cette cuisinière électrique populaire + tags: + - tag1 + - tag2 + relationships: + files: + data: [] + links: + self: /products/60afe403-a191-455e-b771-c510c928a308/relationships/files + templates: + data: [] + links: + self: /products/60afe403-a191-455e-b771-c510c928a308/relationships/templates + meta: + created_at: '2023-09-28T10:43:41.72Z' + owner: organization + product_types: + - standard + updated_at: '2023-09-28T10:43:41.72Z' + update_build_rules_response: + value: + data: + type: product + id: 9214719b-17fe-4ea7-896c-d61e60fc0d05 + attributes: + build_rules: + default: include + exclude: + - - cbde9096-e0e1-43d8-a1aa-cb66cf1d299f + - 0b261f7d-753d-4af6-b9f4-62b436cca37d + - 994c2029-519c-43d9-9c54-14f3af4e3efd + commodity_type: physical + description: T-shirt. + locales: + fr-FR: + name: Shirt + description: T-Shirt. + mpn: 1234-5678-SSSS + name: Shirt + sku: '978055216732567' + slug: '978055216732567' + status: live + upc_ean: '135623456' + relationships: + children: + data: [] + links: + self: /products/9214719b-17fe-4ea7-896c-d61e60fc0d05/children + component_products: + data: [] + links: + self: /products/9214719b-17fe-4ea7-896c-d61e60fc0d05/relationships/component_products + files: + data: [] + links: + self: /products/9214719b-17fe-4ea7-896c-d61e60fc0d05/relationships/files + main_image: + data: null + templates: + data: [] + links: + self: /products/9214719b-17fe-4ea7-896c-d61e60fc0d05/relationships/templates + variations: + data: [] + links: + self: /products/9214719b-17fe-4ea7-896c-d61e60fc0d05/relationships/variations + meta: + created_at: '2022-08-18T12:14:52.782Z' + owner: store + product_types: + - standard + updated_at: '2022-08-18T12:40:13.484Z' + variation_matrix: {} + variations: + - id: 6c4b5caa-3819-4366-a14e-c5b85009544b + name: Shirt Size + options: + - id: cbde9096-e0e1-43d8-a1aa-cb66cf1d299f + name: Small + description: Size Small + - id: da9d88d0-8ea6-434c-a0dd-059caf595687 + name: Medium + description: Size Medium + - id: 07493fea-74b0-40a2-972a-cd7e1d6561bd + name: Large + description: Size Large + - id: b1ae545e-3375-455f-b5ea-09669b60996f + name: Shirt Material + options: + - id: 994c2029-519c-43d9-9c54-14f3af4e3efd + name: Cotton + description: Material Cotton + - id: 7951f3d9-f628-49f8-8a43-7749d28153d6 + name: Denim + description: Material Denim + - id: 58115bff-589a-4287-98d8-373112102617 + name: Wool + description: Material Wool + - id: f192e114-9f8a-4284-99d0-4d9ccd8a0275 + name: Shirt Color + options: + - id: 0b261f7d-753d-4af6-b9f4-62b436cca37d + name: Red + description: Color Red + - id: 55d6d785-cc52-453a-bff6-2cf9add8a580 + name: Green + description: Color Green + - id: a43d8b6f-b411-49aa-adaa-36a1a025051e + name: Blue + description: Color Blue + update_custom_inputs_response: + value: + data: + type: product + id: 9214719b-17fe-4ea7-896c-d61e60fc0d05 + attributes: + commodity_type: physical + custom_inputs: + back: + name: T-Shirt Back + validation_rules: + - type: string + options: + max_length: 50 + required: false + front: + name: T-Shirt Front + validation_rules: + - type: string + options: + max_length: 50 + required: false + description: T-shirt. + locales: + fr-FR: + name: T-Shirt + description: T-Shirt. + mpn: 1234-5678-SSSS + name: Shirt + sku: '978055216732567' + slug: '978055216732567' + status: live + relationships: + children: + data: [] + links: + self: /products/9214719b-17fe-4ea7-896c-d61e60fc0d05/children + component_products: + data: [] + links: + self: /products/9214719b-17fe-4ea7-896c-d61e60fc0d05/relationships/component_products + files: + data: [] + links: + self: /products/9214719b-17fe-4ea7-896c-d61e60fc0d05/relationships/files + main_image: + data: null + templates: + data: [] + links: + self: /products/9214719b-17fe-4ea7-896c-d61e60fc0d05/relationships/templates + variations: + data: [] + links: + self: /products/9214719b-17fe-4ea7-896c-d61e60fc0d05/relationships/variations + meta: + created_at: '2022-08-18T12:14:52.782Z' + updated_at: '2022-08-19T12:28:26.343Z' + variation_matrix: {} + variations: + - id: 6c4b5caa-3819-4366-a14e-c5b85009544b + name: Shirt Size + options: + - id: cbde9096-e0e1-43d8-a1aa-cb66cf1d299f + name: Small + description: Size Small + - id: da9d88d0-8ea6-434c-a0dd-059caf595687 + name: Medium + description: Size Meduim + - id: 07493fea-74b0-40a2-972a-cd7e1d6561bd + name: Large + description: Size Large + - id: b1ae545e-3375-455f-b5ea-09669b60996f + name: Shirt Material + options: + - id: 994c2029-519c-43d9-9c54-14f3af4e3efd + name: Cotton + description: Material Cotton + - id: 7951f3d9-f628-49f8-8a43-7749d28153d6 + name: Denim + description: Material Denim + - id: 58115bff-589a-4287-98d8-373112102617 + name: Wool + description: Material Wool + - id: f192e114-9f8a-4284-99d0-4d9ccd8a0275 + name: Shirt Color + options: + - id: 0b261f7d-753d-4af6-b9f4-62b436cca37d + name: Red + description: Color Red + - id: 55d6d785-cc52-453a-bff6-2cf9add8a580 + name: Green + description: Color Green + - id: a43d8b6f-b411-49aa-adaa-36a1a025051e + name: Blue + description: Color Blue + update_bundle_response: + value: + data: + type: product + id: 8a0072c0-cedf-4e53-bdc4-a14a5d6389d5 + attributes: + commodity_type: digital + components: + List 1: + name: PS5 + options: + - id: c7cf43f3-24c6-4523-8a24-3663b49b81aa + type: product + quantity: 1 + default: true + sort_order: 1 + List 2: + name: Controller + options: + - id: e59ca559-37c7-4dc9-8a91-df94cd5700d3 + type: product + quantity: 1 + default: true + sort_order: 2 + List 3: + name: PS+ + options: + - id: 8ae2a7ea-f767-4af0-8486-ae203947ecc4 + type: product + quantity: 1 + default: true + sort_order: 3 + List 4: + options: + - id: 549a291f-669c-47d0-bc04-60a3f18fc55c + type: product + quantity: 1 + default: true + - id: 071e461c-22a2-42e0-9604-c345bbc9b85c + type: product + quantity: 1 + default: false + - id: 633b8172-8aa9-4dbd-aa07-0dcefca3de74 + type: product + quantity: 1 + default: false + - id: 549a291f-669c-47d0-bc04-60a3f18fc55c + type: product + quantity: 1 + default: false + min: 1 + max: 1 + sort_order: 4 + headsets: + name: Headsets + options: + - id: 8ae2a7ea-f767-4af0-8486-ae203947ecc4 + type: product + quantity: 5 + default: true + description: Favourite DOOM games in one bundle - Select one from four choices + mpn: 1234-5678-ABCD00 + name: Favourite games bundle + sku: fav23455 + slug: PGH69345-B + status: live + upc_ean: '123456' + relationships: + children: + data: [] + links: + self: /products/8a0072c0-cedf-4e53-bdc4-a14a5d6389d5/children + component_products: + data: [] + links: + self: /products/8a0072c0-cedf-4e53-bdc4-a14a5d6389d5/relationships/component_products + files: + data: [] + links: + self: /products/8a0072c0-cedf-4e53-bdc4-a14a5d6389d5/relationships/files + main_image: + data: null + templates: + data: [] + links: + self: /products/8a0072c0-cedf-4e53-bdc4-a14a5d6389d5/relationships/templates + variations: + data: [] + links: + self: /products/8a0072c0-cedf-4e53-bdc4-a14a5d6389d5/relationships/variations + meta: + created_at: '2022-02-03T19:38:00.602Z' + owner: store + updated_at: '2022-02-03T19:43:21.487Z' + variation_matrix: {} + resp_multi_nodes: + value: + data: + - id: 9ea0de15-3347-43dd-8faa-cd32f44a04c7 + type: node + attributes: + description: Latest Ballet Shoes + locales: + fr-FR: + name: Chaussons de ballet + description: Dernières chaussures de ballet + name: Ballet Shoes + slug: ballet-shoes + relationships: + children: + data: [] + links: + related: /hierarchies/6183d10c-94b5-4caa-9f12-2f14cb738d41/nodes/9ea0de15-3347-43dd-8faa-cd32f44a04c7/children + products: + data: [] + links: + related: /hierarchies/6183d10c-94b5-4caa-9f12-2f14cb738d41/nodes/9ea0de15-3347-43dd-8faa-cd32f44a04c7/products + meta: + created_at: '2024-01-11T19:19:50.087Z' + owner: store + sort_order: 5 + updated_at: '2024-01-11T19:56:53.695Z' + - type: node + id: b2f5e53e-de3c-4548-98da-120f8b185d34 + attributes: + description: All Dress Shoes + locales: + fr-FR: + name: Chaussures habillées + description: Toutes les chaussures habillées + name: Dress Shoes + slug: dress-shoes + relationships: + children: + data: [] + links: + related: /hierarchies/6183d10c-94b5-4caa-9f12-2f14cb738d41/nodes/b2f5e53e-de3c-4548-98da-120f8b185d34/children + products: + data: [] + links: + related: /hierarchies/6183d10c-94b5-4caa-9f12-2f14cb738d41/nodes/b2f5e53e-de3c-4548-98da-120f8b185d34/products + meta: + created_at: '2024-01-11T19:50:21.729Z' + owner: store + sort_order: 3 + updated_at: '2024-01-11T19:50:21.729Z' + meta: + results: + total: 2 + multi_get_child_response: + value: + data: + - type: product + id: 4d32b816-4397-4a71-b875-4e4ea3ce6745 + attributes: + commodity_type: physical + name: Jeans + sku: jeansRed + slug: jeansRed + status: live + relationships: + base_product: + data: + type: product + id: 571e366f-17e6-4e51-8239-b3cc8ee1144d + children: + data: [] + component_products: + data: [] + links: + self: /products/4d32b816-4397-4a71-b875-4e4ea3ce6745/relationships/component_products + files: + data: [] + links: + self: /products/4d32b816-4397-4a71-b875-4e4ea3ce6745/relationships/files + main_image: + data: null + templates: + data: [] + links: + self: /products/4d32b816-4397-4a71-b875-4e4ea3ce6745/relationships/templates + variations: + data: [] + links: + self: /products/4d32b816-4397-4a71-b875-4e4ea3ce6745/relationships/variations + meta: + created_at: '2024-01-05T10:29:44.603Z' + owner: store + product_types: + - child + updated_at: '2024-01-05T10:29:45.155Z' + variation_matrix: {} + template_response: + value: + data: + - id: 43903bfa-5352-4a3d-9496-c9ab1229a175 + type: template + - id: 50f56ce9-9381-43f6-8a52-5369a8b42e52 + type: template + templates_relationship_request: + value: + data: + - id: 43903bfa-5352-4a3d-9496-c9ab1229a175 + type: template + - id: 50f56ce9-9381-43f6-8a52-5369a8b42e52 + type: template + component_products_relationship_response: + value: + data: + - id: 43903bfa-5352-4a3d-9496-c9ab1229a175 + type: product + - id: 50f56ce9-9381-43f6-8a52-5369a8b42e52 + type: product + file_relationship_response: + value: + data: + - id: 43903bfa-5352-4a3d-9496-c9ab1229a175 + type: file + - id: 50f56ce9-9381-43f6-8a52-5369a8b42e52 + type: file + file_relationship_request: + value: + data: + - id: 43903bfa-5352-4a3d-9496-c9ab1229a175 + type: file + - id: 50f56ce9-9381-43f6-8a52-5369a8b42e52 + type: file + variations_response: + value: + data: + - id: 43903bfa-5352-4a3d-9496-c9ab1229a175 + type: product-variation + - id: 50f56ce9-9381-43f6-8a52-5369a8b42e52 + type: product-variation + product_variations_relationship_request: + value: + data: + - id: 43903bfa-5352-4a3d-9496-c9ab1229a175 + type: product-variation + multi_variations: + value: + data: + - type: product-variation + id: c1ccccba-53e4-46b5-aed8-94f32823148a + attributes: + name: Size + sort_order: 1 + meta: + options: + - id: 057a50ba-1afb-4944-9637-bd9b568a9f39 + name: Large + description: Large size + sort_order: 3 + created_at: '2024-01-25T11:25:38.001Z' + updated_at: '2024-01-25T11:25:38.001Z' + - id: fa191e68-9bba-49f9-8e12-056c4e8f50e2 + name: Medium + description: Medium size + sort_order: 2 + created_at: '2024-01-25T11:25:38.001Z' + updated_at: '2024-01-25T11:25:38.001Z' + - id: 112d1c5c-d149-453e-b208-89470968bacf + name: Small + description: Small size + sort_order: 1 + created_at: '2024-01-25T11:25:38.001Z' + updated_at: '2024-01-25T11:25:38.001Z' + owner: store + created_at: '2024-01-25T11:25:38.001Z' + updated_at: '2024-01-25T11:25:38.001Z' + - type: product-variation + id: 3fa85f64-5717-4562-b3fc-2c963f66afa6 + attributes: + name: Paint Color + meta: + owner: store + created_at: '2024-01-25T11:25:38.001Z' + updated_at: '2024-01-25T11:25:38.001Z' + meta: + results: + total: 2 + create_variation: + value: + data: + type: product-variation + attributes: + name: Paint Color + sort_order: 10 + created_variation: + value: + data: + id: 3fa85f64-5717-4562-b3fc-2c963f66afa6 + type: product-variation + attributes: + name: Paint Color + sort_order: 10 + meta: + owner: store + created_at: '2024-01-25T11:25:38.001Z' + updated_at: '2024-01-25T11:25:38.001Z' + single_variation: + value: + data: + id: 3fa85f64-5717-4562-b3fc-2c963f66afa6 + type: product-variation + attributes: + name: Paint Color + sort_order: 1 + meta: + options: + - id: 3de2c96c-2a99-4ded-bcf8-eeba32c0c5be + name: Red + description: Red color + sort_order: 2 + created_at: '2024-01-25T11:25:38.001Z' + updated_at: '2024-01-25T11:25:38.001Z' + - id: 31f2d09b-8a10-447a-b3ad-3358d07f818a + name: Blue + description: Blue color + sort_order: 1 + created_at: '2024-01-25T11:25:38.001Z' + updated_at: '2024-01-25T11:25:38.001Z' + owner: store + created_at: '2024-01-25T11:25:38.001Z' + updated_at: '2024-01-25T11:25:38.001Z' + update_variation: + value: + data: + id: 3fa85f64-5717-4562-b3fc-2c963f66afa6 + type: product-variation + attributes: + name: Paint Color + sort_order: 0 + multi_options: + value: + data: + - type: product-variation-option + id: 3fa85f64-5717-4562-b3fc-2c963f66afa6 + attributes: + description: Our most popular color + name: Blue + sort_order: 0 + meta: + owner: store + created_at: '2024-01-25T11:25:38.001Z' + updated_at: '2024-01-25T11:25:38.001Z' + - type: product-variation-option + id: fbe73839-58a2-41b4-aca6-cb0724668c97 + attributes: + description: Our second most popular color + name: Red + meta: + owner: store + created_at: '2024-01-25T11:25:38.001Z' + updated_at: '2024-01-25T11:25:38.001Z' + meta: + results: + total: 2 + create_option: + value: + data: + type: product-variation-option + attributes: + name: Blue + sort_order: 0 + description: Our most popular color + created_option: + value: + data: + type: product-variation-option + id: 3fa85f64-5717-4562-b3fc-2c963f66afa6 + attributes: + description: Our most popular color + name: Blue + sort_order: 0 + meta: + owner: store + created_at: '2024-01-25T11:25:38.001Z' + updated_at: '2024-01-25T11:25:38.001Z' + single_option: + value: + data: + type: product-variation-option + id: 3fa85f64-5717-4562-b3fc-2c963f66afa6 + attributes: + description: Our most popular color + name: Blue + sort_order: 0 + meta: + owner: store + created_at: '2024-01-25T11:25:38.001Z' + updated_at: '2024-01-25T11:25:38.001Z' + update_option: + value: + data: + type: product-variation-option + id: 3fa85f64-5717-4562-b3fc-2c963f66afa6 + attributes: + description: Our most popular color + name: Blue + sort_order: 0 + multi_modifiers: + value: + data: + - type: product-variation-modifier + id: 68ec4892-9e4c-4154-a9fd-f5a9fb1f6878 + attributes: + type: sku_equals + value: newSku + meta: + owner: store + - type: product-variation-modifier + id: a510cddc-e946-4c22-9541-54626a7cf0ec + attributes: + seek: '{color}' + set: red + type: slug_builder + meta: + owner: store + - type: product-variation-modifier + id: 2f0cbb06-8880-4a75-bfc6-a20f0f73a997 + attributes: + reference_name: PriceEqual + type: price + meta: + owner: store + meta: + results: + total: 3 + create_modifier: + value: + data: + type: product-variation-modifier + attributes: + seek: '{color}' + set: red + type: slug_builder + created_modifier: + value: + data: + type: product-variation-modifier + id: a510cddc-e946-4c22-9541-54626a7cf0ec + attributes: + seek: '{color}' + set: red + type: slug_builder + meta: + owner: store + single_modifier: + value: + data: + type: product-variation-modifier + id: 68ec4892-9e4c-4154-a9fd-f5a9fb1f6878 + attributes: + type: sku_equals + value: newSku + meta: + owner: store + update_modifier: + value: + data: + type: product-variation-modifier + id: 68ec4892-9e4c-4154-a9fd-f5a9fb1f6878 + attributes: + type: sku_equals + value: anotherSku + resp_multi_hierarchy: + value: + data: + - type: hierarchy + id: 6183d10c-94b5-4caa-9f12-2f14cb738d41 + attributes: + description: Shoes Category + locales: + fr-FR: + name: Chaussures + description: Catégorie de chaussures + name: Shoes + slug: shoes + relationships: + children: + data: [] + links: + related: /hierarchies/6183d10c-94b5-4caa-9f12-2f14cb738d41/children + meta: + created_at: '2024-01-10T20:16:35.343Z' + owner: store + updated_at: '2024-01-10T20:30:50.867Z' + links: + last: /pcm/hierarchies?page[offset]=29&page[limit]=1 + next: /pcm/hierarchies?page[offset]=1&page[limit]=1 + meta: + results: + total: 30 + create_hierarchy: + value: + data: + type: hierarchy + attributes: + name: Shoes + description: Shoes Category + slug: shoes + locales: + fr-FR: + name: Chaussures + description: Catégorie de chaussures + hierarchy_created: + value: + data: + type: hierarchy + id: 6183d10c-94b5-4caa-9f12-2f14cb738d41 + attributes: + description: Shoes Category + locales: + fr-FR: + name: Chaussures + description: Catégorie de chaussures + name: Shoes + slug: shoes + relationships: + children: + data: [] + links: + related: /hierarchies/6183d10c-94b5-4caa-9f12-2f14cb738d41/children + meta: + created_at: '2024-01-10T20:16:35.343Z' + owner: store + updated_at: '2024-01-10T20:16:35.343Z' + update_hierarchy: + value: + data: + type: hierarchy + id: 6183d10c-94b5-4caa-9f12-2f14cb738d41 + attributes: + description: Shoes Category Updated + locales: + fr-FR: + name: Chaussures mises à jour + description: Catégorie de chaussures mise à jour + name: Shoes Updated + slug: shoes + hierarchy_updated: + value: + data: + type: hierarchy + id: 6183d10c-94b5-4caa-9f12-2f14cb738d41 + attributes: + description: Shoes Category Updated + locales: + fr-FR: + name: Chaussures mises à jour + description: Catégorie de chaussures mise à jour + name: Shoes Updated + slug: shoes + relationships: + children: + data: [] + links: + related: /hierarchies/6183d10c-94b5-4caa-9f12-2f14cb738d41/children + meta: + created_at: '2024-01-10T20:16:35.343Z' + owner: store + updated_at: '2024-01-10T20:30:50.867Z' + create_node: + value: + data: + type: node + attributes: + name: Ballet Shoes + description: All Ballet Shoes + slug: ballet-shoes + locales: + fr-FR: + name: Chaussons de ballet + description: Toutes les ballerines + meta: + sort_order: 2 + node_created: + value: + data: + type: node + id: 9ea0de15-3347-43dd-8faa-cd32f44a04c7 + attributes: + description: All Ballet Shoes + locales: + fr-FR: + name: Chaussons de ballet + description: Toutes les chaussures de ballet + name: Ballet Shoes + slug: ballet-shoes + relationships: + children: + data: [] + links: + related: /hierarchies/6183d10c-94b5-4caa-9f12-2f14cb738d41/nodes/9ea0de15-3347-43dd-8faa-cd32f44a04c7/children + parent: + data: + type: node + id: 14e8e15a-7214-435d-bccb-6ae9b570d683 + products: + data: [] + links: + related: /hierarchies/6183d10c-94b5-4caa-9f12-2f14cb738d41/nodes/9ea0de15-3347-43dd-8faa-cd32f44a04c7/products + meta: + created_at: '2024-01-11T19:19:50.087Z' + owner: store + parent_name: Shoes + sort_order: 2 + updated_at: '2024-01-11T19:19:50.087Z' + update_node: + value: + data: + type: node + id: 9ea0de15-3347-43dd-8faa-cd32f44a04c7 + attributes: + name: Ballet Shoes + description: Latest Ballet Shoes + slug: ballet-shoes + locales: + fr-FR: + name: Chaussons de ballet + description: Dernières chaussures de ballet + meta: + sort_order: 5 + node_updated: + value: + data: + type: node + id: 9ea0de15-3347-43dd-8faa-cd32f44a04c7 + attributes: + description: Latest Ballet Shoes + locales: + fr-FR: + name: Chaussons de ballet + description: Dernières chaussures de ballet + name: Ballet Shoes + slug: ballet-shoes + relationships: + children: + data: [] + links: + related: /hierarchies/6183d10c-94b5-4caa-9f12-2f14cb738d41/nodes/9ea0de15-3347-43dd-8faa-cd32f44a04c7/children + products: + data: [] + links: + related: /hierarchies/6183d10c-94b5-4caa-9f12-2f14cb738d41/nodes/9ea0de15-3347-43dd-8faa-cd32f44a04c7/products + meta: + created_at: '2024-01-11T19:19:50.087Z' + owner: store + sort_order: 5 + updated_at: '2024-01-11T19:56:53.695Z' + node_children: + value: + data: + - type: node + id: b2f5e53e-de3c-4548-98da-120f8b185d34 + node_parent: + value: + data: + type: node + id: 60dc3982-ab34-47e8-9173-c920c63dc382 + node_products: + value: + data: + - type: product + id: 9c85b276-09b4-488e-a59c-c561bae14c9e + duplicate_job: + value: + data: + type: hierarchy + attributes: + name: New Shoes + description: New Shoes Category + include_products: true + duplicate_hierarchy_job_created: + value: + data: + type: pim-job + id: 1d9b101e-a40a-4e53-9f54-08a9ede65019 + attributes: + completed_at: null + created_at: '2024-01-11T22:49:10.338Z' + started_at: null + status: pending + type: hierarchy-duplicate + updated_at: '2024-01-11T22:49:10.338Z' + meta: + x_request_id: 40995a1d-c0c1-4d52-a178-bfb5399ab0ec + resp_multi_tags: + value: + data: + - type: tag + id: a88aac35-54de-40c2-bb4b-f1c57624db27 + attributes: + value: shirts + meta: + created_at: '2024-03-20T15:56:40.014Z' + owner: store + updated_at: '2024-03-20T15:56:40.014Z' + - type: tag + id: 6782e020-fefd-431e-9dea-b59d249c2c5e + attributes: + value: shoes + meta: + created_at: '2024-03-20T15:56:40.014Z' + owner: store + updated_at: '2024-03-20T15:56:40.014Z' + meta: + results: + total: 2 + resp_single_tag: + value: + data: + type: tag + id: 9879a8f5-0da2-4be6-91f6-a0f09d1c77a9 + attributes: + value: tables + meta: + created_at: '2024-03-20T18:37:43.398Z' + owner: organization + updated_at: '2024-03-20T18:37:43.398Z' + create_custom_relationship: + value: + data: + type: custom-relationship + attributes: + name: Kitchen electrics + description: Kitchen electric devices + slug: CRP_kitchen_individual_devices + custom_relationship_created: + value: + data: + type: custom-relationship + id: f3297ee8-da90-45e9-ae56-a2654aebbdfe + attributes: + name: Kitchen electrics + description: Kitchen electric devices + slug: CRP_kitchen_individual_devices + meta: + owner: store + timestamps: + created_at: '2024-01-10T20:16:35.343Z' + updated_at: '2024-01-10T20:16:35.343Z' + update_custom_relationship: + value: + data: + type: custom-relationship + id: f3297ee8-da90-45e9-ae56-a2654aebbdfe + attributes: + name: Kitchen electrics + description: Kitchen electric devices 2024 + slug: CRP_kitchen_individual_devices + custom_relationship_updated: + value: + data: + type: custom-relationship + id: f3297ee8-da90-45e9-ae56-a2654aebbdfe + attributes: + name: Kitchen electrics + description: Kitchen electric devices 2024 + slug: CRP_kitchen_individual_devices + meta: + owner: store + timestamps: + created_at: '2024-01-10T20:16:35.343Z' + updated_at: '2024-01-10T20:16:35.343Z' + responses: + bad_request: + description: Bad request. The request failed validation. + content: + application/json: + schema: + $ref: '#/components/schemas/error' + examples: + bad-request: + value: + errors: + - title: Bad Request + detail: Could not parse the supplied filter + status: '400' + not_found: + description: Bad Request. Not Found. + content: + application/json: + schema: + $ref: '#/components/schemas/error' + examples: + internal-server-error: + value: + errors: + - title: Not Found + status: '404' + unprocessable_entity: + description: Bad request. The request failed validation. + content: + application/json: + schema: + $ref: '#/components/schemas/error' + examples: + failed-validation: + value: + errors: + - title: Failed Validation + status: '422' + detail: can not be empty + internal: + description: Internal server error. There was a system failure in the platform. + content: + application/json: + schema: + $ref: '#/components/schemas/error' + examples: + internal-server-error: + value: + errors: + - status: '500' + title: Internal Server Error + detail: There was an internal server error, you can report with your request id. + request_id: 635da56d-75a1-43cd-b696-7ab119756b3a + forbidden: + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/error' + examples: + internal-server-error: + value: + errors: + - title: Forbidden + status: '403' + detail: entity owned by organization + write_conflict: + description: Write conflict detected + content: + application/json: + schema: + $ref: '#/components/schemas/error' + examples: + internal-server-error: + value: + errors: + - title: Conflict + status: '409' + detail: write conflict detected + parameters: + job_id: + name: jobID + in: path + schema: + type: string + example: 00000000-0000-0000-0000-000000000000 + required: true + description: A unique identifier for the job. + page_offset: + name: page[offset] + in: query + description: The number of records to offset the results by. + schema: + type: integer + minimum: 0 + maximum: 10000 + format: int64 + example: + - '0' + page_limit: + name: page[limit] + in: query + description: The number of records per page. The maximum limit is 100. + schema: + type: integer + minimum: 0 + maximum: 10000 + format: int64 + example: + - '10' + filterproduct: + name: filter + in: query + description: | + Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering). + + For more information about the attributes and operators that are supported, see [Get all products](/docs/api/pxm/products/get-all-products). + style: form + explode: true + schema: + type: string + example: + - eq(name,some-name) + - like(name,*some-name*) + - filter=in(id,some-id) + include: + name: include + in: query + description: | + Using the include parameter, you can retrieve top-level resources. + + - Files or main image. For example, `include=files,main_image`. + - Component product data. For example, `include=component_products`. + - Key attribute data, such as SKU or slug. + style: form + explode: true + schema: + type: string + example: + - component_products + useTemplateSlugs: + name: useTemplateSlugs + description: Set to `true` if you want to use a template slug instead of a template ID when exporting products that have custom data. + in: query + style: form + explode: true + schema: + type: boolean + default: false + filterexport: + name: filter + in: query + description: | + + Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering), but you must go to a specific endpoint to understand the attributes and operators an endpoint supports. + + For more information about the attributes and operators that this endpoint supports, see [Export Products](/docs/api/pxm/products/export-products). + style: form + explode: true + schema: + type: string + example: + - eq(name,some-name) + - like(name,*some-name*) + - filter=in(id,some-id) + product_id: + name: productID + in: path + schema: + type: string + example: 00000000-0000-0000-0000-000000000000 + x-postman-example: '{{productID}}' + required: true + description: A unique identifier for the product. + variation_id: + name: variationID + in: path + schema: + type: string + example: 00000000-0000-0000-0000-000000000000 + x-postman-example: '{{variationID}}' + required: true + description: A unique identifier for the variation. + option_id: + name: optionID + in: path + schema: + type: string + example: 00000000-0000-0000-0000-000000000000 + required: true + description: A unique identifier for the option. + modifier_id: + name: modifierID + in: path + schema: + type: string + example: 00000000-0000-0000-0000-000000000000 + required: true + description: A unique identifier for the modifier. + hierarchy_id: + name: hierarchyID + in: path + schema: + type: string + example: 00000000-0000-0000-0000-000000000000 + required: true + description: A unique identifier for the hierarchy. + node_id: + name: nodeID + in: path + schema: + type: string + example: 00000000-0000-0000-0000-000000000000 + required: true + description: A unique identifier for the node. + tag_id: + name: tagID + in: path + schema: + type: string + example: 00000000-0000-0000-0000-000000000000 + required: true + description: A unique identifier for the tag. + custom_relationship_slug: + name: customRelationshipSlug + in: path + schema: + type: string + example: CRP_electric_devices_2024 + required: true + description: A custom relationship slug. diff --git a/packages/sdks/src/client/core/ApiError.ts b/packages/sdks/src/client/core/ApiError.ts new file mode 100644 index 00000000..36675d28 --- /dev/null +++ b/packages/sdks/src/client/core/ApiError.ts @@ -0,0 +1,21 @@ +import type { ApiRequestOptions } from './ApiRequestOptions'; +import type { ApiResult } from './ApiResult'; + +export class ApiError extends Error { + public readonly url: string; + public readonly status: number; + public readonly statusText: string; + public readonly body: unknown; + public readonly request: ApiRequestOptions; + + constructor(request: ApiRequestOptions, response: ApiResult, message: string) { + super(message); + + this.name = 'ApiError'; + this.url = response.url; + this.status = response.status; + this.statusText = response.statusText; + this.body = response.body; + this.request = request; + } +} \ No newline at end of file diff --git a/packages/sdks/src/client/core/ApiRequestOptions.ts b/packages/sdks/src/client/core/ApiRequestOptions.ts new file mode 100644 index 00000000..1758d98c --- /dev/null +++ b/packages/sdks/src/client/core/ApiRequestOptions.ts @@ -0,0 +1,14 @@ +export type ApiRequestOptions = { + readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH'; + readonly url: string; + readonly path?: Record; + readonly cookies?: Record; + readonly headers?: Record; + readonly query?: Record; + readonly formData?: Record; + readonly body?: any; + readonly mediaType?: string; + readonly responseHeader?: string; + readonly responseTransformer?: (data: unknown) => Promise; + readonly errors?: Record; +}; \ No newline at end of file diff --git a/packages/sdks/src/client/core/ApiResult.ts b/packages/sdks/src/client/core/ApiResult.ts new file mode 100644 index 00000000..4c58e391 --- /dev/null +++ b/packages/sdks/src/client/core/ApiResult.ts @@ -0,0 +1,7 @@ +export type ApiResult = { + readonly body: TData; + readonly ok: boolean; + readonly status: number; + readonly statusText: string; + readonly url: string; +}; \ No newline at end of file diff --git a/packages/sdks/src/client/core/CancelablePromise.ts b/packages/sdks/src/client/core/CancelablePromise.ts new file mode 100644 index 00000000..ccc082e8 --- /dev/null +++ b/packages/sdks/src/client/core/CancelablePromise.ts @@ -0,0 +1,126 @@ +export class CancelError extends Error { + constructor(message: string) { + super(message); + this.name = 'CancelError'; + } + + public get isCancelled(): boolean { + return true; + } +} + +export interface OnCancel { + readonly isResolved: boolean; + readonly isRejected: boolean; + readonly isCancelled: boolean; + + (cancelHandler: () => void): void; +} + +export class CancelablePromise implements Promise { + private _isResolved: boolean; + private _isRejected: boolean; + private _isCancelled: boolean; + readonly cancelHandlers: (() => void)[]; + readonly promise: Promise; + private _resolve?: (value: T | PromiseLike) => void; + private _reject?: (reason?: unknown) => void; + + constructor( + executor: ( + resolve: (value: T | PromiseLike) => void, + reject: (reason?: unknown) => void, + onCancel: OnCancel + ) => void + ) { + this._isResolved = false; + this._isRejected = false; + this._isCancelled = false; + this.cancelHandlers = []; + this.promise = new Promise((resolve, reject) => { + this._resolve = resolve; + this._reject = reject; + + const onResolve = (value: T | PromiseLike): void => { + if (this._isResolved || this._isRejected || this._isCancelled) { + return; + } + this._isResolved = true; + if (this._resolve) this._resolve(value); + }; + + const onReject = (reason?: unknown): void => { + if (this._isResolved || this._isRejected || this._isCancelled) { + return; + } + this._isRejected = true; + if (this._reject) this._reject(reason); + }; + + const onCancel = (cancelHandler: () => void): void => { + if (this._isResolved || this._isRejected || this._isCancelled) { + return; + } + this.cancelHandlers.push(cancelHandler); + }; + + Object.defineProperty(onCancel, 'isResolved', { + get: (): boolean => this._isResolved, + }); + + Object.defineProperty(onCancel, 'isRejected', { + get: (): boolean => this._isRejected, + }); + + Object.defineProperty(onCancel, 'isCancelled', { + get: (): boolean => this._isCancelled, + }); + + return executor(onResolve, onReject, onCancel as OnCancel); + }); + } + + get [Symbol.toStringTag]() { + return "Cancellable Promise"; + } + + public then( + onFulfilled?: ((value: T) => TResult1 | PromiseLike) | null, + onRejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): Promise { + return this.promise.then(onFulfilled, onRejected); + } + + public catch( + onRejected?: ((reason: unknown) => TResult | PromiseLike) | null + ): Promise { + return this.promise.catch(onRejected); + } + + public finally(onFinally?: (() => void) | null): Promise { + return this.promise.finally(onFinally); + } + + public cancel(): void { + if (this._isResolved || this._isRejected || this._isCancelled) { + return; + } + this._isCancelled = true; + if (this.cancelHandlers.length) { + try { + for (const cancelHandler of this.cancelHandlers) { + cancelHandler(); + } + } catch (error) { + console.warn('Cancellation threw an error', error); + return; + } + } + this.cancelHandlers.length = 0; + if (this._reject) this._reject(new CancelError('Request aborted')); + } + + public get isCancelled(): boolean { + return this._isCancelled; + } +} \ No newline at end of file diff --git a/packages/sdks/src/client/core/OpenAPI.ts b/packages/sdks/src/client/core/OpenAPI.ts new file mode 100644 index 00000000..34e139da --- /dev/null +++ b/packages/sdks/src/client/core/OpenAPI.ts @@ -0,0 +1,56 @@ +import type { ApiRequestOptions } from './ApiRequestOptions'; + +type Headers = Record; +type Middleware = (value: T) => T | Promise; +type Resolver = (options: ApiRequestOptions) => Promise; + +export class Interceptors { + _fns: Middleware[]; + + constructor() { + this._fns = []; + } + + eject(fn: Middleware): void { + const index = this._fns.indexOf(fn); + if (index !== -1) { + this._fns = [...this._fns.slice(0, index), ...this._fns.slice(index + 1)]; + } + } + + use(fn: Middleware): void { + this._fns = [...this._fns, fn]; + } +} + +export type OpenAPIConfig = { + BASE: string; + CREDENTIALS: 'include' | 'omit' | 'same-origin'; + ENCODE_PATH?: ((path: string) => string) | undefined; + HEADERS?: Headers | Resolver | undefined; + PASSWORD?: string | Resolver | undefined; + TOKEN?: string | Resolver | undefined; + USERNAME?: string | Resolver | undefined; + VERSION: string; + WITH_CREDENTIALS: boolean; + interceptors: { + request: Interceptors; + response: Interceptors; + }; +}; + +export const OpenAPI: OpenAPIConfig = { + BASE: 'https://euwest.api.elasticpath.com', + CREDENTIALS: 'include', + ENCODE_PATH: undefined, + HEADERS: undefined, + PASSWORD: undefined, + TOKEN: undefined, + USERNAME: undefined, + VERSION: '1.0.0', + WITH_CREDENTIALS: false, + interceptors: { + request: new Interceptors(), + response: new Interceptors(), + }, +}; \ No newline at end of file diff --git a/packages/sdks/src/client/core/request.ts b/packages/sdks/src/client/core/request.ts new file mode 100644 index 00000000..5458a289 --- /dev/null +++ b/packages/sdks/src/client/core/request.ts @@ -0,0 +1,350 @@ +import { ApiError } from './ApiError'; +import type { ApiRequestOptions } from './ApiRequestOptions'; +import type { ApiResult } from './ApiResult'; +import { CancelablePromise } from './CancelablePromise'; +import type { OnCancel } from './CancelablePromise'; +import type { OpenAPIConfig } from './OpenAPI'; + +export const isString = (value: unknown): value is string => { + return typeof value === 'string'; +}; + +export const isStringWithValue = (value: unknown): value is string => { + return isString(value) && value !== ''; +}; + +export const isBlob = (value: any): value is Blob => { + return value instanceof Blob; +}; + +export const isFormData = (value: unknown): value is FormData => { + return value instanceof FormData; +}; + +export const base64 = (str: string): string => { + try { + return btoa(str); + } catch (err) { + // @ts-ignore + return Buffer.from(str).toString('base64'); + } +}; + +export const getQueryString = (params: Record): string => { + const qs: string[] = []; + + const append = (key: string, value: unknown) => { + qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`); + }; + + const encodePair = (key: string, value: unknown) => { + if (value === undefined || value === null) { + return; + } + + if (value instanceof Date) { + append(key, value.toISOString()); + } else if (Array.isArray(value)) { + value.forEach(v => encodePair(key, v)); + } else if (typeof value === 'object') { + Object.entries(value).forEach(([k, v]) => encodePair(`${key}[${k}]`, v)); + } else { + append(key, value); + } + }; + + Object.entries(params).forEach(([key, value]) => encodePair(key, value)); + + return qs.length ? `?${qs.join('&')}` : ''; +}; + +const getUrl = (config: OpenAPIConfig, options: ApiRequestOptions): string => { + const encoder = config.ENCODE_PATH || encodeURI; + + const path = options.url + .replace('{api-version}', config.VERSION) + .replace(/{(.*?)}/g, (substring: string, group: string) => { + if (options.path?.hasOwnProperty(group)) { + return encoder(String(options.path[group])); + } + return substring; + }); + + const url = config.BASE + path; + return options.query ? url + getQueryString(options.query) : url; +}; + +export const getFormData = (options: ApiRequestOptions): FormData | undefined => { + if (options.formData) { + const formData = new FormData(); + + const process = (key: string, value: unknown) => { + if (isString(value) || isBlob(value)) { + formData.append(key, value); + } else { + formData.append(key, JSON.stringify(value)); + } + }; + + Object.entries(options.formData) + .filter(([, value]) => value !== undefined && value !== null) + .forEach(([key, value]) => { + if (Array.isArray(value)) { + value.forEach(v => process(key, v)); + } else { + process(key, value); + } + }); + + return formData; + } + return undefined; +}; + +type Resolver = (options: ApiRequestOptions) => Promise; + +export const resolve = async (options: ApiRequestOptions, resolver?: T | Resolver): Promise => { + if (typeof resolver === 'function') { + return (resolver as Resolver)(options); + } + return resolver; +}; + +export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions): Promise => { + const [token, username, password, additionalHeaders] = await Promise.all([ + // @ts-ignore + resolve(options, config.TOKEN), + // @ts-ignore + resolve(options, config.USERNAME), + // @ts-ignore + resolve(options, config.PASSWORD), + // @ts-ignore + resolve(options, config.HEADERS), + ]); + + const headers = Object.entries({ + Accept: 'application/json', + ...additionalHeaders, + ...options.headers, + }) + .filter(([, value]) => value !== undefined && value !== null) + .reduce((headers, [key, value]) => ({ + ...headers, + [key]: String(value), + }), {} as Record); + + if (isStringWithValue(token)) { + headers['Authorization'] = `Bearer ${token}`; + } + + if (isStringWithValue(username) && isStringWithValue(password)) { + const credentials = base64(`${username}:${password}`); + headers['Authorization'] = `Basic ${credentials}`; + } + + if (options.body !== undefined) { + if (options.mediaType) { + headers['Content-Type'] = options.mediaType; + } else if (isBlob(options.body)) { + headers['Content-Type'] = options.body.type || 'application/octet-stream'; + } else if (isString(options.body)) { + headers['Content-Type'] = 'text/plain'; + } else if (!isFormData(options.body)) { + headers['Content-Type'] = 'application/json'; + } + } + + return new Headers(headers); +}; + +export const getRequestBody = (options: ApiRequestOptions): unknown => { + if (options.body !== undefined) { + if (options.mediaType?.includes('application/json') || options.mediaType?.includes('+json')) { + return JSON.stringify(options.body); + } else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) { + return options.body; + } else { + return JSON.stringify(options.body); + } + } + return undefined; +}; + +export const sendRequest = async ( + config: OpenAPIConfig, + options: ApiRequestOptions, + url: string, + body: any, + formData: FormData | undefined, + headers: Headers, + onCancel: OnCancel +): Promise => { + const controller = new AbortController(); + + let request: RequestInit = { + headers, + body: body ?? formData, + method: options.method, + signal: controller.signal, + }; + + if (config.WITH_CREDENTIALS) { + request.credentials = config.CREDENTIALS; + } + + for (const fn of config.interceptors.request._fns) { + request = await fn(request); + } + + onCancel(() => controller.abort()); + + return await fetch(url, request); +}; + +export const getResponseHeader = (response: Response, responseHeader?: string): string | undefined => { + if (responseHeader) { + const content = response.headers.get(responseHeader); + if (isString(content)) { + return content; + } + } + return undefined; +}; + +export const getResponseBody = async (response: Response): Promise => { + if (response.status !== 204) { + try { + const contentType = response.headers.get('Content-Type'); + if (contentType) { + const binaryTypes = ['application/octet-stream', 'application/pdf', 'application/zip', 'audio/', 'image/', 'video/']; + if (contentType.includes('application/json') || contentType.includes('+json')) { + return await response.json(); + } else if (binaryTypes.some(type => contentType.includes(type))) { + return await response.blob(); + } else if (contentType.includes('multipart/form-data')) { + return await response.formData(); + } else if (contentType.includes('text/')) { + return await response.text(); + } + } + } catch (error) { + console.error(error); + } + } + return undefined; +}; + +export const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult): void => { + const errors: Record = { + 400: 'Bad Request', + 401: 'Unauthorized', + 402: 'Payment Required', + 403: 'Forbidden', + 404: 'Not Found', + 405: 'Method Not Allowed', + 406: 'Not Acceptable', + 407: 'Proxy Authentication Required', + 408: 'Request Timeout', + 409: 'Conflict', + 410: 'Gone', + 411: 'Length Required', + 412: 'Precondition Failed', + 413: 'Payload Too Large', + 414: 'URI Too Long', + 415: 'Unsupported Media Type', + 416: 'Range Not Satisfiable', + 417: 'Expectation Failed', + 418: 'Im a teapot', + 421: 'Misdirected Request', + 422: 'Unprocessable Content', + 423: 'Locked', + 424: 'Failed Dependency', + 425: 'Too Early', + 426: 'Upgrade Required', + 428: 'Precondition Required', + 429: 'Too Many Requests', + 431: 'Request Header Fields Too Large', + 451: 'Unavailable For Legal Reasons', + 500: 'Internal Server Error', + 501: 'Not Implemented', + 502: 'Bad Gateway', + 503: 'Service Unavailable', + 504: 'Gateway Timeout', + 505: 'HTTP Version Not Supported', + 506: 'Variant Also Negotiates', + 507: 'Insufficient Storage', + 508: 'Loop Detected', + 510: 'Not Extended', + 511: 'Network Authentication Required', + ...options.errors, + } + + const error = errors[result.status]; + if (error) { + throw new ApiError(options, result, error); + } + + if (!result.ok) { + const errorStatus = result.status ?? 'unknown'; + const errorStatusText = result.statusText ?? 'unknown'; + const errorBody = (() => { + try { + return JSON.stringify(result.body, null, 2); + } catch (e) { + return undefined; + } + })(); + + throw new ApiError(options, result, + `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}` + ); + } +}; + +/** + * Request method + * @param config The OpenAPI configuration object + * @param options The request options from the service + * @returns CancelablePromise + * @throws ApiError + */ +export const request = (config: OpenAPIConfig, options: ApiRequestOptions): CancelablePromise => { + return new CancelablePromise(async (resolve, reject, onCancel) => { + try { + const url = getUrl(config, options); + const formData = getFormData(options); + const body = getRequestBody(options); + const headers = await getHeaders(config, options); + + if (!onCancel.isCancelled) { + let response = await sendRequest(config, options, url, body, formData, headers, onCancel); + + for (const fn of config.interceptors.response._fns) { + response = await fn(response); + } + + const responseBody = await getResponseBody(response); + const responseHeader = getResponseHeader(response, options.responseHeader); + + let transformedBody = responseBody; + if (options.responseTransformer && response.ok) { + transformedBody = await options.responseTransformer(responseBody) + } + + const result: ApiResult = { + url, + ok: response.ok, + status: response.status, + statusText: response.statusText, + body: responseHeader ?? transformedBody, + }; + + catchErrorCodes(options, result); + + resolve(result.body); + } + } catch (error) { + reject(error); + } + }); +}; \ No newline at end of file diff --git a/packages/sdks/src/client/index.ts b/packages/sdks/src/client/index.ts new file mode 100644 index 00000000..205031a4 --- /dev/null +++ b/packages/sdks/src/client/index.ts @@ -0,0 +1,7 @@ +// This file is auto-generated by @hey-api/openapi-ts +export { ApiError } from './core/ApiError'; +export { CancelablePromise, CancelError } from './core/CancelablePromise'; +export { OpenAPI, type OpenAPIConfig } from './core/OpenAPI'; +export * from './schemas.gen'; +export * from './services.gen'; +export * from './types.gen'; \ No newline at end of file diff --git a/packages/sdks/src/client/schemas.gen.ts b/packages/sdks/src/client/schemas.gen.ts new file mode 100644 index 00000000..c8db716d --- /dev/null +++ b/packages/sdks/src/client/schemas.gen.ts @@ -0,0 +1,2996 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export const $job = { + type: 'object', + properties: { + id: { + description: 'A unique identifier generated when a job is created.', + type: 'string' + }, + type: { + description: 'This represents the type of resource object being returned. Always `pim-job`.', + type: 'string', + enum: ['pim-job'] + }, + attributes: { + type: 'object', + properties: { + started_at: { + description: 'The date and time a job is started.', + type: 'string', + example: '2020-09-22T09:00:00', + format: 'date-time', + nullable: true + }, + completed_at: { + type: 'string', + example: '2020-09-22T09:00:00', + format: 'date-time', + nullable: true, + description: 'The date and time a job is completed.' + }, + created_at: { + type: 'string', + description: 'The date and time a job is created.', + example: '2020-09-22T09:00:00', + format: 'date-time' + }, + updated_at: { + type: 'string', + description: 'The date and time a job is updated.', + example: '2020-09-22T09:00:00', + format: 'date-time' + }, + type: { + type: 'string', + description: `The status of a job. + +* \`pending\` - Commerce has received the request but is currently busy processing other requests. +* \`started\` - Commerce has started processing the job. +* \`success\` - The job has successfully completed. +* \`failed\` - The job has failed. +`, + enum: ['child-products', 'product-import', 'product-export', 'hierarchy-duplicate', 'price-import'] + }, + status: { + type: 'string', + enum: ['pending', 'cancelled', 'started', 'success', 'failed'] + } + } + }, + meta: { + type: 'object', + properties: { + x_request_id: { + type: 'string', + description: 'Applies to all job types. A unique request ID is generated when a job is created.' + }, + copied_from: { + type: 'string', + description: 'Applies to `hierarchy-duplicate` job types. The ID of the original hierarchy that you duplicated.' + }, + hierarchy_id: { + type: 'string', + description: 'Applies to `hierarchy-duplicate` job types. The duplicated hierarchy ID.' + }, + file_locations: { + type: 'array', + nullable: true, + description: 'If the job type is `product_export`, a link to the file is created when running a job.', + items: { + type: 'string' + } + }, + filter: { + type: 'string', + description: 'The entities included in the job. For example, if the job type is `product-export`, the PXM products included in the export.' + } + } + } + } +} as const; + +export const $multi = { + type: 'object', + properties: { + data: { + description: 'An array of jobs.', + type: 'array', + items: { + '$ref': '#/components/schemas/job' + } + }, + meta: { + type: 'object', + properties: { + results: { + description: 'Contains the results for the entire collection.', + type: 'object', + properties: { + total: { + description: 'Total number of results for the entire collection.', + type: 'integer', + example: 2 + } + } + } + } + } + } +} as const; + +export const $error = { + required: ['errors'], + properties: { + errors: { + type: 'array', + items: { + required: ['status', 'title'], + properties: { + status: { + type: 'string', + description: 'The HTTP response code of the error.', + example: '500' + }, + title: { + type: 'string', + description: 'A brief summary of the error.', + example: 'Internal server error' + }, + detail: { + type: 'string', + description: 'Optional additional detail about the error.', + example: 'An internal error has occurred.' + }, + request_id: { + type: 'string', + description: 'Internal request ID.', + example: '00000000-0000-0000-0000-000000000000' + }, + meta: { + type: 'object', + description: 'Additional supporting meta data for the error.', + example: { + missing_ids: ['e7d50bd5-1833-43c0-9848-f9d325b08be8'] + } + } + } + } + } + } +} as const; + +export const $single = { + type: 'object', + properties: { + data: { + '$ref': '#/components/schemas/job' + } + } +} as const; + +export const $errors = { + type: 'object', + properties: { + data: { + type: 'array', + description: 'An array of job errors.', + items: { + type: 'object', + properties: { + type: { + description: 'This represents the type of resource object being returned. Always `pim-job-error`.', + type: 'string', + example: 'pim-job-error', + enum: ['pim-job-error'] + }, + id: { + description: 'A unique identifier for a job error generated when a job error is created.', + type: 'string' + }, + attributes: { + type: 'object', + properties: { + message: { + description: 'A description of an error message.', + type: 'string', + example: 'data.attributes.sku: Must be unique amongst products.' + } + } + } + } + } + } + } +} as const; + +export const $product_custom_inputs = { + type: 'object', + description: 'You use the `custom_inputs` attribute to allow your shoppers to add custom text to a product when adding product items to their carts. This is useful, for example, if you have a product like a T-shirt that can be personalized or you sell greetings cards that can be printed with your shoppers personalized messages. See [Personalizing Products](/docs/api/pxm/products/create-product#personalizing-products).', + additionalProperties: { + description: 'A name for the custom text field. You can rename this to something more representative of the input that shoppers are adding, for example, `message` or `front`.', + type: 'object', + properties: { + name: { + type: 'string', + description: 'A name for the custom text field.' + }, + validation_rules: { + type: 'array', + description: 'The validation rules for the custom text.' + }, + type: { + description: 'This represents the type of the resource being returned.', + type: 'string' + }, + options: { + type: 'object', + description: 'The length of the custom input text field.' + }, + max_length: { + type: 'integer', + description: 'The number of characters the custom text field can be. You can specify a maximum length up to 255 characters, as the limit is 255 characters.' + }, + required: { + type: 'boolean', + description: `\`true\` or \`false\` depending on whether the custom text is required.` + } + } + } +} as const; + +export const $product_build_rules = { + type: 'object', + description: 'You can build a combination of child products associated with a product, based on build rules that you specify. This is useful, for example, if you have a variation option that you do not sell. This makes managing and building your child products quick and easy. See [Using Build Rules](/docs/api/pxm/products/build-child-products#using-build-rules).', + properties: { + default: { + description: 'Specifies the default behaviour, either `include` or `exclude`.', + type: 'string', + enum: ['include', 'exclude'] + }, + include: { + description: 'An array of option IDs to include when child products are built. Each combination consists of a nested array of option IDs from one or more variations. Combinations of option IDs in the nested arrays must come from different variations.', + type: 'array', + items: { + type: 'array', + items: { + type: 'string' + } + } + }, + exclude: { + description: 'An array of option IDs to exclude when child products are built. Each combination consists of a nested array of option IDs from one or more variations. Combinations of option IDs in the nested arrays must come from different variations.', + type: 'array', + items: { + type: 'array', + items: { + type: 'string' + } + } + } + } +} as const; + +export const $product_bundle_components = { + type: 'object', + description: 'With Product Experience Manager, you can create and manage bundles. A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. See [Bundles](/docs/api/pxm/products/products#bundles).', + additionalProperties: { + description: 'The name of the component, such as `games`. The `bundle_configuration` uses the component name to reference a component. A component name should be relatively short and must not contain any special characters.', + type: 'object', + properties: { + name: { + type: 'string', + description: 'The component name. The component name is the name that is displayed in your storefront.' + }, + options: { + type: 'array', + description: 'The product options included in a component. This can be the ID of another bundle.', + items: { + type: 'object', + properties: { + id: { + type: 'string', + description: 'The unique ID of the product you want to add to a component.' + }, + type: { + type: 'string', + description: 'This represents the type of object being returned. Always `product`.' + }, + quantity: { + type: 'integer', + description: 'The number of this product option that a shopper must purchase.' + }, + sort_order: { + type: 'integer', + description: 'The sort order of the options. The `create a bundle` and `update a bundle` endpoints do not sort the options. You can use the `sort_order` attribute when programming your storefront to display the options in the order that you want.' + }, + default: { + description: 'Whether the product option is a default option in a bundle. Shoppers can select a bundle that specifies a default list of product options. See [Dynamic Bundles](/docs/api/pxm/products/products#dynamic-bundles).', + type: 'boolean' + } + } + } + }, + min: { + type: 'integer', + description: 'The minimum number of product options a shopper can select from this component.' + }, + max: { + type: 'integer', + description: 'The maximum number of product options a shopper can select from this component.' + }, + sort_order: { + type: 'integer', + description: 'The sort order of the components. The `create a bundle` and `update a bundle` endpoints do not sort the components. You can use the `sort_order` attribute when programming your storefront to display the components in the order that you want.' + } + } + } +} as const; + +export const $product_response = { + type: 'object', + properties: { + id: { + description: 'A unique product ID that is generated when you create the product.', + type: 'string' + }, + type: { + description: 'This represents the type of resource object being returned. Always `product`.', + type: 'string', + enum: ['product'] + }, + attributes: { + type: 'object', + additionalProperties: false, + properties: { + name: { + description: 'A name for the product.', + type: 'string' + }, + description: { + description: 'A description for the product.', + type: 'string' + }, + slug: { + description: 'A label for the product that is used in the URL paths. A slug can contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. By default, the product name is used as the slug.', + type: 'string' + }, + sku: { + description: 'The unique stock keeping unit of the product.', + type: 'string' + }, + status: { + description: 'The status for the product, either `draft` or `live`.', + type: 'string', + enum: ['live', 'draft'] + }, + commodity_type: { + description: 'The commodity type, either `physical` or `digital`.', + type: 'string', + enum: ['physical', 'digital'] + }, + upc_ean: { + description: 'The universal product code or european article number of the product.', + type: 'string' + }, + mpn: { + description: 'The manufacturer part number of the product.', + type: 'string' + }, + external_ref: { + description: 'The unique attribute associated with the product. This could be an external reference from a separate company system, for example. The maximum length is 2048 characters.', + type: 'string' + }, + locales: { + description: 'Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want.', + type: 'object' + }, + tags: { + description: 'You can use product tags to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. A product can have up to 20 tags. A product tag can be up to 255 characters. Product tags must not contain any spaces or commas.', + type: 'array', + items: { + type: 'string' + } + }, + extensions: { + type: 'object', + additionalProperties: { + type: 'object', + additionalProperties: { + oneOf: [ + { + type: 'string', + nullable: true + }, + { + type: 'integer' + }, + { + type: 'boolean' + } + ] + } + } + }, + custom_inputs: { + '$ref': '#/components/schemas/product_custom_inputs' + }, + build_rules: { + '$ref': '#/components/schemas/product_build_rules' + }, + components: { + '$ref': '#/components/schemas/product_bundle_components' + } + } + }, + meta: { + type: 'object', + properties: { + created_at: { + description: 'The date and time a product is created.', + type: 'string', + example: '2020-09-22T09:00:00', + format: 'date-time' + }, + updated_at: { + description: 'The date and time a product is updated.', + type: 'string', + example: '2020-09-22T09:00:00', + format: 'date-time' + }, + owner: { + description: 'The resource owner, either `organization` or `store`.', + type: 'string', + enum: ['organization', 'store'] + }, + variations: { + description: "A product's variations and the options defined for each variation. If you have specified `build_rules`, only the child products included in the `build_rules` are specified.", + type: 'array', + items: { + type: 'object', + properties: { + id: { + type: 'string', + description: 'A unique ID generated when a variation is created.' + }, + name: { + type: 'string', + description: 'The name of a variation.' + }, + options: { + type: 'array', + items: { + type: 'object', + description: 'The options available for this variation.', + properties: { + id: { + type: 'string', + description: 'A unique ID that is generated an option is created.' + }, + name: { + type: 'string', + description: 'The name of an option.' + }, + description: { + type: 'string', + description: 'A description of an option.' + } + } + } + } + } + } + }, + product_types: { + description: `One of the following product types: + +- \`standard\` - A \`standard\` product is a standalone product. +- \`parent\` - A \`parent\` product is a product that has child products that have been built using the \`Build Child Products\` endpoint. +- \`child\` - When you configure product variations and variation options for \`parent\` products, the \`child\` products derived from the \`parent\` products are automatically created in Commerce. +- \`bundle\` - A \`bundle\` is a purchasable product, comprising one or more standalone products (in other words, components) to be sold together. +`, + type: 'array', + items: { + type: 'string', + enum: ['parent', 'child', 'bundle', 'standard'] + } + }, + variation_matrix: { + description: 'The child products defined for a product. The order of the variations in the `variation_matrix` is the order of the variations in the array when the variations were linked to the product. For example, the first variation in the `variation_matrix` corresponds to the first variation in the array, and so on. You can use the `sort_order`attribute to sort the order of your variation and variation options in the `variation_matrix` object. See [Sorting the Order of Variations and Options](/docs/api/pxm/products/variations#sorting-the-order-of-variations-and-options) If no variations are defined for a product, the `variation_matrix` is empty.', + type: 'object' + } + } + }, + relationships: { + description: 'Relationships are established between different product entities. For example, a `bundle` product and a `child` product are related to a `parent` product, as both are associated with it.', + type: 'object', + additionalProperties: { + type: 'object', + properties: { + data: { + oneOf: [ + { + type: 'array', + items: { + type: 'object', + properties: { + id: { + description: 'A unique identifier for a resource.', + type: 'string' + }, + type: { + description: 'This represents the type of resource object being returned.', + type: 'string' + } + } + } + }, + { + type: 'object', + nullable: true, + properties: { + id: { + description: 'A unique identifier for a resource.', + type: 'string' + }, + type: { + description: 'This represents the type of resource object being returned.', + type: 'string' + } + } + } + ] + }, + links: { + description: `Links are used to allow you to move between requests. Single entities use a \`self\` parameter with a link to that specific resource. Sometimes, there are not enough entities for a project to fill multiple pages. In this situation, we return some defaults. + + | Property | Description | + | :--- | :--- | + | \`current\` | Always the current page. | + | \`first\` | Always the first page. | + | \`last\` | \`null\` if there is only one page. | + | \`prev\` | \`null\` if the user is on the first page. | + | \`next\` | \`null\` if there is only one page. | +`, + type: 'object', + additionalProperties: { + type: 'string' + } + } + } + } + } + } +} as const; + +export const $multi_product_response = { + type: 'object', + properties: { + data: { + type: 'array', + items: { + '$ref': '#/components/schemas/product_response' + } + }, + included: { + type: 'object', + description: 'Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned.', + properties: { + component_products: { + description: 'Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned.', + type: 'array', + items: { + '$ref': '#/components/schemas/product_response' + } + } + } + }, + meta: { + type: 'object', + properties: { + results: { + description: 'Contains the results for the entire collection.', + type: 'object', + properties: { + total: { + description: 'Total number of results for the entire collection.', + type: 'integer', + example: 2 + } + } + } + } + } + } +} as const; + +export const $product_locales = { + type: 'object', + description: 'Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want.', + additionalProperties: { + description: 'A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used.', + type: 'object', + required: ['name'], + properties: { + name: { + type: 'string', + description: 'A localized name for the product.' + }, + description: { + type: 'string', + description: 'A localized description for the product.' + } + } + } +} as const; + +export const $product_attributes = { + type: 'object', + additionalProperties: false, + properties: { + external_ref: { + type: 'string', + description: 'The unique attribute associated with the product. This could be an external reference from a separate company system, for example. The maximum length is 2048 characters.' + }, + name: { + type: 'string', + description: 'The product name to display to customers.' + }, + description: { + description: 'A description for the product.', + type: 'string' + }, + slug: { + type: 'string', + description: 'The unique slug of the product. A slug can contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.' + }, + sku: { + type: 'string', + description: 'The unique stock keeping unit of the product.' + }, + status: { + type: 'string', + enum: ['live', 'draft'], + description: 'The status for the product, either `draft` or `live`. Default is `draft`.' + }, + commodity_type: { + description: 'The commodity type, either `physical` or `digital`.', + type: 'string', + enum: ['physical', 'digital'] + }, + upc_ean: { + type: 'string', + description: 'The universal product code or european article number of the product.' + }, + mpn: { + type: 'string', + description: 'The manufacturer part number of the product.' + }, + tags: { + type: 'array', + description: 'You can use product tags to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. A product can have up to 20 tags. A product tag can be up to 255 characters. Product tags must not contain any spaces or commas. See [Product Tags](/docs/api/pxm/products/product-tags).', + items: { + type: 'string' + } + }, + build_rules: { + '$ref': '#/components/schemas/product_build_rules' + }, + locales: { + '$ref': '#/components/schemas/product_locales' + }, + custom_inputs: { + '$ref': '#/components/schemas/product_custom_inputs' + }, + components: { + '$ref': '#/components/schemas/product_bundle_components' + } + } +} as const; + +export const $create_product_request = { + type: 'object', + required: ['data'], + properties: { + data: { + type: 'object', + required: ['type', 'attributes'], + properties: { + type: { + description: 'This represents the type of resource being returned. Always `product`.', + type: 'string', + enum: ['product'], + example: 'product' + }, + attributes: { + '$ref': '#/components/schemas/product_attributes' + }, + relationships: { + description: 'Relationships are established between different product entities.', + type: 'object', + properties: { + variations: { + type: 'object', + properties: { + data: { + type: 'array', + items: { + type: 'object', + properties: { + id: { + description: 'A unique identifier for a resource.', + type: 'string' + }, + type: { + description: 'This represents the type of resource object being returned.', + type: 'string' + } + } + } + } + } + } + } + } + } + } + } +} as const; + +export const $single_product_response = { + type: 'object', + properties: { + data: { + '$ref': '#/components/schemas/product_response' + }, + included: { + type: 'object', + description: 'Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned.', + properties: { + component_products: { + description: 'A list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned.', + type: 'array', + items: { + '$ref': '#/components/schemas/product_response' + } + } + } + } + } +} as const; + +export const $update_product_request = { + type: 'object', + required: ['data'], + properties: { + data: { + type: 'object', + required: ['type', 'attributes', 'id'], + properties: { + type: { + description: 'This represents the type of resource object being returned. Always `product`.', + type: 'string', + enum: ['product'], + example: 'product' + }, + id: { + type: 'string', + description: 'The unique identifier of the product. Must match the product ID specified in the request path.', + example: '00000000-0000-0000-0000-000000000000' + }, + attributes: { + '$ref': '#/components/schemas/product_attributes' + } + } + } + } +} as const; + +export const $attributes = { + type: 'object', + properties: { + name: { + description: 'The name of the node, such as `Ranges` or `Refrigerators`. Names must be unique among sibling nodes in the hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies.', + type: 'string' + }, + description: { + description: 'A description for a node.', + type: 'string' + }, + slug: { + description: 'A slug for the node. Slugs must be unique among sibling nodes in the hierarchy. Otherwise, a slug can be non-unique within the hierarchy and across multiple hierarchies.', + type: 'string' + }, + curated_products: { + description: 'You can curate your products in your nodes product lists. Product curation allows you to promote specific products within each node in a hierarchy, enabling you to create unique product collections in your storefront.', + type: 'array', + items: { + description: 'A list of product IDs whose products you want to curate.', + type: 'string' + } + }, + locales: { + description: 'Product Experience Manager supports localization of hierarchies and nodes. If you store supports multiple languages, you can localize hierarchy and node names and descriptions.', + type: 'object', + additionalProperties: { + description: 'A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used.', + type: 'object', + additionalProperties: false, + properties: { + name: { + description: 'A localized hierarchy or node name.', + type: 'string' + }, + description: { + description: 'A localized hierarchy or node description.', + type: 'string' + } + } + } + } + } +} as const; + +export const $relationships = { + type: 'object', + description: 'Relationships allow you to move between requests. Includes links to the child nodes and products associated with a hierarchy or node.', + properties: { + children: { + description: 'The child nodes related to the resource.', + type: 'object', + properties: { + data: { + description: 'An array of child nodes.', + type: 'array', + required: [] + }, + links: { + description: 'Links allow you to move between requests.', + type: 'object', + properties: { + related: { + description: 'A link to a related resource.', + type: 'string' + } + } + } + } + }, + parent: { + description: 'The parent node related to the resource', + type: 'object', + properties: { + data: { + description: 'The parent node', + type: 'object', + required: ['id', 'type'], + properties: { + type: { + description: 'This represents the type of resource object being returned. Always `node`.', + type: 'string', + enum: ['node'] + }, + id: { + description: 'The unique identifier of a node.', + type: 'string' + } + } + } + } + }, + products: { + type: 'object', + description: 'The products related to the resource.', + properties: { + data: { + description: 'An array of products.', + type: 'array', + required: [] + }, + links: { + type: 'object', + description: 'Links allow you to move between requests.', + properties: { + related: { + description: 'A link to a related resource.', + type: 'string' + } + } + } + } + } + } +} as const; + +export const $node = { + type: 'object', + properties: { + id: { + description: 'The unique identifier of a node.', + type: 'string' + }, + type: { + description: 'This represents the type of resource object being returned. Always `node`.', + type: 'string', + enum: ['node'] + }, + attributes: { + '$ref': '#/components/schemas/attributes' + }, + relationships: { + '$ref': '#/components/schemas/relationships' + }, + meta: { + type: 'object', + properties: { + sort_order: { + description: 'The sort order value. The node with the highest value of `sort_order` is displayed first. For example, a node with a `sort_order` value of `3` appears before a node with a `sort_order` value of `2`. See [Sorting Nodes in a hierarchy](/docs/api/pxm/products/create-node#sorting-nodes-in-a-hierarchy).', + type: 'integer' + }, + created_at: { + description: 'The date and time a node is created.', + type: 'string', + example: '2020-09-22T09:00:00', + format: 'date-time' + }, + updated_at: { + description: 'The date and time a node was updated.', + type: 'string', + example: '2020-09-22T09:00:00', + format: 'date-time' + }, + parent_name: { + description: 'The name of the parent of the node if one exists.', + type: 'string' + }, + owner: { + description: 'The node owner, either `organization` or `store`.', + type: 'string', + enum: ['store', 'organization'] + } + } + } + } +} as const; + +export const $multi_meta = { + type: 'object', + properties: { + results: { + description: 'Contains the results for the entire collection.', + type: 'object', + properties: { + total: { + description: 'Total number of results for the entire collection.', + type: 'integer', + example: 30, + minimum: 0 + } + } + } + } +} as const; + +export const $multi_links = { + type: 'object', + description: 'Links are used to allow you to move between requests.', + properties: { + first: { + description: 'Always the first page.', + type: 'string', + example: '/pcm/hierarchies?page[offset]=0&page[limit]=10' + }, + last: { + description: 'This is `null` if there is only one page.', + type: 'string', + example: '/pcm/hierarchies?page[offset]=20&page[limit]=10' + }, + next: { + description: 'This is `null` if there is only one page.', + type: 'string', + example: '/pcm/hierarchies?page[offset]=10&page[limit]=10' + }, + prev: { + description: 'This is `null` if you on the first page.', + type: 'string', + example: '/pcm/hierarchies?page[offset]=8&page[limit]=10' + } + } +} as const; + +export const $multi_nodes = { + type: 'object', + properties: { + data: { + description: 'An array of nodes.', + type: 'array', + items: { + '$ref': '#/components/schemas/node' + } + }, + meta: { + '$ref': '#/components/schemas/multi_meta' + }, + links: { + '$ref': '#/components/schemas/multi_links' + } + } +} as const; + +export const $template_response = { + type: 'object', + properties: { + data: { + type: 'array', + items: { + type: 'object', + properties: { + id: { + description: 'A unique identifier for a template generated when a template is created.', + type: 'string' + }, + type: { + description: 'This represents the type of resource object being returned. Always `template`.', + type: 'string', + enum: ['template'] + } + } + } + } + } +} as const; + +export const $product_templates_request = { + type: 'object', + properties: { + data: { + type: 'array', + items: { + type: 'object', + properties: { + id: { + type: 'string', + description: 'The unique identifier of a template.' + }, + type: { + type: 'string', + enum: ['template'], + description: "This represents the type of resource object being returned. Always `template'." + } + } + } + } + } +} as const; + +export const $component_products_response = { + type: 'object', + properties: { + data: { + type: 'array', + items: { + type: 'object', + properties: { + id: { + type: 'string', + description: 'The unique identifier of a product component generated when a product is created.' + }, + type: { + type: 'string', + enum: ['product'], + description: 'This represents the type of resource object being returned. Always `product`.' + } + } + } + } + } +} as const; + +export const $file_response = { + type: 'object', + properties: { + data: { + type: 'array', + items: { + type: 'object', + properties: { + id: { + type: 'string', + description: 'The unique identifier of the new file.' + }, + type: { + type: 'string', + description: 'This represents the type of resource object being returned. Always `file`.', + enum: ['file'] + } + } + } + } + } +} as const; + +export const $product_files_request = { + type: 'object', + properties: { + data: { + type: 'array', + items: { + type: 'object', + properties: { + id: { + description: 'A unique identifier for a file generated when a file is created.', + type: 'string' + }, + type: { + description: 'This represents the type of resource being returned. Always `file`.', + type: 'string', + enum: ['file'] + }, + meta: { + type: 'object', + properties: { + tags: { + description: 'The files associated with a product.', + type: 'array', + items: { + type: 'string' + } + } + }, + additionalProperties: false + } + } + } + } + } +} as const; + +export const $variations_response = { + type: 'object', + properties: { + data: { + type: 'array', + items: { + type: 'object', + properties: { + id: { + description: 'A unique identifier generated when a variation is created.', + type: 'string' + }, + type: { + description: 'This represents the type of resource object being returned. Always `product-variation`.', + type: 'string', + enum: ['product-variation'] + }, + meta: { + type: 'object', + properties: { + created_at: { + description: 'The date and time a resource is created.', + type: 'string', + example: '2020-09-22T09:00:00', + format: 'date-time' + } + } + } + } + } + } + } +} as const; + +export const $product_variations_request = { + type: 'object', + properties: { + data: { + type: 'array', + items: { + type: 'object', + properties: { + id: { + type: 'string', + description: 'The ID of the product variation.' + }, + type: { + type: 'string', + enum: ['product-variation'], + description: 'This represents the type of resource being returned. Always `product-variation`.' + } + } + } + } + } +} as const; + +export const $main_image_response = { + type: 'object', + properties: { + data: { + type: 'array', + items: { + type: 'object', + properties: { + id: { + description: 'A unique identifier for the image file generated automatically when a file is created.', + type: 'string' + }, + type: { + description: 'This represents the type of resource object being returned. Always `file`.', + type: 'string' + } + } + } + } + } +} as const; + +export const $replace_main_image_request = { + type: 'object', + properties: { + data: { + type: 'array', + items: { + type: 'object', + properties: { + id: { + type: 'string', + description: 'The ID of the new image file.', + example: '00000000-0000-0000-0000-000000000000' + }, + type: { + type: 'string', + enum: ['file'] + } + } + } + } + } +} as const; + +export const $main_image_request = { + type: 'object', + properties: { + data: { + type: 'object', + properties: { + id: { + type: 'string', + description: 'The ID of the image file.', + example: '00000000-0000-0000-0000-000000000000' + }, + type: { + description: 'This represents the type of resource being returned. Always `file`.', + type: 'string', + enum: ['file'] + } + } + } + } +} as const; + +export const $multi_variations = { + type: 'object', + properties: { + data: { + type: 'array', + items: { + type: 'object', + properties: { + id: { + description: 'A unique identifier for a variation.', + type: 'string' + }, + type: { + description: 'This represents the type of resource object being returned. Always `product-variation`.', + type: 'string', + enum: ['product-variation'] + }, + attributes: { + type: 'object', + additionalProperties: false, + properties: { + name: { + description: 'The name of a variation.', + type: 'string' + }, + sort_order: { + description: 'The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.', + type: 'integer' + } + } + }, + meta: { + type: 'object', + properties: { + options: { + type: 'array', + items: { + type: 'object', + description: 'The options available for this variation.', + properties: { + id: { + type: 'string', + description: 'A unique ID that is generated when an option is created.' + }, + name: { + type: 'string', + description: 'A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.' + }, + description: { + type: 'string', + description: 'A human recognizable description of the option.' + }, + created_at: { + type: 'string', + description: 'The date and time an option is created.', + example: '2020-09-22T09:00:00', + format: 'date-time' + }, + updated_at: { + type: 'string', + description: 'The date and time an option is updated.', + example: '2020-09-22T09:00:00', + format: 'date-time' + }, + sort_order: { + description: 'The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.', + type: 'integer' + } + } + } + }, + owner: { + type: 'string', + description: 'The owner of the resource, either `organization` or `store`.', + enum: ['organization', 'store'] + }, + created_at: { + type: 'string', + description: 'The date and time a variation is created.', + example: '2020-09-22T09:00:00', + format: 'date-time' + }, + updated_at: { + type: 'string', + description: 'The date and time a variation is updated.', + example: '2020-09-22T09:00:00', + format: 'date-time' + } + } + } + } + } + }, + meta: { + type: 'object', + properties: { + results: { + description: 'Contains the results for the entire collection.', + type: 'object', + properties: { + total: { + description: 'Total number of results for the entire collection.', + type: 'integer', + example: 3 + } + } + } + } + } + } +} as const; + +export const $create_variation = { + type: 'object', + required: ['data'], + properties: { + data: { + type: 'object', + required: ['type', 'attributes'], + properties: { + type: { + description: 'This represents the type of resource object being returned. Always `product-variation`.', + type: 'string', + enum: ['product-variation'] + }, + attributes: { + type: 'object', + additionalProperties: false, + properties: { + name: { + description: 'The variation name.', + type: 'string' + }, + sort_order: { + description: `The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the \`sort_order\` value to program your storefront to display the variation options in the order that you want. + + The variation with the highest value of \`sort_order\` is displayed first. For example, a variation with a \`sort_order\` value of 3 appears before a variation with a \`sort_order\` value of 2. + + You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set \`sort_order\` to either \`null\` or omit it entirely from the request if you wish to remove an existing \`sort_order\` attribute. + + You must rebuild your products for the sort order changes to take effect. +`, + type: 'integer' + } + } + } + } + } + } +} as const; + +export const $created_variation = { + type: 'object', + required: ['data'], + properties: { + data: { + type: 'object', + required: ['id', 'type', 'attributes', 'meta'], + properties: { + id: { + description: 'A unique identifier generated when a variation is created.', + type: 'string' + }, + type: { + description: 'This represents the type of resource object being returned. Always `product-variation`.', + type: 'string', + enum: ['product-variation'] + }, + attributes: { + type: 'object', + additionalProperties: false, + properties: { + name: { + description: 'A human-recognizable identifier for a variation.', + type: 'string' + }, + sort_order: { + description: 'The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.', + type: 'integer' + } + } + }, + meta: { + type: 'object', + properties: { + owner: { + description: 'The owner of the resource, either `organization` or `store`.', + type: 'string', + enum: ['organization', 'store'] + }, + created_at: { + type: 'string', + description: 'The date and time a variation is created.', + example: '2020-09-22T09:00:00', + format: 'date-time' + }, + updated_at: { + type: 'string', + description: 'The date and time a variation is updated.', + example: '2020-09-22T09:00:00', + format: 'date-time' + } + } + } + } + } + } +} as const; + +export const $single_variation = { + type: 'object', + required: ['data'], + properties: { + data: { + type: 'object', + required: ['id', 'type', 'attributes', 'meta'], + properties: { + id: { + description: 'A unique identifier for a variation.', + type: 'string' + }, + type: { + description: 'This represents the type of resource object being returned. Always `product-variation`.', + type: 'string', + enum: ['product-variation'] + }, + attributes: { + type: 'object', + additionalProperties: false, + properties: { + name: { + description: 'The name for a variation.', + type: 'string' + }, + sort_order: { + description: 'The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.', + type: 'integer' + } + } + }, + meta: { + type: 'object', + properties: { + options: { + description: 'A variation option represents an option for selection for a single product-variation. For example, if your variation is `color`, you might have three possible options; red, green, and blue.', + type: 'array', + items: { + type: 'object', + description: 'The options available for this variation', + properties: { + id: { + type: 'string', + description: 'A unique ID that is generated an option is created.' + }, + name: { + type: 'string', + description: 'A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.' + }, + description: { + type: 'string', + description: 'A description for an option.' + }, + created_at: { + type: 'string', + description: 'The date and time an option is created.', + example: '2020-09-22T09:00:00', + format: 'date-time' + }, + updated_at: { + type: 'string', + description: 'The date and time an option is updated.', + example: '2020-09-22T09:00:00', + format: 'date-time' + }, + sort_order: { + description: 'The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.', + type: 'integer' + } + } + } + }, + owner: { + description: 'The owner of the resource, either `organization` or `store`.', + type: 'string', + enum: ['organization', 'store'] + }, + created_at: { + type: 'string', + description: 'The date and time a variation is created.' + }, + updated_at: { + type: 'string', + description: 'The date and time a variation is updated.' + } + } + } + } + } + } +} as const; + +export const $update_variation = { + type: 'object', + required: ['data'], + properties: { + data: { + type: 'object', + required: ['type', 'attributes', 'id'], + properties: { + type: { + description: 'This represents the type of resource object being returned. Always `product-variation`.', + type: 'string', + enum: ['product-variation'] + }, + attributes: { + type: 'object', + additionalProperties: false, + properties: { + name: { + description: 'The variation name.', + type: 'string' + }, + sort_order: { + description: `The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the \`sort_order\` value to program your storefront to display the variation options in the order that you want. + + The variation with the highest value of \`sort_order\` is displayed first. For example, a variation with a \`sort_order\` value of 3 appears before a variation with a \`sort_order\` value of 2. + + You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set \`sort_order\` to either \`null\` or omit it entirely from the request if you wish to remove an existing \`sort_order\` attribute. + + You must rebuild your products for the sort order changes to take effect. +`, + type: 'integer' + } + } + }, + id: { + type: 'string', + description: 'The unique identifier of the variation. Must match the variation ID specified in the request path.', + example: '00000000-0000-0000-0000-000000000000' + } + } + } + } +} as const; + +export const $multi_options = { + type: 'object', + properties: { + data: { + type: 'array', + items: { + type: 'object', + properties: { + id: { + description: 'A unique identifier generated when an option is created.', + type: 'string' + }, + type: { + description: 'This represents the type of resource object being returned. Always `product-variation-option`.', + type: 'string', + enum: ['product-variation-option'] + }, + attributes: { + type: 'object', + additionalProperties: false, + properties: { + name: { + description: 'A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.', + type: 'string' + }, + description: { + description: 'A human-recognizable description for the option.', + type: 'string' + }, + sort_order: { + description: 'The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.', + type: 'integer' + } + } + }, + meta: { + type: 'object', + properties: { + owner: { + description: 'The owner of a resource, either `organization` or `store`.', + type: 'string', + enum: ['organization', 'store'] + }, + created_at: { + type: 'string', + description: 'The date and time an option is created.', + example: '2020-09-22T09:00:00', + format: 'date-time' + }, + updated_at: { + type: 'string', + description: 'The date and time an option is updated.', + example: '2020-09-22T09:00:00', + format: 'date-time' + } + } + } + } + } + }, + meta: { + type: 'object', + properties: { + results: { + description: 'Contains the results for the entire collection.', + type: 'object', + properties: { + total: { + description: 'Total number of results for the entire collection.', + type: 'integer', + example: 3 + } + } + } + } + } + } +} as const; + +export const $create_option = { + type: 'object', + required: ['data'], + properties: { + data: { + type: 'object', + required: ['type', 'attributes'], + properties: { + type: { + description: 'This represents the type of resource object being returned. Always `product-variation-option`.', + type: 'string', + enum: ['product-variation-option'] + }, + attributes: { + type: 'object', + additionalProperties: false, + properties: { + name: { + description: 'A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.', + type: 'string' + }, + sort_order: { + description: `By default, variations and variation options are sorted alphabetically. You can use the \`sort_order\` attribute to sort the order of your variation and variation options in the \`variation_matrix\`. + + The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the \`sort_order\` value to program your storefront to display the variation options in the order that you want. + + The variation option with the highest value of \`sort_order\` is displayed first. For example, a variation option with a \`sort_order\` value of \`3\` appears before a variation option with a \`sort_order\` value of \`2\`. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, and so on, zero or negative numbers. + + You can set \`sort_order\` to either \`null\` or omit it entirely from the request if you wish to remove an existing \`sort_order\` attribute. + + You must rebuild your products for the sort order changes to take effect. +`, + type: 'integer' + }, + description: { + description: 'A description of a product variation option.', + type: 'string' + } + } + } + } + } + } +} as const; + +export const $created_option = { + type: 'object', + required: ['data'], + properties: { + data: { + type: 'object', + required: ['type', 'attributes'], + properties: { + id: { + description: 'A unique identifier that is generated when an option is created.', + type: 'string' + }, + type: { + description: 'This represents the type of resource object being returned. Always `product-variation-option`.', + type: 'string', + enum: ['product-variation-option'] + }, + attributes: { + type: 'object', + additionalProperties: false, + properties: { + name: { + description: 'A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.', + type: 'string' + }, + description: { + description: 'A human-recognizable description for the option.', + type: 'string' + }, + sort_order: { + description: 'The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.', + type: 'integer' + } + } + }, + meta: { + type: 'object', + properties: { + owner: { + description: 'The owner of a resource, either `organization` or `store`.', + type: 'string', + enum: ['organization', 'store'] + }, + created_at: { + type: 'string', + description: 'The date and time an option is created.', + example: '2020-09-22T09:00:00', + format: 'date-time' + }, + updated_at: { + type: 'string', + description: 'The date and time an option is updated.', + example: '2020-09-22T09:00:00', + format: 'date-time' + } + } + } + } + } + } +} as const; + +export const $single_option = { + type: 'object', + required: ['data'], + properties: { + data: { + type: 'object', + required: ['id', 'type', 'attributes', 'meta'], + properties: { + id: { + description: 'The unique identifier generated when an option is created.', + type: 'string' + }, + type: { + description: 'This represents the type of resource object being returned. Always `product-variation-option`.', + type: 'string', + enum: ['product-variation-option'] + }, + attributes: { + type: 'object', + description: 'A variation option represents an option for selection for a single product-variation. For example, if your variation is `color`, you might have three possible options; red, green, and blue.', + additionalProperties: false, + properties: { + name: { + description: 'A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.', + type: 'string' + }, + description: { + description: 'A human-recognizable description for the option.', + type: 'string' + }, + sort_order: { + description: 'The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.', + type: 'integer' + } + } + }, + meta: { + type: 'object', + properties: { + owner: { + description: 'The owner of a resource, either `organization` or `store`.', + type: 'string', + enum: ['organization', 'store'] + }, + created_at: { + type: 'string', + description: 'The date and time an option is created.', + example: '2020-09-22T09:00:00', + format: 'date-time' + }, + updated_at: { + type: 'string', + description: 'The date and time an option is updated.', + example: '2020-09-22T09:00:00', + format: 'date-time' + } + } + } + } + } + } +} as const; + +export const $update_option = { + type: 'object', + required: ['data'], + properties: { + data: { + type: 'object', + required: ['type', 'attributes', 'id'], + properties: { + type: { + description: 'This represents the type of resource object being returned. Always `product-variation-option`.', + type: 'string', + enum: ['product-variation-option'] + }, + attributes: { + type: 'object', + additionalProperties: false, + properties: { + name: { + description: 'A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.', + type: 'string' + }, + description: { + description: 'The description of the option.', + type: 'string' + }, + sort_order: { + description: `By default, variations and variation options are sorted alphabetically. You can use the \`sort_order\` attribute to sort the order of your variation and variation options in the \`variation_matrix\`. The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the \`sort_order\` value to program your storefront to display the variation options in the order that you want. + +The variation option with the highest value of \`sort_order\` is displayed first. For example, a variation option with a \`sort_order\` value of \`3\` appears before a variation option with a \`sort_order\` value of \`2\`. + +You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, and so on, zero or negative numbers. + +You can set \`sort_order\` to either \`null\` or omit it entirely from the request if you wish to remove an existing \`sort_order\` attribute. + +You must rebuild your products for the sort order changes to take effect. +`, + type: 'integer' + } + } + }, + id: { + type: 'string', + description: 'The unique identifier of the option. Must match the option ID specified in the request path.', + example: '00000000-0000-0000-0000-000000000000' + } + } + } + } +} as const; + +export const $multi_modifiers = { + type: 'object', + properties: { + data: { + type: 'array', + items: { + type: 'object', + properties: { + id: { + description: 'A unique identifier for a modifier that is generated automatically when a modifier is created.', + type: 'string' + }, + type: { + description: "This represents the type of resource object being returned. Always `product-variation-modifier'.", + type: 'string', + enum: ['product-variation-modifier'] + }, + attributes: { + type: 'object', + additionalProperties: false, + properties: { + type: { + description: `You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + +| Modifier | Data Type | Effect | +| :--- | :--- | :--- | +| \`name_equals\` | \`string\` | Overrides the name of the child product with the name specified by the modifier. | +| \`name_append\` | \`string\` | Appends the string specified in the modifier to the name of the child product. | +| \`name_prepend\` | \`string\` | Prepends the string specified in the modifier to the name of the child product. | +| \`description_equals\` | \`string\` | Overrides the description of the child product. | +| \`description_append\` | \`string\` | Appends the string specified in the modifier to the description of the child product. | +| \`description_prepend\` | \`string\` | Prepends the string specified in the modifier to the product description of the child product. | +| \`commodity_type\` | \`string\` | Sets the commodity type of the child product, such as \`physical\` or \`digital\`. | +| \`price\` | \`string\` | Allows application of price modifiers (\`price_increment\`, \`price_decrement\`, and \`price_equals\`) to the child products. | +| \`price_increment\` | \`string\` | Increases the price of the child product. | +| \`price_decrement\` | \`string\` | Decreases the price of the child product. | +| \`price_equals\` | \`string\` | Sets the price of a child product to the amount you specify. | +| \`slug_append\` | \`string\` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the \`slug-builder\` modifier, you can use \`{}\` in the \`seek\` field, for example, \`"seek": :{COLOR}"\`. | +| \`slug_prepend\` | \`string\` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the \`slug-builder\` modifier, you can use \`{}\` in the \`seek\` field, for example, \`"seek": :{COLOR}"\`. | +| \`slug_builder\` | \`string\`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the \`slug-builder\` modifier, you can use \`{}\` in the \`seek\` field, for example, \`"seek": :{COLOR}"\`. | +| \`sku_equals\` | \`string\` | Sets the SKU of the child product. | +| \`sku_append\` | \`string\` | Appends the string specified in the modifier to the SKU of the child product. | +| \`sku_prepend\` | \`string\` | Prepends the string specified in the modifier to the SKU of the child product. | +| \`sku_builder\` | \`string\` | Sets a part of the SKU of the child product. | +| \`status\` | \`string\` | Sets the status of the child product, such as \`draft\` or \`live\`. | +`, + type: 'string', + enum: ['commodity_type', 'status', 'price', 'name_append', 'name_prepend', 'name_equals', 'sku_append', 'sku_prepend', 'sku_equals', 'sku_builder', 'slug_append', 'slug_prepend', 'slug_equals', 'slug_builder', 'description_append', 'description_prepend', 'description_equals', 'custom_inputs_equals', 'build_rules_equals', 'locales_equals', 'upc_ean_equals', 'mpn_equals', 'external_ref_equals'] + }, + value: { + description: 'Required for non-builder modifiers. The value of the modifier type.', + type: 'string' + }, + seek: { + description: 'Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`.', + type: 'string' + }, + set: { + description: 'Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`.', + type: 'string' + }, + reference_name: { + description: 'The name of the modifier.', + type: 'string' + } + } + }, + meta: { + type: 'object', + properties: { + owner: { + description: 'The owner of a resource, either `organization` or `store`.', + type: 'string', + enum: ['store', 'organization'] + } + } + } + } + } + }, + meta: { + type: 'object', + properties: { + results: { + type: 'object', + description: 'Contains the results for the entire collection.', + properties: { + total: { + description: 'Total number of results for the entire collection.', + type: 'integer', + example: 3 + } + } + } + } + } + } +} as const; + +export const $create_modifier = { + type: 'object', + description: 'Use modifiers to change the properties of child products that are inherited from a parent product. With modifiers, you only need to have one parent product with a variation attached to the product.', + required: ['data'], + properties: { + data: { + type: 'object', + required: ['type', 'attributes'], + properties: { + type: { + description: 'This represents the type of resource object being returned. Always `product-variation-modifier`.', + type: 'string', + enum: ['product-variation-modifier'] + }, + attributes: { + type: 'object', + required: ['type'], + additionalProperties: false, + properties: { + type: { + type: 'string', + description: `You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + +| Modifier | Data Type | Effect | +| :--- | :--- | :--- | +| \`name_equals\` | \`string\` | Overrides the name of the child product with the name specified by the modifier. | +| \`name_append\` | \`string\` | Appends the string specified in the modifier to the name of the child product. | +| \`name_prepend\` | \`string\` | Prepends the string specified in the modifier to the name of the child product. | +| \`description_equals\` | \`string\` | Overrides the description of the child product. | +| \`description_append\` | \`string\` | Appends the string specified in the modifier to the description of the child product. | +| \`description_prepend\` | \`string\` | Prepends the string specified in the modifier to the product description of the child product. | +| \`commodity_type\` | \`string\` | Sets the commodity type of the child product, such as \`physical\` or \`digital\`. | +| \`price\` | \`string\` | Allows application of price modifiers (\`price_increment\`, \`price_decrement\`, and \`price_equals\`) to the child products. | +| \`price_increment\` | \`string\` | Increases the price of the child product. | +| \`price_decrement\` | \`string\` | Decreases the price of the child product. | +| \`price_equals\` | \`string\` | Sets the price of a child product to the amount you specify. | +| \`slug_append\` | \`string\` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the \`slug-builder\` modifier, you can use \`{}\` in the \`seek\` field, for example, \`"seek": :{COLOR}"\`. | +| \`slug_prepend\` | \`string\` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the \`slug-builder\` modifier, you can use \`{}\` in the \`seek\` field, for example, \`"seek": :{COLOR}"\`. | +| \`slug_builder\` | \`string\`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the \`slug-builder\` modifier, you can use \`{}\` in the \`seek\` field, for example, \`"seek": :{COLOR}"\`. | +| \`sku_equals\` | \`string\` | Sets the SKU of the child product. | +| \`sku_append\` | \`string\` | Appends the string specified in the modifier to the SKU of the child product. | +| \`sku_prepend\` | \`string\` | Prepends the string specified in the modifier to the SKU of the child product. | +| \`sku_builder\` | \`string\` | Sets a part of the SKU of the child product. | +| \`status\` | \`string\` | Sets the status of the child product, such as \`draft\` or \`live\`. | +`, + enum: ['commodity_type', 'status', 'price', 'name_append', 'name_prepend', 'name_equals', 'sku_append', 'sku_prepend', 'sku_equals', 'sku_builder', 'slug_append', 'slug_prepend', 'slug_equals', 'slug_builder', 'description_append', 'description_prepend', 'description_equals', 'custom_inputs_equals', 'build_rules_equals', 'locales_equals', 'upc_ean_equals', 'mpn_equals', 'external_ref_equals'] + }, + value: { + description: 'Required for non-builder modifiers. The value of the modifier type.', + type: 'string' + }, + seek: { + description: 'Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`.', + type: 'string' + }, + set: { + description: 'Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`.', + type: 'string' + }, + reference_name: { + description: 'A name for the modifier.', + type: 'string' + } + } + } + } + } + } +} as const; + +export const $created_modifier = { + type: 'object', + properties: { + data: { + type: 'object', + properties: { + id: { + description: 'A unique identifier for a modifier that is generated automatically when a modifier is created.', + type: 'string' + }, + type: { + description: "This represents the type of resource object being returned. Always `product-variation-modifier'.", + type: 'string', + enum: ['product-variation-modifier'] + }, + attributes: { + type: 'object', + additionalProperties: false, + properties: { + type: { + description: `You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + +| Modifier | Data Type | Effect | +| :--- | :--- | :--- | +| \`name_equals\` | \`string\` | Overrides the name of the child product with the name specified by the modifier. | +| \`name_append\` | \`string\` | Appends the string specified in the modifier to the name of the child product. | +| \`name_prepend\` | \`string\` | Prepends the string specified in the modifier to the name of the child product. | +| \`description_equals\` | \`string\` | Overrides the description of the child product. | +| \`description_append\` | \`string\` | Appends the string specified in the modifier to the description of the child product. | +| \`description_prepend\` | \`string\` | Prepends the string specified in the modifier to the product description of the child product. | +| \`commodity_type\` | \`string\` | Sets the commodity type of the child product, such as \`physical\` or \`digital\`. | +| \`price\` | \`string\` | Allows application of price modifiers (\`price_increment\`, \`price_decrement\`, and \`price_equals\`) to the child products. | +| \`price_increment\` | \`string\` | Increases the price of the child product. | +| \`price_decrement\` | \`string\` | Decreases the price of the child product. | +| \`price_equals\` | \`string\` | Sets the price of a child product to the amount you specify. | +| \`slug_append\` | \`string\` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the \`slug-builder\` modifier, you can use \`{}\` in the \`seek\` field, for example, \`"seek": :{COLOR}"\`. | +| \`slug_prepend\` | \`string\` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the \`slug-builder\` modifier, you can use \`{}\` in the \`seek\` field, for example, \`"seek": :{COLOR}"\`. | +| \`slug_builder\` | \`string\`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the \`slug-builder\` modifier, you can use \`{}\` in the \`seek\` field, for example, \`"seek": :{COLOR}"\`. | +| \`sku_equals\` | \`string\` | Sets the SKU of the child product. | +| \`sku_append\` | \`string\` | Appends the string specified in the modifier to the SKU of the child product. | +| \`sku_prepend\` | \`string\` | Prepends the string specified in the modifier to the SKU of the child product. | +| \`sku_builder\` | \`string\` | Sets a part of the SKU of the child product. | +| \`status\` | \`string\` | Sets the status of the child product, such as \`draft\` or \`live\`. | +`, + type: 'string', + enum: ['commodity_type', 'status', 'price', 'name_append', 'name_prepend', 'name_equals', 'sku_append', 'sku_prepend', 'sku_equals', 'sku_builder', 'slug_append', 'slug_prepend', 'slug_equals', 'slug_builder', 'description_append', 'description_prepend', 'description_equals', 'custom_inputs_equals', 'build_rules_equals', 'locales_equals', 'upc_ean_equals', 'mpn_equals', 'external_ref_equals'] + }, + value: { + description: 'Required for non-builder modifiers. The value of the modifier type.', + type: 'string' + }, + seek: { + description: 'Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`.', + type: 'string' + }, + set: { + description: 'Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`.', + type: 'string' + }, + reference_name: { + description: 'The name of the modifier.', + type: 'string' + } + } + }, + meta: { + type: 'object', + properties: { + owner: { + description: 'The owner of the resource, either `organization` or `store`.', + type: 'string', + enum: ['organization', 'store'] + } + } + } + } + } + } +} as const; + +export const $single_modifier = { + type: 'object', + properties: { + data: { + type: 'object', + properties: { + id: { + description: 'A unique identifier for a modifier that is generated automatically when a modifier is created.', + type: 'string' + }, + type: { + description: "This represents the type of resource object being returned. Always `product-variation-modifier'.", + type: 'string', + enum: ['product-variation-modifier'] + }, + attributes: { + type: 'object', + additionalProperties: false, + properties: { + type: { + description: `You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + +| Modifier | Data Type | Effect | +| :--- | :--- | :--- | +| \`name_equals\` | \`string\` | Overrides the name of the child product with the name specified by the modifier. | +| \`name_append\` | \`string\` | Appends the string specified in the modifier to the name of the child product. | +| \`name_prepend\` | \`string\` | Prepends the string specified in the modifier to the name of the child product. | +| \`description_equals\` | \`string\` | Overrides the description of the child product. | +| \`description_append\` | \`string\` | Appends the string specified in the modifier to the description of the child product. | +| \`description_prepend\` | \`string\` | Prepends the string specified in the modifier to the product description of the child product. | +| \`commodity_type\` | \`string\` | Sets the commodity type of the child product, such as \`physical\` or \`digital\`. | +| \`price\` | \`string\` | Allows application of price modifiers (\`price_increment\`, \`price_decrement\`, and \`price_equals\`) to the child products. | +| \`price_increment\` | \`string\` | Increases the price of the child product. | +| \`price_decrement\` | \`string\` | Decreases the price of the child product. | +| \`price_equals\` | \`string\` | Sets the price of a child product to the amount you specify. | +| \`slug_append\` | \`string\` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the \`slug-builder\` modifier, you can use \`{}\` in the \`seek\` field, for example, \`"seek": :{COLOR}"\`. | +| \`slug_prepend\` | \`string\` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the \`slug-builder\` modifier, you can use \`{}\` in the \`seek\` field, for example, \`"seek": :{COLOR}"\`. | +| \`slug_builder\` | \`string\`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the \`slug-builder\` modifier, you can use \`{}\` in the \`seek\` field, for example, \`"seek": :{COLOR}"\`. | +| \`sku_equals\` | \`string\` | Sets the SKU of the child product. | +| \`sku_append\` | \`string\` | Appends the string specified in the modifier to the SKU of the child product. | +| \`sku_prepend\` | \`string\` | Prepends the string specified in the modifier to the SKU of the child product. | +| \`sku_builder\` | \`string\` | Sets a part of the SKU of the child product. | +| \`status\` | \`string\` | Sets the status of the child product, such as \`draft\` or \`live\`. | +`, + type: 'string', + enum: ['commodity_type', 'status', 'price', 'name_append', 'name_prepend', 'name_equals', 'sku_append', 'sku_prepend', 'sku_equals', 'sku_builder', 'slug_append', 'slug_prepend', 'slug_equals', 'slug_builder', 'description_append', 'description_prepend', 'description_equals', 'custom_inputs_equals', 'build_rules_equals', 'locales_equals', 'upc_ean_equals', 'mpn_equals', 'external_ref_equals'] + }, + value: { + description: 'Required for non-builder modifiers. The value of the modifier type.', + type: 'string' + }, + seek: { + description: 'Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`.', + type: 'string' + }, + set: { + description: 'Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`.', + type: 'string' + }, + reference_name: { + description: 'The name of the modifier.', + type: 'string' + } + } + }, + meta: { + type: 'object', + description: 'The owner of the resource, either `organization` or `store`.', + properties: { + owner: { + type: 'string', + enum: ['organization', 'store'] + } + } + } + } + } + } +} as const; + +export const $update_modifier = { + type: 'object', + required: ['data'], + properties: { + data: { + type: 'object', + required: ['type', 'attributes', 'id'], + properties: { + type: { + description: 'This represents the type of resource object being returned. Always `product-variation-modifier`.', + type: 'string', + enum: ['product-variation-modifier'] + }, + attributes: { + type: 'object', + required: ['type'], + additionalProperties: false, + properties: { + type: { + description: `You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + +| Modifier | Data Type | Effect | +| :--- | :--- | :--- | +| \`name_equals\` | \`string\` | Overrides the name of the child product with the name specified by the modifier. | +| \`name_append\` | \`string\` | Appends the string specified in the modifier to the name of the child product. | +| \`name_prepend\` | \`string\` | Prepends the string specified in the modifier to the name of the child product. | +| \`description_equals\` | \`string\` | Overrides the description of the child product. | +| \`description_append\` | \`string\` | Appends the string specified in the modifier to the description of the child product. | +| \`description_prepend\` | \`string\` | Prepends the string specified in the modifier to the product description of the child product. | +| \`commodity_type\` | \`string\` | Sets the commodity type of the child product, such as \`physical\` or \`digital\`. | +| \`price\` | \`string\` | Allows application of price modifiers (\`price_increment\`, \`price_decrement\`, and \`price_equals\`) to the child products. | +| \`price_increment\` | \`string\` | Increases the price of the child product. | +| \`price_decrement\` | \`string\` | Decreases the price of the child product. | +| \`price_equals\` | \`string\` | Sets the price of a child product to the amount you specify. | +| \`slug_append\` | \`string\` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the \`slug-builder\` modifier, you can use \`{}\` in the \`seek\` field, for example, \`"seek": :{COLOR}"\`. | +| \`slug_prepend\` | \`string\` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the \`slug-builder\` modifier, you can use \`{}\` in the \`seek\` field, for example, \`"seek": :{COLOR}"\`. | +| \`slug_builder\` | \`string\`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the \`slug-builder\` modifier, you can use \`{}\` in the \`seek\` field, for example, \`"seek": :{COLOR}"\`. | +| \`sku_equals\` | \`string\` | Sets the SKU of the child product. | +| \`sku_append\` | \`string\` | Appends the string specified in the modifier to the SKU of the child product. | +| \`sku_prepend\` | \`string\` | Prepends the string specified in the modifier to the SKU of the child product. | +| \`sku_builder\` | \`string\` | Sets a part of the SKU of the child product. | +| \`status\` | \`string\` | Sets the status of the child product, such as \`draft\` or \`live\`. | +`, + type: 'string', + enum: ['commodity_type', 'status', 'price', 'name_append', 'name_prepend', 'name_equals', 'sku_append', 'sku_prepend', 'sku_equals', 'sku_builder', 'slug_append', 'slug_prepend', 'slug_equals', 'slug_builder', 'description_append', 'description_prepend', 'description_equals', 'custom_inputs_equals', 'build_rules_equals', 'locales_equals', 'upc_ean_equals', 'mpn_equals', 'external_ref_equals'] + }, + value: { + description: 'Required for non-builder modifiers. The value of the modifier type.', + type: 'string' + }, + seek: { + description: 'Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`.', + type: 'string' + }, + set: { + description: 'Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`.', + type: 'string' + }, + reference_name: { + description: 'The name of the modifier.', + type: 'string' + } + } + }, + id: { + type: 'string', + description: 'The unique identifier of the modifier. Must match the modifier ID specified in the request path.', + example: '00000000-0000-0000-0000-000000000000' + } + } + } + } +} as const; + +export const $attributes_hierarchy = { + type: 'object', + properties: { + name: { + description: 'The name of a hierarchy, such as `Major Appliances`.', + type: 'string' + }, + description: { + description: 'A description for a hierarchy.', + type: 'string' + }, + slug: { + description: 'A unique slug for a hierarchy.', + type: 'string' + }, + locales: { + description: 'Product Experience Manager supports localization of hierarchies and nodes. If you store supports multiple languages, you can localize hierarchy and node names and descriptions.', + type: 'object', + additionalProperties: { + description: 'A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used.', + type: 'object', + additionalProperties: false, + properties: { + name: { + description: 'A localized hierarchy or node name.', + type: 'string' + }, + description: { + description: 'A localized hierarchy or node description.', + type: 'string' + } + } + } + } + } +} as const; + +export const $relationships_hierarchy = { + type: 'object', + properties: { + children: { + description: 'The child nodes related to the hierarchy.', + type: 'object', + properties: { + data: { + description: 'An array of child nodes.', + type: 'array', + required: [] + }, + links: { + description: 'Links allow you to move between requests.', + type: 'object', + properties: { + related: { + description: 'A link to a related resource.', + type: 'string' + } + } + } + } + } + } +} as const; + +export const $hierarchy = { + type: 'object', + properties: { + id: { + description: 'A unique identifier generated when a hierarchy is created.', + type: 'string' + }, + type: { + description: 'This represents the type of resource object being returned. Always `hierarchy`.', + type: 'string', + enum: ['hierarchy'] + }, + attributes: { + '$ref': '#/components/schemas/attributes_hierarchy' + }, + relationships: { + '$ref': '#/components/schemas/relationships_hierarchy' + }, + meta: { + type: 'object', + properties: { + created_at: { + description: 'The date and time a hierarchy is created.', + type: 'string', + example: '2020-09-22T09:00:00', + format: 'date-time' + }, + updated_at: { + description: 'The date and time a hierarchy is updated.', + type: 'string', + example: '2020-09-22T09:00:00', + format: 'date-time' + }, + owner: { + description: 'The owner of a resource, either `organization` or `store`.', + type: 'string', + enum: ['store', 'organization'] + } + } + } + } +} as const; + +export const $multi_hierarchy = { + type: 'object', + properties: { + data: { + type: 'array', + items: { + '$ref': '#/components/schemas/hierarchy' + } + }, + links: { + '$ref': '#/components/schemas/multi_links' + }, + meta: { + '$ref': '#/components/schemas/multi_meta' + } + } +} as const; + +export const $req_attributes_hierarchy = { + type: 'object', + additionalProperties: false, + properties: { + name: { + description: 'The name of the hierarchy, such as `Major Appliances`.', + type: 'string' + }, + description: { + description: 'A description of the hierarchy.', + type: 'string' + }, + slug: { + description: 'A unique slug for the hierarchy.', + type: 'string' + }, + locales: { + description: 'Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want.', + type: 'object', + additionalProperties: { + description: 'A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used.', + type: 'object', + additionalProperties: false, + properties: { + name: { + description: 'A localized name for the hierarchy.', + type: 'string' + }, + description: { + description: 'A localized description for the hierarchy.', + type: 'string' + } + } + } + } + } +} as const; + +export const $create_hierarchy = { + type: 'object', + properties: { + data: { + type: 'object', + required: ['type', 'attributes'], + properties: { + type: { + description: 'This represents the type of resource object being returned. Always `hierarchy`.', + type: 'string', + enum: ['hierarchy'] + }, + attributes: { + '$ref': '#/components/schemas/req_attributes_hierarchy' + } + } + } + } +} as const; + +export const $single_hierarchy = { + type: 'object', + properties: { + data: { + '$ref': '#/components/schemas/hierarchy' + } + } +} as const; + +export const $update_hierarchy = { + type: 'object', + required: ['data'], + properties: { + data: { + type: 'object', + required: ['id', 'type', 'attributes'], + properties: { + id: { + type: 'string', + description: 'The unique identifier of the hierarchy. Must match the hierarchy ID specified in the request path.', + example: '00000000-0000-0000-0000-000000000000' + }, + type: { + description: 'This represents the type of resource object being returned. Always `hierarchy`.', + type: 'string', + enum: ['hierarchy'], + example: 'hierarchy' + }, + attributes: { + '$ref': '#/components/schemas/req_attributes_hierarchy' + } + } + } + } +} as const; + +export const $attributes_nodes = { + type: 'object', + additionalProperties: false, + properties: { + name: { + description: 'The name of the node, such as `Ranges` or `Refrigerators`. Names must be unique among sibling nodes in the hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies.', + type: 'string' + }, + description: { + description: 'A description of the node.', + type: 'string' + }, + slug: { + description: 'A slug for the node. Slugs must be unique among sibling nodes in the hierarchy. Otherwise, a slug can be non-unique within the hierarchy and across multiple hierarchies.', + type: 'string' + }, + curated_products: { + description: 'You can curate your products in your nodes product lists. Product curation allows you to promote specific products within each node in a hierarchy, enabling you to create unique product collections in your storefront. See [Curating Products in a node](/docs/api/pxm/products/create-node#curating-products-in-a-node).', + type: 'array', + items: { + description: 'A list of product IDs for the products that you want to curate in a node.', + type: 'string' + } + }, + locales: { + description: 'Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want.', + type: 'object', + additionalProperties: { + description: 'A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used.', + type: 'object', + additionalProperties: false, + properties: { + name: { + description: 'A localized name for the node.', + type: 'string' + }, + description: { + description: 'A localized description for the node.', + type: 'string' + } + } + } + } + } +} as const; + +export const $create_node = { + type: 'object', + properties: { + data: { + type: 'object', + required: ['type', 'attributes'], + properties: { + type: { + description: 'This represents the type of resource object being returned. Always `node`.', + type: 'string', + enum: ['node'] + }, + attributes: { + '$ref': '#/components/schemas/attributes_nodes' + }, + meta: { + type: 'object', + additionalProperties: false, + properties: { + sort_order: { + description: `You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. The \`sort_order\` for each node. This value determines the order of nodes in the response for the \`Get a Node’s Children\` request. The node with the highest value of sort_order is displayed first. For example, a node with a sort_order value of 3 appears before a node with a sort_order value of 2. + +- If you don’t provide \`sort_order\` when creating nodes, all child nodes in the response for \`Get a Node’s Children\` request are ordered by the \`updated_at\` time in descending order, with the most recently updated child node first. +- If you set \`sort_order\` for only a few child nodes or not all, the child nodes with a \`sort_order\` value appear first and then other child nodes appear in the order of \`updated_at\` time. See [Sorting Nodes in a hierarchy](). +`, + type: 'integer' + } + } + } + } + } + } +} as const; + +export const $single_node = { + type: 'object', + properties: { + data: { + '$ref': '#/components/schemas/node' + } + } +} as const; + +export const $update_node = { + type: 'object', + properties: { + data: { + type: 'object', + required: ['id', 'type', 'attributes'], + properties: { + id: { + type: 'string', + description: 'The unique identifier of the node. Must match the node ID specified in the request path.', + example: '00000000-0000-0000-0000-000000000000' + }, + type: { + description: 'This represents the type of resource object being returned. Always `node`.', + type: 'string', + enum: ['node'] + }, + attributes: { + '$ref': '#/components/schemas/attributes_nodes' + }, + meta: { + type: 'object', + additionalProperties: false, + properties: { + sort_order: { + description: `You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. The \`sort_order\` for each node. This value determines the order of nodes in the response for the \`Get a Node’s Children\` request. The node with the highest value of sort_order is displayed first. For example, a node with a sort_order value of 3 appears before a node with a sort_order value of 2. + +- If you don’t provide \`sort_order\` when creating nodes, all child nodes in the response for \`Get a Node’s Children\` request are ordered by the \`updated_at\` time in descending order, with the most recently updated child node first. +- If you set \`sort_order\` for only a few child nodes or not all, the child nodes with a \`sort_order\` value appear first and then other child nodes appear in the order of \`updated_at\` time. +`, + type: 'integer' + } + } + } + } + } + } +} as const; + +export const $node_children = { + type: 'object', + properties: { + data: { + type: 'array', + items: { + type: 'object', + required: ['id', 'type'], + properties: { + id: { + type: 'string', + description: 'The unique identifier of the child node. Must not match the node ID specified in the request path.', + example: '00000000-0000-0000-0000-000000000000' + }, + type: { + description: 'This represents the type of resource object being returned. Always `node`.', + type: 'string', + enum: ['node'] + } + } + } + } + } +} as const; + +export const $node_parent = { + type: 'object', + properties: { + data: { + type: 'object', + required: ['id', 'type'], + properties: { + id: { + type: 'string', + description: 'The unique identifier of the new parent node. Must not match the node ID specified in the request path.', + example: '00000000-0000-0000-0000-000000000000' + }, + type: { + description: 'This represents the type of resource object being returned. Always `node`.', + type: 'string', + enum: ['node'] + } + } + } + } +} as const; + +export const $node_products = { + type: 'object', + properties: { + data: { + type: 'array', + items: { + type: 'object', + required: ['id', 'type'], + properties: { + id: { + type: 'string', + description: 'The unique identifier of the product to be attached to the node.', + example: '00000000-0000-0000-0000-000000000000' + }, + type: { + description: 'This represents the type of resource object being returned. Always `product`.', + type: 'string', + enum: ['product'] + } + } + } + } + } +} as const; + +export const $duplicate_job = { + type: 'object', + properties: { + data: { + type: 'object', + properties: { + type: { + description: 'This represents the type of resource object being returned. Always `hierarchy`.', + type: 'string', + enum: ['hierarchy'] + }, + attributes: { + type: 'object', + additionalProperties: false, + properties: { + name: { + description: 'The name of the duplicate hierarchy. The maximum length is 1000 characters.', + type: 'string' + }, + description: { + description: 'A description of the duplicate hierarchy.', + type: 'string' + }, + include_products: { + description: 'Specify `true` if you want the product associations in the existing nodes associated in your duplicated hierarchy. If not, specify `false`.', + type: 'boolean' + } + } + } + } + } + } +} as const; + +export const $tag = { + type: 'object', + properties: { + id: { + description: 'A unique identifier generated when a tag is created.', + type: 'string' + }, + type: { + description: 'This represents the type of resource object being returned. Always `tag`.', + type: 'string', + enum: ['tag'] + }, + attributes: { + type: 'object', + properties: { + value: { + type: 'string', + description: 'The text value of the tag.' + } + } + }, + meta: { + type: 'object', + properties: { + x_request_id: { + type: 'string', + description: 'A unique request ID is generated when a tag is created.' + }, + created_at: { + type: 'string', + description: 'The date and time a tag is created.', + example: '2020-09-22T09:00:00', + format: 'date-time' + }, + updated_at: { + type: 'string', + description: 'The date and time a tag is updated.', + example: '2020-09-22T09:00:00', + format: 'date-time' + }, + owner: { + description: 'The owner of a resource, either `organization` or `store`.', + type: 'string', + enum: ['store', 'organization'] + } + } + } + } +} as const; + +export const $multi_tag = { + type: 'object', + properties: { + data: { + description: 'An array of tags.', + type: 'array', + items: { + '$ref': '#/components/schemas/tag' + } + }, + meta: { + type: 'object', + properties: { + results: { + description: 'Contains the results for the entire collection.', + type: 'object', + properties: { + total: { + description: 'Total number of results for the entire collection.', + type: 'integer', + example: 2 + } + } + } + } + } + } +} as const; + +export const $single_tag = { + type: 'object', + properties: { + data: { + '$ref': '#/components/schemas/tag' + } + } +} as const; + +export const $req_attributes_custom_relationship = { + type: 'object', + additionalProperties: false, + properties: { + name: { + description: 'The name of the custom relationship, such as `Kitchen electrics`.', + type: 'string' + }, + description: { + description: 'A description of the custom relationship.', + type: 'string' + }, + slug: { + description: 'A unique slug for the custom relationship. Must match the slug specified in the request path.', + type: 'string' + } + } +} as const; + +export const $create_custom_relationship = { + type: 'object', + properties: { + data: { + type: 'object', + required: ['type', 'attributes'], + properties: { + type: { + description: 'This represents the type of resource object being returned. Always `custom-relationship`.', + type: 'string', + enum: ['custom-relationship'] + }, + attributes: { + '$ref': '#/components/schemas/req_attributes_custom_relationship' + } + } + } + } +} as const; + +export const $attributes_custom_relationship = { + type: 'object', + additionalProperties: false, + properties: { + name: { + description: 'The name of the custom relationship, such as `Kitchen electrics`.', + type: 'string' + }, + description: { + description: 'A description of the custom relationship.', + type: 'string' + }, + slug: { + description: 'A unique slug for the custom relationship.', + type: 'string' + } + } +} as const; + +export const $custom_relationship = { + type: 'object', + properties: { + id: { + description: 'A unique identifier generated when a custom relationship is created.', + type: 'string' + }, + type: { + description: 'This represents the type of resource object being returned. Always `hierarchy`.', + type: 'string', + enum: ['custom-relationship'] + }, + attributes: { + '$ref': '#/components/schemas/attributes_custom_relationship' + }, + meta: { + type: 'object', + properties: { + owner: { + description: 'The owner of the resource.', + type: 'string', + example: 'store' + }, + timestamps: { + type: 'object', + properties: { + created_at: { + description: 'The date and time the resource is created.', + type: 'string', + example: '2024-01-10T20:16:35.343Z', + format: 'date-time' + }, + updated_at: { + description: 'The date and time the resource is updated.', + type: 'string', + example: '2024-01-10T20:16:35.343Z', + format: 'date-time' + } + } + } + } + } + } +} as const; + +export const $single_custom_relationship = { + type: 'object', + properties: { + data: { + '$ref': '#/components/schemas/custom_relationship' + } + } +} as const; + +export const $update_custom_relationship = { + type: 'object', + required: ['data'], + properties: { + data: { + type: 'object', + required: ['id', 'type', 'attributes'], + properties: { + id: { + type: 'string', + description: 'The unique identifier of the custom relationship.', + example: '00000000-0000-0000-0000-000000000000' + }, + type: { + description: 'This represents the type of resource object being returned. Always `custom-relationship`.', + type: 'string', + enum: ['custom-relationship'], + example: 'custom-relationship' + }, + attributes: { + '$ref': '#/components/schemas/req_attributes_custom_relationship' + } + } + } + } +} as const; \ No newline at end of file diff --git a/packages/sdks/src/client/services.gen.ts b/packages/sdks/src/client/services.gen.ts new file mode 100644 index 00000000..0a573e2c --- /dev/null +++ b/packages/sdks/src/client/services.gen.ts @@ -0,0 +1,1968 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { CancelablePromise } from './core/CancelablePromise'; +import { OpenAPI } from './core/OpenAPI'; +import { request as __request } from './core/request'; +import type { GetAllJobsResponse, GetJobData, GetJobResponse, CancelJobData, CancelJobResponse, GetJobErrorsData, GetJobErrorsResponse, CreateProductData, CreateProductResponse, GetAllProductsData, GetAllProductsResponse, ImportProductsData, ImportProductsResponse, ExportProductsData, ExportProductsResponse, GetProductData, GetProductResponse, UpdateProductData, UpdateProductResponse, DeleteProductData, DeleteProductResponse, AttachNodesData, AttachNodesResponse, DetachNodesData, DetachNodesResponse, GetProductsNodesData, GetProductsNodesResponse, BuildChildProductsData, BuildChildProductsResponse, GetChildProductsData, GetChildProductsResponse, CreateProductTemplateRelationshipData, CreateProductTemplateRelationshipResponse, GetProductTemplateRelationshipsData, GetProductTemplateRelationshipsResponse, DeleteProductTemplateRelationshipData, DeleteProductTemplateRelationshipResponse, GetProductComponentProductsRelationshipsData, GetProductComponentProductsRelationshipsResponse, GetProductFileRelationshipsData, GetProductFileRelationshipsResponse, CreateProductFileRelationshipsData, CreateProductFileRelationshipsResponse, UpdateProductFileRelationshipsData, UpdateProductFileRelationshipsResponse, DeleteProductFileRelationshipsData, DeleteProductFileRelationshipsResponse, CreateProductVariationRelationshipsData, CreateProductVariationRelationshipsResponse, GetProductVariationRelationshipsData, GetProductVariationRelationshipsResponse, UpdateProductVariationRelationshipsData, UpdateProductVariationRelationshipsResponse, DeleteProductVariationRelationshipsData, DeleteProductVariationRelationshipsResponse, CreateProductMainImageRelationshipsData, CreateProductMainImageRelationshipsResponse, GetProductMainImageRelationshipsData, GetProductMainImageRelationshipsResponse, UpdateProductMainImageRelationshipsData, UpdateProductMainImageRelationshipsResponse, DeleteProductMainImageRelationshipsData, DeleteProductMainImageRelationshipsResponse, CreateVariationData, CreateVariationResponse, GetAllVariationsData, GetAllVariationsResponse, GetVariationData, GetVariationResponse, UpdateVariationData, UpdateVariationResponse, DeleteVariationData, DeleteVariationResponse, CreateVariationOptionData, CreateVariationOptionResponse, GetAllVariationOptionsData, GetAllVariationOptionsResponse, GetVariationOptionData, GetVariationOptionResponse, UpdateVariationOptionData, UpdateVariationOptionResponse, DeleteVariationOptionData, DeleteVariationOptionResponse, CreateModifierData, CreateModifierResponse, GetAllModifiersData, GetAllModifiersResponse, GetModifierData, GetModifierResponse, UpdateModifierData, UpdateModifierResponse, DeleteModifierData, DeleteModifierResponse, CreateHierarchyData, CreateHierarchyResponse, GetHierarchyData, GetHierarchyResponse, GetHierarchyChildData, GetHierarchyChildResponse, UpdateHierarchyData, UpdateHierarchyResponse, DeleteHierarchyData, DeleteHierarchyResponse, CreateNodeData, CreateNodeResponse, GetAllNodesInHierarchyData, GetAllNodesInHierarchyResponse, GetHierarchyNodeData, GetHierarchyNodeResponse, UpdateNodeData, UpdateNodeResponse, DeleteNodeData, DeleteNodeResponse, GetAllChildrenData, GetAllChildrenResponse, CreateNodeChildRelationshipsData, CreateNodeChildRelationshipsResponse, GetAllNodeChildrenData, GetAllNodeChildrenResponse, UpdateNodeParentData, UpdateNodeParentResponse, DeleteNodeParentData, DeleteNodeParentResponse, CreateNodeProductRelationshipData, CreateNodeProductRelationshipResponse, DeleteNodeProductRelationshipsData, DeleteNodeProductRelationshipsResponse, GetNodeProductsData, GetNodeProductsResponse, DuplicateHierarchyData, DuplicateHierarchyResponse, GetAllProductTagsResponse, GetProductTagData, GetProductTagResponse, CreateCustomRelationshipData, CreateCustomRelationshipResponse, UpdateCustomRelationshipData, UpdateCustomRelationshipResponse } from './types.gen'; + +/** + * Get All Jobs + * The jobs endpoints displays the status of a number of endpoints that function as jobs, for example, product import and export, price book import, building child products, and duplicating hierarchies. + * @returns multi Returns all the jobs. + * @throws ApiError + */ +export const getAllJobs = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/pcm/jobs', + errors: { + 400: 'Bad request. The request failed validation.', + 404: 'Bad Request. Not Found.', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Get a Job + * @param data The data for the request. + * @param data.jobId A unique identifier for the job. + * @returns single Returns a job with the following attributes. + * @throws ApiError + */ +export const getJob = (data: GetJobData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/pcm/jobs/{jobID}', + path: { + jobID: data.jobId + }, + errors: { + 400: 'Bad request. The request failed validation.', + 404: 'Bad Request. Not Found.', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Cancel a Job + * The jobs endpoints display the status of a number of endpoints that function as jobs, for example, product import and export, and duplicating hierarchies. + * + * Jobs are processed one at a time. You can continue to send job requests, but those jobs are queued. In other words, Commerce looks for any jobs that have a status of PENDING and starts the job with the earliest created date. If you decide that a specific job needs to be prioritized over another, you can cancel the less critical job using the `Cancel a job` endpoint. You can only cancel jobs whose status is PENDING. + * + * @param data The data for the request. + * @param data.jobId A unique identifier for the job. + * @param data.requestBody + * @returns single Successfully cancelled job + * @throws ApiError + */ +export const cancelJob = (data: CancelJobData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/pcm/jobs/{jobID}/cancel', + path: { + jobID: data.jobId + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 400: 'Bad request. The request failed validation.', + 404: 'Bad Request. Not Found.', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Get Job Errors + * @param data The data for the request. + * @param data.jobId A unique identifier for the job. + * @returns errors Successful + * @throws ApiError + */ +export const getJobErrors = (data: GetJobErrorsData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/pcm/jobs/{jobID}/errors', + path: { + jobID: data.jobId + }, + errors: { + 400: 'Bad request. The request failed validation.', + 404: 'Bad Request. Not Found.', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Create a product or bundle + * Creates a product or bundle with the attributes that are defined in the body. + * + * #### Product Types + * + * Commerce automatically assigns types to the products you create. In Commerce Manager, you can see at a glance the product types in a list of a products. In addition, you can filter on product types in both the API and Commerce Manager. + * + * Product types can also be used in catalogs. For example, in your catalog, you can filter on `parent` so that only your parent products are displayed in your storefront. + * + * See [**Product Types**](/docs/api/pxm/products/products#product-types). + * + * #### Product Tags + * + * You can use product tags to store or assign a key word against a product or service that you sell in your store. The product tag can then be used to describe or label that product. Product tags represent similarities between products who do not share the same attributes. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. + * + * See [**Product Tags**](/docs/api/pxm/products/product-tags). + * + * #### Personalizing products + * + * You can allow your shoppers to add custom text to a product when adding product items to their carts. This is useful, for example, if you have a product like a T-shirt that can be personalized or you sell greetings cards that can be printed with your shoppers personalized messages. You can do this by configuring the the `custom_inputs` attribute. + * + * When configuring the `custom_inputs` attribute: + * + * - You can rename `input` to something more representative of the input that shoppers are adding, for example, `message` or `front`. + * - `name` is the name that is displayed in your storefront. + * - You can add validation rules. For example, the input field must be a `string` and/or up to 255 characters in length. The limit is 255 characters. + * - You can specify if the input field is required. + * + * #### Curating Products + * + * You can curate the products in a node. Product curation allows you to promote specific products within each node of your hierarchies, enabling you to create unique product collections in your storefront. For example, you may find you have an abundance of cotton T-Shirts and you want to promote these products to the top of the product list. When a shopper navigates to T-shirts, the cotton T-Shirts are displayed first. See [**Update a node**](/docs/api/pxm/products/update-node). + * + * #### Bundles + * + * With Product Experience Manager, you can use the products API to create and manage bundles. A bundle is a purchasable product, comprising of one or more products that you want to sell together. + * + * See [**Bundles**](/docs/api/pxm/products/products#bundles). + * + * @param data The data for the request. + * @param data.requestBody + * @returns single_product_response Creates a product with the following attributes. + * @throws ApiError + */ +export const createProduct = (data: CreateProductData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/pcm/products', + body: data.requestBody, + mediaType: 'application/json', + errors: { + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Get all products + * Retrieves a list of all your products in the Product Experience Manager system. + * + * You can also use `include` to retrieve top-level resources, such as files or images, and key attribute data, such as SKU or slug for component products in a product bundle. With this option, you can get more information about the products in a product bundle in your store front, improving the buying experience for your shoppers. + * + * #### Filtering + * + * Many Commerce API endpoints support filtering. The general syntax is described in [**Filtering**](/docs/commerce-cloud/api-overview/filtering). + * + * The following attributes and operators are supported. + * + * | Operator | Attribute | Description | Example | + * | :--- |:------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------| + * | `eq` | `sku`, `slug`,`upc_ean`, `mpn`, `name`, `templates`, `commodity_type`, `owner`, `product_types`, `tags` | Equals. Checks if the values of two operands are equal. If they are, the condition is true. For `product_types`, you can only specify one product type. For example, `filter=eq(product_types,child)` | `filter=eq(name,some-name)` | + * | `like` | `sku`, `slug`,`upc_ean`, `mpn`, `name`, `tags` | Like. Checks if the operand contains the specified string. Wildcards are supported. | `filter=like(name,*some-name*)` | + * | `In` | `id`, `name`, `SKU`, `slug`, `upc_ean`, `mpn`, `product_types`, `tags` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `filter=in(id,some-id)` | + * + * @param data The data for the request. + * @param data.pageOffset The number of records to offset the results by. + * @param data.pageLimit The number of records per page. The maximum limit is 100. + * @param data.filter Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering). + * + * For more information about the attributes and operators that are supported, see [Get all products](/docs/api/pxm/products/get-all-products). + * + * @param data.include Using the include parameter, you can retrieve top-level resources. + * + * - Files or main image. For example, `include=files,main_image`. + * - Component product data. For example, `include=component_products`. + * - Key attribute data, such as SKU or slug. + * + * @returns multi_product_response Returns a list of all products. + * @throws ApiError + */ +export const getAllProducts = (data: GetAllProductsData = {}): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/pcm/products', + query: { + 'page[offset]': data.pageOffset, + 'page[limit]': data.pageLimit, + filter: data.filter, + include: data.include + }, + errors: { + 400: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Import Products + * + * You can use the Product Import API to: + * + * - Add new products, including: + * + * - main image files. See [Importing Main Image Files](/docs/api/pxm/products/product-import-bulk-update#using-imported-main-image-files). + * - custom data. See [Importing custom data](/docs/api/pxm/products/product-import-bulk-update#importing-custom-data-flows). + * - Make bulk updates to existing products. + * + * You cannot use product import to: + * + * - Delete existing products. + * - Import product bundles. + * + * The Product Import API uses a Comma Separated Values (CSV) file to import products, main image files and custom extension data. Each row in a .csv file represents a product you want to create/update. + * + * Each file can have 50,000 rows, including the header. If a CSV file exceeds 50,000 rows, an error is displayed, and the products are not imported. A CSV file must not be larger than 50 megabytes. If a CSV file is larger than 50 megabytes, a `503 client read` error is displayed. + * + * If you want to create/update more than 50,000 products or your CSV file is larger than 50 megabytes, you must have a separate CSV file and import each CSV file one at a time. + * + * See [**Characteristics of CSV Files**](/docs/api/pxm/products/product-import-bulk-update#characteristics-of-csv-import-files). + * + * @param data The data for the request. + * @param data.formData + * @returns single Import started + * @throws ApiError + */ +export const importProducts = (data: ImportProductsData = {}): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/pcm/products/import', + formData: data.formData, + mediaType: 'multipart/form-data', + errors: { + 400: 'Bad request. The request failed validation.', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Export Products + * + * The Export API is available to make bulk updates to products in Product Experience Manager. You might also export products for your personal requirements. + * + * The Export API builds a CSV file containing the product entries. A CSV file can contain up to 50,000 product entries. If you have more than 50,000 product entries, then another CSV file is created and so on, until all your products are exported. + * + * The Job endpoint response specifies the location where the CSV file is stored. See [Characteristics of CSV Files](/docs/api/pxm/products/product-export#characteristics-of-exporting-products). + * + * ### Filtering + * + * The following attributes and operators are supported. + * + * | Operator | Attribute | Description | Example | + * | :--- |:-------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------| :--- | + * | `eq` | `sku`, `slug`, `upc_ean`, `mpn`, `name`, `description`, `tags` | Equals. Checks if the values of two operands are equal. If they are, the condition is true. When filtering on tags, you can only specify one product tag. | `filter=eq(name,some-name)` | + * | `In` | `sku`, `tags` | Checks if the values are included in the specified string. If they are, the condition is true. When filtering on tags, you can specify a list of product tags. | `filter=in(id,some-id)` | + * | `like` | `sku`, `slug`, `upc_ean`, `mpn`, `name`, `description` | Like. Checks if the operand contains the specified string. Wildcards are supported. | `filter=like(name,some-name)` | + * + * @param data The data for the request. + * @param data.useTemplateSlugs Set to `true` if you want to use a template slug instead of a template ID when exporting products that have custom data. + * @param data.filter + * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering), but you must go to a specific endpoint to understand the attributes and operators an endpoint supports. + * + * For more information about the attributes and operators that this endpoint supports, see [Export Products](/docs/api/pxm/products/export-products). + * + * @param data.requestBody + * @returns single Export started + * @throws ApiError + */ +export const exportProducts = (data: ExportProductsData = {}): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/pcm/products/export', + query: { + useTemplateSlugs: data.useTemplateSlugs, + filter: data.filter + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 400: 'Bad request. The request failed validation.', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Get a product + * Returns a product by its identifier. + * + * You can also use `include=component_products` to retrieve top-level resources, such as files or images, and key attribute data, such as SKU or slug for component products in a product bundle. With this option, you can get more information about the products in a product bundle in your store front, improving the buying experience for your shoppers. + * + * @param data The data for the request. + * @param data.productId A unique identifier for the product. + * @param data.include Using the include parameter, you can retrieve top-level resources. + * + * - Files or main image. For example, `include=files,main_image`. + * - Component product data. For example, `include=component_products`. + * - Key attribute data, such as SKU or slug. + * + * @returns single_product_response Returns a product by its identifier. + * @throws ApiError + */ +export const getProduct = (data: GetProductData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/pcm/products/{productID}', + path: { + productID: data.productId + }, + query: { + include: data.include + }, + errors: { + 400: 'Bad request. The request failed validation.', + 404: 'Bad Request. Not Found.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Update a product or bundle + * Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the product or bundle is not updated. + * @param data The data for the request. + * @param data.productId A unique identifier for the product. + * @param data.requestBody + * @returns single_product_response Updates a product with the following attributes. + * @throws ApiError + */ +export const updateProduct = (data: UpdateProductData): CancelablePromise => { return __request(OpenAPI, { + method: 'PUT', + url: '/pcm/products/{productID}', + path: { + productID: data.productId + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 403: 'Forbidden', + 404: 'Bad Request. Not Found.', + 409: 'Write conflict detected', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Delete a product + * Deletes the specified product. + * + * You cannot delete a product if it is part of a bundle. You must first delete the bundle before you delete the product. + * + * @param data The data for the request. + * @param data.productId A unique identifier for the product. + * @returns void Deletes the specified product. + * @throws ApiError + */ +export const deleteProduct = (data: DeleteProductData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/pcm/products/{productID}', + path: { + productID: data.productId + }, + errors: { + 403: 'Forbidden', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Attach multiple nodes + * Assigns products to multiple hierarchies and their children nodes. You can apply a filter to search for the appropriate products to attach to a node. For general filtering syntax, see [**Filtering**](/docs/commerce-cloud/api-overview/filtering). + * + * The following attributes and operators are supported. + * + * | Operator | Attribute | Description | Example | + * | :--- |:------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------| + * | `eq` | `sku`, `slug`,`upc_ean`, `mpn`, `name`, `templates`, `commodity_type`, `owner`, `product_types` | Equals. Checks if the values of two operands are equal. If they are, the condition is true. For `product_types`, you can only specify one product type. For example, `filter=eq(product_types,child)` | `filter=eq(name,some-name)` | + * | `like` | `sku`, `slug`,`upc_ean`, `mpn`, `name` | Like. Checks if the operand contains the specified string. Wildcards are supported. | `filter=like(name,*some-name*)` | + * | `In` | `id`, `name`, `SKU`, `slug`, `upc_ean`, `mpn`, `product_types` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `filter=in(id,some-id)` | + * + * + * @param data The data for the request. + * @param data.requestBody + * @returns unknown This request assigns the products that you have selected to multiple hierarchies and their children nodes and returns the following. + * @throws ApiError + */ +export const attachNodes = (data: AttachNodesData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/pcm/products/attach_nodes', + body: data.requestBody, + mediaType: 'application/json', + errors: { + 400: 'Bad request. The request failed validation.', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Detach multiple nodes + * Dissociates products from multiple hierarchies and their children nodes. You can apply filters to search for the appropriate products to detach. For general filtering syntax, see [**Filtering**](/docs/commerce-cloud/api-overview/filtering). + * + * The following attributes and operators are supported. + * + * | Operator | Attribute | Description | Example | + * | :--- |:------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------| + * | `eq` | `sku`, `slug`,`upc_ean`, `mpn`, `name`, `templates`, `commodity_type`, `owner`, `product_types` | Equals. Checks if the values of two operands are equal. If they are, the condition is true. For `product_types`, you can only specify one product type. For example, `filter=eq(product_types,child)` | `filter=eq(name,some-name)` | + * | `like` | `sku`, `slug`,`upc_ean`, `mpn`, `name` | Like. Checks if the operand contains the specified string. Wildcards are supported. | `filter=like(name,*some-name*)` | + * | `In` | `id`, `name`, `SKU`, `slug`, `upc_ean`, `mpn`, `product_types` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `filter=in(id,some-id)` | + * + * @param data The data for the request. + * @param data.requestBody + * @returns unknown The request dissociates the products that you have selected from multiple hierarchies and their children and returns the following. + * @throws ApiError + */ +export const detachNodes = (data: DetachNodesData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/pcm/products/detach_nodes', + body: data.requestBody, + mediaType: 'application/json', + errors: { + 400: 'Bad request. The request failed validation.', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Get a product's nodes + * Returns the nodes associated with the product. Products must be in a `live` status. + * @param data The data for the request. + * @param data.productId A unique identifier for the product. + * @param data.pageOffset The number of records to offset the results by. + * @param data.pageLimit The number of records per page. The maximum limit is 100. + * @returns multi_nodes Successfully returns the product's nodes. + * @throws ApiError + */ +export const getProductsNodes = (data: GetProductsNodesData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/pcm/products/{productID}/nodes', + path: { + productID: data.productId + }, + query: { + 'page[offset]': data.pageOffset, + 'page[limit]': data.pageLimit + }, + errors: { + 400: 'Bad request. The request failed validation.', + 404: 'Bad Request. Not Found.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Build child products + * With product variations in Product Experience Manager, you can create product variations and different options for each variation and use both to create child products for a product. Each child product is a unique combination of options associated with the product. + * + * Child products inherit attributes from their parent products. When you make changes to the attributes of the parent products, you can rebuild your child products, ensuring that changes to the parent products are propagated to the child products. + * + * Alternatively, you can modify a child product independently, without impacting its parent product. For example, you may prefer the status of your child product to be `live`, while keeping the parent product's status as `draft`. When you directly update a child product, it becomes independent of its parent product. In other words, any subsequent changes made to the parent product are not automatically reflected in the child product when you rebuild the parent product and its child products. Once a child product is independent of its parent, you cannot recreate the association between the child product and its parent. You must delete the child product and rebuild the parent to recreate the child product. + * + * Following on from that, if you add the same flow to both a parent and child product, the child flow values are not affected by changes to the parent flow values in a rebuild. + * + * ### Using Build Rules + * + * When building your child products, you can build all products related to a product. + * + * Alternatively, you can build a combination of child products associated with a product, based on build rules that you specify. This is useful, for example, if you have a variation option that you do not sell. This makes managing and building your child products quick and easy. You can do this using `build_rules`. `build_rules` are combinations of variation option IDs that you wish to include or exclude when building your child products. + * + * :::note + * + * You do not need to configure any `build_rules` in the following scenarios: + * + * - Child products must be built with all variation options. Simply, use the `Create a product` or `Update a product` endpoints with no `build_rules` specified. + * - Child products must be built apart from all options for a specific variation. In this case, you must remove the variation and use the `Create a product` or `Update a product` endpoints with no `build_rules` specified. In other words, using our example, if none of the `size` options should be included, then remove the `size` variation. + * + * ::: + * + * The `build_rules` contain: + * + * - (Required) `default`: specifies the default behavior. + * - (Optional) `include`: specifies the option IDs to include when the child products are built. Each combination consists of a nested array of option IDs from one or more variations. Combinations of option IDs in the nested arrays must come from different variations. See [**Invalid Build Rules**](#invalid-build-rules). + * - (Optional) `exclude`: specifies the option IDs to exclude when the child products are built. Each combination consists of a nested array of option IDs from one or more variations. Combinations of option IDs in the nested arrays must come from different variations. See [**Invalid build rules**](#invalid-build-rules). + * + * When building child products, Commerce compares each combination of option IDs to these rules to determine how your child products should be built, depending on how you have configured the `build_rules`. It depends on your requirements how you configure your `build_rules`. + * + * #### Invalid Build Rules + * + * The `build_rules` are invalid if both the option IDs come from the same variation. Combinations of option IDs in the nested arrays must come from different variations. + * + * If Commerce cannot resolve the `build_rules` a `could not determine whether to include or exclude a child product due to ambiguous rules` error is returned. This error can occur, for example, if you have the same number of variation option IDs in both the `include` and `exclude` arrays and the variation option IDs match. + * + * ### Building Child Products + * + * Building child products is an asynchronous operation. When you build child products, a job is created. The jobId of the job is displayed in the response. When the job is complete, the build child products operation is also complete. You can use the jobId to see the status of your job using the `Get a Job` endpoint. + * + * Jobs are processed one at a time. You can continue to send build child product requests, but those jobs are queued. In other words, Commerce looks for any jobs that have a status of PENDING and starts the job with the earliest created date. This process is repeated until all jobs are processed. See Jobs. + * + * Re-building child products after adding or removing a new variation changes the total number of child products that you can generate from a parent product. When you rebuild the child products after updating variations associated with the parent product, all existing child products that belong to a parent product are deleted. New child products are created with new product IDs. + * + * If you have any bundles that reference child products directly, then you must update the bundles with the new child product IDs. + * + * However, re-building child products after adding or removing an option does not change the existing product IDs. + * + * @param data The data for the request. + * @param data.productId A unique identifier for the product. + * @param data.requestBody + * @returns unknown Successfully started building child products + * @throws ApiError + */ +export const buildChildProducts = (data: BuildChildProductsData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/pcm/products/{productID}/build', + path: { + productID: data.productId + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 403: 'Forbidden', + 404: 'Bad Request. Not Found.', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Get child products + * @param data The data for the request. + * @param data.productId A unique identifier for the product. + * @returns multi_product_response Returns a list of child products for the specified parent product ID. + * @throws ApiError + */ +export const getChildProducts = (data: GetChildProductsData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/pcm/products/{productID}/children', + path: { + productID: data.productId + }, + errors: { + 400: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Create a product template relationship + * Retrieves all the templates that are associated with the specified product. + * @param data The data for the request. + * @param data.productId A unique identifier for the product. + * @param data.requestBody + * @returns template_response Returns a created product template relationship. + * @throws ApiError + */ +export const createProductTemplateRelationship = (data: CreateProductTemplateRelationshipData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/pcm/products/{productID}/relationships/templates', + path: { + productID: data.productId + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 400: 'Bad request. The request failed validation.', + 403: 'Forbidden', + 404: 'Bad Request. Not Found.', + 409: 'Write conflict detected', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Get all product template relationships + * @param data The data for the request. + * @param data.productId A unique identifier for the product. + * @returns template_response Returns all product template relationships + * @throws ApiError + */ +export const getProductTemplateRelationships = (data: GetProductTemplateRelationshipsData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/pcm/products/{productID}/relationships/templates', + path: { + productID: data.productId + }, + errors: { + 400: 'Bad request. The request failed validation.', + 403: 'Forbidden', + 404: 'Bad Request. Not Found.', + 409: 'Write conflict detected', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Delete a product template relationship + * @param data The data for the request. + * @param data.productId A unique identifier for the product. + * @param data.requestBody + * @returns void No Content + * @throws ApiError + */ +export const deleteProductTemplateRelationship = (data: DeleteProductTemplateRelationshipData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/pcm/products/{productID}/relationships/templates', + path: { + productID: data.productId + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 400: 'Bad request. The request failed validation.', + 403: 'Forbidden', + 404: 'Bad Request. Not Found.', + 409: 'Write conflict detected', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Get Bundle Component Product Relationships + * Retrieves all the products included in the specified bundle product. + * @param data The data for the request. + * @param data.productId A unique identifier for the product. + * @returns component_products_response Returns all Component Products relationships + * @throws ApiError + */ +export const getProductComponentProductsRelationships = (data: GetProductComponentProductsRelationshipsData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/pcm/products/{productID}/relationships/component_products', + path: { + productID: data.productId + }, + errors: { + 400: 'Bad request. The request failed validation.', + 403: 'Forbidden', + 404: 'Bad Request. Not Found.', + 409: 'Write conflict detected', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Get all product file relationships + * Retrieves all files that are associated with the specified product. + * @param data The data for the request. + * @param data.productId A unique identifier for the product. + * @returns file_response Returns all product file relationships. + * @throws ApiError + */ +export const getProductFileRelationships = (data: GetProductFileRelationshipsData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/pcm/products/{productID}/relationships/files', + path: { + productID: data.productId + }, + errors: { + 400: 'Bad request. The request failed validation.', + 403: 'Forbidden', + 404: 'Bad Request. Not Found.', + 409: 'Write conflict detected', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Create a product file relationship + * @param data The data for the request. + * @param data.productId A unique identifier for the product. + * @param data.requestBody + * @returns void No Content + * @throws ApiError + */ +export const createProductFileRelationships = (data: CreateProductFileRelationshipsData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/pcm/products/{productID}/relationships/files', + path: { + productID: data.productId + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 400: 'Bad request. The request failed validation.', + 403: 'Forbidden', + 404: 'Bad Request. Not Found.', + 409: 'Write conflict detected', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Replace a product file relationship + * @param data The data for the request. + * @param data.productId A unique identifier for the product. + * @param data.requestBody + * @returns void No Content + * @throws ApiError + */ +export const updateProductFileRelationships = (data: UpdateProductFileRelationshipsData): CancelablePromise => { return __request(OpenAPI, { + method: 'PUT', + url: '/pcm/products/{productID}/relationships/files', + path: { + productID: data.productId + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 400: 'Bad request. The request failed validation.', + 403: 'Forbidden', + 404: 'Bad Request. Not Found.', + 409: 'Write conflict detected', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Delete a product file relationships + * @param data The data for the request. + * @param data.productId A unique identifier for the product. + * @param data.requestBody + * @returns void No Content + * @throws ApiError + */ +export const deleteProductFileRelationships = (data: DeleteProductFileRelationshipsData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/pcm/products/{productID}/relationships/files', + path: { + productID: data.productId + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 400: 'Bad request. The request failed validation.', + 403: 'Forbidden', + 404: 'Bad Request. Not Found.', + 409: 'Write conflict detected', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Create a product variation relationship + * @param data The data for the request. + * @param data.productId A unique identifier for the product. + * @param data.requestBody + * @returns void No Content + * @throws ApiError + */ +export const createProductVariationRelationships = (data: CreateProductVariationRelationshipsData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/pcm/products/{productID}/relationships/variations', + path: { + productID: data.productId + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 400: 'Bad request. The request failed validation.', + 403: 'Forbidden', + 404: 'Bad Request. Not Found.', + 409: 'Write conflict detected', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Get all product variation relationships + * @param data The data for the request. + * @param data.productId A unique identifier for the product. + * @returns variations_response Returns all product variation relationships + * @throws ApiError + */ +export const getProductVariationRelationships = (data: GetProductVariationRelationshipsData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/pcm/products/{productID}/relationships/variations', + path: { + productID: data.productId + }, + errors: { + 400: 'Bad request. The request failed validation.', + 403: 'Forbidden', + 404: 'Bad Request. Not Found.', + 409: 'Write conflict detected', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Replace a product variation relationship + * @param data The data for the request. + * @param data.productId A unique identifier for the product. + * @param data.requestBody + * @returns void No Content + * @throws ApiError + */ +export const updateProductVariationRelationships = (data: UpdateProductVariationRelationshipsData): CancelablePromise => { return __request(OpenAPI, { + method: 'PUT', + url: '/pcm/products/{productID}/relationships/variations', + path: { + productID: data.productId + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 400: 'Bad request. The request failed validation.', + 403: 'Forbidden', + 404: 'Bad Request. Not Found.', + 409: 'Write conflict detected', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Delete a product variation relationships + * @param data The data for the request. + * @param data.productId A unique identifier for the product. + * @param data.requestBody + * @returns void No Content + * @throws ApiError + */ +export const deleteProductVariationRelationships = (data: DeleteProductVariationRelationshipsData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/pcm/products/{productID}/relationships/variations', + path: { + productID: data.productId + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 400: 'Bad request. The request failed validation.', + 403: 'Forbidden', + 404: 'Bad Request. Not Found.', + 409: 'Write conflict detected', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Create main image relationships + * Associates a main image with the specified product. + * @param data The data for the request. + * @param data.productId A unique identifier for the product. + * @param data.requestBody + * @returns void No Content + * @throws ApiError + */ +export const createProductMainImageRelationships = (data: CreateProductMainImageRelationshipsData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/pcm/products/{productID}/relationships/main_image', + path: { + productID: data.productId + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 400: 'Bad request. The request failed validation.', + 403: 'Forbidden', + 404: 'Bad Request. Not Found.', + 409: 'Write conflict detected', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Get Main Image Relationships + * @param data The data for the request. + * @param data.productId A unique identifier for the product. + * @returns main_image_response Returns all product variation relationships + * @throws ApiError + */ +export const getProductMainImageRelationships = (data: GetProductMainImageRelationshipsData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/pcm/products/{productID}/relationships/main_image', + path: { + productID: data.productId + }, + errors: { + 400: 'Bad request. The request failed validation.', + 403: 'Forbidden', + 404: 'Bad Request. Not Found.', + 409: 'Write conflict detected', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Replace Main Image Relationships + * @param data The data for the request. + * @param data.productId A unique identifier for the product. + * @param data.requestBody + * @returns void No Content + * @throws ApiError + */ +export const updateProductMainImageRelationships = (data: UpdateProductMainImageRelationshipsData): CancelablePromise => { return __request(OpenAPI, { + method: 'PUT', + url: '/pcm/products/{productID}/relationships/main_image', + path: { + productID: data.productId + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 400: 'Bad request. The request failed validation.', + 403: 'Forbidden', + 404: 'Bad Request. Not Found.', + 409: 'Write conflict detected', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Delete Main Image Relationships + * @param data The data for the request. + * @param data.productId A unique identifier for the product. + * @returns void No Content + * @throws ApiError + */ +export const deleteProductMainImageRelationships = (data: DeleteProductMainImageRelationshipsData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/pcm/products/{productID}/relationships/main_image', + path: { + productID: data.productId + }, + errors: { + 400: 'Bad request. The request failed validation.', + 403: 'Forbidden', + 404: 'Bad Request. Not Found.', + 409: 'Write conflict detected', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Create a variation + * @param data The data for the request. + * @param data.requestBody + * @returns created_variation Returns a created variation with the following attributes. + * @throws ApiError + */ +export const createVariation = (data: CreateVariationData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/pcm/variations', + body: data.requestBody, + mediaType: 'application/json', + errors: { + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Get all variations + * @param data The data for the request. + * @param data.pageOffset The number of records to offset the results by. + * @param data.pageLimit The number of records per page. The maximum limit is 100. + * @returns multi_variations Returns all variations. + * @throws ApiError + */ +export const getAllVariations = (data: GetAllVariationsData = {}): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/pcm/variations', + query: { + 'page[offset]': data.pageOffset, + 'page[limit]': data.pageLimit + }, + errors: { + 400: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Get a variation + * @param data The data for the request. + * @param data.variationId A unique identifier for the variation. + * @returns single_variation Returns the specified variation. + * @throws ApiError + */ +export const getVariation = (data: GetVariationData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/pcm/variations/{variationID}', + path: { + variationID: data.variationId + }, + errors: { + 400: 'Bad request. The request failed validation.', + 404: 'Bad Request. Not Found.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Update a variation + * Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the variation is not updated. + * @param data The data for the request. + * @param data.variationId A unique identifier for the variation. + * @param data.requestBody + * @returns single_variation Returns an updated variation with the following attributes. + * @throws ApiError + */ +export const updateVariation = (data: UpdateVariationData): CancelablePromise => { return __request(OpenAPI, { + method: 'PUT', + url: '/pcm/variations/{variationID}', + path: { + variationID: data.variationId + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 403: 'Forbidden', + 404: 'Bad Request. Not Found.', + 409: 'Write conflict detected', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Delete a variation and all it's associated options + * @param data The data for the request. + * @param data.variationId A unique identifier for the variation. + * @returns void No Content + * @throws ApiError + */ +export const deleteVariation = (data: DeleteVariationData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/pcm/variations/{variationID}', + path: { + variationID: data.variationId + }, + errors: { + 403: 'Forbidden', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Create a variation option + * @param data The data for the request. + * @param data.variationId A unique identifier for the variation. + * @param data.requestBody + * @returns created_option Successfully returns the created variation option + * @throws ApiError + */ +export const createVariationOption = (data: CreateVariationOptionData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/pcm/variations/{variationID}/options', + path: { + variationID: data.variationId + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Get all variation options + * @param data The data for the request. + * @param data.variationId A unique identifier for the variation. + * @param data.pageOffset The number of records to offset the results by. + * @param data.pageLimit The number of records per page. The maximum limit is 100. + * @returns multi_options Successfully returns all variation options + * @throws ApiError + */ +export const getAllVariationOptions = (data: GetAllVariationOptionsData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/pcm/variations/{variationID}/options', + path: { + variationID: data.variationId + }, + query: { + 'page[offset]': data.pageOffset, + 'page[limit]': data.pageLimit + }, + errors: { + 400: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Get a variation option + * @param data The data for the request. + * @param data.variationId A unique identifier for the variation. + * @param data.optionId A unique identifier for the option. + * @returns single_option Successfully returns the variation option + * @throws ApiError + */ +export const getVariationOption = (data: GetVariationOptionData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/pcm/variations/{variationID}/options/{optionID}', + path: { + variationID: data.variationId, + optionID: data.optionId + }, + errors: { + 400: 'Bad request. The request failed validation.', + 404: 'Bad Request. Not Found.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Update a variation option + * @param data The data for the request. + * @param data.variationId A unique identifier for the variation. + * @param data.optionId A unique identifier for the option. + * @param data.requestBody + * @returns single_option Successfully returns the updated variation option + * @throws ApiError + */ +export const updateVariationOption = (data: UpdateVariationOptionData): CancelablePromise => { return __request(OpenAPI, { + method: 'PUT', + url: '/pcm/variations/{variationID}/options/{optionID}', + path: { + variationID: data.variationId, + optionID: data.optionId + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 403: 'Forbidden', + 404: 'Bad Request. Not Found.', + 409: 'Write conflict detected', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Delete a variation option + * @param data The data for the request. + * @param data.variationId A unique identifier for the variation. + * @param data.optionId A unique identifier for the option. + * @returns void No Content + * @throws ApiError + */ +export const deleteVariationOption = (data: DeleteVariationOptionData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/pcm/variations/{variationID}/options/{optionID}', + path: { + variationID: data.variationId, + optionID: data.optionId + }, + errors: { + 403: 'Forbidden', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Create a modifier + * @param data The data for the request. + * @param data.variationId A unique identifier for the variation. + * @param data.optionId A unique identifier for the option. + * @param data.requestBody + * @returns created_modifier Successfully returns the created modifier + * @throws ApiError + */ +export const createModifier = (data: CreateModifierData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/pcm/variations/{variationID}/options/{optionID}/modifiers', + path: { + variationID: data.variationId, + optionID: data.optionId + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Get all modifiers + * @param data The data for the request. + * @param data.variationId A unique identifier for the variation. + * @param data.optionId A unique identifier for the option. + * @param data.pageOffset The number of records to offset the results by. + * @param data.pageLimit The number of records per page. The maximum limit is 100. + * @returns multi_modifiers Successfully returns all variation modifiers + * @throws ApiError + */ +export const getAllModifiers = (data: GetAllModifiersData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/pcm/variations/{variationID}/options/{optionID}/modifiers', + path: { + variationID: data.variationId, + optionID: data.optionId + }, + query: { + 'page[offset]': data.pageOffset, + 'page[limit]': data.pageLimit + }, + errors: { + 400: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Get a modifier + * @param data The data for the request. + * @param data.variationId A unique identifier for the variation. + * @param data.optionId A unique identifier for the option. + * @param data.modifierId A unique identifier for the modifier. + * @returns single_modifier Returns the specified modifier. + * @throws ApiError + */ +export const getModifier = (data: GetModifierData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/pcm/variations/{variationID}/options/{optionID}/modifiers/{modifierID}', + path: { + variationID: data.variationId, + optionID: data.optionId, + modifierID: data.modifierId + }, + errors: { + 400: 'Bad request. The request failed validation.', + 404: 'Bad Request. Not Found.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Update a modifier + * Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the modifier is not updated. + * @param data The data for the request. + * @param data.variationId A unique identifier for the variation. + * @param data.optionId A unique identifier for the option. + * @param data.modifierId A unique identifier for the modifier. + * @param data.requestBody + * @returns single_modifier Successfully returns the updated modifier + * @throws ApiError + */ +export const updateModifier = (data: UpdateModifierData): CancelablePromise => { return __request(OpenAPI, { + method: 'PUT', + url: '/pcm/variations/{variationID}/options/{optionID}/modifiers/{modifierID}', + path: { + variationID: data.variationId, + optionID: data.optionId, + modifierID: data.modifierId + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 403: 'Forbidden', + 404: 'Bad Request. Not Found.', + 409: 'Write conflict detected', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Delete a modifier + * You cannot delete a modifier if it is in use. Deleting a modifier in us returns a `422 Failed Validation` error. + * @param data The data for the request. + * @param data.variationId A unique identifier for the variation. + * @param data.optionId A unique identifier for the option. + * @param data.modifierId A unique identifier for the modifier. + * @returns void No Content + * @throws ApiError + */ +export const deleteModifier = (data: DeleteModifierData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/pcm/variations/{variationID}/options/{optionID}/modifiers/{modifierID}', + path: { + variationID: data.variationId, + optionID: data.optionId, + modifierID: data.modifierId + }, + errors: { + 403: 'Forbidden', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Create a hierarchy + * Create a hierarchy + * @param data The data for the request. + * @param data.requestBody + * @returns single_hierarchy Returns a created hierarchy with the following attributes. + * @throws ApiError + */ +export const createHierarchy = (data: CreateHierarchyData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/pcm/hierarchies', + body: data.requestBody, + mediaType: 'application/json', + errors: { + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Get all hierarchies + * Get all hierarchies + * @param data The data for the request. + * @param data.pageOffset The number of records to offset the results by. + * @param data.pageLimit The number of records per page. The maximum limit is 100. + * @returns multi_hierarchy Returns a list of all hierarchies. + * @throws ApiError + */ +export const getHierarchy = (data: GetHierarchyData = {}): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/pcm/hierarchies', + query: { + 'page[offset]': data.pageOffset, + 'page[limit]': data.pageLimit + }, + errors: { + 400: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Get a hierarchy + * Retrieves the specified hierarchy. + * @param data The data for the request. + * @param data.hierarchyId A unique identifier for the hierarchy. + * @returns single_hierarchy Returns a hierarchy with the following attributes. + * @throws ApiError + */ +export const getHierarchyChild = (data: GetHierarchyChildData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/pcm/hierarchies/{hierarchyID}', + path: { + hierarchyID: data.hierarchyId + }, + errors: { + 400: 'Bad request. The request failed validation.', + 404: 'Bad Request. Not Found.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Update a hierarchy + * Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the hierarchy is not updated. + * @param data The data for the request. + * @param data.hierarchyId A unique identifier for the hierarchy. + * @param data.requestBody + * @returns single_hierarchy Successfully returns the updated hierarchy + * @throws ApiError + */ +export const updateHierarchy = (data: UpdateHierarchyData): CancelablePromise => { return __request(OpenAPI, { + method: 'PUT', + url: '/pcm/hierarchies/{hierarchyID}', + path: { + hierarchyID: data.hierarchyId + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 403: 'Forbidden', + 404: 'Bad Request. Not Found.', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Delete a hierarchy + * Deletes the specified hierarchy and all its children. + * @param data The data for the request. + * @param data.hierarchyId A unique identifier for the hierarchy. + * @returns void No Content + * @throws ApiError + */ +export const deleteHierarchy = (data: DeleteHierarchyData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/pcm/hierarchies/{hierarchyID}', + path: { + hierarchyID: data.hierarchyId + }, + errors: { + 403: 'Forbidden', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Create a node + * Creates a node in the specified hierarchy. + * + * ### Sorting Nodes in a Hierarchy + * + * You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. + * + * You can do this by adding a `meta` object to the body of your request and specifying a `sort_order` value. + * + * The node with the highest value of `sort_order` is displayed first. For example, a node with a `sort_order` value of `3` appears before a node with a `sort_order` value of `2`. + * + * - If you don’t provide `sort_order` when creating nodes, all child nodes in the response for Get a Node’s Children request are ordered by the `updated_at` time in descending order, with the most recently updated child node first. + * - If you set `sort_order` for only a few child nodes, the child nodes with a `sort_order` value appear first and then other child nodes appear in the order of `updated_at` time. + * + * You can also specify a `sort_order` when creating a node relationship. + * + * - If you create a node (**Node A**) with a `sort_order` and then you create a relationship for **Node A** with another node (**Node B**), the `sort_order` you specified when creating **Node A** is overwritten. + * - If you create **Node A** and then you create a relationship with **Node B** but do not configure a `sort_order`, the `sort_order` you specified when you created **Node A** is not overwritten. + * + * ### Curating Products in a node + * + * You can curate the products in a node. Product curation allows you to promote specific products within each node of your hierarchies, enabling you to create unique product collections in your storefront. For example, you may find you have an abundance of cotton T-Shirts and you want to promote these products to the top of the product list. When a shopper navigates to T-shirts, the cotton T-Shirts are displayed first. + * + * You can do this by adding a `curated_products` attribute to the body of your request and adding an array of product IDs to the attribute. You should add the products IDs in the order you want them to be displayed in your node. The first product ID is displayed first in the product list. + * + * You can only curate 20 products or less. You cannot have more than 20 curated products. + * + * - The product IDs you provide must exist in the specified node. + * - If a curated product is removed from a node, the product is also removed from the curated_products list. + * - Once you have curated the products in a node, you can use the get node products endpoint to retrieve a list of curated products. + * + * You can then display your curated products in your catalogs using the following catalog endpoints. + * + * - Get a node in your latest catalog release. + * - Get a node in a catalog. + * - Get all nodes in your latest catalog release. + * - Get all nodes in a catalog. + * - Get node children in your latest catalog release. + * - Get node children in a catalog. + * + * @param data The data for the request. + * @param data.hierarchyId A unique identifier for the hierarchy. + * @param data.requestBody + * @returns single_node Successfully returns the created node + * @throws ApiError + */ +export const createNode = (data: CreateNodeData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/pcm/hierarchies/{hierarchyID}/nodes', + path: { + hierarchyID: data.hierarchyId + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 403: 'Forbidden', + 404: 'Bad Request. Not Found.', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Get all nodes in a hierarchy + * A fully paginated view of all nodes in a hierarchy regardless of depth. + * @param data The data for the request. + * @param data.hierarchyId A unique identifier for the hierarchy. + * @param data.pageOffset The number of records to offset the results by. + * @param data.pageLimit The number of records per page. The maximum limit is 100. + * @returns multi_nodes Successfully returns the node's children + * @throws ApiError + */ +export const getAllNodesInHierarchy = (data: GetAllNodesInHierarchyData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/pcm/hierarchies/{hierarchyID}/nodes', + path: { + hierarchyID: data.hierarchyId + }, + query: { + 'page[offset]': data.pageOffset, + 'page[limit]': data.pageLimit + }, + errors: { + 400: 'Bad request. The request failed validation.', + 404: 'Bad Request. Not Found.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Get a node + * Retrieves a node from a hierarchy. + * @param data The data for the request. + * @param data.hierarchyId A unique identifier for the hierarchy. + * @param data.nodeId A unique identifier for the node. + * @returns single_node Returns a node with the following attributes. + * @throws ApiError + */ +export const getHierarchyNode = (data: GetHierarchyNodeData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}', + path: { + hierarchyID: data.hierarchyId, + nodeID: data.nodeId + }, + errors: { + 400: 'Bad request. The request failed validation.', + 404: 'Bad Request. Not Found.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Update a node + * Updates the specified node in a hierarchy. You can do a partial update, where you specify only the field value to change. + * + * ### Sorting Nodes in a hierarchy + * + * You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. + * + * The node with the highest value of sort_order is displayed first. For example, a node with a `sort_order` value of `3` appears before a node with a `sort_order` value of `2`. + * + * - If you don’t provide `sort_order` when creating nodes, all child nodes in the response for Get a Node’s Children request are ordered by the `updated_at` time in descending order, with the most recently updated child node first. + * - If you set `sort_order` for only a few child nodes or not all, the child nodes with a `sort_order` value appear first and then other child nodes appear in the order of `updated_at` time. + * + * You can also specify a sort_order when creating a node relationship. + * + * - If you update a node (**Node A**) with a `sort_order` and then you create a relationship for **Node A** with another node (**Node B**), the `sort_order` you specified when updating **Node A** is overwritten. + * - If you have updated **Node A** and then you create a relationship with **Node B** but do not configure a `sort_order`, the `sort_order` you specified when you updated **Node A** is not overwritten. + * + * ### Curating Products in a node + * + * You can curate the products in a node. Product curation allows you to promote specific products within each node of your hierarchies, enabling you to create unique product collections in your storefront. For example, you may find you have an abundance of cotton T-Shirts and you want to promote these products to the top of the product list. When a shopper navigates to T-shirts, the cotton T-Shirts are displayed first. + * + * You can do this by adding a `curated_products` attribute to the body of your request and adding an array of product IDs to the attribute. You should add the products IDs in the order you want them to be displayed in your node. The first product ID is displayed first in the product list. + * + * You can only curate 20 products or less. You cannot have more than 20 curated products. + * + * - The product IDs you provide must exist in the specified node. + * - If a curated product is removed from a node, the product is also removed from the curated_products list. + * - Once you have curated the products in a node, you can use the get node products endpoint to retrieve a list of curated products. + * + * You can then display your curated products in your catalogs using the following catalog endpoints. + * + * - Get a node in your latest catalog release. + * - Get a node in a catalog. + * - Get all nodes in your latest catalog release. + * - Get all nodes in a catalog. + * - Get node children in your latest catalog release. + * - Get node children in a catalog. + * + * @param data The data for the request. + * @param data.hierarchyId A unique identifier for the hierarchy. + * @param data.nodeId A unique identifier for the node. + * @param data.requestBody + * @returns single_node Successfully returns the updated node + * @throws ApiError + */ +export const updateNode = (data: UpdateNodeData): CancelablePromise => { return __request(OpenAPI, { + method: 'PUT', + url: '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}', + path: { + hierarchyID: data.hierarchyId, + nodeID: data.nodeId + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 403: 'Forbidden', + 404: 'Bad Request. Not Found.', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Deletes a node + * Deletes a node by the node ID + * @param data The data for the request. + * @param data.hierarchyId A unique identifier for the hierarchy. + * @param data.nodeId A unique identifier for the node. + * @returns void No Content + * @throws ApiError + */ +export const deleteNode = (data: DeleteNodeData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}', + path: { + hierarchyID: data.hierarchyId, + nodeID: data.nodeId + }, + errors: { + 403: 'Forbidden', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Get a hierarchy's children + * Get a hierarchy's children + * @param data The data for the request. + * @param data.hierarchyId A unique identifier for the hierarchy. + * @param data.pageOffset The number of records to offset the results by. + * @param data.pageLimit The number of records per page. The maximum limit is 100. + * @returns multi_nodes Returns the hierarchy's children. + * @throws ApiError + */ +export const getAllChildren = (data: GetAllChildrenData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/pcm/hierarchies/{hierarchyID}/children', + path: { + hierarchyID: data.hierarchyId + }, + query: { + 'page[offset]': data.pageOffset, + 'page[limit]': data.pageLimit + }, + errors: { + 400: 'Bad request. The request failed validation.', + 404: 'Bad Request. Not Found.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Create relationships between a node and child nodes + * Use this endpoint to create relationships between a single parent node and one or more child nodes. You can create a relationship only if: + * + * - The parent node already exists. + * - All child nodes already exist. + * - Every child node in the body of the request exists in the same hierarchy as the parent node. + * - A node is not a parent of itself. An array of child nodes request body must not contain the ID of the parent node in the path. + * - All siblings in a hierarchy must have a unique `slug`. Siblings are the child nodes that are related to the same parent. + * + * ### Sort Order + * + * You can also provide `sort_order` information when you create a relationship by adding a `meta` object to the array of node reference objects for each child node that requires sorting. + * + * The node with the highest value of `sort_order` appears at the top of the response. For example, a node with a `sort_order` value of `3` appears before a node with a `sort_order` value of `2`. + * + * - If you don’t provide `sort_order` when creating relationships, all child nodes in the response for Get a Node’s Children request are ordered by the `updated_at` time in descending order. The most recently updated child node appears at the top of the response. + * - If you set `sort_order` for only a few child nodes or not all, the child nodes with `sort_order` value appear first in the response and then other child nodes appear in the order of `updated_at` time. + * + * You can also specify a `sort_order` when creating and updating a node. + * + * - If you create or update a node (**Node A**) with a `sort_order` and then you create a relationship for **Node A** with another node (**Node B**), the `sort_order` you specified when creating\updating **Node A** is overwritten. + * - If you create\update **Node A** and then you create a relationship with **Node B** but do not configure a `sort_order`, the `sort_order` you specified when you created\updated **Node A** is not overwritten. + * + * @param data The data for the request. + * @param data.hierarchyId A unique identifier for the hierarchy. + * @param data.nodeId A unique identifier for the node. + * @param data.requestBody + * @returns single_node Successfully returns the node's children + * @throws ApiError + */ +export const createNodeChildRelationships = (data: CreateNodeChildRelationshipsData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/children', + path: { + hierarchyID: data.hierarchyId, + nodeID: data.nodeId + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 403: 'Forbidden', + 404: 'Bad Request. Not Found.', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Get a node's children + * Retrieves the child nodes for a specified node. + * @param data The data for the request. + * @param data.hierarchyId A unique identifier for the hierarchy. + * @param data.nodeId A unique identifier for the node. + * @param data.pageOffset The number of records to offset the results by. + * @param data.pageLimit The number of records per page. The maximum limit is 100. + * @returns multi_nodes Successfully returns the node's children + * @throws ApiError + */ +export const getAllNodeChildren = (data: GetAllNodeChildrenData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/children', + path: { + hierarchyID: data.hierarchyId, + nodeID: data.nodeId + }, + query: { + 'page[offset]': data.pageOffset, + 'page[limit]': data.pageLimit + }, + errors: { + 400: 'Bad request. The request failed validation.', + 404: 'Bad Request. Not Found.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Update a node's parent + * Changes the parent of the specified node. The new parent node must be located within the same hierarchy as the specified node. + * + * You cannot move a node to another hierarchy. If you want to put the specified node into another hierarchy, create the node in the target hierarchy and delete it from the current hierarchy. + * + * @param data The data for the request. + * @param data.hierarchyId A unique identifier for the hierarchy. + * @param data.nodeId A unique identifier for the node. + * @param data.requestBody + * @returns void No Content + * @throws ApiError + */ +export const updateNodeParent = (data: UpdateNodeParentData): CancelablePromise => { return __request(OpenAPI, { + method: 'PUT', + url: '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/parent', + path: { + hierarchyID: data.hierarchyId, + nodeID: data.nodeId + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 403: 'Forbidden', + 404: 'Bad Request. Not Found.', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Delete a node's parent + * @param data The data for the request. + * @param data.hierarchyId A unique identifier for the hierarchy. + * @param data.nodeId A unique identifier for the node. + * @returns void No Content + * @throws ApiError + */ +export const deleteNodeParent = (data: DeleteNodeParentData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/parent', + path: { + hierarchyID: data.hierarchyId, + nodeID: data.nodeId + }, + errors: { + 403: 'Forbidden', + 404: 'Bad Request. Not Found.', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Create a node's product relationships + * Creates relationships between the specified node and one or more products in a specified hierarchy. + * @param data The data for the request. + * @param data.hierarchyId A unique identifier for the hierarchy. + * @param data.nodeId A unique identifier for the node. + * @param data.requestBody + * @returns single_node Successfully returns the updated node + * @throws ApiError + */ +export const createNodeProductRelationship = (data: CreateNodeProductRelationshipData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/products', + path: { + hierarchyID: data.hierarchyId, + nodeID: data.nodeId + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 403: 'Forbidden', + 404: 'Bad Request. Not Found.', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Deletes a node's product relationships + * @param data The data for the request. + * @param data.hierarchyId A unique identifier for the hierarchy. + * @param data.nodeId A unique identifier for the node. + * @param data.requestBody + * @returns single_node Successfully returns the updated node + * @throws ApiError + */ +export const deleteNodeProductRelationships = (data: DeleteNodeProductRelationshipsData): CancelablePromise => { return __request(OpenAPI, { + method: 'DELETE', + url: '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/products', + path: { + hierarchyID: data.hierarchyId, + nodeID: data.nodeId + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 404: 'Bad Request. Not Found.', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Get a node's products + * Returns the products associated with the specified hierarchy node from a published catalog. Products must be in a live status. If the products have been curated using the update a hierarchy node endpoint, then the products are returned in the order specified in the `curated_products` attribute in the body of the update a hierarchy node request. A product that is curated has the "curated_product": true attribute displayed. + * + * @param data The data for the request. + * @param data.hierarchyId A unique identifier for the hierarchy. + * @param data.nodeId A unique identifier for the node. + * @param data.pageOffset The number of records to offset the results by. + * @param data.pageLimit The number of records per page. The maximum limit is 100. + * @returns multi_product_response Successfully returns the node's products + * @throws ApiError + */ +export const getNodeProducts = (data: GetNodeProductsData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/products', + path: { + hierarchyID: data.hierarchyId, + nodeID: data.nodeId + }, + query: { + 'page[offset]': data.pageOffset, + 'page[limit]': data.pageLimit + }, + errors: { + 400: 'Bad request. The request failed validation.', + 404: 'Bad Request. Not Found.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Duplicate a hierarchy + * Using this option, you can duplicate an existing hierarchy. This is useful because it enables you to quickly and easily create multiple hierarchies with the same node structure. + * + * When you duplicate a hierarchy, you can specify a new name and/or a new description for the duplicated hierarchy. All other attributes, such as slug and locales, stay the same. + * + * Any nodes in the existing hierarchy are also replicated in the duplicated hierarchy. In addition, you can optionally use the `include_products` attribute to specify whether you want products associated with the nodes in an existing hierarchy to be associated with the nodes in the duplicated hierarchy. By default, product associations in an existing hierarchy are not duplicated in a duplicate hierarchy. + * + * Duplicating a hierarchy is an asynchronous operation. When you duplicate a hierarchy, a job is created. The jobId of the job is displayed in the response. When the job is complete, the duplicate hierarchy operation is also complete. You can use the jobId to see the status of your job using Get a Job. + * + * Jobs are processed one at a time. You can continue to send duplicate hierarchy requests, but those jobs are queued. In other words, Commerce looks for any jobs that have a status of PENDING and starts the job with the earliest created date. This process is repeated until all jobs are processed. + * + * Once the job is complete, run: + * + * - Get all hierarchies to retrieve the HierarchyId of your duplicated hierarchy. + * - Get a hierarchy to retrieve the nodes and (if applicable) products associated with the duplicated hierarchy. + * + * @param data The data for the request. + * @param data.hierarchyId A unique identifier for the hierarchy. + * @param data.requestBody + * @returns single Successfully returns the duplicate hierarchy job ID + * @throws ApiError + */ +export const duplicateHierarchy = (data: DuplicateHierarchyData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/pcm/hierarchies/{hierarchyID}/duplicate_job', + path: { + hierarchyID: data.hierarchyId + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 404: 'Bad Request. Not Found.', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Get All Product Tags + * Retrieves all product tags for a store. A store can view the tags associated with the organization to which the store belongs. However, an organization can only view the tags associated with the organization. + * + * + * @returns multi_tag Returns all the product tags. + * @throws ApiError + */ +export const getAllProductTags = (): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/pcm/tags', + errors: { + 400: 'Bad request. The request failed validation.', + 404: 'Bad Request. Not Found.', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Get a Product Tag + * Retrieves a product tag for a store. A store can view the tags associated with the organization to which the store belongs. However, an organization can only view the tags associated with the organization. + * @param data The data for the request. + * @param data.tagId A unique identifier for the tag. + * @returns single_tag Returns a product tag with the following attributes. + * @throws ApiError + */ +export const getProductTag = (data: GetProductTagData): CancelablePromise => { return __request(OpenAPI, { + method: 'GET', + url: '/pcm/tags/{tagID}', + path: { + tagID: data.tagId + }, + errors: { + 400: 'Bad request. The request failed validation.', + 404: 'Bad Request. Not Found.', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Create a custom relationship + * Create a custom relationship + * @param data The data for the request. + * @param data.requestBody + * @returns single_custom_relationship Returns a created custom relationship with the following attributes. + * @throws ApiError + */ +export const createCustomRelationship = (data: CreateCustomRelationshipData): CancelablePromise => { return __request(OpenAPI, { + method: 'POST', + url: '/pcm/custom_relationships', + body: data.requestBody, + mediaType: 'application/json', + errors: { + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; + +/** + * Update a custom relationship + * Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the custom relationship is not updated. + * @param data The data for the request. + * @param data.customRelationshipSlug A custom relationship slug. + * @param data.requestBody + * @returns single_custom_relationship Successfully returns the updated custom relationship + * @throws ApiError + */ +export const updateCustomRelationship = (data: UpdateCustomRelationshipData): CancelablePromise => { return __request(OpenAPI, { + method: 'PUT', + url: '/pcm/custom_relationships/{customRelationshipSlug}', + path: { + customRelationshipSlug: data.customRelationshipSlug + }, + body: data.requestBody, + mediaType: 'application/json', + errors: { + 403: 'Forbidden', + 404: 'Bad Request. Not Found.', + 422: 'Bad request. The request failed validation.', + 500: 'Internal server error. There was a system failure in the platform.' + } +}); }; \ No newline at end of file diff --git a/packages/sdks/src/client/types.gen.ts b/packages/sdks/src/client/types.gen.ts new file mode 100644 index 00000000..15bedc33 --- /dev/null +++ b/packages/sdks/src/client/types.gen.ts @@ -0,0 +1,4864 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type job = { + /** + * A unique identifier generated when a job is created. + */ + id?: string; + /** + * This represents the type of resource object being returned. Always `pim-job`. + */ + type?: 'pim-job'; + attributes?: { + /** + * The date and time a job is started. + */ + started_at?: string | null; + /** + * The date and time a job is completed. + */ + completed_at?: string | null; + /** + * The date and time a job is created. + */ + created_at?: string; + /** + * The date and time a job is updated. + */ + updated_at?: string; + /** + * The status of a job. + * + * * `pending` - Commerce has received the request but is currently busy processing other requests. + * * `started` - Commerce has started processing the job. + * * `success` - The job has successfully completed. + * * `failed` - The job has failed. + * + */ + type?: 'child-products' | 'product-import' | 'product-export' | 'hierarchy-duplicate' | 'price-import'; + status?: 'pending' | 'cancelled' | 'started' | 'success' | 'failed'; + }; + meta?: { + /** + * Applies to all job types. A unique request ID is generated when a job is created. + */ + x_request_id?: string; + /** + * Applies to `hierarchy-duplicate` job types. The ID of the original hierarchy that you duplicated. + */ + copied_from?: string; + /** + * Applies to `hierarchy-duplicate` job types. The duplicated hierarchy ID. + */ + hierarchy_id?: string; + /** + * If the job type is `product_export`, a link to the file is created when running a job. + */ + file_locations?: Array<(string)> | null; + /** + * The entities included in the job. For example, if the job type is `product-export`, the PXM products included in the export. + */ + filter?: string; + }; +}; + +/** + * This represents the type of resource object being returned. Always `pim-job`. + */ +export type type = 'pim-job'; + +export type status = 'pending' | 'cancelled' | 'started' | 'success' | 'failed'; + +export type multi = { + /** + * An array of jobs. + */ + data?: Array; + meta?: { + /** + * Contains the results for the entire collection. + */ + results?: { + /** + * Total number of results for the entire collection. + */ + total?: number; + }; + }; +}; + +export type error = { + errors: Array<{ + /** + * The HTTP response code of the error. + */ + status: string; + /** + * A brief summary of the error. + */ + title: string; + /** + * Optional additional detail about the error. + */ + detail?: string; + /** + * Internal request ID. + */ + request_id?: string; + /** + * Additional supporting meta data for the error. + */ + meta?: { + [key: string]: unknown; + }; + }>; +}; + +export type single = { + data?: job; +}; + +export type errors = { + /** + * An array of job errors. + */ + data?: Array<{ + /** + * This represents the type of resource object being returned. Always `pim-job-error`. + */ + type?: 'pim-job-error'; + /** + * A unique identifier for a job error generated when a job error is created. + */ + id?: string; + attributes?: { + /** + * A description of an error message. + */ + message?: string; + }; + }>; +}; + +/** + * You use the `custom_inputs` attribute to allow your shoppers to add custom text to a product when adding product items to their carts. This is useful, for example, if you have a product like a T-shirt that can be personalized or you sell greetings cards that can be printed with your shoppers personalized messages. See [Personalizing Products](/docs/api/pxm/products/create-product#personalizing-products). + */ +export type product_custom_inputs = { + [key: string]: { + /** + * A name for the custom text field. + */ + name?: string; + /** + * The validation rules for the custom text. + */ + validation_rules?: unknown[]; + /** + * This represents the type of the resource being returned. + */ + type?: string; + /** + * The length of the custom input text field. + */ + options?: { + [key: string]: unknown; + }; + /** + * The number of characters the custom text field can be. You can specify a maximum length up to 255 characters, as the limit is 255 characters. + */ + max_length?: number; + /** + * `true` or `false` depending on whether the custom text is required. + */ + required?: boolean; + }; +}; + +/** + * You can build a combination of child products associated with a product, based on build rules that you specify. This is useful, for example, if you have a variation option that you do not sell. This makes managing and building your child products quick and easy. See [Using Build Rules](/docs/api/pxm/products/build-child-products#using-build-rules). + */ +export type product_build_rules = { + /** + * Specifies the default behaviour, either `include` or `exclude`. + */ + default?: 'include' | 'exclude'; + /** + * An array of option IDs to include when child products are built. Each combination consists of a nested array of option IDs from one or more variations. Combinations of option IDs in the nested arrays must come from different variations. + */ + include?: Array>; + /** + * An array of option IDs to exclude when child products are built. Each combination consists of a nested array of option IDs from one or more variations. Combinations of option IDs in the nested arrays must come from different variations. + */ + exclude?: Array>; +}; + +/** + * Specifies the default behaviour, either `include` or `exclude`. + */ +export type default = 'include' | 'exclude'; + +/** + * With Product Experience Manager, you can create and manage bundles. A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. See [Bundles](/docs/api/pxm/products/products#bundles). + */ +export type product_bundle_components = { + [key: string]: { + /** + * The component name. The component name is the name that is displayed in your storefront. + */ + name?: string; + /** + * The product options included in a component. This can be the ID of another bundle. + */ + options?: Array<{ + /** + * The unique ID of the product you want to add to a component. + */ + id?: string; + /** + * This represents the type of object being returned. Always `product`. + */ + type?: string; + /** + * The number of this product option that a shopper must purchase. + */ + quantity?: number; + /** + * The sort order of the options. The `create a bundle` and `update a bundle` endpoints do not sort the options. You can use the `sort_order` attribute when programming your storefront to display the options in the order that you want. + */ + sort_order?: number; + /** + * Whether the product option is a default option in a bundle. Shoppers can select a bundle that specifies a default list of product options. See [Dynamic Bundles](/docs/api/pxm/products/products#dynamic-bundles). + */ + default?: boolean; + }>; + /** + * The minimum number of product options a shopper can select from this component. + */ + min?: number; + /** + * The maximum number of product options a shopper can select from this component. + */ + max?: number; + /** + * The sort order of the components. The `create a bundle` and `update a bundle` endpoints do not sort the components. You can use the `sort_order` attribute when programming your storefront to display the components in the order that you want. + */ + sort_order?: number; + }; +}; + +export type product_response = { + /** + * A unique product ID that is generated when you create the product. + */ + id?: string; + /** + * This represents the type of resource object being returned. Always `product`. + */ + type?: 'product'; + attributes?: { + /** + * A name for the product. + */ + name?: string; + /** + * A description for the product. + */ + description?: string; + /** + * A label for the product that is used in the URL paths. A slug can contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. By default, the product name is used as the slug. + */ + slug?: string; + /** + * The unique stock keeping unit of the product. + */ + sku?: string; + /** + * The status for the product, either `draft` or `live`. + */ + status?: 'live' | 'draft'; + /** + * The commodity type, either `physical` or `digital`. + */ + commodity_type?: 'physical' | 'digital'; + /** + * The universal product code or european article number of the product. + */ + upc_ean?: string; + /** + * The manufacturer part number of the product. + */ + mpn?: string; + /** + * The unique attribute associated with the product. This could be an external reference from a separate company system, for example. The maximum length is 2048 characters. + */ + external_ref?: string; + /** + * Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. + */ + locales?: { + [key: string]: unknown; + }; + /** + * You can use product tags to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. A product can have up to 20 tags. A product tag can be up to 255 characters. Product tags must not contain any spaces or commas. + */ + tags?: Array<(string)>; + extensions?: { + [key: string]: { + [key: string]: (string | null | number | boolean); + }; + }; + custom_inputs?: product_custom_inputs; + build_rules?: product_build_rules; + components?: product_bundle_components; + }; + meta?: { + /** + * The date and time a product is created. + */ + created_at?: string; + /** + * The date and time a product is updated. + */ + updated_at?: string; + /** + * The resource owner, either `organization` or `store`. + */ + owner?: 'organization' | 'store'; + /** + * A product's variations and the options defined for each variation. If you have specified `build_rules`, only the child products included in the `build_rules` are specified. + */ + variations?: Array<{ + /** + * A unique ID generated when a variation is created. + */ + id?: string; + /** + * The name of a variation. + */ + name?: string; + options?: Array<{ + /** + * A unique ID that is generated an option is created. + */ + id?: string; + /** + * The name of an option. + */ + name?: string; + /** + * A description of an option. + */ + description?: string; + }>; + }>; + /** + * One of the following product types: + * + * - `standard` - A `standard` product is a standalone product. + * - `parent` - A `parent` product is a product that has child products that have been built using the `Build Child Products` endpoint. + * - `child` - When you configure product variations and variation options for `parent` products, the `child` products derived from the `parent` products are automatically created in Commerce. + * - `bundle` - A `bundle` is a purchasable product, comprising one or more standalone products (in other words, components) to be sold together. + * + */ + product_types?: Array<('parent' | 'child' | 'bundle' | 'standard')>; + /** + * The child products defined for a product. The order of the variations in the `variation_matrix` is the order of the variations in the array when the variations were linked to the product. For example, the first variation in the `variation_matrix` corresponds to the first variation in the array, and so on. You can use the `sort_order`attribute to sort the order of your variation and variation options in the `variation_matrix` object. See [Sorting the Order of Variations and Options](/docs/api/pxm/products/variations#sorting-the-order-of-variations-and-options) If no variations are defined for a product, the `variation_matrix` is empty. + */ + variation_matrix?: { + [key: string]: unknown; + }; + }; + /** + * Relationships are established between different product entities. For example, a `bundle` product and a `child` product are related to a `parent` product, as both are associated with it. + */ + relationships?: { + [key: string]: { + data?: Array<{ + /** + * A unique identifier for a resource. + */ + id?: string; + /** + * This represents the type of resource object being returned. + */ + type?: string; +}> | { + /** + * A unique identifier for a resource. + */ + id?: string; + /** + * This represents the type of resource object being returned. + */ + type?: string; +} | null; + /** + * Links are used to allow you to move between requests. Single entities use a `self` parameter with a link to that specific resource. Sometimes, there are not enough entities for a project to fill multiple pages. In this situation, we return some defaults. + * + * | Property | Description | + * | :--- | :--- | + * | `current` | Always the current page. | + * | `first` | Always the first page. | + * | `last` | `null` if there is only one page. | + * | `prev` | `null` if the user is on the first page. | + * | `next` | `null` if there is only one page. | + * + */ + links?: { + [key: string]: (string); + }; + }; + }; +}; + +/** + * This represents the type of resource object being returned. Always `product`. + */ +export type type2 = 'product'; + +/** + * The status for the product, either `draft` or `live`. + */ +export type status2 = 'live' | 'draft'; + +/** + * The commodity type, either `physical` or `digital`. + */ +export type commodity_type = 'physical' | 'digital'; + +/** + * The resource owner, either `organization` or `store`. + */ +export type owner = 'organization' | 'store'; + +export type multi_product_response = { + data?: Array; + /** + * Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. + */ + included?: { + /** + * Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. + */ + component_products?: Array; + }; + meta?: { + /** + * Contains the results for the entire collection. + */ + results?: { + /** + * Total number of results for the entire collection. + */ + total?: number; + }; + }; +}; + +/** + * Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. + */ +export type product_locales = { + [key: string]: { + /** + * A localized name for the product. + */ + name: string; + /** + * A localized description for the product. + */ + description?: string; + }; +}; + +export type product_attributes = { + /** + * The unique attribute associated with the product. This could be an external reference from a separate company system, for example. The maximum length is 2048 characters. + */ + external_ref?: string; + /** + * The product name to display to customers. + */ + name?: string; + /** + * A description for the product. + */ + description?: string; + /** + * The unique slug of the product. A slug can contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + */ + slug?: string; + /** + * The unique stock keeping unit of the product. + */ + sku?: string; + /** + * The status for the product, either `draft` or `live`. Default is `draft`. + */ + status?: 'live' | 'draft'; + /** + * The commodity type, either `physical` or `digital`. + */ + commodity_type?: 'physical' | 'digital'; + /** + * The universal product code or european article number of the product. + */ + upc_ean?: string; + /** + * The manufacturer part number of the product. + */ + mpn?: string; + /** + * You can use product tags to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. A product can have up to 20 tags. A product tag can be up to 255 characters. Product tags must not contain any spaces or commas. See [Product Tags](/docs/api/pxm/products/product-tags). + */ + tags?: Array<(string)>; + build_rules?: product_build_rules; + locales?: product_locales; + custom_inputs?: product_custom_inputs; + components?: product_bundle_components; +}; + +export type create_product_request = { + data: { + /** + * This represents the type of resource being returned. Always `product`. + */ + type: 'product'; + attributes: product_attributes; + /** + * Relationships are established between different product entities. + */ + relationships?: { + variations?: { + data?: Array<{ + /** + * A unique identifier for a resource. + */ + id?: string; + /** + * This represents the type of resource object being returned. + */ + type?: string; + }>; + }; + }; + }; +}; + +export type single_product_response = { + data?: product_response; + /** + * Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. + */ + included?: { + /** + * A list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. + */ + component_products?: Array; + }; +}; + +export type update_product_request = { + data: { + /** + * This represents the type of resource object being returned. Always `product`. + */ + type: 'product'; + /** + * The unique identifier of the product. Must match the product ID specified in the request path. + */ + id: string; + attributes: product_attributes; + }; +}; + +export type attributes = { + /** + * The name of the node, such as `Ranges` or `Refrigerators`. Names must be unique among sibling nodes in the hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies. + */ + name?: string; + /** + * A description for a node. + */ + description?: string; + /** + * A slug for the node. Slugs must be unique among sibling nodes in the hierarchy. Otherwise, a slug can be non-unique within the hierarchy and across multiple hierarchies. + */ + slug?: string; + /** + * You can curate your products in your nodes product lists. Product curation allows you to promote specific products within each node in a hierarchy, enabling you to create unique product collections in your storefront. + */ + curated_products?: Array<(string)>; + /** + * Product Experience Manager supports localization of hierarchies and nodes. If you store supports multiple languages, you can localize hierarchy and node names and descriptions. + */ + locales?: { + [key: string]: { + /** + * A localized hierarchy or node name. + */ + name?: string; + /** + * A localized hierarchy or node description. + */ + description?: string; + }; + }; +}; + +/** + * Relationships allow you to move between requests. Includes links to the child nodes and products associated with a hierarchy or node. + */ +export type relationships = { + /** + * The child nodes related to the resource. + */ + children?: { + /** + * An array of child nodes. + */ + data?: unknown[]; + /** + * Links allow you to move between requests. + */ + links?: { + /** + * A link to a related resource. + */ + related?: string; + }; + }; + /** + * The parent node related to the resource + */ + parent?: { + /** + * The parent node + */ + data?: { + /** + * This represents the type of resource object being returned. Always `node`. + */ + type: 'node'; + /** + * The unique identifier of a node. + */ + id: string; + }; + }; + /** + * The products related to the resource. + */ + products?: { + /** + * An array of products. + */ + data?: unknown[]; + /** + * Links allow you to move between requests. + */ + links?: { + /** + * A link to a related resource. + */ + related?: string; + }; + }; +}; + +/** + * This represents the type of resource object being returned. Always `node`. + */ +export type type3 = 'node'; + +export type node = { + /** + * The unique identifier of a node. + */ + id?: string; + /** + * This represents the type of resource object being returned. Always `node`. + */ + type?: 'node'; + attributes?: attributes; + relationships?: relationships; + meta?: { + /** + * The sort order value. The node with the highest value of `sort_order` is displayed first. For example, a node with a `sort_order` value of `3` appears before a node with a `sort_order` value of `2`. See [Sorting Nodes in a hierarchy](/docs/api/pxm/products/create-node#sorting-nodes-in-a-hierarchy). + */ + sort_order?: number; + /** + * The date and time a node is created. + */ + created_at?: string; + /** + * The date and time a node was updated. + */ + updated_at?: string; + /** + * The name of the parent of the node if one exists. + */ + parent_name?: string; + /** + * The node owner, either `organization` or `store`. + */ + owner?: 'store' | 'organization'; + }; +}; + +export type multi_meta = { + /** + * Contains the results for the entire collection. + */ + results?: { + /** + * Total number of results for the entire collection. + */ + total?: number; + }; +}; + +/** + * Links are used to allow you to move between requests. + */ +export type multi_links = { + /** + * Always the first page. + */ + first?: string; + /** + * This is `null` if there is only one page. + */ + last?: string; + /** + * This is `null` if there is only one page. + */ + next?: string; + /** + * This is `null` if you on the first page. + */ + prev?: string; +}; + +export type multi_nodes = { + /** + * An array of nodes. + */ + data?: Array; + meta?: multi_meta; + links?: multi_links; +}; + +export type template_response = { + data?: Array<{ + /** + * A unique identifier for a template generated when a template is created. + */ + id?: string; + /** + * This represents the type of resource object being returned. Always `template`. + */ + type?: 'template'; + }>; +}; + +export type product_templates_request = { + data?: Array<{ + /** + * The unique identifier of a template. + */ + id?: string; + /** + * This represents the type of resource object being returned. Always `template'. + */ + type?: 'template'; + }>; +}; + +export type component_products_response = { + data?: Array<{ + /** + * The unique identifier of a product component generated when a product is created. + */ + id?: string; + /** + * This represents the type of resource object being returned. Always `product`. + */ + type?: 'product'; + }>; +}; + +export type file_response = { + data?: Array<{ + /** + * The unique identifier of the new file. + */ + id?: string; + /** + * This represents the type of resource object being returned. Always `file`. + */ + type?: 'file'; + }>; +}; + +export type product_files_request = { + data?: Array<{ + /** + * A unique identifier for a file generated when a file is created. + */ + id?: string; + /** + * This represents the type of resource being returned. Always `file`. + */ + type?: 'file'; + meta?: { + /** + * The files associated with a product. + */ + tags?: Array<(string)>; + }; + }>; +}; + +export type variations_response = { + data?: Array<{ + /** + * A unique identifier generated when a variation is created. + */ + id?: string; + /** + * This represents the type of resource object being returned. Always `product-variation`. + */ + type?: 'product-variation'; + meta?: { + /** + * The date and time a resource is created. + */ + created_at?: string; + }; + }>; +}; + +export type product_variations_request = { + data?: Array<{ + /** + * The ID of the product variation. + */ + id?: string; + /** + * This represents the type of resource being returned. Always `product-variation`. + */ + type?: 'product-variation'; + }>; +}; + +export type main_image_response = { + data?: Array<{ + /** + * A unique identifier for the image file generated automatically when a file is created. + */ + id?: string; + /** + * This represents the type of resource object being returned. Always `file`. + */ + type?: string; + }>; +}; + +export type replace_main_image_request = { + data?: Array<{ + /** + * The ID of the new image file. + */ + id?: string; + type?: 'file'; + }>; +}; + +export type main_image_request = { + data?: { + /** + * The ID of the image file. + */ + id?: string; + /** + * This represents the type of resource being returned. Always `file`. + */ + type?: 'file'; + }; +}; + +/** + * This represents the type of resource being returned. Always `file`. + */ +export type type4 = 'file'; + +export type multi_variations = { + data?: Array<{ + /** + * A unique identifier for a variation. + */ + id?: string; + /** + * This represents the type of resource object being returned. Always `product-variation`. + */ + type?: 'product-variation'; + attributes?: { + /** + * The name of a variation. + */ + name?: string; + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + */ + sort_order?: number; + }; + meta?: { + options?: Array<{ + /** + * A unique ID that is generated when an option is created. + */ + id?: string; + /** + * A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + */ + name?: string; + /** + * A human recognizable description of the option. + */ + description?: string; + /** + * The date and time an option is created. + */ + created_at?: string; + /** + * The date and time an option is updated. + */ + updated_at?: string; + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + */ + sort_order?: number; + }>; + /** + * The owner of the resource, either `organization` or `store`. + */ + owner?: 'organization' | 'store'; + /** + * The date and time a variation is created. + */ + created_at?: string; + /** + * The date and time a variation is updated. + */ + updated_at?: string; + }; + }>; + meta?: { + /** + * Contains the results for the entire collection. + */ + results?: { + /** + * Total number of results for the entire collection. + */ + total?: number; + }; + }; +}; + +export type create_variation = { + data: { + /** + * This represents the type of resource object being returned. Always `product-variation`. + */ + type: 'product-variation'; + attributes: { + /** + * The variation name. + */ + name?: string; + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. + * + * The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. + * + * You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + * + * You must rebuild your products for the sort order changes to take effect. + * + */ + sort_order?: number; + }; + }; +}; + +/** + * This represents the type of resource object being returned. Always `product-variation`. + */ +export type type5 = 'product-variation'; + +export type created_variation = { + data: { + /** + * A unique identifier generated when a variation is created. + */ + id: string; + /** + * This represents the type of resource object being returned. Always `product-variation`. + */ + type: 'product-variation'; + attributes: { + /** + * A human-recognizable identifier for a variation. + */ + name?: string; + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + */ + sort_order?: number; + }; + meta: { + /** + * The owner of the resource, either `organization` or `store`. + */ + owner?: 'organization' | 'store'; + /** + * The date and time a variation is created. + */ + created_at?: string; + /** + * The date and time a variation is updated. + */ + updated_at?: string; + }; + }; +}; + +export type single_variation = { + data: { + /** + * A unique identifier for a variation. + */ + id: string; + /** + * This represents the type of resource object being returned. Always `product-variation`. + */ + type: 'product-variation'; + attributes: { + /** + * The name for a variation. + */ + name?: string; + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + */ + sort_order?: number; + }; + meta: { + /** + * A variation option represents an option for selection for a single product-variation. For example, if your variation is `color`, you might have three possible options; red, green, and blue. + */ + options?: Array<{ + /** + * A unique ID that is generated an option is created. + */ + id?: string; + /** + * A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + */ + name?: string; + /** + * A description for an option. + */ + description?: string; + /** + * The date and time an option is created. + */ + created_at?: string; + /** + * The date and time an option is updated. + */ + updated_at?: string; + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + */ + sort_order?: number; + }>; + /** + * The owner of the resource, either `organization` or `store`. + */ + owner?: 'organization' | 'store'; + /** + * The date and time a variation is created. + */ + created_at?: string; + /** + * The date and time a variation is updated. + */ + updated_at?: string; + }; + }; +}; + +export type update_variation = { + data: { + /** + * This represents the type of resource object being returned. Always `product-variation`. + */ + type: 'product-variation'; + attributes: { + /** + * The variation name. + */ + name?: string; + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. + * + * The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. + * + * You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + * + * You must rebuild your products for the sort order changes to take effect. + * + */ + sort_order?: number; + }; + /** + * The unique identifier of the variation. Must match the variation ID specified in the request path. + */ + id: string; + }; +}; + +export type multi_options = { + data?: Array<{ + /** + * A unique identifier generated when an option is created. + */ + id?: string; + /** + * This represents the type of resource object being returned. Always `product-variation-option`. + */ + type?: 'product-variation-option'; + attributes?: { + /** + * A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + */ + name?: string; + /** + * A human-recognizable description for the option. + */ + description?: string; + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + */ + sort_order?: number; + }; + meta?: { + /** + * The owner of a resource, either `organization` or `store`. + */ + owner?: 'organization' | 'store'; + /** + * The date and time an option is created. + */ + created_at?: string; + /** + * The date and time an option is updated. + */ + updated_at?: string; + }; + }>; + meta?: { + /** + * Contains the results for the entire collection. + */ + results?: { + /** + * Total number of results for the entire collection. + */ + total?: number; + }; + }; +}; + +export type create_option = { + data: { + /** + * This represents the type of resource object being returned. Always `product-variation-option`. + */ + type: 'product-variation-option'; + attributes: { + /** + * A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + */ + name?: string; + /** + * By default, variations and variation options are sorted alphabetically. You can use the `sort_order` attribute to sort the order of your variation and variation options in the `variation_matrix`. + * + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. + * + * The variation option with the highest value of `sort_order` is displayed first. For example, a variation option with a `sort_order` value of `3` appears before a variation option with a `sort_order` value of `2`. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, and so on, zero or negative numbers. + * + * You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + * + * You must rebuild your products for the sort order changes to take effect. + * + */ + sort_order?: number; + /** + * A description of a product variation option. + */ + description?: string; + }; + }; +}; + +/** + * This represents the type of resource object being returned. Always `product-variation-option`. + */ +export type type6 = 'product-variation-option'; + +export type created_option = { + data: { + /** + * A unique identifier that is generated when an option is created. + */ + id?: string; + /** + * This represents the type of resource object being returned. Always `product-variation-option`. + */ + type: 'product-variation-option'; + attributes: { + /** + * A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + */ + name?: string; + /** + * A human-recognizable description for the option. + */ + description?: string; + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + */ + sort_order?: number; + }; + meta?: { + /** + * The owner of a resource, either `organization` or `store`. + */ + owner?: 'organization' | 'store'; + /** + * The date and time an option is created. + */ + created_at?: string; + /** + * The date and time an option is updated. + */ + updated_at?: string; + }; + }; +}; + +export type single_option = { + data: { + /** + * The unique identifier generated when an option is created. + */ + id: string; + /** + * This represents the type of resource object being returned. Always `product-variation-option`. + */ + type: 'product-variation-option'; + /** + * A variation option represents an option for selection for a single product-variation. For example, if your variation is `color`, you might have three possible options; red, green, and blue. + */ + attributes: { + /** + * A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + */ + name?: string; + /** + * A human-recognizable description for the option. + */ + description?: string; + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + */ + sort_order?: number; + }; + meta: { + /** + * The owner of a resource, either `organization` or `store`. + */ + owner?: 'organization' | 'store'; + /** + * The date and time an option is created. + */ + created_at?: string; + /** + * The date and time an option is updated. + */ + updated_at?: string; + }; + }; +}; + +export type update_option = { + data: { + /** + * This represents the type of resource object being returned. Always `product-variation-option`. + */ + type: 'product-variation-option'; + attributes: { + /** + * A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + */ + name?: string; + /** + * The description of the option. + */ + description?: string; + /** + * By default, variations and variation options are sorted alphabetically. You can use the `sort_order` attribute to sort the order of your variation and variation options in the `variation_matrix`. The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. + * + * The variation option with the highest value of `sort_order` is displayed first. For example, a variation option with a `sort_order` value of `3` appears before a variation option with a `sort_order` value of `2`. + * + * You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, and so on, zero or negative numbers. + * + * You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + * + * You must rebuild your products for the sort order changes to take effect. + * + */ + sort_order?: number; + }; + /** + * The unique identifier of the option. Must match the option ID specified in the request path. + */ + id: string; + }; +}; + +export type multi_modifiers = { + data?: Array<{ + /** + * A unique identifier for a modifier that is generated automatically when a modifier is created. + */ + id?: string; + /** + * This represents the type of resource object being returned. Always `product-variation-modifier'. + */ + type?: 'product-variation-modifier'; + attributes?: { + /** + * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + * + * | Modifier | Data Type | Effect | + * | :--- | :--- | :--- | + * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | + * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | + * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | + * | `description_equals` | `string` | Overrides the description of the child product. | + * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | + * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | + * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | + * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | + * | `price_increment` | `string` | Increases the price of the child product. | + * | `price_decrement` | `string` | Decreases the price of the child product. | + * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | + * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `sku_equals` | `string` | Sets the SKU of the child product. | + * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | + * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | + * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | + * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | + * + */ + type?: 'commodity_type' | 'status' | 'price' | 'name_append' | 'name_prepend' | 'name_equals' | 'sku_append' | 'sku_prepend' | 'sku_equals' | 'sku_builder' | 'slug_append' | 'slug_prepend' | 'slug_equals' | 'slug_builder' | 'description_append' | 'description_prepend' | 'description_equals' | 'custom_inputs_equals' | 'build_rules_equals' | 'locales_equals' | 'upc_ean_equals' | 'mpn_equals' | 'external_ref_equals'; + /** + * Required for non-builder modifiers. The value of the modifier type. + */ + value?: string; + /** + * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. + */ + seek?: string; + /** + * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. + */ + set?: string; + /** + * The name of the modifier. + */ + reference_name?: string; + }; + meta?: { + /** + * The owner of a resource, either `organization` or `store`. + */ + owner?: 'store' | 'organization'; + }; + }>; + meta?: { + /** + * Contains the results for the entire collection. + */ + results?: { + /** + * Total number of results for the entire collection. + */ + total?: number; + }; + }; +}; + +/** + * Use modifiers to change the properties of child products that are inherited from a parent product. With modifiers, you only need to have one parent product with a variation attached to the product. + */ +export type create_modifier = { + data: { + /** + * This represents the type of resource object being returned. Always `product-variation-modifier`. + */ + type: 'product-variation-modifier'; + attributes: { + /** + * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + * + * | Modifier | Data Type | Effect | + * | :--- | :--- | :--- | + * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | + * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | + * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | + * | `description_equals` | `string` | Overrides the description of the child product. | + * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | + * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | + * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | + * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | + * | `price_increment` | `string` | Increases the price of the child product. | + * | `price_decrement` | `string` | Decreases the price of the child product. | + * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | + * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `sku_equals` | `string` | Sets the SKU of the child product. | + * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | + * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | + * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | + * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | + * + */ + type: 'commodity_type' | 'status' | 'price' | 'name_append' | 'name_prepend' | 'name_equals' | 'sku_append' | 'sku_prepend' | 'sku_equals' | 'sku_builder' | 'slug_append' | 'slug_prepend' | 'slug_equals' | 'slug_builder' | 'description_append' | 'description_prepend' | 'description_equals' | 'custom_inputs_equals' | 'build_rules_equals' | 'locales_equals' | 'upc_ean_equals' | 'mpn_equals' | 'external_ref_equals'; + /** + * Required for non-builder modifiers. The value of the modifier type. + */ + value?: string; + /** + * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. + */ + seek?: string; + /** + * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. + */ + set?: string; + /** + * A name for the modifier. + */ + reference_name?: string; + }; + }; +}; + +/** + * This represents the type of resource object being returned. Always `product-variation-modifier`. + */ +export type type7 = 'product-variation-modifier'; + +export type created_modifier = { + data?: { + /** + * A unique identifier for a modifier that is generated automatically when a modifier is created. + */ + id?: string; + /** + * This represents the type of resource object being returned. Always `product-variation-modifier'. + */ + type?: 'product-variation-modifier'; + attributes?: { + /** + * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + * + * | Modifier | Data Type | Effect | + * | :--- | :--- | :--- | + * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | + * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | + * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | + * | `description_equals` | `string` | Overrides the description of the child product. | + * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | + * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | + * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | + * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | + * | `price_increment` | `string` | Increases the price of the child product. | + * | `price_decrement` | `string` | Decreases the price of the child product. | + * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | + * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `sku_equals` | `string` | Sets the SKU of the child product. | + * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | + * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | + * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | + * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | + * + */ + type?: 'commodity_type' | 'status' | 'price' | 'name_append' | 'name_prepend' | 'name_equals' | 'sku_append' | 'sku_prepend' | 'sku_equals' | 'sku_builder' | 'slug_append' | 'slug_prepend' | 'slug_equals' | 'slug_builder' | 'description_append' | 'description_prepend' | 'description_equals' | 'custom_inputs_equals' | 'build_rules_equals' | 'locales_equals' | 'upc_ean_equals' | 'mpn_equals' | 'external_ref_equals'; + /** + * Required for non-builder modifiers. The value of the modifier type. + */ + value?: string; + /** + * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. + */ + seek?: string; + /** + * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. + */ + set?: string; + /** + * The name of the modifier. + */ + reference_name?: string; + }; + meta?: { + /** + * The owner of the resource, either `organization` or `store`. + */ + owner?: 'organization' | 'store'; + }; + }; +}; + +export type single_modifier = { + data?: { + /** + * A unique identifier for a modifier that is generated automatically when a modifier is created. + */ + id?: string; + /** + * This represents the type of resource object being returned. Always `product-variation-modifier'. + */ + type?: 'product-variation-modifier'; + attributes?: { + /** + * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + * + * | Modifier | Data Type | Effect | + * | :--- | :--- | :--- | + * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | + * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | + * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | + * | `description_equals` | `string` | Overrides the description of the child product. | + * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | + * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | + * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | + * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | + * | `price_increment` | `string` | Increases the price of the child product. | + * | `price_decrement` | `string` | Decreases the price of the child product. | + * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | + * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `sku_equals` | `string` | Sets the SKU of the child product. | + * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | + * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | + * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | + * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | + * + */ + type?: 'commodity_type' | 'status' | 'price' | 'name_append' | 'name_prepend' | 'name_equals' | 'sku_append' | 'sku_prepend' | 'sku_equals' | 'sku_builder' | 'slug_append' | 'slug_prepend' | 'slug_equals' | 'slug_builder' | 'description_append' | 'description_prepend' | 'description_equals' | 'custom_inputs_equals' | 'build_rules_equals' | 'locales_equals' | 'upc_ean_equals' | 'mpn_equals' | 'external_ref_equals'; + /** + * Required for non-builder modifiers. The value of the modifier type. + */ + value?: string; + /** + * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. + */ + seek?: string; + /** + * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. + */ + set?: string; + /** + * The name of the modifier. + */ + reference_name?: string; + }; + /** + * The owner of the resource, either `organization` or `store`. + */ + meta?: { + owner?: 'organization' | 'store'; + }; + }; +}; + +export type update_modifier = { + data: { + /** + * This represents the type of resource object being returned. Always `product-variation-modifier`. + */ + type: 'product-variation-modifier'; + attributes: { + /** + * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + * + * | Modifier | Data Type | Effect | + * | :--- | :--- | :--- | + * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | + * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | + * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | + * | `description_equals` | `string` | Overrides the description of the child product. | + * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | + * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | + * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | + * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | + * | `price_increment` | `string` | Increases the price of the child product. | + * | `price_decrement` | `string` | Decreases the price of the child product. | + * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | + * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `sku_equals` | `string` | Sets the SKU of the child product. | + * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | + * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | + * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | + * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | + * + */ + type: 'commodity_type' | 'status' | 'price' | 'name_append' | 'name_prepend' | 'name_equals' | 'sku_append' | 'sku_prepend' | 'sku_equals' | 'sku_builder' | 'slug_append' | 'slug_prepend' | 'slug_equals' | 'slug_builder' | 'description_append' | 'description_prepend' | 'description_equals' | 'custom_inputs_equals' | 'build_rules_equals' | 'locales_equals' | 'upc_ean_equals' | 'mpn_equals' | 'external_ref_equals'; + /** + * Required for non-builder modifiers. The value of the modifier type. + */ + value?: string; + /** + * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. + */ + seek?: string; + /** + * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. + */ + set?: string; + /** + * The name of the modifier. + */ + reference_name?: string; + }; + /** + * The unique identifier of the modifier. Must match the modifier ID specified in the request path. + */ + id: string; + }; +}; + +export type attributes_hierarchy = { + /** + * The name of a hierarchy, such as `Major Appliances`. + */ + name?: string; + /** + * A description for a hierarchy. + */ + description?: string; + /** + * A unique slug for a hierarchy. + */ + slug?: string; + /** + * Product Experience Manager supports localization of hierarchies and nodes. If you store supports multiple languages, you can localize hierarchy and node names and descriptions. + */ + locales?: { + [key: string]: { + /** + * A localized hierarchy or node name. + */ + name?: string; + /** + * A localized hierarchy or node description. + */ + description?: string; + }; + }; +}; + +export type relationships_hierarchy = { + /** + * The child nodes related to the hierarchy. + */ + children?: { + /** + * An array of child nodes. + */ + data?: unknown[]; + /** + * Links allow you to move between requests. + */ + links?: { + /** + * A link to a related resource. + */ + related?: string; + }; + }; +}; + +export type hierarchy = { + /** + * A unique identifier generated when a hierarchy is created. + */ + id?: string; + /** + * This represents the type of resource object being returned. Always `hierarchy`. + */ + type?: 'hierarchy'; + attributes?: attributes_hierarchy; + relationships?: relationships_hierarchy; + meta?: { + /** + * The date and time a hierarchy is created. + */ + created_at?: string; + /** + * The date and time a hierarchy is updated. + */ + updated_at?: string; + /** + * The owner of a resource, either `organization` or `store`. + */ + owner?: 'store' | 'organization'; + }; +}; + +/** + * This represents the type of resource object being returned. Always `hierarchy`. + */ +export type type8 = 'hierarchy'; + +export type multi_hierarchy = { + data?: Array; + links?: multi_links; + meta?: multi_meta; +}; + +export type req_attributes_hierarchy = { + /** + * The name of the hierarchy, such as `Major Appliances`. + */ + name?: string; + /** + * A description of the hierarchy. + */ + description?: string; + /** + * A unique slug for the hierarchy. + */ + slug?: string; + /** + * Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. + */ + locales?: { + [key: string]: { + /** + * A localized name for the hierarchy. + */ + name?: string; + /** + * A localized description for the hierarchy. + */ + description?: string; + }; + }; +}; + +export type create_hierarchy = { + data?: { + /** + * This represents the type of resource object being returned. Always `hierarchy`. + */ + type: 'hierarchy'; + attributes: req_attributes_hierarchy; + }; +}; + +export type single_hierarchy = { + data?: hierarchy; +}; + +export type update_hierarchy = { + data: { + /** + * The unique identifier of the hierarchy. Must match the hierarchy ID specified in the request path. + */ + id: string; + /** + * This represents the type of resource object being returned. Always `hierarchy`. + */ + type: 'hierarchy'; + attributes: req_attributes_hierarchy; + }; +}; + +export type attributes_nodes = { + /** + * The name of the node, such as `Ranges` or `Refrigerators`. Names must be unique among sibling nodes in the hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies. + */ + name?: string; + /** + * A description of the node. + */ + description?: string; + /** + * A slug for the node. Slugs must be unique among sibling nodes in the hierarchy. Otherwise, a slug can be non-unique within the hierarchy and across multiple hierarchies. + */ + slug?: string; + /** + * You can curate your products in your nodes product lists. Product curation allows you to promote specific products within each node in a hierarchy, enabling you to create unique product collections in your storefront. See [Curating Products in a node](/docs/api/pxm/products/create-node#curating-products-in-a-node). + */ + curated_products?: Array<(string)>; + /** + * Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. + */ + locales?: { + [key: string]: { + /** + * A localized name for the node. + */ + name?: string; + /** + * A localized description for the node. + */ + description?: string; + }; + }; +}; + +export type create_node = { + data?: { + /** + * This represents the type of resource object being returned. Always `node`. + */ + type: 'node'; + attributes: attributes_nodes; + meta?: { + /** + * You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. The `sort_order` for each node. This value determines the order of nodes in the response for the `Get a Node’s Children` request. The node with the highest value of sort_order is displayed first. For example, a node with a sort_order value of 3 appears before a node with a sort_order value of 2. + * + * - If you don’t provide `sort_order` when creating nodes, all child nodes in the response for `Get a Node’s Children` request are ordered by the `updated_at` time in descending order, with the most recently updated child node first. + * - If you set `sort_order` for only a few child nodes or not all, the child nodes with a `sort_order` value appear first and then other child nodes appear in the order of `updated_at` time. See [Sorting Nodes in a hierarchy](). + * + */ + sort_order?: number; + }; + }; +}; + +export type single_node = { + data?: node; +}; + +export type update_node = { + data?: { + /** + * The unique identifier of the node. Must match the node ID specified in the request path. + */ + id: string; + /** + * This represents the type of resource object being returned. Always `node`. + */ + type: 'node'; + attributes: attributes_nodes; + meta?: { + /** + * You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. The `sort_order` for each node. This value determines the order of nodes in the response for the `Get a Node’s Children` request. The node with the highest value of sort_order is displayed first. For example, a node with a sort_order value of 3 appears before a node with a sort_order value of 2. + * + * - If you don’t provide `sort_order` when creating nodes, all child nodes in the response for `Get a Node’s Children` request are ordered by the `updated_at` time in descending order, with the most recently updated child node first. + * - If you set `sort_order` for only a few child nodes or not all, the child nodes with a `sort_order` value appear first and then other child nodes appear in the order of `updated_at` time. + * + */ + sort_order?: number; + }; + }; +}; + +export type node_children = { + data?: Array<{ + /** + * The unique identifier of the child node. Must not match the node ID specified in the request path. + */ + id: string; + /** + * This represents the type of resource object being returned. Always `node`. + */ + type: 'node'; + }>; +}; + +export type node_parent = { + data?: { + /** + * The unique identifier of the new parent node. Must not match the node ID specified in the request path. + */ + id: string; + /** + * This represents the type of resource object being returned. Always `node`. + */ + type: 'node'; + }; +}; + +export type node_products = { + data?: Array<{ + /** + * The unique identifier of the product to be attached to the node. + */ + id: string; + /** + * This represents the type of resource object being returned. Always `product`. + */ + type: 'product'; + }>; +}; + +export type duplicate_job = { + data?: { + /** + * This represents the type of resource object being returned. Always `hierarchy`. + */ + type?: 'hierarchy'; + attributes?: { + /** + * The name of the duplicate hierarchy. The maximum length is 1000 characters. + */ + name?: string; + /** + * A description of the duplicate hierarchy. + */ + description?: string; + /** + * Specify `true` if you want the product associations in the existing nodes associated in your duplicated hierarchy. If not, specify `false`. + */ + include_products?: boolean; + }; + }; +}; + +export type tag = { + /** + * A unique identifier generated when a tag is created. + */ + id?: string; + /** + * This represents the type of resource object being returned. Always `tag`. + */ + type?: 'tag'; + attributes?: { + /** + * The text value of the tag. + */ + value?: string; + }; + meta?: { + /** + * A unique request ID is generated when a tag is created. + */ + x_request_id?: string; + /** + * The date and time a tag is created. + */ + created_at?: string; + /** + * The date and time a tag is updated. + */ + updated_at?: string; + /** + * The owner of a resource, either `organization` or `store`. + */ + owner?: 'store' | 'organization'; + }; +}; + +/** + * This represents the type of resource object being returned. Always `tag`. + */ +export type type9 = 'tag'; + +export type multi_tag = { + /** + * An array of tags. + */ + data?: Array; + meta?: { + /** + * Contains the results for the entire collection. + */ + results?: { + /** + * Total number of results for the entire collection. + */ + total?: number; + }; + }; +}; + +export type single_tag = { + data?: tag; +}; + +export type req_attributes_custom_relationship = { + /** + * The name of the custom relationship, such as `Kitchen electrics`. + */ + name?: string; + /** + * A description of the custom relationship. + */ + description?: string; + /** + * A unique slug for the custom relationship. Must match the slug specified in the request path. + */ + slug?: string; +}; + +export type create_custom_relationship = { + data?: { + /** + * This represents the type of resource object being returned. Always `custom-relationship`. + */ + type: 'custom-relationship'; + attributes: req_attributes_custom_relationship; + }; +}; + +/** + * This represents the type of resource object being returned. Always `custom-relationship`. + */ +export type type10 = 'custom-relationship'; + +export type attributes_custom_relationship = { + /** + * The name of the custom relationship, such as `Kitchen electrics`. + */ + name?: string; + /** + * A description of the custom relationship. + */ + description?: string; + /** + * A unique slug for the custom relationship. + */ + slug?: string; +}; + +export type custom_relationship = { + /** + * A unique identifier generated when a custom relationship is created. + */ + id?: string; + /** + * This represents the type of resource object being returned. Always `hierarchy`. + */ + type?: 'custom-relationship'; + attributes?: attributes_custom_relationship; + meta?: { + /** + * The owner of the resource. + */ + owner?: string; + timestamps?: { + /** + * The date and time the resource is created. + */ + created_at?: string; + /** + * The date and time the resource is updated. + */ + updated_at?: string; + }; + }; +}; + +export type single_custom_relationship = { + data?: custom_relationship; +}; + +export type update_custom_relationship = { + data: { + /** + * The unique identifier of the custom relationship. + */ + id: string; + /** + * This represents the type of resource object being returned. Always `custom-relationship`. + */ + type: 'custom-relationship'; + attributes: req_attributes_custom_relationship; + }; +}; + +/** + * A unique identifier for the job. + */ +export type Parameterjob_id = string; + +/** + * The number of records to offset the results by. + */ +export type Parameterpage_offset = number; + +/** + * The number of records per page. The maximum limit is 100. + */ +export type Parameterpage_limit = number; + +/** + * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering). + * + * For more information about the attributes and operators that are supported, see [Get all products](/docs/api/pxm/products/get-all-products). + * + */ +export type Parameterfilterproduct = string; + +/** + * Using the include parameter, you can retrieve top-level resources. + * + * - Files or main image. For example, `include=files,main_image`. + * - Component product data. For example, `include=component_products`. + * - Key attribute data, such as SKU or slug. + * + */ +export type Parameterinclude = string; + +/** + * Set to `true` if you want to use a template slug instead of a template ID when exporting products that have custom data. + */ +export type ParameteruseTemplateSlugs = boolean; + +/** + * + * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering), but you must go to a specific endpoint to understand the attributes and operators an endpoint supports. + * + * For more information about the attributes and operators that this endpoint supports, see [Export Products](/docs/api/pxm/products/export-products). + * + */ +export type Parameterfilterexport = string; + +/** + * A unique identifier for the product. + */ +export type Parameterproduct_id = string; + +/** + * A unique identifier for the variation. + */ +export type Parametervariation_id = string; + +/** + * A unique identifier for the option. + */ +export type Parameteroption_id = string; + +/** + * A unique identifier for the modifier. + */ +export type Parametermodifier_id = string; + +/** + * A unique identifier for the hierarchy. + */ +export type Parameterhierarchy_id = string; + +/** + * A unique identifier for the node. + */ +export type Parameternode_id = string; + +/** + * A unique identifier for the tag. + */ +export type Parametertag_id = string; + +/** + * A custom relationship slug. + */ +export type Parametercustom_relationship_slug = string; + +export type GetAllJobsResponse = multi; + +export type GetJobData = { + /** + * A unique identifier for the job. + */ + jobId: string; +}; + +export type GetJobResponse = single; + +export type CancelJobData = { + /** + * A unique identifier for the job. + */ + jobId: string; + requestBody?: { + [key: string]: unknown; + }; +}; + +export type CancelJobResponse = single; + +export type GetJobErrorsData = { + /** + * A unique identifier for the job. + */ + jobId: string; +}; + +export type GetJobErrorsResponse = errors; + +export type CreateProductData = { + requestBody: create_product_request; +}; + +export type CreateProductResponse = single_product_response; + +export type GetAllProductsData = { + /** + * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering). + * + * For more information about the attributes and operators that are supported, see [Get all products](/docs/api/pxm/products/get-all-products). + * + */ + filter?: string; + /** + * Using the include parameter, you can retrieve top-level resources. + * + * - Files or main image. For example, `include=files,main_image`. + * - Component product data. For example, `include=component_products`. + * - Key attribute data, such as SKU or slug. + * + */ + include?: string; + /** + * The number of records per page. The maximum limit is 100. + */ + pageLimit?: number; + /** + * The number of records to offset the results by. + */ + pageOffset?: number; +}; + +export type GetAllProductsResponse = multi_product_response; + +export type ImportProductsData = { + formData?: { + /** + * The file you want to upload. Ensure that the file format is Comma Separated Values (CSV). + */ + file?: (Blob | File); + }; +}; + +export type ImportProductsResponse = single; + +export type ExportProductsData = { + /** + * + * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering), but you must go to a specific endpoint to understand the attributes and operators an endpoint supports. + * + * For more information about the attributes and operators that this endpoint supports, see [Export Products](/docs/api/pxm/products/export-products). + * + */ + filter?: string; + requestBody?: { + [key: string]: unknown; + }; + /** + * Set to `true` if you want to use a template slug instead of a template ID when exporting products that have custom data. + */ + useTemplateSlugs?: boolean; +}; + +export type ExportProductsResponse = single; + +export type GetProductData = { + /** + * Using the include parameter, you can retrieve top-level resources. + * + * - Files or main image. For example, `include=files,main_image`. + * - Component product data. For example, `include=component_products`. + * - Key attribute data, such as SKU or slug. + * + */ + include?: string; + /** + * A unique identifier for the product. + */ + productId: string; +}; + +export type GetProductResponse = single_product_response; + +export type UpdateProductData = { + /** + * A unique identifier for the product. + */ + productId: string; + requestBody?: update_product_request; +}; + +export type UpdateProductResponse = single_product_response; + +export type DeleteProductData = { + /** + * A unique identifier for the product. + */ + productId: string; +}; + +export type DeleteProductResponse = void; + +export type AttachNodesData = { + requestBody: { + data: { + /** + * Filters applied to search for appropriate products to attach to a node. See [Attach multiple nodes](/docs/api/pxm/products/attach-nodes). + * + */ + filter: string; + /** + * A list of node unique identifiers that you want to assign to the products. + */ + node_ids: Array<(string)>; + }; + }; +}; + +export type AttachNodesResponse = { + meta?: { + /** + * Number of nodes assigned to the products. + */ + nodes_attached?: number; + /** + * A list of node unique identifiers that could not be identified. + */ + nodes_not_found?: Array<(string)>; + }; +}; + +export type DetachNodesData = { + requestBody: { + data: { + /** + * You can apply filters to search for the appropriate products to detach. See [Detach multiple nodes](/docs/api/pxm/products/detach-nodes). + * + */ + filter: string; + /** + * A list of node unique identifiers that you want to assign to the products. + */ + node_ids: Array<(string)>; + }; + }; +}; + +export type DetachNodesResponse = { + meta?: { + /** + * Number of nodes dissociated from the products. + */ + nodes_detached?: number; + /** + * A list of node unique identifiers that could not be identified. + */ + nodes_not_found?: Array<(string)>; + }; +}; + +export type GetProductsNodesData = { + /** + * The number of records per page. The maximum limit is 100. + */ + pageLimit?: number; + /** + * The number of records to offset the results by. + */ + pageOffset?: number; + /** + * A unique identifier for the product. + */ + productId: string; +}; + +export type GetProductsNodesResponse = multi_nodes; + +export type BuildChildProductsData = { + /** + * A unique identifier for the product. + */ + productId: string; + requestBody?: { + [key: string]: unknown; + }; +}; + +export type BuildChildProductsResponse = unknown; + +export type GetChildProductsData = { + /** + * A unique identifier for the product. + */ + productId: string; +}; + +export type GetChildProductsResponse = multi_product_response; + +export type CreateProductTemplateRelationshipData = { + /** + * A unique identifier for the product. + */ + productId: string; + requestBody?: product_templates_request; +}; + +export type CreateProductTemplateRelationshipResponse = template_response; + +export type GetProductTemplateRelationshipsData = { + /** + * A unique identifier for the product. + */ + productId: string; +}; + +export type GetProductTemplateRelationshipsResponse = template_response; + +export type DeleteProductTemplateRelationshipData = { + /** + * A unique identifier for the product. + */ + productId: string; + requestBody?: product_templates_request; +}; + +export type DeleteProductTemplateRelationshipResponse = void; + +export type GetProductComponentProductsRelationshipsData = { + /** + * A unique identifier for the product. + */ + productId: string; +}; + +export type GetProductComponentProductsRelationshipsResponse = component_products_response; + +export type GetProductFileRelationshipsData = { + /** + * A unique identifier for the product. + */ + productId: string; +}; + +export type GetProductFileRelationshipsResponse = file_response; + +export type CreateProductFileRelationshipsData = { + /** + * A unique identifier for the product. + */ + productId: string; + requestBody?: product_files_request; +}; + +export type CreateProductFileRelationshipsResponse = void; + +export type UpdateProductFileRelationshipsData = { + /** + * A unique identifier for the product. + */ + productId: string; + requestBody?: product_files_request; +}; + +export type UpdateProductFileRelationshipsResponse = void; + +export type DeleteProductFileRelationshipsData = { + /** + * A unique identifier for the product. + */ + productId: string; + requestBody?: product_files_request; +}; + +export type DeleteProductFileRelationshipsResponse = void; + +export type CreateProductVariationRelationshipsData = { + /** + * A unique identifier for the product. + */ + productId: string; + requestBody?: product_variations_request; +}; + +export type CreateProductVariationRelationshipsResponse = void; + +export type GetProductVariationRelationshipsData = { + /** + * A unique identifier for the product. + */ + productId: string; +}; + +export type GetProductVariationRelationshipsResponse = variations_response; + +export type UpdateProductVariationRelationshipsData = { + /** + * A unique identifier for the product. + */ + productId: string; + requestBody?: product_variations_request; +}; + +export type UpdateProductVariationRelationshipsResponse = void; + +export type DeleteProductVariationRelationshipsData = { + /** + * A unique identifier for the product. + */ + productId: string; + requestBody?: product_variations_request; +}; + +export type DeleteProductVariationRelationshipsResponse = void; + +export type CreateProductMainImageRelationshipsData = { + /** + * A unique identifier for the product. + */ + productId: string; + requestBody?: main_image_request; +}; + +export type CreateProductMainImageRelationshipsResponse = void; + +export type GetProductMainImageRelationshipsData = { + /** + * A unique identifier for the product. + */ + productId: string; +}; + +export type GetProductMainImageRelationshipsResponse = main_image_response; + +export type UpdateProductMainImageRelationshipsData = { + /** + * A unique identifier for the product. + */ + productId: string; + requestBody?: replace_main_image_request; +}; + +export type UpdateProductMainImageRelationshipsResponse = void; + +export type DeleteProductMainImageRelationshipsData = { + /** + * A unique identifier for the product. + */ + productId: string; +}; + +export type DeleteProductMainImageRelationshipsResponse = void; + +export type CreateVariationData = { + requestBody: create_variation; +}; + +export type CreateVariationResponse = created_variation; + +export type GetAllVariationsData = { + /** + * The number of records per page. The maximum limit is 100. + */ + pageLimit?: number; + /** + * The number of records to offset the results by. + */ + pageOffset?: number; +}; + +export type GetAllVariationsResponse = multi_variations; + +export type GetVariationData = { + /** + * A unique identifier for the variation. + */ + variationId: string; +}; + +export type GetVariationResponse = single_variation; + +export type UpdateVariationData = { + requestBody?: update_variation; + /** + * A unique identifier for the variation. + */ + variationId: string; +}; + +export type UpdateVariationResponse = single_variation; + +export type DeleteVariationData = { + /** + * A unique identifier for the variation. + */ + variationId: string; +}; + +export type DeleteVariationResponse = void; + +export type CreateVariationOptionData = { + requestBody?: create_option; + /** + * A unique identifier for the variation. + */ + variationId: string; +}; + +export type CreateVariationOptionResponse = created_option; + +export type GetAllVariationOptionsData = { + /** + * The number of records per page. The maximum limit is 100. + */ + pageLimit?: number; + /** + * The number of records to offset the results by. + */ + pageOffset?: number; + /** + * A unique identifier for the variation. + */ + variationId: string; +}; + +export type GetAllVariationOptionsResponse = multi_options; + +export type GetVariationOptionData = { + /** + * A unique identifier for the option. + */ + optionId: string; + /** + * A unique identifier for the variation. + */ + variationId: string; +}; + +export type GetVariationOptionResponse = single_option; + +export type UpdateVariationOptionData = { + /** + * A unique identifier for the option. + */ + optionId: string; + requestBody?: update_option; + /** + * A unique identifier for the variation. + */ + variationId: string; +}; + +export type UpdateVariationOptionResponse = single_option; + +export type DeleteVariationOptionData = { + /** + * A unique identifier for the option. + */ + optionId: string; + /** + * A unique identifier for the variation. + */ + variationId: string; +}; + +export type DeleteVariationOptionResponse = void; + +export type CreateModifierData = { + /** + * A unique identifier for the option. + */ + optionId: string; + requestBody?: create_modifier; + /** + * A unique identifier for the variation. + */ + variationId: string; +}; + +export type CreateModifierResponse = created_modifier; + +export type GetAllModifiersData = { + /** + * A unique identifier for the option. + */ + optionId: string; + /** + * The number of records per page. The maximum limit is 100. + */ + pageLimit?: number; + /** + * The number of records to offset the results by. + */ + pageOffset?: number; + /** + * A unique identifier for the variation. + */ + variationId: string; +}; + +export type GetAllModifiersResponse = multi_modifiers; + +export type GetModifierData = { + /** + * A unique identifier for the modifier. + */ + modifierId: string; + /** + * A unique identifier for the option. + */ + optionId: string; + /** + * A unique identifier for the variation. + */ + variationId: string; +}; + +export type GetModifierResponse = single_modifier; + +export type UpdateModifierData = { + /** + * A unique identifier for the modifier. + */ + modifierId: string; + /** + * A unique identifier for the option. + */ + optionId: string; + requestBody?: update_modifier; + /** + * A unique identifier for the variation. + */ + variationId: string; +}; + +export type UpdateModifierResponse = single_modifier; + +export type DeleteModifierData = { + /** + * A unique identifier for the modifier. + */ + modifierId: string; + /** + * A unique identifier for the option. + */ + optionId: string; + /** + * A unique identifier for the variation. + */ + variationId: string; +}; + +export type DeleteModifierResponse = void; + +export type CreateHierarchyData = { + requestBody: create_hierarchy; +}; + +export type CreateHierarchyResponse = single_hierarchy; + +export type GetHierarchyData = { + /** + * The number of records per page. The maximum limit is 100. + */ + pageLimit?: number; + /** + * The number of records to offset the results by. + */ + pageOffset?: number; +}; + +export type GetHierarchyResponse = multi_hierarchy; + +export type GetHierarchyChildData = { + /** + * A unique identifier for the hierarchy. + */ + hierarchyId: string; +}; + +export type GetHierarchyChildResponse = single_hierarchy; + +export type UpdateHierarchyData = { + /** + * A unique identifier for the hierarchy. + */ + hierarchyId: string; + requestBody: update_hierarchy; +}; + +export type UpdateHierarchyResponse = single_hierarchy; + +export type DeleteHierarchyData = { + /** + * A unique identifier for the hierarchy. + */ + hierarchyId: string; +}; + +export type DeleteHierarchyResponse = void; + +export type CreateNodeData = { + /** + * A unique identifier for the hierarchy. + */ + hierarchyId: string; + requestBody?: create_node; +}; + +export type CreateNodeResponse = single_node; + +export type GetAllNodesInHierarchyData = { + /** + * A unique identifier for the hierarchy. + */ + hierarchyId: string; + /** + * The number of records per page. The maximum limit is 100. + */ + pageLimit?: number; + /** + * The number of records to offset the results by. + */ + pageOffset?: number; +}; + +export type GetAllNodesInHierarchyResponse = multi_nodes; + +export type GetHierarchyNodeData = { + /** + * A unique identifier for the hierarchy. + */ + hierarchyId: string; + /** + * A unique identifier for the node. + */ + nodeId: string; +}; + +export type GetHierarchyNodeResponse = single_node; + +export type UpdateNodeData = { + /** + * A unique identifier for the hierarchy. + */ + hierarchyId: string; + /** + * A unique identifier for the node. + */ + nodeId: string; + requestBody?: update_node; +}; + +export type UpdateNodeResponse = single_node; + +export type DeleteNodeData = { + /** + * A unique identifier for the hierarchy. + */ + hierarchyId: string; + /** + * A unique identifier for the node. + */ + nodeId: string; +}; + +export type DeleteNodeResponse = void; + +export type GetAllChildrenData = { + /** + * A unique identifier for the hierarchy. + */ + hierarchyId: string; + /** + * The number of records per page. The maximum limit is 100. + */ + pageLimit?: number; + /** + * The number of records to offset the results by. + */ + pageOffset?: number; +}; + +export type GetAllChildrenResponse = multi_nodes; + +export type CreateNodeChildRelationshipsData = { + /** + * A unique identifier for the hierarchy. + */ + hierarchyId: string; + /** + * A unique identifier for the node. + */ + nodeId: string; + requestBody?: node_children; +}; + +export type CreateNodeChildRelationshipsResponse = single_node; + +export type GetAllNodeChildrenData = { + /** + * A unique identifier for the hierarchy. + */ + hierarchyId: string; + /** + * A unique identifier for the node. + */ + nodeId: string; + /** + * The number of records per page. The maximum limit is 100. + */ + pageLimit?: number; + /** + * The number of records to offset the results by. + */ + pageOffset?: number; +}; + +export type GetAllNodeChildrenResponse = multi_nodes; + +export type UpdateNodeParentData = { + /** + * A unique identifier for the hierarchy. + */ + hierarchyId: string; + /** + * A unique identifier for the node. + */ + nodeId: string; + requestBody?: node_parent; +}; + +export type UpdateNodeParentResponse = void; + +export type DeleteNodeParentData = { + /** + * A unique identifier for the hierarchy. + */ + hierarchyId: string; + /** + * A unique identifier for the node. + */ + nodeId: string; +}; + +export type DeleteNodeParentResponse = void; + +export type CreateNodeProductRelationshipData = { + /** + * A unique identifier for the hierarchy. + */ + hierarchyId: string; + /** + * A unique identifier for the node. + */ + nodeId: string; + requestBody?: node_products; +}; + +export type CreateNodeProductRelationshipResponse = single_node; + +export type DeleteNodeProductRelationshipsData = { + /** + * A unique identifier for the hierarchy. + */ + hierarchyId: string; + /** + * A unique identifier for the node. + */ + nodeId: string; + requestBody?: node_products; +}; + +export type DeleteNodeProductRelationshipsResponse = single_node; + +export type GetNodeProductsData = { + /** + * A unique identifier for the hierarchy. + */ + hierarchyId: string; + /** + * A unique identifier for the node. + */ + nodeId: string; + /** + * The number of records per page. The maximum limit is 100. + */ + pageLimit?: number; + /** + * The number of records to offset the results by. + */ + pageOffset?: number; +}; + +export type GetNodeProductsResponse = multi_product_response; + +export type DuplicateHierarchyData = { + /** + * A unique identifier for the hierarchy. + */ + hierarchyId: string; + requestBody: duplicate_job; +}; + +export type DuplicateHierarchyResponse = single; + +export type GetAllProductTagsResponse = multi_tag; + +export type GetProductTagData = { + /** + * A unique identifier for the tag. + */ + tagId: string; +}; + +export type GetProductTagResponse = single_tag; + +export type CreateCustomRelationshipData = { + requestBody: create_custom_relationship; +}; + +export type CreateCustomRelationshipResponse = single_custom_relationship; + +export type UpdateCustomRelationshipData = { + /** + * A custom relationship slug. + */ + customRelationshipSlug: string; + requestBody: update_custom_relationship; +}; + +export type UpdateCustomRelationshipResponse = single_custom_relationship; + +export type $OpenApiTs = { + '/pcm/jobs': { + get: { + res: { + /** + * Returns all the jobs. + */ + 200: multi; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/jobs/{jobID}': { + get: { + req: GetJobData; + res: { + /** + * Returns a job with the following attributes. + */ + 200: single; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/jobs/{jobID}/cancel': { + post: { + req: CancelJobData; + res: { + /** + * Successfully cancelled job + */ + 200: single; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/jobs/{jobID}/errors': { + get: { + req: GetJobErrorsData; + res: { + /** + * Successful + */ + 200: errors; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/products': { + post: { + req: CreateProductData; + res: { + /** + * Creates a product with the following attributes. + */ + 201: single_product_response; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + get: { + req: GetAllProductsData; + res: { + /** + * Returns a list of all products. + */ + 200: multi_product_response; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/products/import': { + post: { + req: ImportProductsData; + res: { + /** + * Import started + */ + 201: single; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/products/export': { + post: { + req: ExportProductsData; + res: { + /** + * Export started + */ + 201: single; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/products/{productID}': { + get: { + req: GetProductData; + res: { + /** + * Returns a product by its identifier. + */ + 200: single_product_response; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + put: { + req: UpdateProductData; + res: { + /** + * Updates a product with the following attributes. + */ + 200: single_product_response; + /** + * Forbidden + */ + 403: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Write conflict detected + */ + 409: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + delete: { + req: DeleteProductData; + res: { + /** + * Deletes the specified product. + */ + 204: void; + /** + * Forbidden + */ + 403: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/products/attach_nodes': { + post: { + req: AttachNodesData; + res: { + /** + * This request assigns the products that you have selected to multiple hierarchies and their children nodes and returns the following. + */ + 200: { + meta?: { + /** + * Number of nodes assigned to the products. + */ + nodes_attached?: number; + /** + * A list of node unique identifiers that could not be identified. + */ + nodes_not_found?: Array<(string)>; + }; + }; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/products/detach_nodes': { + post: { + req: DetachNodesData; + res: { + /** + * The request dissociates the products that you have selected from multiple hierarchies and their children and returns the following. + */ + 200: { + meta?: { + /** + * Number of nodes dissociated from the products. + */ + nodes_detached?: number; + /** + * A list of node unique identifiers that could not be identified. + */ + nodes_not_found?: Array<(string)>; + }; + }; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/products/{productID}/nodes': { + get: { + req: GetProductsNodesData; + res: { + /** + * Successfully returns the product's nodes. + */ + 200: multi_nodes; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/products/{productID}/build': { + post: { + req: BuildChildProductsData; + res: { + /** + * Successfully started building child products + */ + 201: unknown; + /** + * Forbidden + */ + 403: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/products/{productID}/children': { + get: { + req: GetChildProductsData; + res: { + /** + * Returns a list of child products for the specified parent product ID. + */ + 200: multi_product_response; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/products/{productID}/relationships/templates': { + post: { + req: CreateProductTemplateRelationshipData; + res: { + /** + * Returns a created product template relationship. + */ + 201: template_response; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Forbidden + */ + 403: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Write conflict detected + */ + 409: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + get: { + req: GetProductTemplateRelationshipsData; + res: { + /** + * Returns all product template relationships + */ + 200: template_response; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Forbidden + */ + 403: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Write conflict detected + */ + 409: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + delete: { + req: DeleteProductTemplateRelationshipData; + res: { + /** + * No Content + */ + 204: void; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Forbidden + */ + 403: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Write conflict detected + */ + 409: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/products/{productID}/relationships/component_products': { + get: { + req: GetProductComponentProductsRelationshipsData; + res: { + /** + * Returns all Component Products relationships + */ + 200: component_products_response; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Forbidden + */ + 403: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Write conflict detected + */ + 409: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/products/{productID}/relationships/files': { + get: { + req: GetProductFileRelationshipsData; + res: { + /** + * Returns all product file relationships. + */ + 200: file_response; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Forbidden + */ + 403: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Write conflict detected + */ + 409: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + post: { + req: CreateProductFileRelationshipsData; + res: { + /** + * No Content + */ + 204: void; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Forbidden + */ + 403: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Write conflict detected + */ + 409: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + put: { + req: UpdateProductFileRelationshipsData; + res: { + /** + * No Content + */ + 204: void; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Forbidden + */ + 403: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Write conflict detected + */ + 409: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + delete: { + req: DeleteProductFileRelationshipsData; + res: { + /** + * No Content + */ + 204: void; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Forbidden + */ + 403: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Write conflict detected + */ + 409: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/products/{productID}/relationships/variations': { + post: { + req: CreateProductVariationRelationshipsData; + res: { + /** + * No Content + */ + 204: void; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Forbidden + */ + 403: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Write conflict detected + */ + 409: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + get: { + req: GetProductVariationRelationshipsData; + res: { + /** + * Returns all product variation relationships + */ + 200: variations_response; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Forbidden + */ + 403: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Write conflict detected + */ + 409: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + put: { + req: UpdateProductVariationRelationshipsData; + res: { + /** + * No Content + */ + 204: void; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Forbidden + */ + 403: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Write conflict detected + */ + 409: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + delete: { + req: DeleteProductVariationRelationshipsData; + res: { + /** + * No Content + */ + 204: void; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Forbidden + */ + 403: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Write conflict detected + */ + 409: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/products/{productID}/relationships/main_image': { + post: { + req: CreateProductMainImageRelationshipsData; + res: { + /** + * No Content + */ + 204: void; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Forbidden + */ + 403: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Write conflict detected + */ + 409: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + get: { + req: GetProductMainImageRelationshipsData; + res: { + /** + * Returns all product variation relationships + */ + 200: main_image_response; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Forbidden + */ + 403: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Write conflict detected + */ + 409: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + put: { + req: UpdateProductMainImageRelationshipsData; + res: { + /** + * No Content + */ + 204: void; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Forbidden + */ + 403: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Write conflict detected + */ + 409: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + delete: { + req: DeleteProductMainImageRelationshipsData; + res: { + /** + * No Content + */ + 204: void; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Forbidden + */ + 403: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Write conflict detected + */ + 409: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/variations': { + post: { + req: CreateVariationData; + res: { + /** + * Returns a created variation with the following attributes. + */ + 201: created_variation; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + get: { + req: GetAllVariationsData; + res: { + /** + * Returns all variations. + */ + 200: multi_variations; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/variations/{variationID}': { + get: { + req: GetVariationData; + res: { + /** + * Returns the specified variation. + */ + 200: single_variation; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + put: { + req: UpdateVariationData; + res: { + /** + * Returns an updated variation with the following attributes. + */ + 200: single_variation; + /** + * Forbidden + */ + 403: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Write conflict detected + */ + 409: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + delete: { + req: DeleteVariationData; + res: { + /** + * No Content + */ + 204: void; + /** + * Forbidden + */ + 403: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/variations/{variationID}/options': { + post: { + req: CreateVariationOptionData; + res: { + /** + * Successfully returns the created variation option + */ + 201: created_option; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + get: { + req: GetAllVariationOptionsData; + res: { + /** + * Successfully returns all variation options + */ + 200: multi_options; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/variations/{variationID}/options/{optionID}': { + get: { + req: GetVariationOptionData; + res: { + /** + * Successfully returns the variation option + */ + 200: single_option; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + put: { + req: UpdateVariationOptionData; + res: { + /** + * Successfully returns the updated variation option + */ + 200: single_option; + /** + * Forbidden + */ + 403: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Write conflict detected + */ + 409: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + delete: { + req: DeleteVariationOptionData; + res: { + /** + * No Content + */ + 204: void; + /** + * Forbidden + */ + 403: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/variations/{variationID}/options/{optionID}/modifiers': { + post: { + req: CreateModifierData; + res: { + /** + * Successfully returns the created modifier + */ + 201: created_modifier; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + get: { + req: GetAllModifiersData; + res: { + /** + * Successfully returns all variation modifiers + */ + 200: multi_modifiers; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/variations/{variationID}/options/{optionID}/modifiers/{modifierID}': { + get: { + req: GetModifierData; + res: { + /** + * Returns the specified modifier. + */ + 200: single_modifier; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + put: { + req: UpdateModifierData; + res: { + /** + * Successfully returns the updated modifier + */ + 200: single_modifier; + /** + * Forbidden + */ + 403: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Write conflict detected + */ + 409: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + delete: { + req: DeleteModifierData; + res: { + /** + * No Content + */ + 204: void; + /** + * Forbidden + */ + 403: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/hierarchies': { + post: { + req: CreateHierarchyData; + res: { + /** + * Returns a created hierarchy with the following attributes. + */ + 201: single_hierarchy; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + get: { + req: GetHierarchyData; + res: { + /** + * Returns a list of all hierarchies. + */ + 200: multi_hierarchy; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/hierarchies/{hierarchyID}': { + get: { + req: GetHierarchyChildData; + res: { + /** + * Returns a hierarchy with the following attributes. + */ + 200: single_hierarchy; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + put: { + req: UpdateHierarchyData; + res: { + /** + * Successfully returns the updated hierarchy + */ + 200: single_hierarchy; + /** + * Forbidden + */ + 403: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + delete: { + req: DeleteHierarchyData; + res: { + /** + * No Content + */ + 204: void; + /** + * Forbidden + */ + 403: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/hierarchies/{hierarchyID}/nodes': { + post: { + req: CreateNodeData; + res: { + /** + * Successfully returns the created node + */ + 201: single_node; + /** + * Forbidden + */ + 403: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + get: { + req: GetAllNodesInHierarchyData; + res: { + /** + * Successfully returns the node's children + */ + 200: multi_nodes; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}': { + get: { + req: GetHierarchyNodeData; + res: { + /** + * Returns a node with the following attributes. + */ + 200: single_node; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + put: { + req: UpdateNodeData; + res: { + /** + * Successfully returns the updated node + */ + 200: single_node; + /** + * Forbidden + */ + 403: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + delete: { + req: DeleteNodeData; + res: { + /** + * No Content + */ + 204: void; + /** + * Forbidden + */ + 403: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/hierarchies/{hierarchyID}/children': { + get: { + req: GetAllChildrenData; + res: { + /** + * Returns the hierarchy's children. + */ + 200: multi_nodes; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/children': { + post: { + req: CreateNodeChildRelationshipsData; + res: { + /** + * Successfully returns the node's children + */ + 200: single_node; + /** + * Forbidden + */ + 403: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/children': { + get: { + req: GetAllNodeChildrenData; + res: { + /** + * Successfully returns the node's children + */ + 200: multi_nodes; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/parent': { + put: { + req: UpdateNodeParentData; + res: { + /** + * No Content + */ + 204: void; + /** + * Forbidden + */ + 403: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + delete: { + req: DeleteNodeParentData; + res: { + /** + * No Content + */ + 204: void; + /** + * Forbidden + */ + 403: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/products': { + post: { + req: CreateNodeProductRelationshipData; + res: { + /** + * Successfully returns the updated node + */ + 201: single_node; + /** + * Forbidden + */ + 403: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + delete: { + req: DeleteNodeProductRelationshipsData; + res: { + /** + * Successfully returns the updated node + */ + 200: single_node; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/products': { + get: { + req: GetNodeProductsData; + res: { + /** + * Successfully returns the node's products + */ + 200: multi_product_response; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/hierarchies/{hierarchyID}/duplicate_job': { + post: { + req: DuplicateHierarchyData; + res: { + /** + * Successfully returns the duplicate hierarchy job ID + */ + 201: single; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/tags': { + get: { + res: { + /** + * Returns all the product tags. + */ + 200: multi_tag; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/tags/{tagID}': { + get: { + req: GetProductTagData; + res: { + /** + * Returns a product tag with the following attributes. + */ + 200: single_tag; + /** + * Bad request. The request failed validation. + */ + 400: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/custom_relationships': { + post: { + req: CreateCustomRelationshipData; + res: { + /** + * Returns a created custom relationship with the following attributes. + */ + 201: single_custom_relationship; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; + '/pcm/custom_relationships/{customRelationshipSlug}': { + put: { + req: UpdateCustomRelationshipData; + res: { + /** + * Successfully returns the updated custom relationship + */ + 200: single_custom_relationship; + /** + * Forbidden + */ + 403: error; + /** + * Bad Request. Not Found. + */ + 404: error; + /** + * Bad request. The request failed validation. + */ + 422: error; + /** + * Internal server error. There was a system failure in the platform. + */ + 500: error; + }; + }; + }; +}; \ No newline at end of file diff --git a/packages/sdks/tsconfig.json b/packages/sdks/tsconfig.json new file mode 100644 index 00000000..75dcaeac --- /dev/null +++ b/packages/sdks/tsconfig.json @@ -0,0 +1,103 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + + /* Language and Environment */ + "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + // "outDir": "./", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + } +} From eac6babac7a942d3a96c8246c83af3ef2419b3ee Mon Sep 17 00:00:00 2001 From: Robert Field Date: Thu, 4 Jul 2024 16:47:16 +0100 Subject: [PATCH 02/30] feat: bumped latest --- packages/sdks/openapi-ts.config.ts | 7 +- packages/sdks/package.json | 6 +- packages/sdks/src/client/core/ApiError.ts | 38 +- .../sdks/src/client/core/ApiRequestOptions.ts | 33 +- packages/sdks/src/client/core/ApiResult.ts | 12 +- .../sdks/src/client/core/CancelablePromise.ts | 236 +- packages/sdks/src/client/core/OpenAPI.ts | 74 +- packages/sdks/src/client/core/request.ts | 682 +- packages/sdks/src/client/index.ts | 9 +- packages/sdks/src/client/schemas.gen.ts | 5600 ++++++----- packages/sdks/src/client/services.gen.ts | 2371 ++--- packages/sdks/src/client/types.gen.ts | 8834 +++++++++-------- packages/sdks/tsconfig.json | 122 +- packages/sdks/tsconfig.node.json | 11 + tsconfig.json | 53 +- 15 files changed, 9156 insertions(+), 8932 deletions(-) create mode 100644 packages/sdks/tsconfig.node.json diff --git a/packages/sdks/openapi-ts.config.ts b/packages/sdks/openapi-ts.config.ts index 8ebcb7a8..f9993994 100644 --- a/packages/sdks/openapi-ts.config.ts +++ b/packages/sdks/openapi-ts.config.ts @@ -1,6 +1,11 @@ import { defineConfig } from "@hey-api/openapi-ts" export default defineConfig({ + client: "@hey-api/client-fetch", input: "./specs/pim.yaml", - output: "src/client", + output: { path: "src/client", format: "prettier" }, + types: { + name: "PascalCase", + enums: false, + }, }) diff --git a/packages/sdks/package.json b/packages/sdks/package.json index 113fff20..a05b7795 100644 --- a/packages/sdks/package.json +++ b/packages/sdks/package.json @@ -10,6 +10,10 @@ "author": "Robert Field", "license": "ISC", "devDependencies": { - "@hey-api/openapi-ts": "^0.48.2" + "@hey-api/openapi-ts": "^0.48.2", + "typescript": "^5.5.3" + }, + "dependencies": { + "@hey-api/client-fetch": "^0.1.7" } } diff --git a/packages/sdks/src/client/core/ApiError.ts b/packages/sdks/src/client/core/ApiError.ts index 36675d28..5499aa8f 100644 --- a/packages/sdks/src/client/core/ApiError.ts +++ b/packages/sdks/src/client/core/ApiError.ts @@ -1,21 +1,25 @@ -import type { ApiRequestOptions } from './ApiRequestOptions'; -import type { ApiResult } from './ApiResult'; +import type { ApiRequestOptions } from "./ApiRequestOptions" +import type { ApiResult } from "./ApiResult" export class ApiError extends Error { - public readonly url: string; - public readonly status: number; - public readonly statusText: string; - public readonly body: unknown; - public readonly request: ApiRequestOptions; + public readonly url: string + public readonly status: number + public readonly statusText: string + public readonly body: unknown + public readonly request: ApiRequestOptions - constructor(request: ApiRequestOptions, response: ApiResult, message: string) { - super(message); + constructor( + request: ApiRequestOptions, + response: ApiResult, + message: string, + ) { + super(message) - this.name = 'ApiError'; - this.url = response.url; - this.status = response.status; - this.statusText = response.statusText; - this.body = response.body; - this.request = request; - } -} \ No newline at end of file + this.name = "ApiError" + this.url = response.url + this.status = response.status + this.statusText = response.statusText + this.body = response.body + this.request = request + } +} diff --git a/packages/sdks/src/client/core/ApiRequestOptions.ts b/packages/sdks/src/client/core/ApiRequestOptions.ts index 1758d98c..b5384fec 100644 --- a/packages/sdks/src/client/core/ApiRequestOptions.ts +++ b/packages/sdks/src/client/core/ApiRequestOptions.ts @@ -1,14 +1,21 @@ export type ApiRequestOptions = { - readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH'; - readonly url: string; - readonly path?: Record; - readonly cookies?: Record; - readonly headers?: Record; - readonly query?: Record; - readonly formData?: Record; - readonly body?: any; - readonly mediaType?: string; - readonly responseHeader?: string; - readonly responseTransformer?: (data: unknown) => Promise; - readonly errors?: Record; -}; \ No newline at end of file + readonly method: + | "GET" + | "PUT" + | "POST" + | "DELETE" + | "OPTIONS" + | "HEAD" + | "PATCH" + readonly url: string + readonly path?: Record + readonly cookies?: Record + readonly headers?: Record + readonly query?: Record + readonly formData?: Record + readonly body?: any + readonly mediaType?: string + readonly responseHeader?: string + readonly responseTransformer?: (data: unknown) => Promise + readonly errors?: Record +} diff --git a/packages/sdks/src/client/core/ApiResult.ts b/packages/sdks/src/client/core/ApiResult.ts index 4c58e391..f88b8c64 100644 --- a/packages/sdks/src/client/core/ApiResult.ts +++ b/packages/sdks/src/client/core/ApiResult.ts @@ -1,7 +1,7 @@ export type ApiResult = { - readonly body: TData; - readonly ok: boolean; - readonly status: number; - readonly statusText: string; - readonly url: string; -}; \ No newline at end of file + readonly body: TData + readonly ok: boolean + readonly status: number + readonly statusText: string + readonly url: string +} diff --git a/packages/sdks/src/client/core/CancelablePromise.ts b/packages/sdks/src/client/core/CancelablePromise.ts index ccc082e8..f47db79e 100644 --- a/packages/sdks/src/client/core/CancelablePromise.ts +++ b/packages/sdks/src/client/core/CancelablePromise.ts @@ -1,126 +1,126 @@ export class CancelError extends Error { - constructor(message: string) { - super(message); - this.name = 'CancelError'; - } - - public get isCancelled(): boolean { - return true; - } + constructor(message: string) { + super(message) + this.name = "CancelError" + } + + public get isCancelled(): boolean { + return true + } } export interface OnCancel { - readonly isResolved: boolean; - readonly isRejected: boolean; - readonly isCancelled: boolean; + readonly isResolved: boolean + readonly isRejected: boolean + readonly isCancelled: boolean - (cancelHandler: () => void): void; + (cancelHandler: () => void): void } export class CancelablePromise implements Promise { - private _isResolved: boolean; - private _isRejected: boolean; - private _isCancelled: boolean; - readonly cancelHandlers: (() => void)[]; - readonly promise: Promise; - private _resolve?: (value: T | PromiseLike) => void; - private _reject?: (reason?: unknown) => void; - - constructor( - executor: ( - resolve: (value: T | PromiseLike) => void, - reject: (reason?: unknown) => void, - onCancel: OnCancel - ) => void - ) { - this._isResolved = false; - this._isRejected = false; - this._isCancelled = false; - this.cancelHandlers = []; - this.promise = new Promise((resolve, reject) => { - this._resolve = resolve; - this._reject = reject; - - const onResolve = (value: T | PromiseLike): void => { - if (this._isResolved || this._isRejected || this._isCancelled) { - return; - } - this._isResolved = true; - if (this._resolve) this._resolve(value); - }; - - const onReject = (reason?: unknown): void => { - if (this._isResolved || this._isRejected || this._isCancelled) { - return; - } - this._isRejected = true; - if (this._reject) this._reject(reason); - }; - - const onCancel = (cancelHandler: () => void): void => { - if (this._isResolved || this._isRejected || this._isCancelled) { - return; - } - this.cancelHandlers.push(cancelHandler); - }; - - Object.defineProperty(onCancel, 'isResolved', { - get: (): boolean => this._isResolved, - }); - - Object.defineProperty(onCancel, 'isRejected', { - get: (): boolean => this._isRejected, - }); - - Object.defineProperty(onCancel, 'isCancelled', { - get: (): boolean => this._isCancelled, - }); - - return executor(onResolve, onReject, onCancel as OnCancel); - }); - } - - get [Symbol.toStringTag]() { - return "Cancellable Promise"; - } - - public then( - onFulfilled?: ((value: T) => TResult1 | PromiseLike) | null, - onRejected?: ((reason: unknown) => TResult2 | PromiseLike) | null - ): Promise { - return this.promise.then(onFulfilled, onRejected); - } - - public catch( - onRejected?: ((reason: unknown) => TResult | PromiseLike) | null - ): Promise { - return this.promise.catch(onRejected); - } - - public finally(onFinally?: (() => void) | null): Promise { - return this.promise.finally(onFinally); - } - - public cancel(): void { - if (this._isResolved || this._isRejected || this._isCancelled) { - return; - } - this._isCancelled = true; - if (this.cancelHandlers.length) { - try { - for (const cancelHandler of this.cancelHandlers) { - cancelHandler(); - } - } catch (error) { - console.warn('Cancellation threw an error', error); - return; - } - } - this.cancelHandlers.length = 0; - if (this._reject) this._reject(new CancelError('Request aborted')); - } - - public get isCancelled(): boolean { - return this._isCancelled; - } -} \ No newline at end of file + private _isResolved: boolean + private _isRejected: boolean + private _isCancelled: boolean + readonly cancelHandlers: (() => void)[] + readonly promise: Promise + private _resolve?: (value: T | PromiseLike) => void + private _reject?: (reason?: unknown) => void + + constructor( + executor: ( + resolve: (value: T | PromiseLike) => void, + reject: (reason?: unknown) => void, + onCancel: OnCancel, + ) => void, + ) { + this._isResolved = false + this._isRejected = false + this._isCancelled = false + this.cancelHandlers = [] + this.promise = new Promise((resolve, reject) => { + this._resolve = resolve + this._reject = reject + + const onResolve = (value: T | PromiseLike): void => { + if (this._isResolved || this._isRejected || this._isCancelled) { + return + } + this._isResolved = true + if (this._resolve) this._resolve(value) + } + + const onReject = (reason?: unknown): void => { + if (this._isResolved || this._isRejected || this._isCancelled) { + return + } + this._isRejected = true + if (this._reject) this._reject(reason) + } + + const onCancel = (cancelHandler: () => void): void => { + if (this._isResolved || this._isRejected || this._isCancelled) { + return + } + this.cancelHandlers.push(cancelHandler) + } + + Object.defineProperty(onCancel, "isResolved", { + get: (): boolean => this._isResolved, + }) + + Object.defineProperty(onCancel, "isRejected", { + get: (): boolean => this._isRejected, + }) + + Object.defineProperty(onCancel, "isCancelled", { + get: (): boolean => this._isCancelled, + }) + + return executor(onResolve, onReject, onCancel as OnCancel) + }) + } + + get [Symbol.toStringTag]() { + return "Cancellable Promise" + } + + public then( + onFulfilled?: ((value: T) => TResult1 | PromiseLike) | null, + onRejected?: ((reason: unknown) => TResult2 | PromiseLike) | null, + ): Promise { + return this.promise.then(onFulfilled, onRejected) + } + + public catch( + onRejected?: ((reason: unknown) => TResult | PromiseLike) | null, + ): Promise { + return this.promise.catch(onRejected) + } + + public finally(onFinally?: (() => void) | null): Promise { + return this.promise.finally(onFinally) + } + + public cancel(): void { + if (this._isResolved || this._isRejected || this._isCancelled) { + return + } + this._isCancelled = true + if (this.cancelHandlers.length) { + try { + for (const cancelHandler of this.cancelHandlers) { + cancelHandler() + } + } catch (error) { + console.warn("Cancellation threw an error", error) + return + } + } + this.cancelHandlers.length = 0 + if (this._reject) this._reject(new CancelError("Request aborted")) + } + + public get isCancelled(): boolean { + return this._isCancelled + } +} diff --git a/packages/sdks/src/client/core/OpenAPI.ts b/packages/sdks/src/client/core/OpenAPI.ts index 34e139da..820233a3 100644 --- a/packages/sdks/src/client/core/OpenAPI.ts +++ b/packages/sdks/src/client/core/OpenAPI.ts @@ -1,56 +1,56 @@ -import type { ApiRequestOptions } from './ApiRequestOptions'; +import type { ApiRequestOptions } from "./ApiRequestOptions" -type Headers = Record; -type Middleware = (value: T) => T | Promise; -type Resolver = (options: ApiRequestOptions) => Promise; +type Headers = Record +type Middleware = (value: T) => T | Promise +type Resolver = (options: ApiRequestOptions) => Promise export class Interceptors { - _fns: Middleware[]; + _fns: Middleware[] constructor() { - this._fns = []; + this._fns = [] } eject(fn: Middleware): void { - const index = this._fns.indexOf(fn); + const index = this._fns.indexOf(fn) if (index !== -1) { - this._fns = [...this._fns.slice(0, index), ...this._fns.slice(index + 1)]; + this._fns = [...this._fns.slice(0, index), ...this._fns.slice(index + 1)] } } use(fn: Middleware): void { - this._fns = [...this._fns, fn]; + this._fns = [...this._fns, fn] } } export type OpenAPIConfig = { - BASE: string; - CREDENTIALS: 'include' | 'omit' | 'same-origin'; - ENCODE_PATH?: ((path: string) => string) | undefined; - HEADERS?: Headers | Resolver | undefined; - PASSWORD?: string | Resolver | undefined; - TOKEN?: string | Resolver | undefined; - USERNAME?: string | Resolver | undefined; - VERSION: string; - WITH_CREDENTIALS: boolean; - interceptors: { - request: Interceptors; - response: Interceptors; - }; -}; + BASE: string + CREDENTIALS: "include" | "omit" | "same-origin" + ENCODE_PATH?: ((path: string) => string) | undefined + HEADERS?: Headers | Resolver | undefined + PASSWORD?: string | Resolver | undefined + TOKEN?: string | Resolver | undefined + USERNAME?: string | Resolver | undefined + VERSION: string + WITH_CREDENTIALS: boolean + interceptors: { + request: Interceptors + response: Interceptors + } +} export const OpenAPI: OpenAPIConfig = { - BASE: 'https://euwest.api.elasticpath.com', - CREDENTIALS: 'include', - ENCODE_PATH: undefined, - HEADERS: undefined, - PASSWORD: undefined, - TOKEN: undefined, - USERNAME: undefined, - VERSION: '1.0.0', - WITH_CREDENTIALS: false, - interceptors: { - request: new Interceptors(), - response: new Interceptors(), - }, -}; \ No newline at end of file + BASE: "https://euwest.api.elasticpath.com", + CREDENTIALS: "include", + ENCODE_PATH: undefined, + HEADERS: undefined, + PASSWORD: undefined, + TOKEN: undefined, + USERNAME: undefined, + VERSION: "1.0.0", + WITH_CREDENTIALS: false, + interceptors: { + request: new Interceptors(), + response: new Interceptors(), + }, +} diff --git a/packages/sdks/src/client/core/request.ts b/packages/sdks/src/client/core/request.ts index 5458a289..c4f42672 100644 --- a/packages/sdks/src/client/core/request.ts +++ b/packages/sdks/src/client/core/request.ts @@ -1,305 +1,341 @@ -import { ApiError } from './ApiError'; -import type { ApiRequestOptions } from './ApiRequestOptions'; -import type { ApiResult } from './ApiResult'; -import { CancelablePromise } from './CancelablePromise'; -import type { OnCancel } from './CancelablePromise'; -import type { OpenAPIConfig } from './OpenAPI'; +import { ApiError } from "./ApiError" +import type { ApiRequestOptions } from "./ApiRequestOptions" +import type { ApiResult } from "./ApiResult" +import { CancelablePromise } from "./CancelablePromise" +import type { OnCancel } from "./CancelablePromise" +import type { OpenAPIConfig } from "./OpenAPI" export const isString = (value: unknown): value is string => { - return typeof value === 'string'; -}; + return typeof value === "string" +} export const isStringWithValue = (value: unknown): value is string => { - return isString(value) && value !== ''; -}; + return isString(value) && value !== "" +} export const isBlob = (value: any): value is Blob => { - return value instanceof Blob; -}; + return value instanceof Blob +} export const isFormData = (value: unknown): value is FormData => { - return value instanceof FormData; -}; + return value instanceof FormData +} export const base64 = (str: string): string => { - try { - return btoa(str); - } catch (err) { - // @ts-ignore - return Buffer.from(str).toString('base64'); - } -}; + try { + return btoa(str) + } catch (err) { + // @ts-ignore + return Buffer.from(str).toString("base64") + } +} export const getQueryString = (params: Record): string => { - const qs: string[] = []; + const qs: string[] = [] - const append = (key: string, value: unknown) => { - qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`); - }; + const append = (key: string, value: unknown) => { + qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`) + } - const encodePair = (key: string, value: unknown) => { - if (value === undefined || value === null) { - return; - } + const encodePair = (key: string, value: unknown) => { + if (value === undefined || value === null) { + return + } - if (value instanceof Date) { - append(key, value.toISOString()); - } else if (Array.isArray(value)) { - value.forEach(v => encodePair(key, v)); - } else if (typeof value === 'object') { - Object.entries(value).forEach(([k, v]) => encodePair(`${key}[${k}]`, v)); - } else { - append(key, value); - } - }; + if (value instanceof Date) { + append(key, value.toISOString()) + } else if (Array.isArray(value)) { + value.forEach((v) => encodePair(key, v)) + } else if (typeof value === "object") { + Object.entries(value).forEach(([k, v]) => encodePair(`${key}[${k}]`, v)) + } else { + append(key, value) + } + } - Object.entries(params).forEach(([key, value]) => encodePair(key, value)); + Object.entries(params).forEach(([key, value]) => encodePair(key, value)) - return qs.length ? `?${qs.join('&')}` : ''; -}; + return qs.length ? `?${qs.join("&")}` : "" +} const getUrl = (config: OpenAPIConfig, options: ApiRequestOptions): string => { - const encoder = config.ENCODE_PATH || encodeURI; - - const path = options.url - .replace('{api-version}', config.VERSION) - .replace(/{(.*?)}/g, (substring: string, group: string) => { - if (options.path?.hasOwnProperty(group)) { - return encoder(String(options.path[group])); - } - return substring; - }); - - const url = config.BASE + path; - return options.query ? url + getQueryString(options.query) : url; -}; - -export const getFormData = (options: ApiRequestOptions): FormData | undefined => { - if (options.formData) { - const formData = new FormData(); - - const process = (key: string, value: unknown) => { - if (isString(value) || isBlob(value)) { - formData.append(key, value); - } else { - formData.append(key, JSON.stringify(value)); - } - }; - - Object.entries(options.formData) - .filter(([, value]) => value !== undefined && value !== null) - .forEach(([key, value]) => { - if (Array.isArray(value)) { - value.forEach(v => process(key, v)); - } else { - process(key, value); - } - }); - - return formData; - } - return undefined; -}; - -type Resolver = (options: ApiRequestOptions) => Promise; - -export const resolve = async (options: ApiRequestOptions, resolver?: T | Resolver): Promise => { - if (typeof resolver === 'function') { - return (resolver as Resolver)(options); - } - return resolver; -}; - -export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions): Promise => { - const [token, username, password, additionalHeaders] = await Promise.all([ - // @ts-ignore - resolve(options, config.TOKEN), - // @ts-ignore - resolve(options, config.USERNAME), - // @ts-ignore - resolve(options, config.PASSWORD), - // @ts-ignore - resolve(options, config.HEADERS), - ]); - - const headers = Object.entries({ - Accept: 'application/json', - ...additionalHeaders, - ...options.headers, - }) - .filter(([, value]) => value !== undefined && value !== null) - .reduce((headers, [key, value]) => ({ - ...headers, - [key]: String(value), - }), {} as Record); - - if (isStringWithValue(token)) { - headers['Authorization'] = `Bearer ${token}`; - } - - if (isStringWithValue(username) && isStringWithValue(password)) { - const credentials = base64(`${username}:${password}`); - headers['Authorization'] = `Basic ${credentials}`; - } - - if (options.body !== undefined) { - if (options.mediaType) { - headers['Content-Type'] = options.mediaType; - } else if (isBlob(options.body)) { - headers['Content-Type'] = options.body.type || 'application/octet-stream'; - } else if (isString(options.body)) { - headers['Content-Type'] = 'text/plain'; - } else if (!isFormData(options.body)) { - headers['Content-Type'] = 'application/json'; - } - } - - return new Headers(headers); -}; + const encoder = config.ENCODE_PATH || encodeURI + + const path = options.url + .replace("{api-version}", config.VERSION) + .replace(/{(.*?)}/g, (substring: string, group: string) => { + if (options.path?.hasOwnProperty(group)) { + return encoder(String(options.path[group])) + } + return substring + }) + + const url = config.BASE + path + return options.query ? url + getQueryString(options.query) : url +} + +export const getFormData = ( + options: ApiRequestOptions, +): FormData | undefined => { + if (options.formData) { + const formData = new FormData() + + const process = (key: string, value: unknown) => { + if (isString(value) || isBlob(value)) { + formData.append(key, value) + } else { + formData.append(key, JSON.stringify(value)) + } + } + + Object.entries(options.formData) + .filter(([, value]) => value !== undefined && value !== null) + .forEach(([key, value]) => { + if (Array.isArray(value)) { + value.forEach((v) => process(key, v)) + } else { + process(key, value) + } + }) + + return formData + } + return undefined +} + +type Resolver = (options: ApiRequestOptions) => Promise + +export const resolve = async ( + options: ApiRequestOptions, + resolver?: T | Resolver, +): Promise => { + if (typeof resolver === "function") { + return (resolver as Resolver)(options) + } + return resolver +} + +export const getHeaders = async ( + config: OpenAPIConfig, + options: ApiRequestOptions, +): Promise => { + const [token, username, password, additionalHeaders] = await Promise.all([ + // @ts-ignore + resolve(options, config.TOKEN), + // @ts-ignore + resolve(options, config.USERNAME), + // @ts-ignore + resolve(options, config.PASSWORD), + // @ts-ignore + resolve(options, config.HEADERS), + ]) + + const headers = Object.entries({ + Accept: "application/json", + ...additionalHeaders, + ...options.headers, + }) + .filter(([, value]) => value !== undefined && value !== null) + .reduce( + (headers, [key, value]) => ({ + ...headers, + [key]: String(value), + }), + {} as Record, + ) + + if (isStringWithValue(token)) { + headers["Authorization"] = `Bearer ${token}` + } + + if (isStringWithValue(username) && isStringWithValue(password)) { + const credentials = base64(`${username}:${password}`) + headers["Authorization"] = `Basic ${credentials}` + } + + if (options.body !== undefined) { + if (options.mediaType) { + headers["Content-Type"] = options.mediaType + } else if (isBlob(options.body)) { + headers["Content-Type"] = options.body.type || "application/octet-stream" + } else if (isString(options.body)) { + headers["Content-Type"] = "text/plain" + } else if (!isFormData(options.body)) { + headers["Content-Type"] = "application/json" + } + } + + return new Headers(headers) +} export const getRequestBody = (options: ApiRequestOptions): unknown => { - if (options.body !== undefined) { - if (options.mediaType?.includes('application/json') || options.mediaType?.includes('+json')) { - return JSON.stringify(options.body); - } else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) { - return options.body; - } else { - return JSON.stringify(options.body); - } - } - return undefined; -}; + if (options.body !== undefined) { + if ( + options.mediaType?.includes("application/json") || + options.mediaType?.includes("+json") + ) { + return JSON.stringify(options.body) + } else if ( + isString(options.body) || + isBlob(options.body) || + isFormData(options.body) + ) { + return options.body + } else { + return JSON.stringify(options.body) + } + } + return undefined +} export const sendRequest = async ( - config: OpenAPIConfig, - options: ApiRequestOptions, - url: string, - body: any, - formData: FormData | undefined, - headers: Headers, - onCancel: OnCancel + config: OpenAPIConfig, + options: ApiRequestOptions, + url: string, + body: any, + formData: FormData | undefined, + headers: Headers, + onCancel: OnCancel, ): Promise => { - const controller = new AbortController(); - - let request: RequestInit = { - headers, - body: body ?? formData, - method: options.method, - signal: controller.signal, - }; - - if (config.WITH_CREDENTIALS) { - request.credentials = config.CREDENTIALS; - } - - for (const fn of config.interceptors.request._fns) { - request = await fn(request); - } - - onCancel(() => controller.abort()); - - return await fetch(url, request); -}; - -export const getResponseHeader = (response: Response, responseHeader?: string): string | undefined => { - if (responseHeader) { - const content = response.headers.get(responseHeader); - if (isString(content)) { - return content; - } - } - return undefined; -}; + const controller = new AbortController() + + let request: RequestInit = { + headers, + body: body ?? formData, + method: options.method, + signal: controller.signal, + } + + if (config.WITH_CREDENTIALS) { + request.credentials = config.CREDENTIALS + } + + for (const fn of config.interceptors.request._fns) { + request = await fn(request) + } + + onCancel(() => controller.abort()) + + return await fetch(url, request) +} + +export const getResponseHeader = ( + response: Response, + responseHeader?: string, +): string | undefined => { + if (responseHeader) { + const content = response.headers.get(responseHeader) + if (isString(content)) { + return content + } + } + return undefined +} export const getResponseBody = async (response: Response): Promise => { - if (response.status !== 204) { - try { - const contentType = response.headers.get('Content-Type'); - if (contentType) { - const binaryTypes = ['application/octet-stream', 'application/pdf', 'application/zip', 'audio/', 'image/', 'video/']; - if (contentType.includes('application/json') || contentType.includes('+json')) { - return await response.json(); - } else if (binaryTypes.some(type => contentType.includes(type))) { - return await response.blob(); - } else if (contentType.includes('multipart/form-data')) { - return await response.formData(); - } else if (contentType.includes('text/')) { - return await response.text(); - } - } - } catch (error) { - console.error(error); - } - } - return undefined; -}; - -export const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult): void => { - const errors: Record = { - 400: 'Bad Request', - 401: 'Unauthorized', - 402: 'Payment Required', - 403: 'Forbidden', - 404: 'Not Found', - 405: 'Method Not Allowed', - 406: 'Not Acceptable', - 407: 'Proxy Authentication Required', - 408: 'Request Timeout', - 409: 'Conflict', - 410: 'Gone', - 411: 'Length Required', - 412: 'Precondition Failed', - 413: 'Payload Too Large', - 414: 'URI Too Long', - 415: 'Unsupported Media Type', - 416: 'Range Not Satisfiable', - 417: 'Expectation Failed', - 418: 'Im a teapot', - 421: 'Misdirected Request', - 422: 'Unprocessable Content', - 423: 'Locked', - 424: 'Failed Dependency', - 425: 'Too Early', - 426: 'Upgrade Required', - 428: 'Precondition Required', - 429: 'Too Many Requests', - 431: 'Request Header Fields Too Large', - 451: 'Unavailable For Legal Reasons', - 500: 'Internal Server Error', - 501: 'Not Implemented', - 502: 'Bad Gateway', - 503: 'Service Unavailable', - 504: 'Gateway Timeout', - 505: 'HTTP Version Not Supported', - 506: 'Variant Also Negotiates', - 507: 'Insufficient Storage', - 508: 'Loop Detected', - 510: 'Not Extended', - 511: 'Network Authentication Required', - ...options.errors, - } - - const error = errors[result.status]; - if (error) { - throw new ApiError(options, result, error); - } - - if (!result.ok) { - const errorStatus = result.status ?? 'unknown'; - const errorStatusText = result.statusText ?? 'unknown'; - const errorBody = (() => { - try { - return JSON.stringify(result.body, null, 2); - } catch (e) { - return undefined; - } - })(); - - throw new ApiError(options, result, - `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}` - ); - } -}; + if (response.status !== 204) { + try { + const contentType = response.headers.get("Content-Type") + if (contentType) { + const binaryTypes = [ + "application/octet-stream", + "application/pdf", + "application/zip", + "audio/", + "image/", + "video/", + ] + if ( + contentType.includes("application/json") || + contentType.includes("+json") + ) { + return await response.json() + } else if (binaryTypes.some((type) => contentType.includes(type))) { + return await response.blob() + } else if (contentType.includes("multipart/form-data")) { + return await response.formData() + } else if (contentType.includes("text/")) { + return await response.text() + } + } + } catch (error) { + console.error(error) + } + } + return undefined +} + +export const catchErrorCodes = ( + options: ApiRequestOptions, + result: ApiResult, +): void => { + const errors: Record = { + 400: "Bad Request", + 401: "Unauthorized", + 402: "Payment Required", + 403: "Forbidden", + 404: "Not Found", + 405: "Method Not Allowed", + 406: "Not Acceptable", + 407: "Proxy Authentication Required", + 408: "Request Timeout", + 409: "Conflict", + 410: "Gone", + 411: "Length Required", + 412: "Precondition Failed", + 413: "Payload Too Large", + 414: "URI Too Long", + 415: "Unsupported Media Type", + 416: "Range Not Satisfiable", + 417: "Expectation Failed", + 418: "Im a teapot", + 421: "Misdirected Request", + 422: "Unprocessable Content", + 423: "Locked", + 424: "Failed Dependency", + 425: "Too Early", + 426: "Upgrade Required", + 428: "Precondition Required", + 429: "Too Many Requests", + 431: "Request Header Fields Too Large", + 451: "Unavailable For Legal Reasons", + 500: "Internal Server Error", + 501: "Not Implemented", + 502: "Bad Gateway", + 503: "Service Unavailable", + 504: "Gateway Timeout", + 505: "HTTP Version Not Supported", + 506: "Variant Also Negotiates", + 507: "Insufficient Storage", + 508: "Loop Detected", + 510: "Not Extended", + 511: "Network Authentication Required", + ...options.errors, + } + + const error = errors[result.status] + if (error) { + throw new ApiError(options, result, error) + } + + if (!result.ok) { + const errorStatus = result.status ?? "unknown" + const errorStatusText = result.statusText ?? "unknown" + const errorBody = (() => { + try { + return JSON.stringify(result.body, null, 2) + } catch (e) { + return undefined + } + })() + + throw new ApiError( + options, + result, + `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`, + ) + } +} /** * Request method @@ -308,43 +344,57 @@ export const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult): * @returns CancelablePromise * @throws ApiError */ -export const request = (config: OpenAPIConfig, options: ApiRequestOptions): CancelablePromise => { - return new CancelablePromise(async (resolve, reject, onCancel) => { - try { - const url = getUrl(config, options); - const formData = getFormData(options); - const body = getRequestBody(options); - const headers = await getHeaders(config, options); - - if (!onCancel.isCancelled) { - let response = await sendRequest(config, options, url, body, formData, headers, onCancel); - - for (const fn of config.interceptors.response._fns) { - response = await fn(response); - } - - const responseBody = await getResponseBody(response); - const responseHeader = getResponseHeader(response, options.responseHeader); - - let transformedBody = responseBody; - if (options.responseTransformer && response.ok) { - transformedBody = await options.responseTransformer(responseBody) - } - - const result: ApiResult = { - url, - ok: response.ok, - status: response.status, - statusText: response.statusText, - body: responseHeader ?? transformedBody, - }; - - catchErrorCodes(options, result); - - resolve(result.body); - } - } catch (error) { - reject(error); - } - }); -}; \ No newline at end of file +export const request = ( + config: OpenAPIConfig, + options: ApiRequestOptions, +): CancelablePromise => { + return new CancelablePromise(async (resolve, reject, onCancel) => { + try { + const url = getUrl(config, options) + const formData = getFormData(options) + const body = getRequestBody(options) + const headers = await getHeaders(config, options) + + if (!onCancel.isCancelled) { + let response = await sendRequest( + config, + options, + url, + body, + formData, + headers, + onCancel, + ) + + for (const fn of config.interceptors.response._fns) { + response = await fn(response) + } + + const responseBody = await getResponseBody(response) + const responseHeader = getResponseHeader( + response, + options.responseHeader, + ) + + let transformedBody = responseBody + if (options.responseTransformer && response.ok) { + transformedBody = await options.responseTransformer(responseBody) + } + + const result: ApiResult = { + url, + ok: response.ok, + status: response.status, + statusText: response.statusText, + body: responseHeader ?? transformedBody, + } + + catchErrorCodes(options, result) + + resolve(result.body) + } + } catch (error) { + reject(error) + } + }) +} diff --git a/packages/sdks/src/client/index.ts b/packages/sdks/src/client/index.ts index 205031a4..a8a3135a 100644 --- a/packages/sdks/src/client/index.ts +++ b/packages/sdks/src/client/index.ts @@ -1,7 +1,4 @@ // This file is auto-generated by @hey-api/openapi-ts -export { ApiError } from './core/ApiError'; -export { CancelablePromise, CancelError } from './core/CancelablePromise'; -export { OpenAPI, type OpenAPIConfig } from './core/OpenAPI'; -export * from './schemas.gen'; -export * from './services.gen'; -export * from './types.gen'; \ No newline at end of file +export * from "./schemas.gen" +export * from "./services.gen" +export * from "./types.gen" diff --git a/packages/sdks/src/client/schemas.gen.ts b/packages/sdks/src/client/schemas.gen.ts index c8db716d..60a1ae74 100644 --- a/packages/sdks/src/client/schemas.gen.ts +++ b/packages/sdks/src/client/schemas.gen.ts @@ -1,548 +1,596 @@ // This file is auto-generated by @hey-api/openapi-ts export const $job = { - type: 'object', - properties: { - id: { - description: 'A unique identifier generated when a job is created.', - type: 'string' + type: "object", + properties: { + id: { + description: "A unique identifier generated when a job is created.", + type: "string", + }, + type: { + description: + "This represents the type of resource object being returned. Always `pim-job`.", + type: "string", + enum: ["pim-job"], + }, + attributes: { + type: "object", + properties: { + started_at: { + description: "The date and time a job is started.", + type: "string", + example: "2020-09-22T09:00:00", + format: "date-time", + nullable: true, + }, + completed_at: { + type: "string", + example: "2020-09-22T09:00:00", + format: "date-time", + nullable: true, + description: "The date and time a job is completed.", + }, + created_at: { + type: "string", + description: "The date and time a job is created.", + example: "2020-09-22T09:00:00", + format: "date-time", + }, + updated_at: { + type: "string", + description: "The date and time a job is updated.", + example: "2020-09-22T09:00:00", + format: "date-time", }, type: { - description: 'This represents the type of resource object being returned. Always `pim-job`.', - type: 'string', - enum: ['pim-job'] - }, - attributes: { - type: 'object', - properties: { - started_at: { - description: 'The date and time a job is started.', - type: 'string', - example: '2020-09-22T09:00:00', - format: 'date-time', - nullable: true - }, - completed_at: { - type: 'string', - example: '2020-09-22T09:00:00', - format: 'date-time', - nullable: true, - description: 'The date and time a job is completed.' - }, - created_at: { - type: 'string', - description: 'The date and time a job is created.', - example: '2020-09-22T09:00:00', - format: 'date-time' - }, - updated_at: { - type: 'string', - description: 'The date and time a job is updated.', - example: '2020-09-22T09:00:00', - format: 'date-time' - }, - type: { - type: 'string', - description: `The status of a job. + type: "string", + description: `The status of a job. * \`pending\` - Commerce has received the request but is currently busy processing other requests. * \`started\` - Commerce has started processing the job. * \`success\` - The job has successfully completed. * \`failed\` - The job has failed. `, - enum: ['child-products', 'product-import', 'product-export', 'hierarchy-duplicate', 'price-import'] - }, - status: { - type: 'string', - enum: ['pending', 'cancelled', 'started', 'success', 'failed'] - } - } + enum: [ + "child-products", + "product-import", + "product-export", + "hierarchy-duplicate", + "price-import", + ], }, - meta: { - type: 'object', - properties: { - x_request_id: { - type: 'string', - description: 'Applies to all job types. A unique request ID is generated when a job is created.' - }, - copied_from: { - type: 'string', - description: 'Applies to `hierarchy-duplicate` job types. The ID of the original hierarchy that you duplicated.' - }, - hierarchy_id: { - type: 'string', - description: 'Applies to `hierarchy-duplicate` job types. The duplicated hierarchy ID.' - }, - file_locations: { - type: 'array', - nullable: true, - description: 'If the job type is `product_export`, a link to the file is created when running a job.', - items: { - type: 'string' - } - }, - filter: { - type: 'string', - description: 'The entities included in the job. For example, if the job type is `product-export`, the PXM products included in the export.' - } - } - } - } -} as const; + status: { + type: "string", + enum: ["pending", "cancelled", "started", "success", "failed"], + }, + }, + }, + meta: { + type: "object", + properties: { + x_request_id: { + type: "string", + description: + "Applies to all job types. A unique request ID is generated when a job is created.", + }, + copied_from: { + type: "string", + description: + "Applies to `hierarchy-duplicate` job types. The ID of the original hierarchy that you duplicated.", + }, + hierarchy_id: { + type: "string", + description: + "Applies to `hierarchy-duplicate` job types. The duplicated hierarchy ID.", + }, + file_locations: { + type: "array", + nullable: true, + description: + "If the job type is `product_export`, a link to the file is created when running a job.", + items: { + type: "string", + }, + }, + filter: { + type: "string", + description: + "The entities included in the job. For example, if the job type is `product-export`, the PXM products included in the export.", + }, + }, + }, + }, +} as const export const $multi = { - type: 'object', - properties: { - data: { - description: 'An array of jobs.', - type: 'array', - items: { - '$ref': '#/components/schemas/job' - } + type: "object", + properties: { + data: { + description: "An array of jobs.", + type: "array", + items: { + $ref: "#/components/schemas/job", + }, + }, + meta: { + type: "object", + properties: { + results: { + description: "Contains the results for the entire collection.", + type: "object", + properties: { + total: { + description: "Total number of results for the entire collection.", + type: "integer", + example: 2, + }, + }, }, - meta: { - type: 'object', - properties: { - results: { - description: 'Contains the results for the entire collection.', - type: 'object', - properties: { - total: { - description: 'Total number of results for the entire collection.', - type: 'integer', - example: 2 - } - } - } - } - } - } -} as const; + }, + }, + }, +} as const export const $error = { - required: ['errors'], - properties: { - errors: { - type: 'array', - items: { - required: ['status', 'title'], - properties: { - status: { - type: 'string', - description: 'The HTTP response code of the error.', - example: '500' - }, - title: { - type: 'string', - description: 'A brief summary of the error.', - example: 'Internal server error' - }, - detail: { - type: 'string', - description: 'Optional additional detail about the error.', - example: 'An internal error has occurred.' - }, - request_id: { - type: 'string', - description: 'Internal request ID.', - example: '00000000-0000-0000-0000-000000000000' - }, - meta: { - type: 'object', - description: 'Additional supporting meta data for the error.', - example: { - missing_ids: ['e7d50bd5-1833-43c0-9848-f9d325b08be8'] - } - } - } - } - } - } -} as const; + required: ["errors"], + properties: { + errors: { + type: "array", + items: { + required: ["status", "title"], + properties: { + status: { + type: "string", + description: "The HTTP response code of the error.", + example: "500", + }, + title: { + type: "string", + description: "A brief summary of the error.", + example: "Internal server error", + }, + detail: { + type: "string", + description: "Optional additional detail about the error.", + example: "An internal error has occurred.", + }, + request_id: { + type: "string", + description: "Internal request ID.", + example: "00000000-0000-0000-0000-000000000000", + }, + meta: { + type: "object", + description: "Additional supporting meta data for the error.", + example: { + missing_ids: ["e7d50bd5-1833-43c0-9848-f9d325b08be8"], + }, + }, + }, + }, + }, + }, +} as const export const $single = { - type: 'object', - properties: { - data: { - '$ref': '#/components/schemas/job' - } - } -} as const; + type: "object", + properties: { + data: { + $ref: "#/components/schemas/job", + }, + }, +} as const export const $errors = { - type: 'object', - properties: { - data: { - type: 'array', - description: 'An array of job errors.', - items: { - type: 'object', - properties: { - type: { - description: 'This represents the type of resource object being returned. Always `pim-job-error`.', - type: 'string', - example: 'pim-job-error', - enum: ['pim-job-error'] - }, - id: { - description: 'A unique identifier for a job error generated when a job error is created.', - type: 'string' - }, - attributes: { - type: 'object', - properties: { - message: { - description: 'A description of an error message.', - type: 'string', - example: 'data.attributes.sku: Must be unique amongst products.' - } - } - } - } - } - } - } -} as const; - -export const $product_custom_inputs = { - type: 'object', - description: 'You use the `custom_inputs` attribute to allow your shoppers to add custom text to a product when adding product items to their carts. This is useful, for example, if you have a product like a T-shirt that can be personalized or you sell greetings cards that can be printed with your shoppers personalized messages. See [Personalizing Products](/docs/api/pxm/products/create-product#personalizing-products).', - additionalProperties: { - description: 'A name for the custom text field. You can rename this to something more representative of the input that shoppers are adding, for example, `message` or `front`.', - type: 'object', + type: "object", + properties: { + data: { + type: "array", + description: "An array of job errors.", + items: { + type: "object", properties: { - name: { - type: 'string', - description: 'A name for the custom text field.' - }, - validation_rules: { - type: 'array', - description: 'The validation rules for the custom text.' - }, - type: { - description: 'This represents the type of the resource being returned.', - type: 'string' - }, - options: { - type: 'object', - description: 'The length of the custom input text field.' - }, - max_length: { - type: 'integer', - description: 'The number of characters the custom text field can be. You can specify a maximum length up to 255 characters, as the limit is 255 characters.' + type: { + description: + "This represents the type of resource object being returned. Always `pim-job-error`.", + type: "string", + example: "pim-job-error", + enum: ["pim-job-error"], + }, + id: { + description: + "A unique identifier for a job error generated when a job error is created.", + type: "string", + }, + attributes: { + type: "object", + properties: { + message: { + description: "A description of an error message.", + type: "string", + example: + "data.attributes.sku: Must be unique amongst products.", + }, }, - required: { - type: 'boolean', - description: `\`true\` or \`false\` depending on whether the custom text is required.` - } - } - } -} as const; + }, + }, + }, + }, + }, +} as const + +export const $product_custom_inputs = { + type: "object", + description: + "You use the `custom_inputs` attribute to allow your shoppers to add custom text to a product when adding product items to their carts. This is useful, for example, if you have a product like a T-shirt that can be personalized or you sell greetings cards that can be printed with your shoppers personalized messages. See [Personalizing Products](/docs/api/pxm/products/create-product#personalizing-products).", + additionalProperties: { + description: + "A name for the custom text field. You can rename this to something more representative of the input that shoppers are adding, for example, `message` or `front`.", + type: "object", + properties: { + name: { + type: "string", + description: "A name for the custom text field.", + }, + validation_rules: { + type: "array", + description: "The validation rules for the custom text.", + }, + type: { + description: "This represents the type of the resource being returned.", + type: "string", + }, + options: { + type: "object", + description: "The length of the custom input text field.", + }, + max_length: { + type: "integer", + description: + "The number of characters the custom text field can be. You can specify a maximum length up to 255 characters, as the limit is 255 characters.", + }, + required: { + type: "boolean", + description: `\`true\` or \`false\` depending on whether the custom text is required.`, + }, + }, + }, +} as const export const $product_build_rules = { - type: 'object', - description: 'You can build a combination of child products associated with a product, based on build rules that you specify. This is useful, for example, if you have a variation option that you do not sell. This makes managing and building your child products quick and easy. See [Using Build Rules](/docs/api/pxm/products/build-child-products#using-build-rules).', - properties: { - default: { - description: 'Specifies the default behaviour, either `include` or `exclude`.', - type: 'string', - enum: ['include', 'exclude'] - }, - include: { - description: 'An array of option IDs to include when child products are built. Each combination consists of a nested array of option IDs from one or more variations. Combinations of option IDs in the nested arrays must come from different variations.', - type: 'array', - items: { - type: 'array', - items: { - type: 'string' - } - } - }, - exclude: { - description: 'An array of option IDs to exclude when child products are built. Each combination consists of a nested array of option IDs from one or more variations. Combinations of option IDs in the nested arrays must come from different variations.', - type: 'array', - items: { - type: 'array', - items: { - type: 'string' - } - } - } - } -} as const; + type: "object", + description: + "You can build a combination of child products associated with a product, based on build rules that you specify. This is useful, for example, if you have a variation option that you do not sell. This makes managing and building your child products quick and easy. See [Using Build Rules](/docs/api/pxm/products/build-child-products#using-build-rules).", + properties: { + default: { + description: + "Specifies the default behaviour, either `include` or `exclude`.", + type: "string", + enum: ["include", "exclude"], + }, + include: { + description: + "An array of option IDs to include when child products are built. Each combination consists of a nested array of option IDs from one or more variations. Combinations of option IDs in the nested arrays must come from different variations.", + type: "array", + items: { + type: "array", + items: { + type: "string", + }, + }, + }, + exclude: { + description: + "An array of option IDs to exclude when child products are built. Each combination consists of a nested array of option IDs from one or more variations. Combinations of option IDs in the nested arrays must come from different variations.", + type: "array", + items: { + type: "array", + items: { + type: "string", + }, + }, + }, + }, +} as const export const $product_bundle_components = { - type: 'object', - description: 'With Product Experience Manager, you can create and manage bundles. A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. See [Bundles](/docs/api/pxm/products/products#bundles).', - additionalProperties: { - description: 'The name of the component, such as `games`. The `bundle_configuration` uses the component name to reference a component. A component name should be relatively short and must not contain any special characters.', - type: 'object', - properties: { - name: { - type: 'string', - description: 'The component name. The component name is the name that is displayed in your storefront.' + type: "object", + description: + "With Product Experience Manager, you can create and manage bundles. A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. See [Bundles](/docs/api/pxm/products/products#bundles).", + additionalProperties: { + description: + "The name of the component, such as `games`. The `bundle_configuration` uses the component name to reference a component. A component name should be relatively short and must not contain any special characters.", + type: "object", + properties: { + name: { + type: "string", + description: + "The component name. The component name is the name that is displayed in your storefront.", + }, + options: { + type: "array", + description: + "The product options included in a component. This can be the ID of another bundle.", + items: { + type: "object", + properties: { + id: { + type: "string", + description: + "The unique ID of the product you want to add to a component.", }, - options: { - type: 'array', - description: 'The product options included in a component. This can be the ID of another bundle.', - items: { - type: 'object', - properties: { - id: { - type: 'string', - description: 'The unique ID of the product you want to add to a component.' - }, - type: { - type: 'string', - description: 'This represents the type of object being returned. Always `product`.' - }, - quantity: { - type: 'integer', - description: 'The number of this product option that a shopper must purchase.' - }, - sort_order: { - type: 'integer', - description: 'The sort order of the options. The `create a bundle` and `update a bundle` endpoints do not sort the options. You can use the `sort_order` attribute when programming your storefront to display the options in the order that you want.' - }, - default: { - description: 'Whether the product option is a default option in a bundle. Shoppers can select a bundle that specifies a default list of product options. See [Dynamic Bundles](/docs/api/pxm/products/products#dynamic-bundles).', - type: 'boolean' - } - } - } - }, - min: { - type: 'integer', - description: 'The minimum number of product options a shopper can select from this component.' - }, - max: { - type: 'integer', - description: 'The maximum number of product options a shopper can select from this component.' + type: { + type: "string", + description: + "This represents the type of object being returned. Always `product`.", + }, + quantity: { + type: "integer", + description: + "The number of this product option that a shopper must purchase.", }, sort_order: { - type: 'integer', - description: 'The sort order of the components. The `create a bundle` and `update a bundle` endpoints do not sort the components. You can use the `sort_order` attribute when programming your storefront to display the components in the order that you want.' - } - } - } -} as const; + type: "integer", + description: + "The sort order of the options. The `create a bundle` and `update a bundle` endpoints do not sort the options. You can use the `sort_order` attribute when programming your storefront to display the options in the order that you want.", + }, + default: { + description: + "Whether the product option is a default option in a bundle. Shoppers can select a bundle that specifies a default list of product options. See [Dynamic Bundles](/docs/api/pxm/products/products#dynamic-bundles).", + type: "boolean", + }, + }, + }, + }, + min: { + type: "integer", + description: + "The minimum number of product options a shopper can select from this component.", + }, + max: { + type: "integer", + description: + "The maximum number of product options a shopper can select from this component.", + }, + sort_order: { + type: "integer", + description: + "The sort order of the components. The `create a bundle` and `update a bundle` endpoints do not sort the components. You can use the `sort_order` attribute when programming your storefront to display the components in the order that you want.", + }, + }, + }, +} as const export const $product_response = { - type: 'object', - properties: { - id: { - description: 'A unique product ID that is generated when you create the product.', - type: 'string' + type: "object", + properties: { + id: { + description: + "A unique product ID that is generated when you create the product.", + type: "string", + }, + type: { + description: + "This represents the type of resource object being returned. Always `product`.", + type: "string", + enum: ["product"], + }, + attributes: { + type: "object", + additionalProperties: false, + properties: { + name: { + description: "A name for the product.", + type: "string", }, - type: { - description: 'This represents the type of resource object being returned. Always `product`.', - type: 'string', - enum: ['product'] + description: { + description: "A description for the product.", + type: "string", }, - attributes: { - type: 'object', - additionalProperties: false, - properties: { - name: { - description: 'A name for the product.', - type: 'string' - }, - description: { - description: 'A description for the product.', - type: 'string' - }, - slug: { - description: 'A label for the product that is used in the URL paths. A slug can contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. By default, the product name is used as the slug.', - type: 'string' - }, - sku: { - description: 'The unique stock keeping unit of the product.', - type: 'string' - }, - status: { - description: 'The status for the product, either `draft` or `live`.', - type: 'string', - enum: ['live', 'draft'] - }, - commodity_type: { - description: 'The commodity type, either `physical` or `digital`.', - type: 'string', - enum: ['physical', 'digital'] - }, - upc_ean: { - description: 'The universal product code or european article number of the product.', - type: 'string' - }, - mpn: { - description: 'The manufacturer part number of the product.', - type: 'string' - }, - external_ref: { - description: 'The unique attribute associated with the product. This could be an external reference from a separate company system, for example. The maximum length is 2048 characters.', - type: 'string' - }, - locales: { - description: 'Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want.', - type: 'object' - }, - tags: { - description: 'You can use product tags to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. A product can have up to 20 tags. A product tag can be up to 255 characters. Product tags must not contain any spaces or commas.', - type: 'array', - items: { - type: 'string' - } - }, - extensions: { - type: 'object', - additionalProperties: { - type: 'object', - additionalProperties: { - oneOf: [ - { - type: 'string', - nullable: true - }, - { - type: 'integer' - }, - { - type: 'boolean' - } - ] - } - } + slug: { + description: + "A label for the product that is used in the URL paths. A slug can contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. By default, the product name is used as the slug.", + type: "string", + }, + sku: { + description: "The unique stock keeping unit of the product.", + type: "string", + }, + status: { + description: "The status for the product, either `draft` or `live`.", + type: "string", + enum: ["live", "draft"], + }, + commodity_type: { + description: "The commodity type, either `physical` or `digital`.", + type: "string", + enum: ["physical", "digital"], + }, + upc_ean: { + description: + "The universal product code or european article number of the product.", + type: "string", + }, + mpn: { + description: "The manufacturer part number of the product.", + type: "string", + }, + external_ref: { + description: + "The unique attribute associated with the product. This could be an external reference from a separate company system, for example. The maximum length is 2048 characters.", + type: "string", + }, + locales: { + description: + "Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want.", + type: "object", + }, + tags: { + description: + "You can use product tags to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. A product can have up to 20 tags. A product tag can be up to 255 characters. Product tags must not contain any spaces or commas.", + type: "array", + items: { + type: "string", + }, + }, + extensions: { + type: "object", + additionalProperties: { + type: "object", + additionalProperties: { + oneOf: [ + { + type: "string", + nullable: true, }, - custom_inputs: { - '$ref': '#/components/schemas/product_custom_inputs' + { + type: "integer", }, - build_rules: { - '$ref': '#/components/schemas/product_build_rules' + { + type: "boolean", }, - components: { - '$ref': '#/components/schemas/product_bundle_components' - } - } + ], + }, + }, }, - meta: { - type: 'object', + custom_inputs: { + $ref: "#/components/schemas/product_custom_inputs", + }, + build_rules: { + $ref: "#/components/schemas/product_build_rules", + }, + components: { + $ref: "#/components/schemas/product_bundle_components", + }, + }, + }, + meta: { + type: "object", + properties: { + created_at: { + description: "The date and time a product is created.", + type: "string", + example: "2020-09-22T09:00:00", + format: "date-time", + }, + updated_at: { + description: "The date and time a product is updated.", + type: "string", + example: "2020-09-22T09:00:00", + format: "date-time", + }, + owner: { + description: "The resource owner, either `organization` or `store`.", + type: "string", + enum: ["organization", "store"], + }, + variations: { + description: + "A product's variations and the options defined for each variation. If you have specified `build_rules`, only the child products included in the `build_rules` are specified.", + type: "array", + items: { + type: "object", properties: { - created_at: { - description: 'The date and time a product is created.', - type: 'string', - example: '2020-09-22T09:00:00', - format: 'date-time' - }, - updated_at: { - description: 'The date and time a product is updated.', - type: 'string', - example: '2020-09-22T09:00:00', - format: 'date-time' - }, - owner: { - description: 'The resource owner, either `organization` or `store`.', - type: 'string', - enum: ['organization', 'store'] - }, - variations: { - description: "A product's variations and the options defined for each variation. If you have specified `build_rules`, only the child products included in the `build_rules` are specified.", - type: 'array', - items: { - type: 'object', - properties: { - id: { - type: 'string', - description: 'A unique ID generated when a variation is created.' - }, - name: { - type: 'string', - description: 'The name of a variation.' - }, - options: { - type: 'array', - items: { - type: 'object', - description: 'The options available for this variation.', - properties: { - id: { - type: 'string', - description: 'A unique ID that is generated an option is created.' - }, - name: { - type: 'string', - description: 'The name of an option.' - }, - description: { - type: 'string', - description: 'A description of an option.' - } - } - } - } - } - } + id: { + type: "string", + description: + "A unique ID generated when a variation is created.", + }, + name: { + type: "string", + description: "The name of a variation.", + }, + options: { + type: "array", + items: { + type: "object", + description: "The options available for this variation.", + properties: { + id: { + type: "string", + description: + "A unique ID that is generated an option is created.", + }, + name: { + type: "string", + description: "The name of an option.", + }, + description: { + type: "string", + description: "A description of an option.", + }, + }, }, - product_types: { - description: `One of the following product types: + }, + }, + }, + }, + product_types: { + description: `One of the following product types: - \`standard\` - A \`standard\` product is a standalone product. - \`parent\` - A \`parent\` product is a product that has child products that have been built using the \`Build Child Products\` endpoint. - \`child\` - When you configure product variations and variation options for \`parent\` products, the \`child\` products derived from the \`parent\` products are automatically created in Commerce. - \`bundle\` - A \`bundle\` is a purchasable product, comprising one or more standalone products (in other words, components) to be sold together. `, - type: 'array', - items: { - type: 'string', - enum: ['parent', 'child', 'bundle', 'standard'] - } + type: "array", + items: { + type: "string", + enum: ["parent", "child", "bundle", "standard"], + }, + }, + variation_matrix: { + description: + "The child products defined for a product. The order of the variations in the `variation_matrix` is the order of the variations in the array when the variations were linked to the product. For example, the first variation in the `variation_matrix` corresponds to the first variation in the array, and so on. You can use the `sort_order`attribute to sort the order of your variation and variation options in the `variation_matrix` object. See [Sorting the Order of Variations and Options](/docs/api/pxm/products/variations#sorting-the-order-of-variations-and-options) If no variations are defined for a product, the `variation_matrix` is empty.", + type: "object", + }, + }, + }, + relationships: { + description: + "Relationships are established between different product entities. For example, a `bundle` product and a `child` product are related to a `parent` product, as both are associated with it.", + type: "object", + additionalProperties: { + type: "object", + properties: { + data: { + oneOf: [ + { + type: "array", + items: { + type: "object", + properties: { + id: { + description: "A unique identifier for a resource.", + type: "string", + }, + type: { + description: + "This represents the type of resource object being returned.", + type: "string", + }, + }, }, - variation_matrix: { - description: 'The child products defined for a product. The order of the variations in the `variation_matrix` is the order of the variations in the array when the variations were linked to the product. For example, the first variation in the `variation_matrix` corresponds to the first variation in the array, and so on. You can use the `sort_order`attribute to sort the order of your variation and variation options in the `variation_matrix` object. See [Sorting the Order of Variations and Options](/docs/api/pxm/products/variations#sorting-the-order-of-variations-and-options) If no variations are defined for a product, the `variation_matrix` is empty.', - type: 'object' - } - } - }, - relationships: { - description: 'Relationships are established between different product entities. For example, a `bundle` product and a `child` product are related to a `parent` product, as both are associated with it.', - type: 'object', - additionalProperties: { - type: 'object', + }, + { + type: "object", + nullable: true, properties: { - data: { - oneOf: [ - { - type: 'array', - items: { - type: 'object', - properties: { - id: { - description: 'A unique identifier for a resource.', - type: 'string' - }, - type: { - description: 'This represents the type of resource object being returned.', - type: 'string' - } - } - } - }, - { - type: 'object', - nullable: true, - properties: { - id: { - description: 'A unique identifier for a resource.', - type: 'string' - }, - type: { - description: 'This represents the type of resource object being returned.', - type: 'string' - } - } - } - ] - }, - links: { - description: `Links are used to allow you to move between requests. Single entities use a \`self\` parameter with a link to that specific resource. Sometimes, there are not enough entities for a project to fill multiple pages. In this situation, we return some defaults. + id: { + description: "A unique identifier for a resource.", + type: "string", + }, + type: { + description: + "This represents the type of resource object being returned.", + type: "string", + }, + }, + }, + ], + }, + links: { + description: `Links are used to allow you to move between requests. Single entities use a \`self\` parameter with a link to that specific resource. Sometimes, there are not enough entities for a project to fill multiple pages. In this situation, we return some defaults. | Property | Description | | :--- | :--- | @@ -552,857 +600,904 @@ export const $product_response = { | \`prev\` | \`null\` if the user is on the first page. | | \`next\` | \`null\` if there is only one page. | `, - type: 'object', - additionalProperties: { - type: 'string' - } - } - } - } - } - } -} as const; + type: "object", + additionalProperties: { + type: "string", + }, + }, + }, + }, + }, + }, +} as const export const $multi_product_response = { - type: 'object', - properties: { - data: { - type: 'array', - items: { - '$ref': '#/components/schemas/product_response' - } - }, - included: { - type: 'object', - description: 'Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned.', - properties: { - component_products: { - description: 'Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned.', - type: 'array', - items: { - '$ref': '#/components/schemas/product_response' - } - } - } + type: "object", + properties: { + data: { + type: "array", + items: { + $ref: "#/components/schemas/product_response", + }, + }, + included: { + type: "object", + description: + "Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned.", + properties: { + component_products: { + description: + "Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned.", + type: "array", + items: { + $ref: "#/components/schemas/product_response", + }, + }, + }, + }, + meta: { + type: "object", + properties: { + results: { + description: "Contains the results for the entire collection.", + type: "object", + properties: { + total: { + description: "Total number of results for the entire collection.", + type: "integer", + example: 2, + }, + }, }, - meta: { - type: 'object', - properties: { - results: { - description: 'Contains the results for the entire collection.', - type: 'object', - properties: { - total: { - description: 'Total number of results for the entire collection.', - type: 'integer', - example: 2 - } - } - } - } - } - } -} as const; + }, + }, + }, +} as const export const $product_locales = { - type: 'object', - description: 'Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want.', - additionalProperties: { - description: 'A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used.', - type: 'object', - required: ['name'], - properties: { - name: { - type: 'string', - description: 'A localized name for the product.' - }, - description: { - type: 'string', - description: 'A localized description for the product.' - } - } - } -} as const; + type: "object", + description: + "Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want.", + additionalProperties: { + description: + "A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used.", + type: "object", + required: ["name"], + properties: { + name: { + type: "string", + description: "A localized name for the product.", + }, + description: { + type: "string", + description: "A localized description for the product.", + }, + }, + }, +} as const export const $product_attributes = { - type: 'object', - additionalProperties: false, - properties: { - external_ref: { - type: 'string', - description: 'The unique attribute associated with the product. This could be an external reference from a separate company system, for example. The maximum length is 2048 characters.' - }, - name: { - type: 'string', - description: 'The product name to display to customers.' - }, - description: { - description: 'A description for the product.', - type: 'string' - }, - slug: { - type: 'string', - description: 'The unique slug of the product. A slug can contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.' - }, - sku: { - type: 'string', - description: 'The unique stock keeping unit of the product.' - }, - status: { - type: 'string', - enum: ['live', 'draft'], - description: 'The status for the product, either `draft` or `live`. Default is `draft`.' - }, - commodity_type: { - description: 'The commodity type, either `physical` or `digital`.', - type: 'string', - enum: ['physical', 'digital'] - }, - upc_ean: { - type: 'string', - description: 'The universal product code or european article number of the product.' - }, - mpn: { - type: 'string', - description: 'The manufacturer part number of the product.' - }, - tags: { - type: 'array', - description: 'You can use product tags to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. A product can have up to 20 tags. A product tag can be up to 255 characters. Product tags must not contain any spaces or commas. See [Product Tags](/docs/api/pxm/products/product-tags).', - items: { - type: 'string' - } - }, - build_rules: { - '$ref': '#/components/schemas/product_build_rules' - }, - locales: { - '$ref': '#/components/schemas/product_locales' - }, - custom_inputs: { - '$ref': '#/components/schemas/product_custom_inputs' - }, - components: { - '$ref': '#/components/schemas/product_bundle_components' - } - } -} as const; + type: "object", + additionalProperties: false, + properties: { + external_ref: { + type: "string", + description: + "The unique attribute associated with the product. This could be an external reference from a separate company system, for example. The maximum length is 2048 characters.", + }, + name: { + type: "string", + description: "The product name to display to customers.", + }, + description: { + description: "A description for the product.", + type: "string", + }, + slug: { + type: "string", + description: + "The unique slug of the product. A slug can contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.", + }, + sku: { + type: "string", + description: "The unique stock keeping unit of the product.", + }, + status: { + type: "string", + enum: ["live", "draft"], + description: + "The status for the product, either `draft` or `live`. Default is `draft`.", + }, + commodity_type: { + description: "The commodity type, either `physical` or `digital`.", + type: "string", + enum: ["physical", "digital"], + }, + upc_ean: { + type: "string", + description: + "The universal product code or european article number of the product.", + }, + mpn: { + type: "string", + description: "The manufacturer part number of the product.", + }, + tags: { + type: "array", + description: + "You can use product tags to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. A product can have up to 20 tags. A product tag can be up to 255 characters. Product tags must not contain any spaces or commas. See [Product Tags](/docs/api/pxm/products/product-tags).", + items: { + type: "string", + }, + }, + build_rules: { + $ref: "#/components/schemas/product_build_rules", + }, + locales: { + $ref: "#/components/schemas/product_locales", + }, + custom_inputs: { + $ref: "#/components/schemas/product_custom_inputs", + }, + components: { + $ref: "#/components/schemas/product_bundle_components", + }, + }, +} as const export const $create_product_request = { - type: 'object', - required: ['data'], - properties: { - data: { - type: 'object', - required: ['type', 'attributes'], - properties: { - type: { - description: 'This represents the type of resource being returned. Always `product`.', - type: 'string', - enum: ['product'], - example: 'product' - }, - attributes: { - '$ref': '#/components/schemas/product_attributes' - }, - relationships: { - description: 'Relationships are established between different product entities.', - type: 'object', + type: "object", + required: ["data"], + properties: { + data: { + type: "object", + required: ["type", "attributes"], + properties: { + type: { + description: + "This represents the type of resource being returned. Always `product`.", + type: "string", + enum: ["product"], + example: "product", + }, + attributes: { + $ref: "#/components/schemas/product_attributes", + }, + relationships: { + description: + "Relationships are established between different product entities.", + type: "object", + properties: { + variations: { + type: "object", + properties: { + data: { + type: "array", + items: { + type: "object", properties: { - variations: { - type: 'object', - properties: { - data: { - type: 'array', - items: { - type: 'object', - properties: { - id: { - description: 'A unique identifier for a resource.', - type: 'string' - }, - type: { - description: 'This represents the type of resource object being returned.', - type: 'string' - } - } - } - } - } - } - } - } - } - } - } -} as const; + id: { + description: "A unique identifier for a resource.", + type: "string", + }, + type: { + description: + "This represents the type of resource object being returned.", + type: "string", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, +} as const export const $single_product_response = { - type: 'object', - properties: { - data: { - '$ref': '#/components/schemas/product_response' - }, - included: { - type: 'object', - description: 'Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned.', - properties: { - component_products: { - description: 'A list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned.', - type: 'array', - items: { - '$ref': '#/components/schemas/product_response' - } - } - } - } - } -} as const; + type: "object", + properties: { + data: { + $ref: "#/components/schemas/product_response", + }, + included: { + type: "object", + description: + "Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned.", + properties: { + component_products: { + description: + "A list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned.", + type: "array", + items: { + $ref: "#/components/schemas/product_response", + }, + }, + }, + }, + }, +} as const export const $update_product_request = { - type: 'object', - required: ['data'], - properties: { - data: { - type: 'object', - required: ['type', 'attributes', 'id'], - properties: { - type: { - description: 'This represents the type of resource object being returned. Always `product`.', - type: 'string', - enum: ['product'], - example: 'product' - }, - id: { - type: 'string', - description: 'The unique identifier of the product. Must match the product ID specified in the request path.', - example: '00000000-0000-0000-0000-000000000000' - }, - attributes: { - '$ref': '#/components/schemas/product_attributes' - } - } - } - } -} as const; - -export const $attributes = { - type: 'object', - properties: { - name: { - description: 'The name of the node, such as `Ranges` or `Refrigerators`. Names must be unique among sibling nodes in the hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies.', - type: 'string' - }, - description: { - description: 'A description for a node.', - type: 'string' + type: "object", + required: ["data"], + properties: { + data: { + type: "object", + required: ["type", "attributes", "id"], + properties: { + type: { + description: + "This represents the type of resource object being returned. Always `product`.", + type: "string", + enum: ["product"], + example: "product", }, - slug: { - description: 'A slug for the node. Slugs must be unique among sibling nodes in the hierarchy. Otherwise, a slug can be non-unique within the hierarchy and across multiple hierarchies.', - type: 'string' + id: { + type: "string", + description: + "The unique identifier of the product. Must match the product ID specified in the request path.", + example: "00000000-0000-0000-0000-000000000000", }, - curated_products: { - description: 'You can curate your products in your nodes product lists. Product curation allows you to promote specific products within each node in a hierarchy, enabling you to create unique product collections in your storefront.', - type: 'array', - items: { - description: 'A list of product IDs whose products you want to curate.', - type: 'string' - } + attributes: { + $ref: "#/components/schemas/product_attributes", }, - locales: { - description: 'Product Experience Manager supports localization of hierarchies and nodes. If you store supports multiple languages, you can localize hierarchy and node names and descriptions.', - type: 'object', - additionalProperties: { - description: 'A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used.', - type: 'object', - additionalProperties: false, - properties: { - name: { - description: 'A localized hierarchy or node name.', - type: 'string' - }, - description: { - description: 'A localized hierarchy or node description.', - type: 'string' - } - } - } - } - } -} as const; + }, + }, + }, +} as const -export const $relationships = { - type: 'object', - description: 'Relationships allow you to move between requests. Includes links to the child nodes and products associated with a hierarchy or node.', - properties: { - children: { - description: 'The child nodes related to the resource.', - type: 'object', - properties: { - data: { - description: 'An array of child nodes.', - type: 'array', - required: [] - }, - links: { - description: 'Links allow you to move between requests.', - type: 'object', - properties: { - related: { - description: 'A link to a related resource.', - type: 'string' - } - } - } - } - }, - parent: { - description: 'The parent node related to the resource', - type: 'object', - properties: { - data: { - description: 'The parent node', - type: 'object', - required: ['id', 'type'], - properties: { - type: { - description: 'This represents the type of resource object being returned. Always `node`.', - type: 'string', - enum: ['node'] - }, - id: { - description: 'The unique identifier of a node.', - type: 'string' - } - } - } - } - }, - products: { - type: 'object', - description: 'The products related to the resource.', - properties: { - data: { - description: 'An array of products.', - type: 'array', - required: [] - }, - links: { - type: 'object', - description: 'Links allow you to move between requests.', - properties: { - related: { - description: 'A link to a related resource.', - type: 'string' - } - } - } - } - } - } -} as const; +export const $attributes = { + type: "object", + properties: { + name: { + description: + "The name of the node, such as `Ranges` or `Refrigerators`. Names must be unique among sibling nodes in the hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies.", + type: "string", + }, + description: { + description: "A description for a node.", + type: "string", + }, + slug: { + description: + "A slug for the node. Slugs must be unique among sibling nodes in the hierarchy. Otherwise, a slug can be non-unique within the hierarchy and across multiple hierarchies.", + type: "string", + }, + curated_products: { + description: + "You can curate your products in your nodes product lists. Product curation allows you to promote specific products within each node in a hierarchy, enabling you to create unique product collections in your storefront.", + type: "array", + items: { + description: "A list of product IDs whose products you want to curate.", + type: "string", + }, + }, + locales: { + description: + "Product Experience Manager supports localization of hierarchies and nodes. If you store supports multiple languages, you can localize hierarchy and node names and descriptions.", + type: "object", + additionalProperties: { + description: + "A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used.", + type: "object", + additionalProperties: false, + properties: { + name: { + description: "A localized hierarchy or node name.", + type: "string", + }, + description: { + description: "A localized hierarchy or node description.", + type: "string", + }, + }, + }, + }, + }, +} as const -export const $node = { - type: 'object', - properties: { - id: { - description: 'The unique identifier of a node.', - type: 'string' - }, - type: { - description: 'This represents the type of resource object being returned. Always `node`.', - type: 'string', - enum: ['node'] +export const $relationships = { + type: "object", + description: + "Relationships allow you to move between requests. Includes links to the child nodes and products associated with a hierarchy or node.", + properties: { + children: { + description: "The child nodes related to the resource.", + type: "object", + properties: { + data: { + description: "An array of child nodes.", + type: "array", + required: [], }, - attributes: { - '$ref': '#/components/schemas/attributes' + links: { + description: "Links allow you to move between requests.", + type: "object", + properties: { + related: { + description: "A link to a related resource.", + type: "string", + }, + }, + }, + }, + }, + parent: { + description: "The parent node related to the resource", + type: "object", + properties: { + data: { + description: "The parent node", + type: "object", + required: ["id", "type"], + properties: { + type: { + description: + "This represents the type of resource object being returned. Always `node`.", + type: "string", + enum: ["node"], + }, + id: { + description: "The unique identifier of a node.", + type: "string", + }, + }, + }, + }, + }, + products: { + type: "object", + description: "The products related to the resource.", + properties: { + data: { + description: "An array of products.", + type: "array", + required: [], }, - relationships: { - '$ref': '#/components/schemas/relationships' + links: { + type: "object", + description: "Links allow you to move between requests.", + properties: { + related: { + description: "A link to a related resource.", + type: "string", + }, + }, }, - meta: { - type: 'object', - properties: { - sort_order: { - description: 'The sort order value. The node with the highest value of `sort_order` is displayed first. For example, a node with a `sort_order` value of `3` appears before a node with a `sort_order` value of `2`. See [Sorting Nodes in a hierarchy](/docs/api/pxm/products/create-node#sorting-nodes-in-a-hierarchy).', - type: 'integer' - }, - created_at: { - description: 'The date and time a node is created.', - type: 'string', - example: '2020-09-22T09:00:00', - format: 'date-time' - }, - updated_at: { - description: 'The date and time a node was updated.', - type: 'string', - example: '2020-09-22T09:00:00', - format: 'date-time' - }, - parent_name: { - description: 'The name of the parent of the node if one exists.', - type: 'string' - }, - owner: { - description: 'The node owner, either `organization` or `store`.', - type: 'string', - enum: ['store', 'organization'] - } - } - } - } -} as const; + }, + }, + }, +} as const + +export const $node = { + type: "object", + properties: { + id: { + description: "The unique identifier of a node.", + type: "string", + }, + type: { + description: + "This represents the type of resource object being returned. Always `node`.", + type: "string", + enum: ["node"], + }, + attributes: { + $ref: "#/components/schemas/attributes", + }, + relationships: { + $ref: "#/components/schemas/relationships", + }, + meta: { + type: "object", + properties: { + sort_order: { + description: + "The sort order value. The node with the highest value of `sort_order` is displayed first. For example, a node with a `sort_order` value of `3` appears before a node with a `sort_order` value of `2`. See [Sorting Nodes in a hierarchy](/docs/api/pxm/products/create-node#sorting-nodes-in-a-hierarchy).", + type: "integer", + }, + created_at: { + description: "The date and time a node is created.", + type: "string", + example: "2020-09-22T09:00:00", + format: "date-time", + }, + updated_at: { + description: "The date and time a node was updated.", + type: "string", + example: "2020-09-22T09:00:00", + format: "date-time", + }, + parent_name: { + description: "The name of the parent of the node if one exists.", + type: "string", + }, + owner: { + description: "The node owner, either `organization` or `store`.", + type: "string", + enum: ["store", "organization"], + }, + }, + }, + }, +} as const export const $multi_meta = { - type: 'object', - properties: { - results: { - description: 'Contains the results for the entire collection.', - type: 'object', - properties: { - total: { - description: 'Total number of results for the entire collection.', - type: 'integer', - example: 30, - minimum: 0 - } - } - } - } -} as const; + type: "object", + properties: { + results: { + description: "Contains the results for the entire collection.", + type: "object", + properties: { + total: { + description: "Total number of results for the entire collection.", + type: "integer", + example: 30, + minimum: 0, + }, + }, + }, + }, +} as const export const $multi_links = { - type: 'object', - description: 'Links are used to allow you to move between requests.', - properties: { - first: { - description: 'Always the first page.', - type: 'string', - example: '/pcm/hierarchies?page[offset]=0&page[limit]=10' - }, - last: { - description: 'This is `null` if there is only one page.', - type: 'string', - example: '/pcm/hierarchies?page[offset]=20&page[limit]=10' - }, - next: { - description: 'This is `null` if there is only one page.', - type: 'string', - example: '/pcm/hierarchies?page[offset]=10&page[limit]=10' - }, - prev: { - description: 'This is `null` if you on the first page.', - type: 'string', - example: '/pcm/hierarchies?page[offset]=8&page[limit]=10' - } - } -} as const; + type: "object", + description: "Links are used to allow you to move between requests.", + properties: { + first: { + description: "Always the first page.", + type: "string", + example: "/pcm/hierarchies?page[offset]=0&page[limit]=10", + }, + last: { + description: "This is `null` if there is only one page.", + type: "string", + example: "/pcm/hierarchies?page[offset]=20&page[limit]=10", + }, + next: { + description: "This is `null` if there is only one page.", + type: "string", + example: "/pcm/hierarchies?page[offset]=10&page[limit]=10", + }, + prev: { + description: "This is `null` if you on the first page.", + type: "string", + example: "/pcm/hierarchies?page[offset]=8&page[limit]=10", + }, + }, +} as const export const $multi_nodes = { - type: 'object', - properties: { - data: { - description: 'An array of nodes.', - type: 'array', - items: { - '$ref': '#/components/schemas/node' - } - }, - meta: { - '$ref': '#/components/schemas/multi_meta' - }, - links: { - '$ref': '#/components/schemas/multi_links' - } - } -} as const; + type: "object", + properties: { + data: { + description: "An array of nodes.", + type: "array", + items: { + $ref: "#/components/schemas/node", + }, + }, + meta: { + $ref: "#/components/schemas/multi_meta", + }, + links: { + $ref: "#/components/schemas/multi_links", + }, + }, +} as const export const $template_response = { - type: 'object', - properties: { - data: { - type: 'array', - items: { - type: 'object', - properties: { - id: { - description: 'A unique identifier for a template generated when a template is created.', - type: 'string' - }, - type: { - description: 'This represents the type of resource object being returned. Always `template`.', - type: 'string', - enum: ['template'] - } - } - } - } - } -} as const; + type: "object", + properties: { + data: { + type: "array", + items: { + type: "object", + properties: { + id: { + description: + "A unique identifier for a template generated when a template is created.", + type: "string", + }, + type: { + description: + "This represents the type of resource object being returned. Always `template`.", + type: "string", + enum: ["template"], + }, + }, + }, + }, + }, +} as const export const $product_templates_request = { - type: 'object', - properties: { - data: { - type: 'array', - items: { - type: 'object', - properties: { - id: { - type: 'string', - description: 'The unique identifier of a template.' - }, - type: { - type: 'string', - enum: ['template'], - description: "This represents the type of resource object being returned. Always `template'." - } - } - } - } - } -} as const; + type: "object", + properties: { + data: { + type: "array", + items: { + type: "object", + properties: { + id: { + type: "string", + description: "The unique identifier of a template.", + }, + type: { + type: "string", + enum: ["template"], + description: + "This represents the type of resource object being returned. Always `template'.", + }, + }, + }, + }, + }, +} as const export const $component_products_response = { - type: 'object', - properties: { - data: { - type: 'array', - items: { - type: 'object', - properties: { - id: { - type: 'string', - description: 'The unique identifier of a product component generated when a product is created.' - }, - type: { - type: 'string', - enum: ['product'], - description: 'This represents the type of resource object being returned. Always `product`.' - } - } - } - } - } -} as const; + type: "object", + properties: { + data: { + type: "array", + items: { + type: "object", + properties: { + id: { + type: "string", + description: + "The unique identifier of a product component generated when a product is created.", + }, + type: { + type: "string", + enum: ["product"], + description: + "This represents the type of resource object being returned. Always `product`.", + }, + }, + }, + }, + }, +} as const export const $file_response = { - type: 'object', - properties: { - data: { - type: 'array', - items: { - type: 'object', - properties: { - id: { - type: 'string', - description: 'The unique identifier of the new file.' - }, - type: { - type: 'string', - description: 'This represents the type of resource object being returned. Always `file`.', - enum: ['file'] - } - } - } - } - } -} as const; + type: "object", + properties: { + data: { + type: "array", + items: { + type: "object", + properties: { + id: { + type: "string", + description: "The unique identifier of the new file.", + }, + type: { + type: "string", + description: + "This represents the type of resource object being returned. Always `file`.", + enum: ["file"], + }, + }, + }, + }, + }, +} as const export const $product_files_request = { - type: 'object', - properties: { - data: { - type: 'array', - items: { - type: 'object', - properties: { - id: { - description: 'A unique identifier for a file generated when a file is created.', - type: 'string' - }, - type: { - description: 'This represents the type of resource being returned. Always `file`.', - type: 'string', - enum: ['file'] - }, - meta: { - type: 'object', - properties: { - tags: { - description: 'The files associated with a product.', - type: 'array', - items: { - type: 'string' - } - } - }, - additionalProperties: false - } - } - } - } - } -} as const; + type: "object", + properties: { + data: { + type: "array", + items: { + type: "object", + properties: { + id: { + description: + "A unique identifier for a file generated when a file is created.", + type: "string", + }, + type: { + description: + "This represents the type of resource being returned. Always `file`.", + type: "string", + enum: ["file"], + }, + meta: { + type: "object", + properties: { + tags: { + description: "The files associated with a product.", + type: "array", + items: { + type: "string", + }, + }, + }, + additionalProperties: false, + }, + }, + }, + }, + }, +} as const export const $variations_response = { - type: 'object', - properties: { - data: { - type: 'array', - items: { - type: 'object', - properties: { - id: { - description: 'A unique identifier generated when a variation is created.', - type: 'string' - }, - type: { - description: 'This represents the type of resource object being returned. Always `product-variation`.', - type: 'string', - enum: ['product-variation'] - }, - meta: { - type: 'object', - properties: { - created_at: { - description: 'The date and time a resource is created.', - type: 'string', - example: '2020-09-22T09:00:00', - format: 'date-time' - } - } - } - } - } - } - } -} as const; + type: "object", + properties: { + data: { + type: "array", + items: { + type: "object", + properties: { + id: { + description: + "A unique identifier generated when a variation is created.", + type: "string", + }, + type: { + description: + "This represents the type of resource object being returned. Always `product-variation`.", + type: "string", + enum: ["product-variation"], + }, + meta: { + type: "object", + properties: { + created_at: { + description: "The date and time a resource is created.", + type: "string", + example: "2020-09-22T09:00:00", + format: "date-time", + }, + }, + }, + }, + }, + }, + }, +} as const export const $product_variations_request = { - type: 'object', - properties: { - data: { - type: 'array', - items: { - type: 'object', - properties: { - id: { - type: 'string', - description: 'The ID of the product variation.' - }, - type: { - type: 'string', - enum: ['product-variation'], - description: 'This represents the type of resource being returned. Always `product-variation`.' - } - } - } - } - } -} as const; + type: "object", + properties: { + data: { + type: "array", + items: { + type: "object", + properties: { + id: { + type: "string", + description: "The ID of the product variation.", + }, + type: { + type: "string", + enum: ["product-variation"], + description: + "This represents the type of resource being returned. Always `product-variation`.", + }, + }, + }, + }, + }, +} as const export const $main_image_response = { - type: 'object', - properties: { - data: { - type: 'array', - items: { - type: 'object', - properties: { - id: { - description: 'A unique identifier for the image file generated automatically when a file is created.', - type: 'string' - }, - type: { - description: 'This represents the type of resource object being returned. Always `file`.', - type: 'string' - } - } - } - } - } -} as const; + type: "object", + properties: { + data: { + type: "array", + items: { + type: "object", + properties: { + id: { + description: + "A unique identifier for the image file generated automatically when a file is created.", + type: "string", + }, + type: { + description: + "This represents the type of resource object being returned. Always `file`.", + type: "string", + }, + }, + }, + }, + }, +} as const export const $replace_main_image_request = { - type: 'object', - properties: { - data: { - type: 'array', - items: { - type: 'object', - properties: { - id: { - type: 'string', - description: 'The ID of the new image file.', - example: '00000000-0000-0000-0000-000000000000' - }, - type: { - type: 'string', - enum: ['file'] - } - } - } - } - } -} as const; + type: "object", + properties: { + data: { + type: "array", + items: { + type: "object", + properties: { + id: { + type: "string", + description: "The ID of the new image file.", + example: "00000000-0000-0000-0000-000000000000", + }, + type: { + type: "string", + enum: ["file"], + }, + }, + }, + }, + }, +} as const export const $main_image_request = { - type: 'object', - properties: { - data: { - type: 'object', - properties: { - id: { - type: 'string', - description: 'The ID of the image file.', - example: '00000000-0000-0000-0000-000000000000' - }, - type: { - description: 'This represents the type of resource being returned. Always `file`.', - type: 'string', - enum: ['file'] - } - } - } - } -} as const; + type: "object", + properties: { + data: { + type: "object", + properties: { + id: { + type: "string", + description: "The ID of the image file.", + example: "00000000-0000-0000-0000-000000000000", + }, + type: { + description: + "This represents the type of resource being returned. Always `file`.", + type: "string", + enum: ["file"], + }, + }, + }, + }, +} as const export const $multi_variations = { - type: 'object', - properties: { - data: { - type: 'array', - items: { - type: 'object', - properties: { + type: "object", + properties: { + data: { + type: "array", + items: { + type: "object", + properties: { + id: { + description: "A unique identifier for a variation.", + type: "string", + }, + type: { + description: + "This represents the type of resource object being returned. Always `product-variation`.", + type: "string", + enum: ["product-variation"], + }, + attributes: { + type: "object", + additionalProperties: false, + properties: { + name: { + description: "The name of a variation.", + type: "string", + }, + sort_order: { + description: + "The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.", + type: "integer", + }, + }, + }, + meta: { + type: "object", + properties: { + options: { + type: "array", + items: { + type: "object", + description: "The options available for this variation.", + properties: { id: { - description: 'A unique identifier for a variation.', - type: 'string' + type: "string", + description: + "A unique ID that is generated when an option is created.", + }, + name: { + type: "string", + description: + "A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.", }, - type: { - description: 'This represents the type of resource object being returned. Always `product-variation`.', - type: 'string', - enum: ['product-variation'] + description: { + type: "string", + description: + "A human recognizable description of the option.", + }, + created_at: { + type: "string", + description: "The date and time an option is created.", + example: "2020-09-22T09:00:00", + format: "date-time", + }, + updated_at: { + type: "string", + description: "The date and time an option is updated.", + example: "2020-09-22T09:00:00", + format: "date-time", }, - attributes: { - type: 'object', - additionalProperties: false, - properties: { - name: { - description: 'The name of a variation.', - type: 'string' - }, - sort_order: { - description: 'The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.', - type: 'integer' - } - } + sort_order: { + description: + "The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.", + type: "integer", }, - meta: { - type: 'object', - properties: { - options: { - type: 'array', - items: { - type: 'object', - description: 'The options available for this variation.', - properties: { - id: { - type: 'string', - description: 'A unique ID that is generated when an option is created.' - }, - name: { - type: 'string', - description: 'A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.' - }, - description: { - type: 'string', - description: 'A human recognizable description of the option.' - }, - created_at: { - type: 'string', - description: 'The date and time an option is created.', - example: '2020-09-22T09:00:00', - format: 'date-time' - }, - updated_at: { - type: 'string', - description: 'The date and time an option is updated.', - example: '2020-09-22T09:00:00', - format: 'date-time' - }, - sort_order: { - description: 'The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.', - type: 'integer' - } - } - } - }, - owner: { - type: 'string', - description: 'The owner of the resource, either `organization` or `store`.', - enum: ['organization', 'store'] - }, - created_at: { - type: 'string', - description: 'The date and time a variation is created.', - example: '2020-09-22T09:00:00', - format: 'date-time' - }, - updated_at: { - type: 'string', - description: 'The date and time a variation is updated.', - example: '2020-09-22T09:00:00', - format: 'date-time' - } - } - } - } - } + }, + }, + }, + owner: { + type: "string", + description: + "The owner of the resource, either `organization` or `store`.", + enum: ["organization", "store"], + }, + created_at: { + type: "string", + description: "The date and time a variation is created.", + example: "2020-09-22T09:00:00", + format: "date-time", + }, + updated_at: { + type: "string", + description: "The date and time a variation is updated.", + example: "2020-09-22T09:00:00", + format: "date-time", + }, + }, + }, }, - meta: { - type: 'object', - properties: { - results: { - description: 'Contains the results for the entire collection.', - type: 'object', - properties: { - total: { - description: 'Total number of results for the entire collection.', - type: 'integer', - example: 3 - } - } - } - } - } - } -} as const; + }, + }, + meta: { + type: "object", + properties: { + results: { + description: "Contains the results for the entire collection.", + type: "object", + properties: { + total: { + description: "Total number of results for the entire collection.", + type: "integer", + example: 3, + }, + }, + }, + }, + }, + }, +} as const export const $create_variation = { - type: 'object', - required: ['data'], - properties: { - data: { - type: 'object', - required: ['type', 'attributes'], - properties: { - type: { - description: 'This represents the type of resource object being returned. Always `product-variation`.', - type: 'string', - enum: ['product-variation'] - }, - attributes: { - type: 'object', - additionalProperties: false, - properties: { - name: { - description: 'The variation name.', - type: 'string' - }, - sort_order: { - description: `The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the \`sort_order\` value to program your storefront to display the variation options in the order that you want. + type: "object", + required: ["data"], + properties: { + data: { + type: "object", + required: ["type", "attributes"], + properties: { + type: { + description: + "This represents the type of resource object being returned. Always `product-variation`.", + type: "string", + enum: ["product-variation"], + }, + attributes: { + type: "object", + additionalProperties: false, + properties: { + name: { + description: "The variation name.", + type: "string", + }, + sort_order: { + description: `The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the \`sort_order\` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of \`sort_order\` is displayed first. For example, a variation with a \`sort_order\` value of 3 appears before a variation with a \`sort_order\` value of 2. @@ -1410,188 +1505,200 @@ export const $create_variation = { You must rebuild your products for the sort order changes to take effect. `, - type: 'integer' - } - } - } - } - } - } -} as const; + type: "integer", + }, + }, + }, + }, + }, + }, +} as const export const $created_variation = { - type: 'object', - required: ['data'], - properties: { - data: { - type: 'object', - required: ['id', 'type', 'attributes', 'meta'], - properties: { - id: { - description: 'A unique identifier generated when a variation is created.', - type: 'string' - }, - type: { - description: 'This represents the type of resource object being returned. Always `product-variation`.', - type: 'string', - enum: ['product-variation'] - }, - attributes: { - type: 'object', - additionalProperties: false, - properties: { - name: { - description: 'A human-recognizable identifier for a variation.', - type: 'string' - }, - sort_order: { - description: 'The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.', - type: 'integer' - } - } - }, - meta: { - type: 'object', - properties: { - owner: { - description: 'The owner of the resource, either `organization` or `store`.', - type: 'string', - enum: ['organization', 'store'] - }, - created_at: { - type: 'string', - description: 'The date and time a variation is created.', - example: '2020-09-22T09:00:00', - format: 'date-time' - }, - updated_at: { - type: 'string', - description: 'The date and time a variation is updated.', - example: '2020-09-22T09:00:00', - format: 'date-time' - } - } - } - } - } - } -} as const; + type: "object", + required: ["data"], + properties: { + data: { + type: "object", + required: ["id", "type", "attributes", "meta"], + properties: { + id: { + description: + "A unique identifier generated when a variation is created.", + type: "string", + }, + type: { + description: + "This represents the type of resource object being returned. Always `product-variation`.", + type: "string", + enum: ["product-variation"], + }, + attributes: { + type: "object", + additionalProperties: false, + properties: { + name: { + description: "A human-recognizable identifier for a variation.", + type: "string", + }, + sort_order: { + description: + "The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.", + type: "integer", + }, + }, + }, + meta: { + type: "object", + properties: { + owner: { + description: + "The owner of the resource, either `organization` or `store`.", + type: "string", + enum: ["organization", "store"], + }, + created_at: { + type: "string", + description: "The date and time a variation is created.", + example: "2020-09-22T09:00:00", + format: "date-time", + }, + updated_at: { + type: "string", + description: "The date and time a variation is updated.", + example: "2020-09-22T09:00:00", + format: "date-time", + }, + }, + }, + }, + }, + }, +} as const export const $single_variation = { - type: 'object', - required: ['data'], - properties: { - data: { - type: 'object', - required: ['id', 'type', 'attributes', 'meta'], - properties: { - id: { - description: 'A unique identifier for a variation.', - type: 'string' - }, - type: { - description: 'This represents the type of resource object being returned. Always `product-variation`.', - type: 'string', - enum: ['product-variation'] - }, - attributes: { - type: 'object', - additionalProperties: false, - properties: { - name: { - description: 'The name for a variation.', - type: 'string' - }, - sort_order: { - description: 'The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.', - type: 'integer' - } - } - }, - meta: { - type: 'object', - properties: { - options: { - description: 'A variation option represents an option for selection for a single product-variation. For example, if your variation is `color`, you might have three possible options; red, green, and blue.', - type: 'array', - items: { - type: 'object', - description: 'The options available for this variation', - properties: { - id: { - type: 'string', - description: 'A unique ID that is generated an option is created.' - }, - name: { - type: 'string', - description: 'A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.' - }, - description: { - type: 'string', - description: 'A description for an option.' - }, - created_at: { - type: 'string', - description: 'The date and time an option is created.', - example: '2020-09-22T09:00:00', - format: 'date-time' - }, - updated_at: { - type: 'string', - description: 'The date and time an option is updated.', - example: '2020-09-22T09:00:00', - format: 'date-time' - }, - sort_order: { - description: 'The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.', - type: 'integer' - } - } - } - }, - owner: { - description: 'The owner of the resource, either `organization` or `store`.', - type: 'string', - enum: ['organization', 'store'] - }, - created_at: { - type: 'string', - description: 'The date and time a variation is created.' - }, - updated_at: { - type: 'string', - description: 'The date and time a variation is updated.' - } - } - } - } - } - } -} as const; + type: "object", + required: ["data"], + properties: { + data: { + type: "object", + required: ["id", "type", "attributes", "meta"], + properties: { + id: { + description: "A unique identifier for a variation.", + type: "string", + }, + type: { + description: + "This represents the type of resource object being returned. Always `product-variation`.", + type: "string", + enum: ["product-variation"], + }, + attributes: { + type: "object", + additionalProperties: false, + properties: { + name: { + description: "The name for a variation.", + type: "string", + }, + sort_order: { + description: + "The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.", + type: "integer", + }, + }, + }, + meta: { + type: "object", + properties: { + options: { + description: + "A variation option represents an option for selection for a single product-variation. For example, if your variation is `color`, you might have three possible options; red, green, and blue.", + type: "array", + items: { + type: "object", + description: "The options available for this variation", + properties: { + id: { + type: "string", + description: + "A unique ID that is generated an option is created.", + }, + name: { + type: "string", + description: + "A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.", + }, + description: { + type: "string", + description: "A description for an option.", + }, + created_at: { + type: "string", + description: "The date and time an option is created.", + example: "2020-09-22T09:00:00", + format: "date-time", + }, + updated_at: { + type: "string", + description: "The date and time an option is updated.", + example: "2020-09-22T09:00:00", + format: "date-time", + }, + sort_order: { + description: + "The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.", + type: "integer", + }, + }, + }, + }, + owner: { + description: + "The owner of the resource, either `organization` or `store`.", + type: "string", + enum: ["organization", "store"], + }, + created_at: { + type: "string", + description: "The date and time a variation is created.", + }, + updated_at: { + type: "string", + description: "The date and time a variation is updated.", + }, + }, + }, + }, + }, + }, +} as const export const $update_variation = { - type: 'object', - required: ['data'], - properties: { - data: { - type: 'object', - required: ['type', 'attributes', 'id'], - properties: { - type: { - description: 'This represents the type of resource object being returned. Always `product-variation`.', - type: 'string', - enum: ['product-variation'] - }, - attributes: { - type: 'object', - additionalProperties: false, - properties: { - name: { - description: 'The variation name.', - type: 'string' - }, - sort_order: { - description: `The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the \`sort_order\` value to program your storefront to display the variation options in the order that you want. + type: "object", + required: ["data"], + properties: { + data: { + type: "object", + required: ["type", "attributes", "id"], + properties: { + type: { + description: + "This represents the type of resource object being returned. Always `product-variation`.", + type: "string", + enum: ["product-variation"], + }, + attributes: { + type: "object", + additionalProperties: false, + properties: { + name: { + description: "The variation name.", + type: "string", + }, + sort_order: { + description: `The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the \`sort_order\` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of \`sort_order\` is displayed first. For example, a variation with a \`sort_order\` value of 3 appears before a variation with a \`sort_order\` value of 2. @@ -1599,122 +1706,130 @@ export const $update_variation = { You must rebuild your products for the sort order changes to take effect. `, - type: 'integer' - } - } - }, - id: { - type: 'string', - description: 'The unique identifier of the variation. Must match the variation ID specified in the request path.', - example: '00000000-0000-0000-0000-000000000000' - } - } - } - } -} as const; + type: "integer", + }, + }, + }, + id: { + type: "string", + description: + "The unique identifier of the variation. Must match the variation ID specified in the request path.", + example: "00000000-0000-0000-0000-000000000000", + }, + }, + }, + }, +} as const export const $multi_options = { - type: 'object', - properties: { - data: { - type: 'array', - items: { - type: 'object', - properties: { - id: { - description: 'A unique identifier generated when an option is created.', - type: 'string' - }, - type: { - description: 'This represents the type of resource object being returned. Always `product-variation-option`.', - type: 'string', - enum: ['product-variation-option'] - }, - attributes: { - type: 'object', - additionalProperties: false, - properties: { - name: { - description: 'A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.', - type: 'string' - }, - description: { - description: 'A human-recognizable description for the option.', - type: 'string' - }, - sort_order: { - description: 'The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.', - type: 'integer' - } - } - }, - meta: { - type: 'object', - properties: { - owner: { - description: 'The owner of a resource, either `organization` or `store`.', - type: 'string', - enum: ['organization', 'store'] - }, - created_at: { - type: 'string', - description: 'The date and time an option is created.', - example: '2020-09-22T09:00:00', - format: 'date-time' - }, - updated_at: { - type: 'string', - description: 'The date and time an option is updated.', - example: '2020-09-22T09:00:00', - format: 'date-time' - } - } - } - } - } - }, - meta: { - type: 'object', + type: "object", + properties: { + data: { + type: "array", + items: { + type: "object", + properties: { + id: { + description: + "A unique identifier generated when an option is created.", + type: "string", + }, + type: { + description: + "This represents the type of resource object being returned. Always `product-variation-option`.", + type: "string", + enum: ["product-variation-option"], + }, + attributes: { + type: "object", + additionalProperties: false, properties: { - results: { - description: 'Contains the results for the entire collection.', - type: 'object', - properties: { - total: { - description: 'Total number of results for the entire collection.', - type: 'integer', - example: 3 - } - } - } - } - } - } -} as const; + name: { + description: + "A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.", + type: "string", + }, + description: { + description: "A human-recognizable description for the option.", + type: "string", + }, + sort_order: { + description: + "The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.", + type: "integer", + }, + }, + }, + meta: { + type: "object", + properties: { + owner: { + description: + "The owner of a resource, either `organization` or `store`.", + type: "string", + enum: ["organization", "store"], + }, + created_at: { + type: "string", + description: "The date and time an option is created.", + example: "2020-09-22T09:00:00", + format: "date-time", + }, + updated_at: { + type: "string", + description: "The date and time an option is updated.", + example: "2020-09-22T09:00:00", + format: "date-time", + }, + }, + }, + }, + }, + }, + meta: { + type: "object", + properties: { + results: { + description: "Contains the results for the entire collection.", + type: "object", + properties: { + total: { + description: "Total number of results for the entire collection.", + type: "integer", + example: 3, + }, + }, + }, + }, + }, + }, +} as const export const $create_option = { - type: 'object', - required: ['data'], - properties: { - data: { - type: 'object', - required: ['type', 'attributes'], - properties: { - type: { - description: 'This represents the type of resource object being returned. Always `product-variation-option`.', - type: 'string', - enum: ['product-variation-option'] - }, - attributes: { - type: 'object', - additionalProperties: false, - properties: { - name: { - description: 'A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.', - type: 'string' - }, - sort_order: { - description: `By default, variations and variation options are sorted alphabetically. You can use the \`sort_order\` attribute to sort the order of your variation and variation options in the \`variation_matrix\`. + type: "object", + required: ["data"], + properties: { + data: { + type: "object", + required: ["type", "attributes"], + properties: { + type: { + description: + "This represents the type of resource object being returned. Always `product-variation-option`.", + type: "string", + enum: ["product-variation-option"], + }, + attributes: { + type: "object", + additionalProperties: false, + properties: { + name: { + description: + "A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.", + type: "string", + }, + sort_order: { + description: `By default, variations and variation options are sorted alphabetically. You can use the \`sort_order\` attribute to sort the order of your variation and variation options in the \`variation_matrix\`. The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the \`sort_order\` value to program your storefront to display the variation options in the order that you want. @@ -1724,171 +1839,184 @@ export const $create_option = { You must rebuild your products for the sort order changes to take effect. `, - type: 'integer' - }, - description: { - description: 'A description of a product variation option.', - type: 'string' - } - } - } - } - } - } -} as const; + type: "integer", + }, + description: { + description: "A description of a product variation option.", + type: "string", + }, + }, + }, + }, + }, + }, +} as const export const $created_option = { - type: 'object', - required: ['data'], - properties: { - data: { - type: 'object', - required: ['type', 'attributes'], - properties: { - id: { - description: 'A unique identifier that is generated when an option is created.', - type: 'string' - }, - type: { - description: 'This represents the type of resource object being returned. Always `product-variation-option`.', - type: 'string', - enum: ['product-variation-option'] - }, - attributes: { - type: 'object', - additionalProperties: false, - properties: { - name: { - description: 'A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.', - type: 'string' - }, - description: { - description: 'A human-recognizable description for the option.', - type: 'string' - }, - sort_order: { - description: 'The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.', - type: 'integer' - } - } - }, - meta: { - type: 'object', - properties: { - owner: { - description: 'The owner of a resource, either `organization` or `store`.', - type: 'string', - enum: ['organization', 'store'] - }, - created_at: { - type: 'string', - description: 'The date and time an option is created.', - example: '2020-09-22T09:00:00', - format: 'date-time' - }, - updated_at: { - type: 'string', - description: 'The date and time an option is updated.', - example: '2020-09-22T09:00:00', - format: 'date-time' - } - } - } - } - } - } -} as const; + type: "object", + required: ["data"], + properties: { + data: { + type: "object", + required: ["type", "attributes"], + properties: { + id: { + description: + "A unique identifier that is generated when an option is created.", + type: "string", + }, + type: { + description: + "This represents the type of resource object being returned. Always `product-variation-option`.", + type: "string", + enum: ["product-variation-option"], + }, + attributes: { + type: "object", + additionalProperties: false, + properties: { + name: { + description: + "A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.", + type: "string", + }, + description: { + description: "A human-recognizable description for the option.", + type: "string", + }, + sort_order: { + description: + "The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.", + type: "integer", + }, + }, + }, + meta: { + type: "object", + properties: { + owner: { + description: + "The owner of a resource, either `organization` or `store`.", + type: "string", + enum: ["organization", "store"], + }, + created_at: { + type: "string", + description: "The date and time an option is created.", + example: "2020-09-22T09:00:00", + format: "date-time", + }, + updated_at: { + type: "string", + description: "The date and time an option is updated.", + example: "2020-09-22T09:00:00", + format: "date-time", + }, + }, + }, + }, + }, + }, +} as const export const $single_option = { - type: 'object', - required: ['data'], - properties: { - data: { - type: 'object', - required: ['id', 'type', 'attributes', 'meta'], - properties: { - id: { - description: 'The unique identifier generated when an option is created.', - type: 'string' - }, - type: { - description: 'This represents the type of resource object being returned. Always `product-variation-option`.', - type: 'string', - enum: ['product-variation-option'] - }, - attributes: { - type: 'object', - description: 'A variation option represents an option for selection for a single product-variation. For example, if your variation is `color`, you might have three possible options; red, green, and blue.', - additionalProperties: false, - properties: { - name: { - description: 'A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.', - type: 'string' - }, - description: { - description: 'A human-recognizable description for the option.', - type: 'string' - }, - sort_order: { - description: 'The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.', - type: 'integer' - } - } - }, - meta: { - type: 'object', - properties: { - owner: { - description: 'The owner of a resource, either `organization` or `store`.', - type: 'string', - enum: ['organization', 'store'] - }, - created_at: { - type: 'string', - description: 'The date and time an option is created.', - example: '2020-09-22T09:00:00', - format: 'date-time' - }, - updated_at: { - type: 'string', - description: 'The date and time an option is updated.', - example: '2020-09-22T09:00:00', - format: 'date-time' - } - } - } - } - } - } -} as const; + type: "object", + required: ["data"], + properties: { + data: { + type: "object", + required: ["id", "type", "attributes", "meta"], + properties: { + id: { + description: + "The unique identifier generated when an option is created.", + type: "string", + }, + type: { + description: + "This represents the type of resource object being returned. Always `product-variation-option`.", + type: "string", + enum: ["product-variation-option"], + }, + attributes: { + type: "object", + description: + "A variation option represents an option for selection for a single product-variation. For example, if your variation is `color`, you might have three possible options; red, green, and blue.", + additionalProperties: false, + properties: { + name: { + description: + "A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.", + type: "string", + }, + description: { + description: "A human-recognizable description for the option.", + type: "string", + }, + sort_order: { + description: + "The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.", + type: "integer", + }, + }, + }, + meta: { + type: "object", + properties: { + owner: { + description: + "The owner of a resource, either `organization` or `store`.", + type: "string", + enum: ["organization", "store"], + }, + created_at: { + type: "string", + description: "The date and time an option is created.", + example: "2020-09-22T09:00:00", + format: "date-time", + }, + updated_at: { + type: "string", + description: "The date and time an option is updated.", + example: "2020-09-22T09:00:00", + format: "date-time", + }, + }, + }, + }, + }, + }, +} as const export const $update_option = { - type: 'object', - required: ['data'], - properties: { - data: { - type: 'object', - required: ['type', 'attributes', 'id'], - properties: { - type: { - description: 'This represents the type of resource object being returned. Always `product-variation-option`.', - type: 'string', - enum: ['product-variation-option'] - }, - attributes: { - type: 'object', - additionalProperties: false, - properties: { - name: { - description: 'A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.', - type: 'string' - }, - description: { - description: 'The description of the option.', - type: 'string' - }, - sort_order: { - description: `By default, variations and variation options are sorted alphabetically. You can use the \`sort_order\` attribute to sort the order of your variation and variation options in the \`variation_matrix\`. The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the \`sort_order\` value to program your storefront to display the variation options in the order that you want. + type: "object", + required: ["data"], + properties: { + data: { + type: "object", + required: ["type", "attributes", "id"], + properties: { + type: { + description: + "This represents the type of resource object being returned. Always `product-variation-option`.", + type: "string", + enum: ["product-variation-option"], + }, + attributes: { + type: "object", + additionalProperties: false, + properties: { + name: { + description: + "A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.", + type: "string", + }, + description: { + description: "The description of the option.", + type: "string", + }, + sort_order: { + description: `By default, variations and variation options are sorted alphabetically. You can use the \`sort_order\` attribute to sort the order of your variation and variation options in the \`variation_matrix\`. The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the \`sort_order\` value to program your storefront to display the variation options in the order that you want. The variation option with the highest value of \`sort_order\` is displayed first. For example, a variation option with a \`sort_order\` value of \`3\` appears before a variation option with a \`sort_order\` value of \`2\`. @@ -1898,43 +2026,46 @@ You can set \`sort_order\` to either \`null\` or omit it entirely from the reque You must rebuild your products for the sort order changes to take effect. `, - type: 'integer' - } - } - }, - id: { - type: 'string', - description: 'The unique identifier of the option. Must match the option ID specified in the request path.', - example: '00000000-0000-0000-0000-000000000000' - } - } - } - } -} as const; + type: "integer", + }, + }, + }, + id: { + type: "string", + description: + "The unique identifier of the option. Must match the option ID specified in the request path.", + example: "00000000-0000-0000-0000-000000000000", + }, + }, + }, + }, +} as const export const $multi_modifiers = { - type: 'object', - properties: { - data: { - type: 'array', - items: { - type: 'object', - properties: { - id: { - description: 'A unique identifier for a modifier that is generated automatically when a modifier is created.', - type: 'string' - }, - type: { - description: "This represents the type of resource object being returned. Always `product-variation-modifier'.", - type: 'string', - enum: ['product-variation-modifier'] - }, - attributes: { - type: 'object', - additionalProperties: false, - properties: { - type: { - description: `You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + type: "object", + properties: { + data: { + type: "array", + items: { + type: "object", + properties: { + id: { + description: + "A unique identifier for a modifier that is generated automatically when a modifier is created.", + type: "string", + }, + type: { + description: + "This represents the type of resource object being returned. Always `product-variation-modifier'.", + type: "string", + enum: ["product-variation-modifier"], + }, + attributes: { + type: "object", + additionalProperties: false, + properties: { + type: { + description: `You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. | Modifier | Data Type | Effect | | :--- | :--- | :--- | @@ -1958,81 +2089,111 @@ export const $multi_modifiers = { | \`sku_builder\` | \`string\` | Sets a part of the SKU of the child product. | | \`status\` | \`string\` | Sets the status of the child product, such as \`draft\` or \`live\`. | `, - type: 'string', - enum: ['commodity_type', 'status', 'price', 'name_append', 'name_prepend', 'name_equals', 'sku_append', 'sku_prepend', 'sku_equals', 'sku_builder', 'slug_append', 'slug_prepend', 'slug_equals', 'slug_builder', 'description_append', 'description_prepend', 'description_equals', 'custom_inputs_equals', 'build_rules_equals', 'locales_equals', 'upc_ean_equals', 'mpn_equals', 'external_ref_equals'] - }, - value: { - description: 'Required for non-builder modifiers. The value of the modifier type.', - type: 'string' - }, - seek: { - description: 'Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`.', - type: 'string' - }, - set: { - description: 'Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`.', - type: 'string' - }, - reference_name: { - description: 'The name of the modifier.', - type: 'string' - } - } - }, - meta: { - type: 'object', - properties: { - owner: { - description: 'The owner of a resource, either `organization` or `store`.', - type: 'string', - enum: ['store', 'organization'] - } - } - } - } - } - }, - meta: { - type: 'object', + type: "string", + enum: [ + "commodity_type", + "status", + "price", + "name_append", + "name_prepend", + "name_equals", + "sku_append", + "sku_prepend", + "sku_equals", + "sku_builder", + "slug_append", + "slug_prepend", + "slug_equals", + "slug_builder", + "description_append", + "description_prepend", + "description_equals", + "custom_inputs_equals", + "build_rules_equals", + "locales_equals", + "upc_ean_equals", + "mpn_equals", + "external_ref_equals", + ], + }, + value: { + description: + "Required for non-builder modifiers. The value of the modifier type.", + type: "string", + }, + seek: { + description: + "Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`.", + type: "string", + }, + set: { + description: + "Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`.", + type: "string", + }, + reference_name: { + description: "The name of the modifier.", + type: "string", + }, + }, + }, + meta: { + type: "object", properties: { - results: { - type: 'object', - description: 'Contains the results for the entire collection.', - properties: { - total: { - description: 'Total number of results for the entire collection.', - type: 'integer', - example: 3 - } - } - } - } - } - } -} as const; + owner: { + description: + "The owner of a resource, either `organization` or `store`.", + type: "string", + enum: ["store", "organization"], + }, + }, + }, + }, + }, + }, + meta: { + type: "object", + properties: { + results: { + type: "object", + description: "Contains the results for the entire collection.", + properties: { + total: { + description: "Total number of results for the entire collection.", + type: "integer", + example: 3, + }, + }, + }, + }, + }, + }, +} as const export const $create_modifier = { - type: 'object', - description: 'Use modifiers to change the properties of child products that are inherited from a parent product. With modifiers, you only need to have one parent product with a variation attached to the product.', - required: ['data'], - properties: { - data: { - type: 'object', - required: ['type', 'attributes'], - properties: { - type: { - description: 'This represents the type of resource object being returned. Always `product-variation-modifier`.', - type: 'string', - enum: ['product-variation-modifier'] - }, - attributes: { - type: 'object', - required: ['type'], - additionalProperties: false, - properties: { - type: { - type: 'string', - description: `You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + type: "object", + description: + "Use modifiers to change the properties of child products that are inherited from a parent product. With modifiers, you only need to have one parent product with a variation attached to the product.", + required: ["data"], + properties: { + data: { + type: "object", + required: ["type", "attributes"], + properties: { + type: { + description: + "This represents the type of resource object being returned. Always `product-variation-modifier`.", + type: "string", + enum: ["product-variation-modifier"], + }, + attributes: { + type: "object", + required: ["type"], + additionalProperties: false, + properties: { + type: { + type: "string", + description: `You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. | Modifier | Data Type | Effect | | :--- | :--- | :--- | @@ -2056,52 +2217,81 @@ export const $create_modifier = { | \`sku_builder\` | \`string\` | Sets a part of the SKU of the child product. | | \`status\` | \`string\` | Sets the status of the child product, such as \`draft\` or \`live\`. | `, - enum: ['commodity_type', 'status', 'price', 'name_append', 'name_prepend', 'name_equals', 'sku_append', 'sku_prepend', 'sku_equals', 'sku_builder', 'slug_append', 'slug_prepend', 'slug_equals', 'slug_builder', 'description_append', 'description_prepend', 'description_equals', 'custom_inputs_equals', 'build_rules_equals', 'locales_equals', 'upc_ean_equals', 'mpn_equals', 'external_ref_equals'] - }, - value: { - description: 'Required for non-builder modifiers. The value of the modifier type.', - type: 'string' - }, - seek: { - description: 'Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`.', - type: 'string' - }, - set: { - description: 'Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`.', - type: 'string' - }, - reference_name: { - description: 'A name for the modifier.', - type: 'string' - } - } - } - } - } - } -} as const; + enum: [ + "commodity_type", + "status", + "price", + "name_append", + "name_prepend", + "name_equals", + "sku_append", + "sku_prepend", + "sku_equals", + "sku_builder", + "slug_append", + "slug_prepend", + "slug_equals", + "slug_builder", + "description_append", + "description_prepend", + "description_equals", + "custom_inputs_equals", + "build_rules_equals", + "locales_equals", + "upc_ean_equals", + "mpn_equals", + "external_ref_equals", + ], + }, + value: { + description: + "Required for non-builder modifiers. The value of the modifier type.", + type: "string", + }, + seek: { + description: + "Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`.", + type: "string", + }, + set: { + description: + "Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`.", + type: "string", + }, + reference_name: { + description: "A name for the modifier.", + type: "string", + }, + }, + }, + }, + }, + }, +} as const export const $created_modifier = { - type: 'object', - properties: { - data: { - type: 'object', - properties: { - id: { - description: 'A unique identifier for a modifier that is generated automatically when a modifier is created.', - type: 'string' - }, - type: { - description: "This represents the type of resource object being returned. Always `product-variation-modifier'.", - type: 'string', - enum: ['product-variation-modifier'] - }, - attributes: { - type: 'object', - additionalProperties: false, - properties: { - type: { - description: `You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + type: "object", + properties: { + data: { + type: "object", + properties: { + id: { + description: + "A unique identifier for a modifier that is generated automatically when a modifier is created.", + type: "string", + }, + type: { + description: + "This represents the type of resource object being returned. Always `product-variation-modifier'.", + type: "string", + enum: ["product-variation-modifier"], + }, + attributes: { + type: "object", + additionalProperties: false, + properties: { + type: { + description: `You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. | Modifier | Data Type | Effect | | :--- | :--- | :--- | @@ -2125,63 +2315,93 @@ export const $created_modifier = { | \`sku_builder\` | \`string\` | Sets a part of the SKU of the child product. | | \`status\` | \`string\` | Sets the status of the child product, such as \`draft\` or \`live\`. | `, - type: 'string', - enum: ['commodity_type', 'status', 'price', 'name_append', 'name_prepend', 'name_equals', 'sku_append', 'sku_prepend', 'sku_equals', 'sku_builder', 'slug_append', 'slug_prepend', 'slug_equals', 'slug_builder', 'description_append', 'description_prepend', 'description_equals', 'custom_inputs_equals', 'build_rules_equals', 'locales_equals', 'upc_ean_equals', 'mpn_equals', 'external_ref_equals'] - }, - value: { - description: 'Required for non-builder modifiers. The value of the modifier type.', - type: 'string' - }, - seek: { - description: 'Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`.', - type: 'string' - }, - set: { - description: 'Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`.', - type: 'string' - }, - reference_name: { - description: 'The name of the modifier.', - type: 'string' - } - } - }, - meta: { - type: 'object', - properties: { - owner: { - description: 'The owner of the resource, either `organization` or `store`.', - type: 'string', - enum: ['organization', 'store'] - } - } - } - } - } - } -} as const; + type: "string", + enum: [ + "commodity_type", + "status", + "price", + "name_append", + "name_prepend", + "name_equals", + "sku_append", + "sku_prepend", + "sku_equals", + "sku_builder", + "slug_append", + "slug_prepend", + "slug_equals", + "slug_builder", + "description_append", + "description_prepend", + "description_equals", + "custom_inputs_equals", + "build_rules_equals", + "locales_equals", + "upc_ean_equals", + "mpn_equals", + "external_ref_equals", + ], + }, + value: { + description: + "Required for non-builder modifiers. The value of the modifier type.", + type: "string", + }, + seek: { + description: + "Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`.", + type: "string", + }, + set: { + description: + "Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`.", + type: "string", + }, + reference_name: { + description: "The name of the modifier.", + type: "string", + }, + }, + }, + meta: { + type: "object", + properties: { + owner: { + description: + "The owner of the resource, either `organization` or `store`.", + type: "string", + enum: ["organization", "store"], + }, + }, + }, + }, + }, + }, +} as const export const $single_modifier = { - type: 'object', - properties: { - data: { - type: 'object', - properties: { - id: { - description: 'A unique identifier for a modifier that is generated automatically when a modifier is created.', - type: 'string' - }, - type: { - description: "This represents the type of resource object being returned. Always `product-variation-modifier'.", - type: 'string', - enum: ['product-variation-modifier'] - }, - attributes: { - type: 'object', - additionalProperties: false, - properties: { - type: { - description: `You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + type: "object", + properties: { + data: { + type: "object", + properties: { + id: { + description: + "A unique identifier for a modifier that is generated automatically when a modifier is created.", + type: "string", + }, + type: { + description: + "This represents the type of resource object being returned. Always `product-variation-modifier'.", + type: "string", + enum: ["product-variation-modifier"], + }, + attributes: { + type: "object", + additionalProperties: false, + properties: { + type: { + description: `You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. | Modifier | Data Type | Effect | | :--- | :--- | :--- | @@ -2205,62 +2425,91 @@ export const $single_modifier = { | \`sku_builder\` | \`string\` | Sets a part of the SKU of the child product. | | \`status\` | \`string\` | Sets the status of the child product, such as \`draft\` or \`live\`. | `, - type: 'string', - enum: ['commodity_type', 'status', 'price', 'name_append', 'name_prepend', 'name_equals', 'sku_append', 'sku_prepend', 'sku_equals', 'sku_builder', 'slug_append', 'slug_prepend', 'slug_equals', 'slug_builder', 'description_append', 'description_prepend', 'description_equals', 'custom_inputs_equals', 'build_rules_equals', 'locales_equals', 'upc_ean_equals', 'mpn_equals', 'external_ref_equals'] - }, - value: { - description: 'Required for non-builder modifiers. The value of the modifier type.', - type: 'string' - }, - seek: { - description: 'Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`.', - type: 'string' - }, - set: { - description: 'Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`.', - type: 'string' - }, - reference_name: { - description: 'The name of the modifier.', - type: 'string' - } - } - }, - meta: { - type: 'object', - description: 'The owner of the resource, either `organization` or `store`.', - properties: { - owner: { - type: 'string', - enum: ['organization', 'store'] - } - } - } - } - } - } -} as const; + type: "string", + enum: [ + "commodity_type", + "status", + "price", + "name_append", + "name_prepend", + "name_equals", + "sku_append", + "sku_prepend", + "sku_equals", + "sku_builder", + "slug_append", + "slug_prepend", + "slug_equals", + "slug_builder", + "description_append", + "description_prepend", + "description_equals", + "custom_inputs_equals", + "build_rules_equals", + "locales_equals", + "upc_ean_equals", + "mpn_equals", + "external_ref_equals", + ], + }, + value: { + description: + "Required for non-builder modifiers. The value of the modifier type.", + type: "string", + }, + seek: { + description: + "Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`.", + type: "string", + }, + set: { + description: + "Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`.", + type: "string", + }, + reference_name: { + description: "The name of the modifier.", + type: "string", + }, + }, + }, + meta: { + type: "object", + description: + "The owner of the resource, either `organization` or `store`.", + properties: { + owner: { + type: "string", + enum: ["organization", "store"], + }, + }, + }, + }, + }, + }, +} as const export const $update_modifier = { - type: 'object', - required: ['data'], - properties: { - data: { - type: 'object', - required: ['type', 'attributes', 'id'], - properties: { - type: { - description: 'This represents the type of resource object being returned. Always `product-variation-modifier`.', - type: 'string', - enum: ['product-variation-modifier'] - }, - attributes: { - type: 'object', - required: ['type'], - additionalProperties: false, - properties: { - type: { - description: `You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + type: "object", + required: ["data"], + properties: { + data: { + type: "object", + required: ["type", "attributes", "id"], + properties: { + type: { + description: + "This represents the type of resource object being returned. Always `product-variation-modifier`.", + type: "string", + enum: ["product-variation-modifier"], + }, + attributes: { + type: "object", + required: ["type"], + additionalProperties: false, + properties: { + type: { + description: `You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. | Modifier | Data Type | Effect | | :--- | :--- | :--- | @@ -2284,713 +2533,778 @@ export const $update_modifier = { | \`sku_builder\` | \`string\` | Sets a part of the SKU of the child product. | | \`status\` | \`string\` | Sets the status of the child product, such as \`draft\` or \`live\`. | `, - type: 'string', - enum: ['commodity_type', 'status', 'price', 'name_append', 'name_prepend', 'name_equals', 'sku_append', 'sku_prepend', 'sku_equals', 'sku_builder', 'slug_append', 'slug_prepend', 'slug_equals', 'slug_builder', 'description_append', 'description_prepend', 'description_equals', 'custom_inputs_equals', 'build_rules_equals', 'locales_equals', 'upc_ean_equals', 'mpn_equals', 'external_ref_equals'] - }, - value: { - description: 'Required for non-builder modifiers. The value of the modifier type.', - type: 'string' - }, - seek: { - description: 'Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`.', - type: 'string' - }, - set: { - description: 'Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`.', - type: 'string' - }, - reference_name: { - description: 'The name of the modifier.', - type: 'string' - } - } - }, - id: { - type: 'string', - description: 'The unique identifier of the modifier. Must match the modifier ID specified in the request path.', - example: '00000000-0000-0000-0000-000000000000' - } - } - } - } -} as const; - -export const $attributes_hierarchy = { - type: 'object', - properties: { - name: { - description: 'The name of a hierarchy, such as `Major Appliances`.', - type: 'string' - }, - description: { - description: 'A description for a hierarchy.', - type: 'string' - }, - slug: { - description: 'A unique slug for a hierarchy.', - type: 'string' + type: "string", + enum: [ + "commodity_type", + "status", + "price", + "name_append", + "name_prepend", + "name_equals", + "sku_append", + "sku_prepend", + "sku_equals", + "sku_builder", + "slug_append", + "slug_prepend", + "slug_equals", + "slug_builder", + "description_append", + "description_prepend", + "description_equals", + "custom_inputs_equals", + "build_rules_equals", + "locales_equals", + "upc_ean_equals", + "mpn_equals", + "external_ref_equals", + ], + }, + value: { + description: + "Required for non-builder modifiers. The value of the modifier type.", + type: "string", + }, + seek: { + description: + "Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`.", + type: "string", + }, + set: { + description: + "Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`.", + type: "string", + }, + reference_name: { + description: "The name of the modifier.", + type: "string", + }, + }, }, - locales: { - description: 'Product Experience Manager supports localization of hierarchies and nodes. If you store supports multiple languages, you can localize hierarchy and node names and descriptions.', - type: 'object', - additionalProperties: { - description: 'A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used.', - type: 'object', - additionalProperties: false, - properties: { - name: { - description: 'A localized hierarchy or node name.', - type: 'string' - }, - description: { - description: 'A localized hierarchy or node description.', - type: 'string' - } - } - } - } - } -} as const; - -export const $relationships_hierarchy = { - type: 'object', - properties: { - children: { - description: 'The child nodes related to the hierarchy.', - type: 'object', - properties: { - data: { - description: 'An array of child nodes.', - type: 'array', - required: [] - }, - links: { - description: 'Links allow you to move between requests.', - type: 'object', - properties: { - related: { - description: 'A link to a related resource.', - type: 'string' - } - } - } - } - } - } -} as const; - -export const $hierarchy = { - type: 'object', - properties: { id: { - description: 'A unique identifier generated when a hierarchy is created.', - type: 'string' + type: "string", + description: + "The unique identifier of the modifier. Must match the modifier ID specified in the request path.", + example: "00000000-0000-0000-0000-000000000000", }, - type: { - description: 'This represents the type of resource object being returned. Always `hierarchy`.', - type: 'string', - enum: ['hierarchy'] - }, - attributes: { - '$ref': '#/components/schemas/attributes_hierarchy' - }, - relationships: { - '$ref': '#/components/schemas/relationships_hierarchy' - }, - meta: { - type: 'object', - properties: { - created_at: { - description: 'The date and time a hierarchy is created.', - type: 'string', - example: '2020-09-22T09:00:00', - format: 'date-time' - }, - updated_at: { - description: 'The date and time a hierarchy is updated.', - type: 'string', - example: '2020-09-22T09:00:00', - format: 'date-time' - }, - owner: { - description: 'The owner of a resource, either `organization` or `store`.', - type: 'string', - enum: ['store', 'organization'] - } - } - } - } -} as const; + }, + }, + }, +} as const -export const $multi_hierarchy = { - type: 'object', - properties: { +export const $attributes_hierarchy = { + type: "object", + properties: { + name: { + description: "The name of a hierarchy, such as `Major Appliances`.", + type: "string", + }, + description: { + description: "A description for a hierarchy.", + type: "string", + }, + slug: { + description: "A unique slug for a hierarchy.", + type: "string", + }, + locales: { + description: + "Product Experience Manager supports localization of hierarchies and nodes. If you store supports multiple languages, you can localize hierarchy and node names and descriptions.", + type: "object", + additionalProperties: { + description: + "A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used.", + type: "object", + additionalProperties: false, + properties: { + name: { + description: "A localized hierarchy or node name.", + type: "string", + }, + description: { + description: "A localized hierarchy or node description.", + type: "string", + }, + }, + }, + }, + }, +} as const + +export const $relationships_hierarchy = { + type: "object", + properties: { + children: { + description: "The child nodes related to the hierarchy.", + type: "object", + properties: { data: { - type: 'array', - items: { - '$ref': '#/components/schemas/hierarchy' - } + description: "An array of child nodes.", + type: "array", + required: [], }, links: { - '$ref': '#/components/schemas/multi_links' + description: "Links allow you to move between requests.", + type: "object", + properties: { + related: { + description: "A link to a related resource.", + type: "string", + }, + }, }, - meta: { - '$ref': '#/components/schemas/multi_meta' - } - } -} as const; + }, + }, + }, +} as const + +export const $hierarchy = { + type: "object", + properties: { + id: { + description: "A unique identifier generated when a hierarchy is created.", + type: "string", + }, + type: { + description: + "This represents the type of resource object being returned. Always `hierarchy`.", + type: "string", + enum: ["hierarchy"], + }, + attributes: { + $ref: "#/components/schemas/attributes_hierarchy", + }, + relationships: { + $ref: "#/components/schemas/relationships_hierarchy", + }, + meta: { + type: "object", + properties: { + created_at: { + description: "The date and time a hierarchy is created.", + type: "string", + example: "2020-09-22T09:00:00", + format: "date-time", + }, + updated_at: { + description: "The date and time a hierarchy is updated.", + type: "string", + example: "2020-09-22T09:00:00", + format: "date-time", + }, + owner: { + description: + "The owner of a resource, either `organization` or `store`.", + type: "string", + enum: ["store", "organization"], + }, + }, + }, + }, +} as const + +export const $multi_hierarchy = { + type: "object", + properties: { + data: { + type: "array", + items: { + $ref: "#/components/schemas/hierarchy", + }, + }, + links: { + $ref: "#/components/schemas/multi_links", + }, + meta: { + $ref: "#/components/schemas/multi_meta", + }, + }, +} as const export const $req_attributes_hierarchy = { - type: 'object', - additionalProperties: false, - properties: { - name: { - description: 'The name of the hierarchy, such as `Major Appliances`.', - type: 'string' - }, - description: { - description: 'A description of the hierarchy.', - type: 'string' - }, - slug: { - description: 'A unique slug for the hierarchy.', - type: 'string' - }, - locales: { - description: 'Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want.', - type: 'object', - additionalProperties: { - description: 'A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used.', - type: 'object', - additionalProperties: false, - properties: { - name: { - description: 'A localized name for the hierarchy.', - type: 'string' - }, - description: { - description: 'A localized description for the hierarchy.', - type: 'string' - } - } - } - } - } -} as const; + type: "object", + additionalProperties: false, + properties: { + name: { + description: "The name of the hierarchy, such as `Major Appliances`.", + type: "string", + }, + description: { + description: "A description of the hierarchy.", + type: "string", + }, + slug: { + description: "A unique slug for the hierarchy.", + type: "string", + }, + locales: { + description: + "Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want.", + type: "object", + additionalProperties: { + description: + "A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used.", + type: "object", + additionalProperties: false, + properties: { + name: { + description: "A localized name for the hierarchy.", + type: "string", + }, + description: { + description: "A localized description for the hierarchy.", + type: "string", + }, + }, + }, + }, + }, +} as const export const $create_hierarchy = { - type: 'object', - properties: { - data: { - type: 'object', - required: ['type', 'attributes'], - properties: { - type: { - description: 'This represents the type of resource object being returned. Always `hierarchy`.', - type: 'string', - enum: ['hierarchy'] - }, - attributes: { - '$ref': '#/components/schemas/req_attributes_hierarchy' - } - } - } - } -} as const; + type: "object", + properties: { + data: { + type: "object", + required: ["type", "attributes"], + properties: { + type: { + description: + "This represents the type of resource object being returned. Always `hierarchy`.", + type: "string", + enum: ["hierarchy"], + }, + attributes: { + $ref: "#/components/schemas/req_attributes_hierarchy", + }, + }, + }, + }, +} as const export const $single_hierarchy = { - type: 'object', - properties: { - data: { - '$ref': '#/components/schemas/hierarchy' - } - } -} as const; + type: "object", + properties: { + data: { + $ref: "#/components/schemas/hierarchy", + }, + }, +} as const export const $update_hierarchy = { - type: 'object', - required: ['data'], - properties: { - data: { - type: 'object', - required: ['id', 'type', 'attributes'], - properties: { - id: { - type: 'string', - description: 'The unique identifier of the hierarchy. Must match the hierarchy ID specified in the request path.', - example: '00000000-0000-0000-0000-000000000000' - }, - type: { - description: 'This represents the type of resource object being returned. Always `hierarchy`.', - type: 'string', - enum: ['hierarchy'], - example: 'hierarchy' - }, - attributes: { - '$ref': '#/components/schemas/req_attributes_hierarchy' - } - } - } - } -} as const; - -export const $attributes_nodes = { - type: 'object', - additionalProperties: false, - properties: { - name: { - description: 'The name of the node, such as `Ranges` or `Refrigerators`. Names must be unique among sibling nodes in the hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies.', - type: 'string' - }, - description: { - description: 'A description of the node.', - type: 'string' + type: "object", + required: ["data"], + properties: { + data: { + type: "object", + required: ["id", "type", "attributes"], + properties: { + id: { + type: "string", + description: + "The unique identifier of the hierarchy. Must match the hierarchy ID specified in the request path.", + example: "00000000-0000-0000-0000-000000000000", }, - slug: { - description: 'A slug for the node. Slugs must be unique among sibling nodes in the hierarchy. Otherwise, a slug can be non-unique within the hierarchy and across multiple hierarchies.', - type: 'string' + type: { + description: + "This represents the type of resource object being returned. Always `hierarchy`.", + type: "string", + enum: ["hierarchy"], + example: "hierarchy", }, - curated_products: { - description: 'You can curate your products in your nodes product lists. Product curation allows you to promote specific products within each node in a hierarchy, enabling you to create unique product collections in your storefront. See [Curating Products in a node](/docs/api/pxm/products/create-node#curating-products-in-a-node).', - type: 'array', - items: { - description: 'A list of product IDs for the products that you want to curate in a node.', - type: 'string' - } + attributes: { + $ref: "#/components/schemas/req_attributes_hierarchy", }, - locales: { - description: 'Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want.', - type: 'object', - additionalProperties: { - description: 'A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used.', - type: 'object', - additionalProperties: false, - properties: { - name: { - description: 'A localized name for the node.', - type: 'string' - }, - description: { - description: 'A localized description for the node.', - type: 'string' - } - } - } - } - } -} as const; + }, + }, + }, +} as const + +export const $attributes_nodes = { + type: "object", + additionalProperties: false, + properties: { + name: { + description: + "The name of the node, such as `Ranges` or `Refrigerators`. Names must be unique among sibling nodes in the hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies.", + type: "string", + }, + description: { + description: "A description of the node.", + type: "string", + }, + slug: { + description: + "A slug for the node. Slugs must be unique among sibling nodes in the hierarchy. Otherwise, a slug can be non-unique within the hierarchy and across multiple hierarchies.", + type: "string", + }, + curated_products: { + description: + "You can curate your products in your nodes product lists. Product curation allows you to promote specific products within each node in a hierarchy, enabling you to create unique product collections in your storefront. See [Curating Products in a node](/docs/api/pxm/products/create-node#curating-products-in-a-node).", + type: "array", + items: { + description: + "A list of product IDs for the products that you want to curate in a node.", + type: "string", + }, + }, + locales: { + description: + "Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want.", + type: "object", + additionalProperties: { + description: + "A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used.", + type: "object", + additionalProperties: false, + properties: { + name: { + description: "A localized name for the node.", + type: "string", + }, + description: { + description: "A localized description for the node.", + type: "string", + }, + }, + }, + }, + }, +} as const export const $create_node = { - type: 'object', - properties: { - data: { - type: 'object', - required: ['type', 'attributes'], - properties: { - type: { - description: 'This represents the type of resource object being returned. Always `node`.', - type: 'string', - enum: ['node'] - }, - attributes: { - '$ref': '#/components/schemas/attributes_nodes' - }, - meta: { - type: 'object', - additionalProperties: false, - properties: { - sort_order: { - description: `You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. The \`sort_order\` for each node. This value determines the order of nodes in the response for the \`Get a Node’s Children\` request. The node with the highest value of sort_order is displayed first. For example, a node with a sort_order value of 3 appears before a node with a sort_order value of 2. + type: "object", + properties: { + data: { + type: "object", + required: ["type", "attributes"], + properties: { + type: { + description: + "This represents the type of resource object being returned. Always `node`.", + type: "string", + enum: ["node"], + }, + attributes: { + $ref: "#/components/schemas/attributes_nodes", + }, + meta: { + type: "object", + additionalProperties: false, + properties: { + sort_order: { + description: `You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. The \`sort_order\` for each node. This value determines the order of nodes in the response for the \`Get a Node’s Children\` request. The node with the highest value of sort_order is displayed first. For example, a node with a sort_order value of 3 appears before a node with a sort_order value of 2. - If you don’t provide \`sort_order\` when creating nodes, all child nodes in the response for \`Get a Node’s Children\` request are ordered by the \`updated_at\` time in descending order, with the most recently updated child node first. - If you set \`sort_order\` for only a few child nodes or not all, the child nodes with a \`sort_order\` value appear first and then other child nodes appear in the order of \`updated_at\` time. See [Sorting Nodes in a hierarchy](). `, - type: 'integer' - } - } - } - } - } - } -} as const; + type: "integer", + }, + }, + }, + }, + }, + }, +} as const export const $single_node = { - type: 'object', - properties: { - data: { - '$ref': '#/components/schemas/node' - } - } -} as const; + type: "object", + properties: { + data: { + $ref: "#/components/schemas/node", + }, + }, +} as const export const $update_node = { - type: 'object', - properties: { - data: { - type: 'object', - required: ['id', 'type', 'attributes'], - properties: { - id: { - type: 'string', - description: 'The unique identifier of the node. Must match the node ID specified in the request path.', - example: '00000000-0000-0000-0000-000000000000' - }, - type: { - description: 'This represents the type of resource object being returned. Always `node`.', - type: 'string', - enum: ['node'] - }, - attributes: { - '$ref': '#/components/schemas/attributes_nodes' - }, - meta: { - type: 'object', - additionalProperties: false, - properties: { - sort_order: { - description: `You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. The \`sort_order\` for each node. This value determines the order of nodes in the response for the \`Get a Node’s Children\` request. The node with the highest value of sort_order is displayed first. For example, a node with a sort_order value of 3 appears before a node with a sort_order value of 2. + type: "object", + properties: { + data: { + type: "object", + required: ["id", "type", "attributes"], + properties: { + id: { + type: "string", + description: + "The unique identifier of the node. Must match the node ID specified in the request path.", + example: "00000000-0000-0000-0000-000000000000", + }, + type: { + description: + "This represents the type of resource object being returned. Always `node`.", + type: "string", + enum: ["node"], + }, + attributes: { + $ref: "#/components/schemas/attributes_nodes", + }, + meta: { + type: "object", + additionalProperties: false, + properties: { + sort_order: { + description: `You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. The \`sort_order\` for each node. This value determines the order of nodes in the response for the \`Get a Node’s Children\` request. The node with the highest value of sort_order is displayed first. For example, a node with a sort_order value of 3 appears before a node with a sort_order value of 2. - If you don’t provide \`sort_order\` when creating nodes, all child nodes in the response for \`Get a Node’s Children\` request are ordered by the \`updated_at\` time in descending order, with the most recently updated child node first. - If you set \`sort_order\` for only a few child nodes or not all, the child nodes with a \`sort_order\` value appear first and then other child nodes appear in the order of \`updated_at\` time. `, - type: 'integer' - } - } - } - } - } - } -} as const; + type: "integer", + }, + }, + }, + }, + }, + }, +} as const export const $node_children = { - type: 'object', - properties: { - data: { - type: 'array', - items: { - type: 'object', - required: ['id', 'type'], - properties: { - id: { - type: 'string', - description: 'The unique identifier of the child node. Must not match the node ID specified in the request path.', - example: '00000000-0000-0000-0000-000000000000' - }, - type: { - description: 'This represents the type of resource object being returned. Always `node`.', - type: 'string', - enum: ['node'] - } - } - } - } - } -} as const; + type: "object", + properties: { + data: { + type: "array", + items: { + type: "object", + required: ["id", "type"], + properties: { + id: { + type: "string", + description: + "The unique identifier of the child node. Must not match the node ID specified in the request path.", + example: "00000000-0000-0000-0000-000000000000", + }, + type: { + description: + "This represents the type of resource object being returned. Always `node`.", + type: "string", + enum: ["node"], + }, + }, + }, + }, + }, +} as const export const $node_parent = { - type: 'object', - properties: { - data: { - type: 'object', - required: ['id', 'type'], - properties: { - id: { - type: 'string', - description: 'The unique identifier of the new parent node. Must not match the node ID specified in the request path.', - example: '00000000-0000-0000-0000-000000000000' - }, - type: { - description: 'This represents the type of resource object being returned. Always `node`.', - type: 'string', - enum: ['node'] - } - } - } - } -} as const; + type: "object", + properties: { + data: { + type: "object", + required: ["id", "type"], + properties: { + id: { + type: "string", + description: + "The unique identifier of the new parent node. Must not match the node ID specified in the request path.", + example: "00000000-0000-0000-0000-000000000000", + }, + type: { + description: + "This represents the type of resource object being returned. Always `node`.", + type: "string", + enum: ["node"], + }, + }, + }, + }, +} as const export const $node_products = { - type: 'object', - properties: { - data: { - type: 'array', - items: { - type: 'object', - required: ['id', 'type'], - properties: { - id: { - type: 'string', - description: 'The unique identifier of the product to be attached to the node.', - example: '00000000-0000-0000-0000-000000000000' - }, - type: { - description: 'This represents the type of resource object being returned. Always `product`.', - type: 'string', - enum: ['product'] - } - } - } - } - } -} as const; + type: "object", + properties: { + data: { + type: "array", + items: { + type: "object", + required: ["id", "type"], + properties: { + id: { + type: "string", + description: + "The unique identifier of the product to be attached to the node.", + example: "00000000-0000-0000-0000-000000000000", + }, + type: { + description: + "This represents the type of resource object being returned. Always `product`.", + type: "string", + enum: ["product"], + }, + }, + }, + }, + }, +} as const export const $duplicate_job = { - type: 'object', - properties: { - data: { - type: 'object', - properties: { - type: { - description: 'This represents the type of resource object being returned. Always `hierarchy`.', - type: 'string', - enum: ['hierarchy'] - }, - attributes: { - type: 'object', - additionalProperties: false, - properties: { - name: { - description: 'The name of the duplicate hierarchy. The maximum length is 1000 characters.', - type: 'string' - }, - description: { - description: 'A description of the duplicate hierarchy.', - type: 'string' - }, - include_products: { - description: 'Specify `true` if you want the product associations in the existing nodes associated in your duplicated hierarchy. If not, specify `false`.', - type: 'boolean' - } - } - } - } - } - } -} as const; - -export const $tag = { - type: 'object', - properties: { - id: { - description: 'A unique identifier generated when a tag is created.', - type: 'string' - }, + type: "object", + properties: { + data: { + type: "object", + properties: { type: { - description: 'This represents the type of resource object being returned. Always `tag`.', - type: 'string', - enum: ['tag'] + description: + "This represents the type of resource object being returned. Always `hierarchy`.", + type: "string", + enum: ["hierarchy"], }, attributes: { - type: 'object', - properties: { - value: { - type: 'string', - description: 'The text value of the tag.' - } - } + type: "object", + additionalProperties: false, + properties: { + name: { + description: + "The name of the duplicate hierarchy. The maximum length is 1000 characters.", + type: "string", + }, + description: { + description: "A description of the duplicate hierarchy.", + type: "string", + }, + include_products: { + description: + "Specify `true` if you want the product associations in the existing nodes associated in your duplicated hierarchy. If not, specify `false`.", + type: "boolean", + }, + }, }, - meta: { - type: 'object', - properties: { - x_request_id: { - type: 'string', - description: 'A unique request ID is generated when a tag is created.' - }, - created_at: { - type: 'string', - description: 'The date and time a tag is created.', - example: '2020-09-22T09:00:00', - format: 'date-time' - }, - updated_at: { - type: 'string', - description: 'The date and time a tag is updated.', - example: '2020-09-22T09:00:00', - format: 'date-time' - }, - owner: { - description: 'The owner of a resource, either `organization` or `store`.', - type: 'string', - enum: ['store', 'organization'] - } - } - } - } -} as const; + }, + }, + }, +} as const + +export const $tag = { + type: "object", + properties: { + id: { + description: "A unique identifier generated when a tag is created.", + type: "string", + }, + type: { + description: + "This represents the type of resource object being returned. Always `tag`.", + type: "string", + enum: ["tag"], + }, + attributes: { + type: "object", + properties: { + value: { + type: "string", + description: "The text value of the tag.", + }, + }, + }, + meta: { + type: "object", + properties: { + x_request_id: { + type: "string", + description: + "A unique request ID is generated when a tag is created.", + }, + created_at: { + type: "string", + description: "The date and time a tag is created.", + example: "2020-09-22T09:00:00", + format: "date-time", + }, + updated_at: { + type: "string", + description: "The date and time a tag is updated.", + example: "2020-09-22T09:00:00", + format: "date-time", + }, + owner: { + description: + "The owner of a resource, either `organization` or `store`.", + type: "string", + enum: ["store", "organization"], + }, + }, + }, + }, +} as const export const $multi_tag = { - type: 'object', - properties: { - data: { - description: 'An array of tags.', - type: 'array', - items: { - '$ref': '#/components/schemas/tag' - } + type: "object", + properties: { + data: { + description: "An array of tags.", + type: "array", + items: { + $ref: "#/components/schemas/tag", + }, + }, + meta: { + type: "object", + properties: { + results: { + description: "Contains the results for the entire collection.", + type: "object", + properties: { + total: { + description: "Total number of results for the entire collection.", + type: "integer", + example: 2, + }, + }, }, - meta: { - type: 'object', - properties: { - results: { - description: 'Contains the results for the entire collection.', - type: 'object', - properties: { - total: { - description: 'Total number of results for the entire collection.', - type: 'integer', - example: 2 - } - } - } - } - } - } -} as const; + }, + }, + }, +} as const export const $single_tag = { - type: 'object', - properties: { - data: { - '$ref': '#/components/schemas/tag' - } - } -} as const; + type: "object", + properties: { + data: { + $ref: "#/components/schemas/tag", + }, + }, +} as const export const $req_attributes_custom_relationship = { - type: 'object', - additionalProperties: false, - properties: { - name: { - description: 'The name of the custom relationship, such as `Kitchen electrics`.', - type: 'string' - }, - description: { - description: 'A description of the custom relationship.', - type: 'string' - }, - slug: { - description: 'A unique slug for the custom relationship. Must match the slug specified in the request path.', - type: 'string' - } - } -} as const; + type: "object", + additionalProperties: false, + properties: { + name: { + description: + "The name of the custom relationship, such as `Kitchen electrics`.", + type: "string", + }, + description: { + description: "A description of the custom relationship.", + type: "string", + }, + slug: { + description: + "A unique slug for the custom relationship. Must match the slug specified in the request path.", + type: "string", + }, + }, +} as const export const $create_custom_relationship = { - type: 'object', - properties: { - data: { - type: 'object', - required: ['type', 'attributes'], - properties: { - type: { - description: 'This represents the type of resource object being returned. Always `custom-relationship`.', - type: 'string', - enum: ['custom-relationship'] - }, - attributes: { - '$ref': '#/components/schemas/req_attributes_custom_relationship' - } - } - } - } -} as const; - -export const $attributes_custom_relationship = { - type: 'object', - additionalProperties: false, - properties: { - name: { - description: 'The name of the custom relationship, such as `Kitchen electrics`.', - type: 'string' + type: "object", + properties: { + data: { + type: "object", + required: ["type", "attributes"], + properties: { + type: { + description: + "This represents the type of resource object being returned. Always `custom-relationship`.", + type: "string", + enum: ["custom-relationship"], }, - description: { - description: 'A description of the custom relationship.', - type: 'string' + attributes: { + $ref: "#/components/schemas/req_attributes_custom_relationship", }, - slug: { - description: 'A unique slug for the custom relationship.', - type: 'string' - } - } -} as const; + }, + }, + }, +} as const + +export const $attributes_custom_relationship = { + type: "object", + additionalProperties: false, + properties: { + name: { + description: + "The name of the custom relationship, such as `Kitchen electrics`.", + type: "string", + }, + description: { + description: "A description of the custom relationship.", + type: "string", + }, + slug: { + description: "A unique slug for the custom relationship.", + type: "string", + }, + }, +} as const export const $custom_relationship = { - type: 'object', - properties: { + type: "object", + properties: { + id: { + description: + "A unique identifier generated when a custom relationship is created.", + type: "string", + }, + type: { + description: + "This represents the type of resource object being returned. Always `hierarchy`.", + type: "string", + enum: ["custom-relationship"], + }, + attributes: { + $ref: "#/components/schemas/attributes_custom_relationship", + }, + meta: { + type: "object", + properties: { + owner: { + description: "The owner of the resource.", + type: "string", + example: "store", + }, + timestamps: { + type: "object", + properties: { + created_at: { + description: "The date and time the resource is created.", + type: "string", + example: "2024-01-10T20:16:35.343Z", + format: "date-time", + }, + updated_at: { + description: "The date and time the resource is updated.", + type: "string", + example: "2024-01-10T20:16:35.343Z", + format: "date-time", + }, + }, + }, + }, + }, + }, +} as const + +export const $single_custom_relationship = { + type: "object", + properties: { + data: { + $ref: "#/components/schemas/custom_relationship", + }, + }, +} as const + +export const $update_custom_relationship = { + type: "object", + required: ["data"], + properties: { + data: { + type: "object", + required: ["id", "type", "attributes"], + properties: { id: { - description: 'A unique identifier generated when a custom relationship is created.', - type: 'string' + type: "string", + description: "The unique identifier of the custom relationship.", + example: "00000000-0000-0000-0000-000000000000", }, type: { - description: 'This represents the type of resource object being returned. Always `hierarchy`.', - type: 'string', - enum: ['custom-relationship'] + description: + "This represents the type of resource object being returned. Always `custom-relationship`.", + type: "string", + enum: ["custom-relationship"], + example: "custom-relationship", }, attributes: { - '$ref': '#/components/schemas/attributes_custom_relationship' + $ref: "#/components/schemas/req_attributes_custom_relationship", }, - meta: { - type: 'object', - properties: { - owner: { - description: 'The owner of the resource.', - type: 'string', - example: 'store' - }, - timestamps: { - type: 'object', - properties: { - created_at: { - description: 'The date and time the resource is created.', - type: 'string', - example: '2024-01-10T20:16:35.343Z', - format: 'date-time' - }, - updated_at: { - description: 'The date and time the resource is updated.', - type: 'string', - example: '2024-01-10T20:16:35.343Z', - format: 'date-time' - } - } - } - } - } - } -} as const; - -export const $single_custom_relationship = { - type: 'object', - properties: { - data: { - '$ref': '#/components/schemas/custom_relationship' - } - } -} as const; - -export const $update_custom_relationship = { - type: 'object', - required: ['data'], - properties: { - data: { - type: 'object', - required: ['id', 'type', 'attributes'], - properties: { - id: { - type: 'string', - description: 'The unique identifier of the custom relationship.', - example: '00000000-0000-0000-0000-000000000000' - }, - type: { - description: 'This represents the type of resource object being returned. Always `custom-relationship`.', - type: 'string', - enum: ['custom-relationship'], - example: 'custom-relationship' - }, - attributes: { - '$ref': '#/components/schemas/req_attributes_custom_relationship' - } - } - } - } -} as const; \ No newline at end of file + }, + }, + }, +} as const diff --git a/packages/sdks/src/client/services.gen.ts b/packages/sdks/src/client/services.gen.ts index 0a573e2c..1ee6ed81 100644 --- a/packages/sdks/src/client/services.gen.ts +++ b/packages/sdks/src/client/services.gen.ts @@ -1,47 +1,241 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { CancelablePromise } from './core/CancelablePromise'; -import { OpenAPI } from './core/OpenAPI'; -import { request as __request } from './core/request'; -import type { GetAllJobsResponse, GetJobData, GetJobResponse, CancelJobData, CancelJobResponse, GetJobErrorsData, GetJobErrorsResponse, CreateProductData, CreateProductResponse, GetAllProductsData, GetAllProductsResponse, ImportProductsData, ImportProductsResponse, ExportProductsData, ExportProductsResponse, GetProductData, GetProductResponse, UpdateProductData, UpdateProductResponse, DeleteProductData, DeleteProductResponse, AttachNodesData, AttachNodesResponse, DetachNodesData, DetachNodesResponse, GetProductsNodesData, GetProductsNodesResponse, BuildChildProductsData, BuildChildProductsResponse, GetChildProductsData, GetChildProductsResponse, CreateProductTemplateRelationshipData, CreateProductTemplateRelationshipResponse, GetProductTemplateRelationshipsData, GetProductTemplateRelationshipsResponse, DeleteProductTemplateRelationshipData, DeleteProductTemplateRelationshipResponse, GetProductComponentProductsRelationshipsData, GetProductComponentProductsRelationshipsResponse, GetProductFileRelationshipsData, GetProductFileRelationshipsResponse, CreateProductFileRelationshipsData, CreateProductFileRelationshipsResponse, UpdateProductFileRelationshipsData, UpdateProductFileRelationshipsResponse, DeleteProductFileRelationshipsData, DeleteProductFileRelationshipsResponse, CreateProductVariationRelationshipsData, CreateProductVariationRelationshipsResponse, GetProductVariationRelationshipsData, GetProductVariationRelationshipsResponse, UpdateProductVariationRelationshipsData, UpdateProductVariationRelationshipsResponse, DeleteProductVariationRelationshipsData, DeleteProductVariationRelationshipsResponse, CreateProductMainImageRelationshipsData, CreateProductMainImageRelationshipsResponse, GetProductMainImageRelationshipsData, GetProductMainImageRelationshipsResponse, UpdateProductMainImageRelationshipsData, UpdateProductMainImageRelationshipsResponse, DeleteProductMainImageRelationshipsData, DeleteProductMainImageRelationshipsResponse, CreateVariationData, CreateVariationResponse, GetAllVariationsData, GetAllVariationsResponse, GetVariationData, GetVariationResponse, UpdateVariationData, UpdateVariationResponse, DeleteVariationData, DeleteVariationResponse, CreateVariationOptionData, CreateVariationOptionResponse, GetAllVariationOptionsData, GetAllVariationOptionsResponse, GetVariationOptionData, GetVariationOptionResponse, UpdateVariationOptionData, UpdateVariationOptionResponse, DeleteVariationOptionData, DeleteVariationOptionResponse, CreateModifierData, CreateModifierResponse, GetAllModifiersData, GetAllModifiersResponse, GetModifierData, GetModifierResponse, UpdateModifierData, UpdateModifierResponse, DeleteModifierData, DeleteModifierResponse, CreateHierarchyData, CreateHierarchyResponse, GetHierarchyData, GetHierarchyResponse, GetHierarchyChildData, GetHierarchyChildResponse, UpdateHierarchyData, UpdateHierarchyResponse, DeleteHierarchyData, DeleteHierarchyResponse, CreateNodeData, CreateNodeResponse, GetAllNodesInHierarchyData, GetAllNodesInHierarchyResponse, GetHierarchyNodeData, GetHierarchyNodeResponse, UpdateNodeData, UpdateNodeResponse, DeleteNodeData, DeleteNodeResponse, GetAllChildrenData, GetAllChildrenResponse, CreateNodeChildRelationshipsData, CreateNodeChildRelationshipsResponse, GetAllNodeChildrenData, GetAllNodeChildrenResponse, UpdateNodeParentData, UpdateNodeParentResponse, DeleteNodeParentData, DeleteNodeParentResponse, CreateNodeProductRelationshipData, CreateNodeProductRelationshipResponse, DeleteNodeProductRelationshipsData, DeleteNodeProductRelationshipsResponse, GetNodeProductsData, GetNodeProductsResponse, DuplicateHierarchyData, DuplicateHierarchyResponse, GetAllProductTagsResponse, GetProductTagData, GetProductTagResponse, CreateCustomRelationshipData, CreateCustomRelationshipResponse, UpdateCustomRelationshipData, UpdateCustomRelationshipResponse } from './types.gen'; +import { + client, + type Options, + formDataBodySerializer, +} from "@hey-api/client-fetch" +import type { + GetAllJobsError, + GetAllJobsResponse, + GetJobData, + GetJobError, + GetJobResponse, + CancelJobData, + CancelJobError, + CancelJobResponse, + GetJobErrorsData, + GetJobErrorsError, + GetJobErrorsResponse, + CreateProductData, + CreateProductError, + CreateProductResponse, + GetAllProductsData, + GetAllProductsError, + GetAllProductsResponse, + ImportProductsData, + ImportProductsError, + ImportProductsResponse, + ExportProductsData, + ExportProductsError, + ExportProductsResponse, + GetProductData, + GetProductError, + GetProductResponse, + UpdateProductData, + UpdateProductError, + UpdateProductResponse, + DeleteProductData, + DeleteProductError, + DeleteProductResponse, + AttachNodesData, + AttachNodesError, + AttachNodesResponse, + DetachNodesData, + DetachNodesError, + DetachNodesResponse, + GetProductsNodesData, + GetProductsNodesError, + GetProductsNodesResponse, + BuildChildProductsData, + BuildChildProductsError, + BuildChildProductsResponse, + GetChildProductsData, + GetChildProductsError, + GetChildProductsResponse, + CreateProductTemplateRelationshipData, + CreateProductTemplateRelationshipError, + CreateProductTemplateRelationshipResponse, + GetProductTemplateRelationshipsData, + GetProductTemplateRelationshipsError, + GetProductTemplateRelationshipsResponse, + DeleteProductTemplateRelationshipData, + DeleteProductTemplateRelationshipError, + DeleteProductTemplateRelationshipResponse, + GetProductComponentProductsRelationshipsData, + GetProductComponentProductsRelationshipsError, + GetProductComponentProductsRelationshipsResponse, + GetProductFileRelationshipsData, + GetProductFileRelationshipsError, + GetProductFileRelationshipsResponse, + CreateProductFileRelationshipsData, + CreateProductFileRelationshipsError, + CreateProductFileRelationshipsResponse, + UpdateProductFileRelationshipsData, + UpdateProductFileRelationshipsError, + UpdateProductFileRelationshipsResponse, + DeleteProductFileRelationshipsData, + DeleteProductFileRelationshipsError, + DeleteProductFileRelationshipsResponse, + CreateProductVariationRelationshipsData, + CreateProductVariationRelationshipsError, + CreateProductVariationRelationshipsResponse, + GetProductVariationRelationshipsData, + GetProductVariationRelationshipsError, + GetProductVariationRelationshipsResponse, + UpdateProductVariationRelationshipsData, + UpdateProductVariationRelationshipsError, + UpdateProductVariationRelationshipsResponse, + DeleteProductVariationRelationshipsData, + DeleteProductVariationRelationshipsError, + DeleteProductVariationRelationshipsResponse, + CreateProductMainImageRelationshipsData, + CreateProductMainImageRelationshipsError, + CreateProductMainImageRelationshipsResponse, + GetProductMainImageRelationshipsData, + GetProductMainImageRelationshipsError, + GetProductMainImageRelationshipsResponse, + UpdateProductMainImageRelationshipsData, + UpdateProductMainImageRelationshipsError, + UpdateProductMainImageRelationshipsResponse, + DeleteProductMainImageRelationshipsData, + DeleteProductMainImageRelationshipsError, + DeleteProductMainImageRelationshipsResponse, + CreateVariationData, + CreateVariationError, + CreateVariationResponse, + GetAllVariationsData, + GetAllVariationsError, + GetAllVariationsResponse, + GetVariationData, + GetVariationError, + GetVariationResponse, + UpdateVariationData, + UpdateVariationError, + UpdateVariationResponse, + DeleteVariationData, + DeleteVariationError, + DeleteVariationResponse, + CreateVariationOptionData, + CreateVariationOptionError, + CreateVariationOptionResponse, + GetAllVariationOptionsData, + GetAllVariationOptionsError, + GetAllVariationOptionsResponse, + GetVariationOptionData, + GetVariationOptionError, + GetVariationOptionResponse, + UpdateVariationOptionData, + UpdateVariationOptionError, + UpdateVariationOptionResponse, + DeleteVariationOptionData, + DeleteVariationOptionError, + DeleteVariationOptionResponse, + CreateModifierData, + CreateModifierError, + CreateModifierResponse, + GetAllModifiersData, + GetAllModifiersError, + GetAllModifiersResponse, + GetModifierData, + GetModifierError, + GetModifierResponse, + UpdateModifierData, + UpdateModifierError, + UpdateModifierResponse, + DeleteModifierData, + DeleteModifierError, + DeleteModifierResponse, + CreateHierarchyData, + CreateHierarchyError, + CreateHierarchyResponse, + GetHierarchyData, + GetHierarchyError, + GetHierarchyResponse, + GetHierarchyChildData, + GetHierarchyChildError, + GetHierarchyChildResponse, + UpdateHierarchyData, + UpdateHierarchyError, + UpdateHierarchyResponse, + DeleteHierarchyData, + DeleteHierarchyError, + DeleteHierarchyResponse, + CreateNodeData, + CreateNodeError, + CreateNodeResponse, + GetAllNodesInHierarchyData, + GetAllNodesInHierarchyError, + GetAllNodesInHierarchyResponse, + GetHierarchyNodeData, + GetHierarchyNodeError, + GetHierarchyNodeResponse, + UpdateNodeData, + UpdateNodeError, + UpdateNodeResponse, + DeleteNodeData, + DeleteNodeError, + DeleteNodeResponse, + GetAllChildrenData, + GetAllChildrenError, + GetAllChildrenResponse, + CreateNodeChildRelationshipsData, + CreateNodeChildRelationshipsError, + CreateNodeChildRelationshipsResponse, + GetAllNodeChildrenData, + GetAllNodeChildrenError, + GetAllNodeChildrenResponse, + UpdateNodeParentData, + UpdateNodeParentError, + UpdateNodeParentResponse, + DeleteNodeParentData, + DeleteNodeParentError, + DeleteNodeParentResponse, + CreateNodeProductRelationshipData, + CreateNodeProductRelationshipError, + CreateNodeProductRelationshipResponse, + DeleteNodeProductRelationshipsData, + DeleteNodeProductRelationshipsError, + DeleteNodeProductRelationshipsResponse, + GetNodeProductsData, + GetNodeProductsError, + GetNodeProductsResponse, + DuplicateHierarchyData, + DuplicateHierarchyError, + DuplicateHierarchyResponse, + GetAllProductTagsError, + GetAllProductTagsResponse, + GetProductTagData, + GetProductTagError, + GetProductTagResponse, + CreateCustomRelationshipData, + CreateCustomRelationshipError, + CreateCustomRelationshipResponse, + UpdateCustomRelationshipData, + UpdateCustomRelationshipError, + UpdateCustomRelationshipResponse, +} from "./types.gen" /** * Get All Jobs * The jobs endpoints displays the status of a number of endpoints that function as jobs, for example, product import and export, price book import, building child products, and duplicating hierarchies. - * @returns multi Returns all the jobs. - * @throws ApiError */ -export const getAllJobs = (): CancelablePromise => { return __request(OpenAPI, { - method: 'GET', - url: '/pcm/jobs', - errors: { - 400: 'Bad request. The request failed validation.', - 404: 'Bad Request. Not Found.', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; +export const getAllJobs = (options?: Options) => { + return (options?.client ?? client).get({ + ...options, + url: "/pcm/jobs", + }) +} /** * Get a Job - * @param data The data for the request. - * @param data.jobId A unique identifier for the job. - * @returns single Returns a job with the following attributes. - * @throws ApiError - */ -export const getJob = (data: GetJobData): CancelablePromise => { return __request(OpenAPI, { - method: 'GET', - url: '/pcm/jobs/{jobID}', - path: { - jobID: data.jobId - }, - errors: { - 400: 'Bad request. The request failed validation.', - 404: 'Bad Request. Not Found.', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const getJob = (options: Options) => { + return (options?.client ?? client).get({ + ...options, + url: "/pcm/jobs/{jobID}", + }) +} /** * Cancel a Job @@ -49,48 +243,26 @@ export const getJob = (data: GetJobData): CancelablePromise => { * * Jobs are processed one at a time. You can continue to send job requests, but those jobs are queued. In other words, Commerce looks for any jobs that have a status of PENDING and starts the job with the earliest created date. If you decide that a specific job needs to be prioritized over another, you can cancel the less critical job using the `Cancel a job` endpoint. You can only cancel jobs whose status is PENDING. * - * @param data The data for the request. - * @param data.jobId A unique identifier for the job. - * @param data.requestBody - * @returns single Successfully cancelled job - * @throws ApiError - */ -export const cancelJob = (data: CancelJobData): CancelablePromise => { return __request(OpenAPI, { - method: 'POST', - url: '/pcm/jobs/{jobID}/cancel', - path: { - jobID: data.jobId - }, - body: data.requestBody, - mediaType: 'application/json', - errors: { - 400: 'Bad request. The request failed validation.', - 404: 'Bad Request. Not Found.', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const cancelJob = (options: Options) => { + return (options?.client ?? client).post({ + ...options, + url: "/pcm/jobs/{jobID}/cancel", + }) +} /** * Get Job Errors - * @param data The data for the request. - * @param data.jobId A unique identifier for the job. - * @returns errors Successful - * @throws ApiError - */ -export const getJobErrors = (data: GetJobErrorsData): CancelablePromise => { return __request(OpenAPI, { - method: 'GET', - url: '/pcm/jobs/{jobID}/errors', - path: { - jobID: data.jobId - }, - errors: { - 400: 'Bad request. The request failed validation.', - 404: 'Bad Request. Not Found.', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const getJobErrors = (options: Options) => { + return (options?.client ?? client).get< + GetJobErrorsResponse, + GetJobErrorsError + >({ + ...options, + url: "/pcm/jobs/{jobID}/errors", + }) +} /** * Create a product or bundle @@ -131,21 +303,16 @@ export const getJobErrors = (data: GetJobErrorsData): CancelablePromise => { return __request(OpenAPI, { - method: 'POST', - url: '/pcm/products', - body: data.requestBody, - mediaType: 'application/json', - errors: { - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; +export const createProduct = (options: Options) => { + return (options?.client ?? client).post< + CreateProductResponse, + CreateProductError + >({ + ...options, + url: "/pcm/products", + }) +} /** * Get all products @@ -165,36 +332,16 @@ export const createProduct = (data: CreateProductData): CancelablePromise => { return __request(OpenAPI, { - method: 'GET', - url: '/pcm/products', - query: { - 'page[offset]': data.pageOffset, - 'page[limit]': data.pageLimit, - filter: data.filter, - include: data.include - }, - errors: { - 400: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; +export const getAllProducts = (options?: Options) => { + return (options?.client ?? client).get< + GetAllProductsResponse, + GetAllProductsError + >({ + ...options, + url: "/pcm/products", + }) +} /** * Import Products @@ -220,22 +367,17 @@ export const getAllProducts = (data: GetAllProductsData = {}): CancelablePromise * * See [**Characteristics of CSV Files**](/docs/api/pxm/products/product-import-bulk-update#characteristics-of-csv-import-files). * - * @param data The data for the request. - * @param data.formData - * @returns single Import started - * @throws ApiError */ -export const importProducts = (data: ImportProductsData = {}): CancelablePromise => { return __request(OpenAPI, { - method: 'POST', - url: '/pcm/products/import', - formData: data.formData, - mediaType: 'multipart/form-data', - errors: { - 400: 'Bad request. The request failed validation.', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; +export const importProducts = (options?: Options) => { + return (options?.client ?? client).post< + ImportProductsResponse, + ImportProductsError + >({ + ...options, + ...formDataBodySerializer, + url: "/pcm/products/import", + }) +} /** * Export Products @@ -256,32 +398,16 @@ export const importProducts = (data: ImportProductsData = {}): CancelablePromise * | `In` | `sku`, `tags` | Checks if the values are included in the specified string. If they are, the condition is true. When filtering on tags, you can specify a list of product tags. | `filter=in(id,some-id)` | * | `like` | `sku`, `slug`, `upc_ean`, `mpn`, `name`, `description` | Like. Checks if the operand contains the specified string. Wildcards are supported. | `filter=like(name,some-name)` | * - * @param data The data for the request. - * @param data.useTemplateSlugs Set to `true` if you want to use a template slug instead of a template ID when exporting products that have custom data. - * @param data.filter - * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering), but you must go to a specific endpoint to understand the attributes and operators an endpoint supports. - * - * For more information about the attributes and operators that this endpoint supports, see [Export Products](/docs/api/pxm/products/export-products). - * - * @param data.requestBody - * @returns single Export started - * @throws ApiError */ -export const exportProducts = (data: ExportProductsData = {}): CancelablePromise => { return __request(OpenAPI, { - method: 'POST', - url: '/pcm/products/export', - query: { - useTemplateSlugs: data.useTemplateSlugs, - filter: data.filter - }, - body: data.requestBody, - mediaType: 'application/json', - errors: { - 400: 'Bad request. The request failed validation.', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; +export const exportProducts = (options?: Options) => { + return (options?.client ?? client).post< + ExportProductsResponse, + ExportProductsError + >({ + ...options, + url: "/pcm/products/export", + }) +} /** * Get a product @@ -289,58 +415,27 @@ export const exportProducts = (data: ExportProductsData = {}): CancelablePromise * * You can also use `include=component_products` to retrieve top-level resources, such as files or images, and key attribute data, such as SKU or slug for component products in a product bundle. With this option, you can get more information about the products in a product bundle in your store front, improving the buying experience for your shoppers. * - * @param data The data for the request. - * @param data.productId A unique identifier for the product. - * @param data.include Using the include parameter, you can retrieve top-level resources. - * - * - Files or main image. For example, `include=files,main_image`. - * - Component product data. For example, `include=component_products`. - * - Key attribute data, such as SKU or slug. - * - * @returns single_product_response Returns a product by its identifier. - * @throws ApiError */ -export const getProduct = (data: GetProductData): CancelablePromise => { return __request(OpenAPI, { - method: 'GET', - url: '/pcm/products/{productID}', - path: { - productID: data.productId - }, - query: { - include: data.include - }, - errors: { - 400: 'Bad request. The request failed validation.', - 404: 'Bad Request. Not Found.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; +export const getProduct = (options: Options) => { + return (options?.client ?? client).get({ + ...options, + url: "/pcm/products/{productID}", + }) +} /** * Update a product or bundle * Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the product or bundle is not updated. - * @param data The data for the request. - * @param data.productId A unique identifier for the product. - * @param data.requestBody - * @returns single_product_response Updates a product with the following attributes. - * @throws ApiError - */ -export const updateProduct = (data: UpdateProductData): CancelablePromise => { return __request(OpenAPI, { - method: 'PUT', - url: '/pcm/products/{productID}', - path: { - productID: data.productId - }, - body: data.requestBody, - mediaType: 'application/json', - errors: { - 403: 'Forbidden', - 404: 'Bad Request. Not Found.', - 409: 'Write conflict detected', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const updateProduct = (options: Options) => { + return (options?.client ?? client).put< + UpdateProductResponse, + UpdateProductError + >({ + ...options, + url: "/pcm/products/{productID}", + }) +} /** * Delete a product @@ -348,23 +443,16 @@ export const updateProduct = (data: UpdateProductData): CancelablePromise => { return __request(OpenAPI, { - method: 'DELETE', - url: '/pcm/products/{productID}', - path: { - productID: data.productId - }, - errors: { - 403: 'Forbidden', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; +export const deleteProduct = (options: Options) => { + return (options?.client ?? client).delete< + DeleteProductResponse, + DeleteProductError + >({ + ...options, + url: "/pcm/products/{productID}", + }) +} /** * Attach multiple nodes @@ -379,22 +467,16 @@ export const deleteProduct = (data: DeleteProductData): CancelablePromise => { return __request(OpenAPI, { - method: 'POST', - url: '/pcm/products/attach_nodes', - body: data.requestBody, - mediaType: 'application/json', - errors: { - 400: 'Bad request. The request failed validation.', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; +export const attachNodes = (options: Options) => { + return (options?.client ?? client).post< + AttachNodesResponse, + AttachNodesError + >({ + ...options, + url: "/pcm/products/attach_nodes", + }) +} /** * Detach multiple nodes @@ -408,49 +490,30 @@ export const attachNodes = (data: AttachNodesData): CancelablePromise => { return __request(OpenAPI, { - method: 'POST', - url: '/pcm/products/detach_nodes', - body: data.requestBody, - mediaType: 'application/json', - errors: { - 400: 'Bad request. The request failed validation.', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; +export const detachNodes = (options: Options) => { + return (options?.client ?? client).post< + DetachNodesResponse, + DetachNodesError + >({ + ...options, + url: "/pcm/products/detach_nodes", + }) +} /** * Get a product's nodes * Returns the nodes associated with the product. Products must be in a `live` status. - * @param data The data for the request. - * @param data.productId A unique identifier for the product. - * @param data.pageOffset The number of records to offset the results by. - * @param data.pageLimit The number of records per page. The maximum limit is 100. - * @returns multi_nodes Successfully returns the product's nodes. - * @throws ApiError - */ -export const getProductsNodes = (data: GetProductsNodesData): CancelablePromise => { return __request(OpenAPI, { - method: 'GET', - url: '/pcm/products/{productID}/nodes', - path: { - productID: data.productId - }, - query: { - 'page[offset]': data.pageOffset, - 'page[limit]': data.pageLimit - }, - errors: { - 400: 'Bad request. The request failed validation.', - 404: 'Bad Request. Not Found.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const getProductsNodes = (options: Options) => { + return (options?.client ?? client).get< + GetProductsNodesResponse, + GetProductsNodesError + >({ + ...options, + url: "/pcm/products/{productID}/nodes", + }) +} /** * Build child products @@ -503,908 +566,552 @@ export const getProductsNodes = (data: GetProductsNodesData): CancelablePromise< * * However, re-building child products after adding or removing an option does not change the existing product IDs. * - * @param data The data for the request. - * @param data.productId A unique identifier for the product. - * @param data.requestBody - * @returns unknown Successfully started building child products - * @throws ApiError - */ -export const buildChildProducts = (data: BuildChildProductsData): CancelablePromise => { return __request(OpenAPI, { - method: 'POST', - url: '/pcm/products/{productID}/build', - path: { - productID: data.productId - }, - body: data.requestBody, - mediaType: 'application/json', - errors: { - 403: 'Forbidden', - 404: 'Bad Request. Not Found.', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const buildChildProducts = ( + options: Options, +) => { + return (options?.client ?? client).post< + BuildChildProductsResponse, + BuildChildProductsError + >({ + ...options, + url: "/pcm/products/{productID}/build", + }) +} /** * Get child products - * @param data The data for the request. - * @param data.productId A unique identifier for the product. - * @returns multi_product_response Returns a list of child products for the specified parent product ID. - * @throws ApiError - */ -export const getChildProducts = (data: GetChildProductsData): CancelablePromise => { return __request(OpenAPI, { - method: 'GET', - url: '/pcm/products/{productID}/children', - path: { - productID: data.productId - }, - errors: { - 400: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const getChildProducts = (options: Options) => { + return (options?.client ?? client).get< + GetChildProductsResponse, + GetChildProductsError + >({ + ...options, + url: "/pcm/products/{productID}/children", + }) +} /** * Create a product template relationship * Retrieves all the templates that are associated with the specified product. - * @param data The data for the request. - * @param data.productId A unique identifier for the product. - * @param data.requestBody - * @returns template_response Returns a created product template relationship. - * @throws ApiError - */ -export const createProductTemplateRelationship = (data: CreateProductTemplateRelationshipData): CancelablePromise => { return __request(OpenAPI, { - method: 'POST', - url: '/pcm/products/{productID}/relationships/templates', - path: { - productID: data.productId - }, - body: data.requestBody, - mediaType: 'application/json', - errors: { - 400: 'Bad request. The request failed validation.', - 403: 'Forbidden', - 404: 'Bad Request. Not Found.', - 409: 'Write conflict detected', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const createProductTemplateRelationship = ( + options: Options, +) => { + return (options?.client ?? client).post< + CreateProductTemplateRelationshipResponse, + CreateProductTemplateRelationshipError + >({ + ...options, + url: "/pcm/products/{productID}/relationships/templates", + }) +} /** * Get all product template relationships - * @param data The data for the request. - * @param data.productId A unique identifier for the product. - * @returns template_response Returns all product template relationships - * @throws ApiError - */ -export const getProductTemplateRelationships = (data: GetProductTemplateRelationshipsData): CancelablePromise => { return __request(OpenAPI, { - method: 'GET', - url: '/pcm/products/{productID}/relationships/templates', - path: { - productID: data.productId - }, - errors: { - 400: 'Bad request. The request failed validation.', - 403: 'Forbidden', - 404: 'Bad Request. Not Found.', - 409: 'Write conflict detected', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const getProductTemplateRelationships = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetProductTemplateRelationshipsResponse, + GetProductTemplateRelationshipsError + >({ + ...options, + url: "/pcm/products/{productID}/relationships/templates", + }) +} /** * Delete a product template relationship - * @param data The data for the request. - * @param data.productId A unique identifier for the product. - * @param data.requestBody - * @returns void No Content - * @throws ApiError - */ -export const deleteProductTemplateRelationship = (data: DeleteProductTemplateRelationshipData): CancelablePromise => { return __request(OpenAPI, { - method: 'DELETE', - url: '/pcm/products/{productID}/relationships/templates', - path: { - productID: data.productId - }, - body: data.requestBody, - mediaType: 'application/json', - errors: { - 400: 'Bad request. The request failed validation.', - 403: 'Forbidden', - 404: 'Bad Request. Not Found.', - 409: 'Write conflict detected', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const deleteProductTemplateRelationship = ( + options: Options, +) => { + return (options?.client ?? client).delete< + DeleteProductTemplateRelationshipResponse, + DeleteProductTemplateRelationshipError + >({ + ...options, + url: "/pcm/products/{productID}/relationships/templates", + }) +} /** * Get Bundle Component Product Relationships * Retrieves all the products included in the specified bundle product. - * @param data The data for the request. - * @param data.productId A unique identifier for the product. - * @returns component_products_response Returns all Component Products relationships - * @throws ApiError - */ -export const getProductComponentProductsRelationships = (data: GetProductComponentProductsRelationshipsData): CancelablePromise => { return __request(OpenAPI, { - method: 'GET', - url: '/pcm/products/{productID}/relationships/component_products', - path: { - productID: data.productId - }, - errors: { - 400: 'Bad request. The request failed validation.', - 403: 'Forbidden', - 404: 'Bad Request. Not Found.', - 409: 'Write conflict detected', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const getProductComponentProductsRelationships = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetProductComponentProductsRelationshipsResponse, + GetProductComponentProductsRelationshipsError + >({ + ...options, + url: "/pcm/products/{productID}/relationships/component_products", + }) +} /** * Get all product file relationships * Retrieves all files that are associated with the specified product. - * @param data The data for the request. - * @param data.productId A unique identifier for the product. - * @returns file_response Returns all product file relationships. - * @throws ApiError - */ -export const getProductFileRelationships = (data: GetProductFileRelationshipsData): CancelablePromise => { return __request(OpenAPI, { - method: 'GET', - url: '/pcm/products/{productID}/relationships/files', - path: { - productID: data.productId - }, - errors: { - 400: 'Bad request. The request failed validation.', - 403: 'Forbidden', - 404: 'Bad Request. Not Found.', - 409: 'Write conflict detected', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const getProductFileRelationships = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetProductFileRelationshipsResponse, + GetProductFileRelationshipsError + >({ + ...options, + url: "/pcm/products/{productID}/relationships/files", + }) +} /** * Create a product file relationship - * @param data The data for the request. - * @param data.productId A unique identifier for the product. - * @param data.requestBody - * @returns void No Content - * @throws ApiError - */ -export const createProductFileRelationships = (data: CreateProductFileRelationshipsData): CancelablePromise => { return __request(OpenAPI, { - method: 'POST', - url: '/pcm/products/{productID}/relationships/files', - path: { - productID: data.productId - }, - body: data.requestBody, - mediaType: 'application/json', - errors: { - 400: 'Bad request. The request failed validation.', - 403: 'Forbidden', - 404: 'Bad Request. Not Found.', - 409: 'Write conflict detected', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const createProductFileRelationships = ( + options: Options, +) => { + return (options?.client ?? client).post< + CreateProductFileRelationshipsResponse, + CreateProductFileRelationshipsError + >({ + ...options, + url: "/pcm/products/{productID}/relationships/files", + }) +} /** * Replace a product file relationship - * @param data The data for the request. - * @param data.productId A unique identifier for the product. - * @param data.requestBody - * @returns void No Content - * @throws ApiError - */ -export const updateProductFileRelationships = (data: UpdateProductFileRelationshipsData): CancelablePromise => { return __request(OpenAPI, { - method: 'PUT', - url: '/pcm/products/{productID}/relationships/files', - path: { - productID: data.productId - }, - body: data.requestBody, - mediaType: 'application/json', - errors: { - 400: 'Bad request. The request failed validation.', - 403: 'Forbidden', - 404: 'Bad Request. Not Found.', - 409: 'Write conflict detected', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const updateProductFileRelationships = ( + options: Options, +) => { + return (options?.client ?? client).put< + UpdateProductFileRelationshipsResponse, + UpdateProductFileRelationshipsError + >({ + ...options, + url: "/pcm/products/{productID}/relationships/files", + }) +} /** * Delete a product file relationships - * @param data The data for the request. - * @param data.productId A unique identifier for the product. - * @param data.requestBody - * @returns void No Content - * @throws ApiError - */ -export const deleteProductFileRelationships = (data: DeleteProductFileRelationshipsData): CancelablePromise => { return __request(OpenAPI, { - method: 'DELETE', - url: '/pcm/products/{productID}/relationships/files', - path: { - productID: data.productId - }, - body: data.requestBody, - mediaType: 'application/json', - errors: { - 400: 'Bad request. The request failed validation.', - 403: 'Forbidden', - 404: 'Bad Request. Not Found.', - 409: 'Write conflict detected', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const deleteProductFileRelationships = ( + options: Options, +) => { + return (options?.client ?? client).delete< + DeleteProductFileRelationshipsResponse, + DeleteProductFileRelationshipsError + >({ + ...options, + url: "/pcm/products/{productID}/relationships/files", + }) +} /** * Create a product variation relationship - * @param data The data for the request. - * @param data.productId A unique identifier for the product. - * @param data.requestBody - * @returns void No Content - * @throws ApiError - */ -export const createProductVariationRelationships = (data: CreateProductVariationRelationshipsData): CancelablePromise => { return __request(OpenAPI, { - method: 'POST', - url: '/pcm/products/{productID}/relationships/variations', - path: { - productID: data.productId - }, - body: data.requestBody, - mediaType: 'application/json', - errors: { - 400: 'Bad request. The request failed validation.', - 403: 'Forbidden', - 404: 'Bad Request. Not Found.', - 409: 'Write conflict detected', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const createProductVariationRelationships = ( + options: Options, +) => { + return (options?.client ?? client).post< + CreateProductVariationRelationshipsResponse, + CreateProductVariationRelationshipsError + >({ + ...options, + url: "/pcm/products/{productID}/relationships/variations", + }) +} /** * Get all product variation relationships - * @param data The data for the request. - * @param data.productId A unique identifier for the product. - * @returns variations_response Returns all product variation relationships - * @throws ApiError - */ -export const getProductVariationRelationships = (data: GetProductVariationRelationshipsData): CancelablePromise => { return __request(OpenAPI, { - method: 'GET', - url: '/pcm/products/{productID}/relationships/variations', - path: { - productID: data.productId - }, - errors: { - 400: 'Bad request. The request failed validation.', - 403: 'Forbidden', - 404: 'Bad Request. Not Found.', - 409: 'Write conflict detected', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const getProductVariationRelationships = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetProductVariationRelationshipsResponse, + GetProductVariationRelationshipsError + >({ + ...options, + url: "/pcm/products/{productID}/relationships/variations", + }) +} /** * Replace a product variation relationship - * @param data The data for the request. - * @param data.productId A unique identifier for the product. - * @param data.requestBody - * @returns void No Content - * @throws ApiError - */ -export const updateProductVariationRelationships = (data: UpdateProductVariationRelationshipsData): CancelablePromise => { return __request(OpenAPI, { - method: 'PUT', - url: '/pcm/products/{productID}/relationships/variations', - path: { - productID: data.productId - }, - body: data.requestBody, - mediaType: 'application/json', - errors: { - 400: 'Bad request. The request failed validation.', - 403: 'Forbidden', - 404: 'Bad Request. Not Found.', - 409: 'Write conflict detected', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const updateProductVariationRelationships = ( + options: Options, +) => { + return (options?.client ?? client).put< + UpdateProductVariationRelationshipsResponse, + UpdateProductVariationRelationshipsError + >({ + ...options, + url: "/pcm/products/{productID}/relationships/variations", + }) +} /** * Delete a product variation relationships - * @param data The data for the request. - * @param data.productId A unique identifier for the product. - * @param data.requestBody - * @returns void No Content - * @throws ApiError - */ -export const deleteProductVariationRelationships = (data: DeleteProductVariationRelationshipsData): CancelablePromise => { return __request(OpenAPI, { - method: 'DELETE', - url: '/pcm/products/{productID}/relationships/variations', - path: { - productID: data.productId - }, - body: data.requestBody, - mediaType: 'application/json', - errors: { - 400: 'Bad request. The request failed validation.', - 403: 'Forbidden', - 404: 'Bad Request. Not Found.', - 409: 'Write conflict detected', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const deleteProductVariationRelationships = ( + options: Options, +) => { + return (options?.client ?? client).delete< + DeleteProductVariationRelationshipsResponse, + DeleteProductVariationRelationshipsError + >({ + ...options, + url: "/pcm/products/{productID}/relationships/variations", + }) +} /** * Create main image relationships * Associates a main image with the specified product. - * @param data The data for the request. - * @param data.productId A unique identifier for the product. - * @param data.requestBody - * @returns void No Content - * @throws ApiError - */ -export const createProductMainImageRelationships = (data: CreateProductMainImageRelationshipsData): CancelablePromise => { return __request(OpenAPI, { - method: 'POST', - url: '/pcm/products/{productID}/relationships/main_image', - path: { - productID: data.productId - }, - body: data.requestBody, - mediaType: 'application/json', - errors: { - 400: 'Bad request. The request failed validation.', - 403: 'Forbidden', - 404: 'Bad Request. Not Found.', - 409: 'Write conflict detected', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const createProductMainImageRelationships = ( + options: Options, +) => { + return (options?.client ?? client).post< + CreateProductMainImageRelationshipsResponse, + CreateProductMainImageRelationshipsError + >({ + ...options, + url: "/pcm/products/{productID}/relationships/main_image", + }) +} /** * Get Main Image Relationships - * @param data The data for the request. - * @param data.productId A unique identifier for the product. - * @returns main_image_response Returns all product variation relationships - * @throws ApiError - */ -export const getProductMainImageRelationships = (data: GetProductMainImageRelationshipsData): CancelablePromise => { return __request(OpenAPI, { - method: 'GET', - url: '/pcm/products/{productID}/relationships/main_image', - path: { - productID: data.productId - }, - errors: { - 400: 'Bad request. The request failed validation.', - 403: 'Forbidden', - 404: 'Bad Request. Not Found.', - 409: 'Write conflict detected', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const getProductMainImageRelationships = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetProductMainImageRelationshipsResponse, + GetProductMainImageRelationshipsError + >({ + ...options, + url: "/pcm/products/{productID}/relationships/main_image", + }) +} /** * Replace Main Image Relationships - * @param data The data for the request. - * @param data.productId A unique identifier for the product. - * @param data.requestBody - * @returns void No Content - * @throws ApiError - */ -export const updateProductMainImageRelationships = (data: UpdateProductMainImageRelationshipsData): CancelablePromise => { return __request(OpenAPI, { - method: 'PUT', - url: '/pcm/products/{productID}/relationships/main_image', - path: { - productID: data.productId - }, - body: data.requestBody, - mediaType: 'application/json', - errors: { - 400: 'Bad request. The request failed validation.', - 403: 'Forbidden', - 404: 'Bad Request. Not Found.', - 409: 'Write conflict detected', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const updateProductMainImageRelationships = ( + options: Options, +) => { + return (options?.client ?? client).put< + UpdateProductMainImageRelationshipsResponse, + UpdateProductMainImageRelationshipsError + >({ + ...options, + url: "/pcm/products/{productID}/relationships/main_image", + }) +} /** * Delete Main Image Relationships - * @param data The data for the request. - * @param data.productId A unique identifier for the product. - * @returns void No Content - * @throws ApiError - */ -export const deleteProductMainImageRelationships = (data: DeleteProductMainImageRelationshipsData): CancelablePromise => { return __request(OpenAPI, { - method: 'DELETE', - url: '/pcm/products/{productID}/relationships/main_image', - path: { - productID: data.productId - }, - errors: { - 400: 'Bad request. The request failed validation.', - 403: 'Forbidden', - 404: 'Bad Request. Not Found.', - 409: 'Write conflict detected', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const deleteProductMainImageRelationships = ( + options: Options, +) => { + return (options?.client ?? client).delete< + DeleteProductMainImageRelationshipsResponse, + DeleteProductMainImageRelationshipsError + >({ + ...options, + url: "/pcm/products/{productID}/relationships/main_image", + }) +} /** * Create a variation - * @param data The data for the request. - * @param data.requestBody - * @returns created_variation Returns a created variation with the following attributes. - * @throws ApiError - */ -export const createVariation = (data: CreateVariationData): CancelablePromise => { return __request(OpenAPI, { - method: 'POST', - url: '/pcm/variations', - body: data.requestBody, - mediaType: 'application/json', - errors: { - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const createVariation = (options: Options) => { + return (options?.client ?? client).post< + CreateVariationResponse, + CreateVariationError + >({ + ...options, + url: "/pcm/variations", + }) +} /** * Get all variations - * @param data The data for the request. - * @param data.pageOffset The number of records to offset the results by. - * @param data.pageLimit The number of records per page. The maximum limit is 100. - * @returns multi_variations Returns all variations. - * @throws ApiError - */ -export const getAllVariations = (data: GetAllVariationsData = {}): CancelablePromise => { return __request(OpenAPI, { - method: 'GET', - url: '/pcm/variations', - query: { - 'page[offset]': data.pageOffset, - 'page[limit]': data.pageLimit - }, - errors: { - 400: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const getAllVariations = (options?: Options) => { + return (options?.client ?? client).get< + GetAllVariationsResponse, + GetAllVariationsError + >({ + ...options, + url: "/pcm/variations", + }) +} /** * Get a variation - * @param data The data for the request. - * @param data.variationId A unique identifier for the variation. - * @returns single_variation Returns the specified variation. - * @throws ApiError - */ -export const getVariation = (data: GetVariationData): CancelablePromise => { return __request(OpenAPI, { - method: 'GET', - url: '/pcm/variations/{variationID}', - path: { - variationID: data.variationId - }, - errors: { - 400: 'Bad request. The request failed validation.', - 404: 'Bad Request. Not Found.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const getVariation = (options: Options) => { + return (options?.client ?? client).get< + GetVariationResponse, + GetVariationError + >({ + ...options, + url: "/pcm/variations/{variationID}", + }) +} /** * Update a variation * Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the variation is not updated. - * @param data The data for the request. - * @param data.variationId A unique identifier for the variation. - * @param data.requestBody - * @returns single_variation Returns an updated variation with the following attributes. - * @throws ApiError - */ -export const updateVariation = (data: UpdateVariationData): CancelablePromise => { return __request(OpenAPI, { - method: 'PUT', - url: '/pcm/variations/{variationID}', - path: { - variationID: data.variationId - }, - body: data.requestBody, - mediaType: 'application/json', - errors: { - 403: 'Forbidden', - 404: 'Bad Request. Not Found.', - 409: 'Write conflict detected', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const updateVariation = (options: Options) => { + return (options?.client ?? client).put< + UpdateVariationResponse, + UpdateVariationError + >({ + ...options, + url: "/pcm/variations/{variationID}", + }) +} /** * Delete a variation and all it's associated options - * @param data The data for the request. - * @param data.variationId A unique identifier for the variation. - * @returns void No Content - * @throws ApiError - */ -export const deleteVariation = (data: DeleteVariationData): CancelablePromise => { return __request(OpenAPI, { - method: 'DELETE', - url: '/pcm/variations/{variationID}', - path: { - variationID: data.variationId - }, - errors: { - 403: 'Forbidden', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const deleteVariation = (options: Options) => { + return (options?.client ?? client).delete< + DeleteVariationResponse, + DeleteVariationError + >({ + ...options, + url: "/pcm/variations/{variationID}", + }) +} /** * Create a variation option - * @param data The data for the request. - * @param data.variationId A unique identifier for the variation. - * @param data.requestBody - * @returns created_option Successfully returns the created variation option - * @throws ApiError - */ -export const createVariationOption = (data: CreateVariationOptionData): CancelablePromise => { return __request(OpenAPI, { - method: 'POST', - url: '/pcm/variations/{variationID}/options', - path: { - variationID: data.variationId - }, - body: data.requestBody, - mediaType: 'application/json', - errors: { - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const createVariationOption = ( + options: Options, +) => { + return (options?.client ?? client).post< + CreateVariationOptionResponse, + CreateVariationOptionError + >({ + ...options, + url: "/pcm/variations/{variationID}/options", + }) +} /** * Get all variation options - * @param data The data for the request. - * @param data.variationId A unique identifier for the variation. - * @param data.pageOffset The number of records to offset the results by. - * @param data.pageLimit The number of records per page. The maximum limit is 100. - * @returns multi_options Successfully returns all variation options - * @throws ApiError - */ -export const getAllVariationOptions = (data: GetAllVariationOptionsData): CancelablePromise => { return __request(OpenAPI, { - method: 'GET', - url: '/pcm/variations/{variationID}/options', - path: { - variationID: data.variationId - }, - query: { - 'page[offset]': data.pageOffset, - 'page[limit]': data.pageLimit - }, - errors: { - 400: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const getAllVariationOptions = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetAllVariationOptionsResponse, + GetAllVariationOptionsError + >({ + ...options, + url: "/pcm/variations/{variationID}/options", + }) +} /** * Get a variation option - * @param data The data for the request. - * @param data.variationId A unique identifier for the variation. - * @param data.optionId A unique identifier for the option. - * @returns single_option Successfully returns the variation option - * @throws ApiError - */ -export const getVariationOption = (data: GetVariationOptionData): CancelablePromise => { return __request(OpenAPI, { - method: 'GET', - url: '/pcm/variations/{variationID}/options/{optionID}', - path: { - variationID: data.variationId, - optionID: data.optionId - }, - errors: { - 400: 'Bad request. The request failed validation.', - 404: 'Bad Request. Not Found.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const getVariationOption = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetVariationOptionResponse, + GetVariationOptionError + >({ + ...options, + url: "/pcm/variations/{variationID}/options/{optionID}", + }) +} /** * Update a variation option - * @param data The data for the request. - * @param data.variationId A unique identifier for the variation. - * @param data.optionId A unique identifier for the option. - * @param data.requestBody - * @returns single_option Successfully returns the updated variation option - * @throws ApiError - */ -export const updateVariationOption = (data: UpdateVariationOptionData): CancelablePromise => { return __request(OpenAPI, { - method: 'PUT', - url: '/pcm/variations/{variationID}/options/{optionID}', - path: { - variationID: data.variationId, - optionID: data.optionId - }, - body: data.requestBody, - mediaType: 'application/json', - errors: { - 403: 'Forbidden', - 404: 'Bad Request. Not Found.', - 409: 'Write conflict detected', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const updateVariationOption = ( + options: Options, +) => { + return (options?.client ?? client).put< + UpdateVariationOptionResponse, + UpdateVariationOptionError + >({ + ...options, + url: "/pcm/variations/{variationID}/options/{optionID}", + }) +} /** * Delete a variation option - * @param data The data for the request. - * @param data.variationId A unique identifier for the variation. - * @param data.optionId A unique identifier for the option. - * @returns void No Content - * @throws ApiError - */ -export const deleteVariationOption = (data: DeleteVariationOptionData): CancelablePromise => { return __request(OpenAPI, { - method: 'DELETE', - url: '/pcm/variations/{variationID}/options/{optionID}', - path: { - variationID: data.variationId, - optionID: data.optionId - }, - errors: { - 403: 'Forbidden', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const deleteVariationOption = ( + options: Options, +) => { + return (options?.client ?? client).delete< + DeleteVariationOptionResponse, + DeleteVariationOptionError + >({ + ...options, + url: "/pcm/variations/{variationID}/options/{optionID}", + }) +} /** * Create a modifier - * @param data The data for the request. - * @param data.variationId A unique identifier for the variation. - * @param data.optionId A unique identifier for the option. - * @param data.requestBody - * @returns created_modifier Successfully returns the created modifier - * @throws ApiError - */ -export const createModifier = (data: CreateModifierData): CancelablePromise => { return __request(OpenAPI, { - method: 'POST', - url: '/pcm/variations/{variationID}/options/{optionID}/modifiers', - path: { - variationID: data.variationId, - optionID: data.optionId - }, - body: data.requestBody, - mediaType: 'application/json', - errors: { - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const createModifier = (options: Options) => { + return (options?.client ?? client).post< + CreateModifierResponse, + CreateModifierError + >({ + ...options, + url: "/pcm/variations/{variationID}/options/{optionID}/modifiers", + }) +} /** * Get all modifiers - * @param data The data for the request. - * @param data.variationId A unique identifier for the variation. - * @param data.optionId A unique identifier for the option. - * @param data.pageOffset The number of records to offset the results by. - * @param data.pageLimit The number of records per page. The maximum limit is 100. - * @returns multi_modifiers Successfully returns all variation modifiers - * @throws ApiError - */ -export const getAllModifiers = (data: GetAllModifiersData): CancelablePromise => { return __request(OpenAPI, { - method: 'GET', - url: '/pcm/variations/{variationID}/options/{optionID}/modifiers', - path: { - variationID: data.variationId, - optionID: data.optionId - }, - query: { - 'page[offset]': data.pageOffset, - 'page[limit]': data.pageLimit - }, - errors: { - 400: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const getAllModifiers = (options: Options) => { + return (options?.client ?? client).get< + GetAllModifiersResponse, + GetAllModifiersError + >({ + ...options, + url: "/pcm/variations/{variationID}/options/{optionID}/modifiers", + }) +} /** * Get a modifier - * @param data The data for the request. - * @param data.variationId A unique identifier for the variation. - * @param data.optionId A unique identifier for the option. - * @param data.modifierId A unique identifier for the modifier. - * @returns single_modifier Returns the specified modifier. - * @throws ApiError - */ -export const getModifier = (data: GetModifierData): CancelablePromise => { return __request(OpenAPI, { - method: 'GET', - url: '/pcm/variations/{variationID}/options/{optionID}/modifiers/{modifierID}', - path: { - variationID: data.variationId, - optionID: data.optionId, - modifierID: data.modifierId + */ +export const getModifier = (options: Options) => { + return (options?.client ?? client).get( + { + ...options, + url: "/pcm/variations/{variationID}/options/{optionID}/modifiers/{modifierID}", }, - errors: { - 400: 'Bad request. The request failed validation.', - 404: 'Bad Request. Not Found.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + ) +} /** * Update a modifier * Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the modifier is not updated. - * @param data The data for the request. - * @param data.variationId A unique identifier for the variation. - * @param data.optionId A unique identifier for the option. - * @param data.modifierId A unique identifier for the modifier. - * @param data.requestBody - * @returns single_modifier Successfully returns the updated modifier - * @throws ApiError - */ -export const updateModifier = (data: UpdateModifierData): CancelablePromise => { return __request(OpenAPI, { - method: 'PUT', - url: '/pcm/variations/{variationID}/options/{optionID}/modifiers/{modifierID}', - path: { - variationID: data.variationId, - optionID: data.optionId, - modifierID: data.modifierId - }, - body: data.requestBody, - mediaType: 'application/json', - errors: { - 403: 'Forbidden', - 404: 'Bad Request. Not Found.', - 409: 'Write conflict detected', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const updateModifier = (options: Options) => { + return (options?.client ?? client).put< + UpdateModifierResponse, + UpdateModifierError + >({ + ...options, + url: "/pcm/variations/{variationID}/options/{optionID}/modifiers/{modifierID}", + }) +} /** * Delete a modifier * You cannot delete a modifier if it is in use. Deleting a modifier in us returns a `422 Failed Validation` error. - * @param data The data for the request. - * @param data.variationId A unique identifier for the variation. - * @param data.optionId A unique identifier for the option. - * @param data.modifierId A unique identifier for the modifier. - * @returns void No Content - * @throws ApiError - */ -export const deleteModifier = (data: DeleteModifierData): CancelablePromise => { return __request(OpenAPI, { - method: 'DELETE', - url: '/pcm/variations/{variationID}/options/{optionID}/modifiers/{modifierID}', - path: { - variationID: data.variationId, - optionID: data.optionId, - modifierID: data.modifierId - }, - errors: { - 403: 'Forbidden', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const deleteModifier = (options: Options) => { + return (options?.client ?? client).delete< + DeleteModifierResponse, + DeleteModifierError + >({ + ...options, + url: "/pcm/variations/{variationID}/options/{optionID}/modifiers/{modifierID}", + }) +} /** * Create a hierarchy * Create a hierarchy - * @param data The data for the request. - * @param data.requestBody - * @returns single_hierarchy Returns a created hierarchy with the following attributes. - * @throws ApiError - */ -export const createHierarchy = (data: CreateHierarchyData): CancelablePromise => { return __request(OpenAPI, { - method: 'POST', - url: '/pcm/hierarchies', - body: data.requestBody, - mediaType: 'application/json', - errors: { - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const createHierarchy = (options: Options) => { + return (options?.client ?? client).post< + CreateHierarchyResponse, + CreateHierarchyError + >({ + ...options, + url: "/pcm/hierarchies", + }) +} /** * Get all hierarchies * Get all hierarchies - * @param data The data for the request. - * @param data.pageOffset The number of records to offset the results by. - * @param data.pageLimit The number of records per page. The maximum limit is 100. - * @returns multi_hierarchy Returns a list of all hierarchies. - * @throws ApiError - */ -export const getHierarchy = (data: GetHierarchyData = {}): CancelablePromise => { return __request(OpenAPI, { - method: 'GET', - url: '/pcm/hierarchies', - query: { - 'page[offset]': data.pageOffset, - 'page[limit]': data.pageLimit - }, - errors: { - 400: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const getHierarchy = (options?: Options) => { + return (options?.client ?? client).get< + GetHierarchyResponse, + GetHierarchyError + >({ + ...options, + url: "/pcm/hierarchies", + }) +} /** * Get a hierarchy * Retrieves the specified hierarchy. - * @param data The data for the request. - * @param data.hierarchyId A unique identifier for the hierarchy. - * @returns single_hierarchy Returns a hierarchy with the following attributes. - * @throws ApiError - */ -export const getHierarchyChild = (data: GetHierarchyChildData): CancelablePromise => { return __request(OpenAPI, { - method: 'GET', - url: '/pcm/hierarchies/{hierarchyID}', - path: { - hierarchyID: data.hierarchyId - }, - errors: { - 400: 'Bad request. The request failed validation.', - 404: 'Bad Request. Not Found.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const getHierarchyChild = (options: Options) => { + return (options?.client ?? client).get< + GetHierarchyChildResponse, + GetHierarchyChildError + >({ + ...options, + url: "/pcm/hierarchies/{hierarchyID}", + }) +} /** * Update a hierarchy * Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the hierarchy is not updated. - * @param data The data for the request. - * @param data.hierarchyId A unique identifier for the hierarchy. - * @param data.requestBody - * @returns single_hierarchy Successfully returns the updated hierarchy - * @throws ApiError - */ -export const updateHierarchy = (data: UpdateHierarchyData): CancelablePromise => { return __request(OpenAPI, { - method: 'PUT', - url: '/pcm/hierarchies/{hierarchyID}', - path: { - hierarchyID: data.hierarchyId - }, - body: data.requestBody, - mediaType: 'application/json', - errors: { - 403: 'Forbidden', - 404: 'Bad Request. Not Found.', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const updateHierarchy = (options: Options) => { + return (options?.client ?? client).put< + UpdateHierarchyResponse, + UpdateHierarchyError + >({ + ...options, + url: "/pcm/hierarchies/{hierarchyID}", + }) +} /** * Delete a hierarchy * Deletes the specified hierarchy and all its children. - * @param data The data for the request. - * @param data.hierarchyId A unique identifier for the hierarchy. - * @returns void No Content - * @throws ApiError - */ -export const deleteHierarchy = (data: DeleteHierarchyData): CancelablePromise => { return __request(OpenAPI, { - method: 'DELETE', - url: '/pcm/hierarchies/{hierarchyID}', - path: { - hierarchyID: data.hierarchyId - }, - errors: { - 403: 'Forbidden', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const deleteHierarchy = (options: Options) => { + return (options?.client ?? client).delete< + DeleteHierarchyResponse, + DeleteHierarchyError + >({ + ...options, + url: "/pcm/hierarchies/{hierarchyID}", + }) +} /** * Create a node @@ -1447,77 +1154,43 @@ export const deleteHierarchy = (data: DeleteHierarchyData): CancelablePromise => { return __request(OpenAPI, { - method: 'POST', - url: '/pcm/hierarchies/{hierarchyID}/nodes', - path: { - hierarchyID: data.hierarchyId - }, - body: data.requestBody, - mediaType: 'application/json', - errors: { - 403: 'Forbidden', - 404: 'Bad Request. Not Found.', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const createNode = (options: Options) => { + return (options?.client ?? client).post({ + ...options, + url: "/pcm/hierarchies/{hierarchyID}/nodes", + }) +} /** * Get all nodes in a hierarchy * A fully paginated view of all nodes in a hierarchy regardless of depth. - * @param data The data for the request. - * @param data.hierarchyId A unique identifier for the hierarchy. - * @param data.pageOffset The number of records to offset the results by. - * @param data.pageLimit The number of records per page. The maximum limit is 100. - * @returns multi_nodes Successfully returns the node's children - * @throws ApiError - */ -export const getAllNodesInHierarchy = (data: GetAllNodesInHierarchyData): CancelablePromise => { return __request(OpenAPI, { - method: 'GET', - url: '/pcm/hierarchies/{hierarchyID}/nodes', - path: { - hierarchyID: data.hierarchyId - }, - query: { - 'page[offset]': data.pageOffset, - 'page[limit]': data.pageLimit - }, - errors: { - 400: 'Bad request. The request failed validation.', - 404: 'Bad Request. Not Found.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const getAllNodesInHierarchy = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetAllNodesInHierarchyResponse, + GetAllNodesInHierarchyError + >({ + ...options, + url: "/pcm/hierarchies/{hierarchyID}/nodes", + }) +} /** * Get a node * Retrieves a node from a hierarchy. - * @param data The data for the request. - * @param data.hierarchyId A unique identifier for the hierarchy. - * @param data.nodeId A unique identifier for the node. - * @returns single_node Returns a node with the following attributes. - * @throws ApiError - */ -export const getHierarchyNode = (data: GetHierarchyNodeData): CancelablePromise => { return __request(OpenAPI, { - method: 'GET', - url: '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}', - path: { - hierarchyID: data.hierarchyId, - nodeID: data.nodeId - }, - errors: { - 400: 'Bad request. The request failed validation.', - 404: 'Bad Request. Not Found.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const getHierarchyNode = (options: Options) => { + return (options?.client ?? client).get< + GetHierarchyNodeResponse, + GetHierarchyNodeError + >({ + ...options, + url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}", + }) +} /** * Update a node @@ -1558,79 +1231,41 @@ export const getHierarchyNode = (data: GetHierarchyNodeData): CancelablePromise< * - Get node children in your latest catalog release. * - Get node children in a catalog. * - * @param data The data for the request. - * @param data.hierarchyId A unique identifier for the hierarchy. - * @param data.nodeId A unique identifier for the node. - * @param data.requestBody - * @returns single_node Successfully returns the updated node - * @throws ApiError - */ -export const updateNode = (data: UpdateNodeData): CancelablePromise => { return __request(OpenAPI, { - method: 'PUT', - url: '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}', - path: { - hierarchyID: data.hierarchyId, - nodeID: data.nodeId - }, - body: data.requestBody, - mediaType: 'application/json', - errors: { - 403: 'Forbidden', - 404: 'Bad Request. Not Found.', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const updateNode = (options: Options) => { + return (options?.client ?? client).put({ + ...options, + url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}", + }) +} /** * Deletes a node * Deletes a node by the node ID - * @param data The data for the request. - * @param data.hierarchyId A unique identifier for the hierarchy. - * @param data.nodeId A unique identifier for the node. - * @returns void No Content - * @throws ApiError - */ -export const deleteNode = (data: DeleteNodeData): CancelablePromise => { return __request(OpenAPI, { - method: 'DELETE', - url: '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}', - path: { - hierarchyID: data.hierarchyId, - nodeID: data.nodeId - }, - errors: { - 403: 'Forbidden', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const deleteNode = (options: Options) => { + return (options?.client ?? client).delete< + DeleteNodeResponse, + DeleteNodeError + >({ + ...options, + url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}", + }) +} /** * Get a hierarchy's children * Get a hierarchy's children - * @param data The data for the request. - * @param data.hierarchyId A unique identifier for the hierarchy. - * @param data.pageOffset The number of records to offset the results by. - * @param data.pageLimit The number of records per page. The maximum limit is 100. - * @returns multi_nodes Returns the hierarchy's children. - * @throws ApiError - */ -export const getAllChildren = (data: GetAllChildrenData): CancelablePromise => { return __request(OpenAPI, { - method: 'GET', - url: '/pcm/hierarchies/{hierarchyID}/children', - path: { - hierarchyID: data.hierarchyId - }, - query: { - 'page[offset]': data.pageOffset, - 'page[limit]': data.pageLimit - }, - errors: { - 400: 'Bad request. The request failed validation.', - 404: 'Bad Request. Not Found.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const getAllChildren = (options: Options) => { + return (options?.client ?? client).get< + GetAllChildrenResponse, + GetAllChildrenError + >({ + ...options, + url: "/pcm/hierarchies/{hierarchyID}/children", + }) +} /** * Create relationships between a node and child nodes @@ -1656,58 +1291,34 @@ export const getAllChildren = (data: GetAllChildrenData): CancelablePromise => { return __request(OpenAPI, { - method: 'POST', - url: '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/children', - path: { - hierarchyID: data.hierarchyId, - nodeID: data.nodeId - }, - body: data.requestBody, - mediaType: 'application/json', - errors: { - 403: 'Forbidden', - 404: 'Bad Request. Not Found.', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const createNodeChildRelationships = ( + options: Options, +) => { + return (options?.client ?? client).post< + CreateNodeChildRelationshipsResponse, + CreateNodeChildRelationshipsError + >({ + ...options, + url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/children", + }) +} /** * Get a node's children * Retrieves the child nodes for a specified node. - * @param data The data for the request. - * @param data.hierarchyId A unique identifier for the hierarchy. - * @param data.nodeId A unique identifier for the node. - * @param data.pageOffset The number of records to offset the results by. - * @param data.pageLimit The number of records per page. The maximum limit is 100. - * @returns multi_nodes Successfully returns the node's children - * @throws ApiError - */ -export const getAllNodeChildren = (data: GetAllNodeChildrenData): CancelablePromise => { return __request(OpenAPI, { - method: 'GET', - url: '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/children', - path: { - hierarchyID: data.hierarchyId, - nodeID: data.nodeId - }, - query: { - 'page[offset]': data.pageOffset, - 'page[limit]': data.pageLimit - }, - errors: { - 400: 'Bad request. The request failed validation.', - 404: 'Bad Request. Not Found.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const getAllNodeChildren = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetAllNodeChildrenResponse, + GetAllNodeChildrenError + >({ + ...options, + url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/children", + }) +} /** * Update a node's parent @@ -1715,134 +1326,75 @@ export const getAllNodeChildren = (data: GetAllNodeChildrenData): CancelableProm * * You cannot move a node to another hierarchy. If you want to put the specified node into another hierarchy, create the node in the target hierarchy and delete it from the current hierarchy. * - * @param data The data for the request. - * @param data.hierarchyId A unique identifier for the hierarchy. - * @param data.nodeId A unique identifier for the node. - * @param data.requestBody - * @returns void No Content - * @throws ApiError - */ -export const updateNodeParent = (data: UpdateNodeParentData): CancelablePromise => { return __request(OpenAPI, { - method: 'PUT', - url: '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/parent', - path: { - hierarchyID: data.hierarchyId, - nodeID: data.nodeId - }, - body: data.requestBody, - mediaType: 'application/json', - errors: { - 403: 'Forbidden', - 404: 'Bad Request. Not Found.', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const updateNodeParent = (options: Options) => { + return (options?.client ?? client).put< + UpdateNodeParentResponse, + UpdateNodeParentError + >({ + ...options, + url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/parent", + }) +} /** * Delete a node's parent - * @param data The data for the request. - * @param data.hierarchyId A unique identifier for the hierarchy. - * @param data.nodeId A unique identifier for the node. - * @returns void No Content - * @throws ApiError - */ -export const deleteNodeParent = (data: DeleteNodeParentData): CancelablePromise => { return __request(OpenAPI, { - method: 'DELETE', - url: '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/parent', - path: { - hierarchyID: data.hierarchyId, - nodeID: data.nodeId - }, - errors: { - 403: 'Forbidden', - 404: 'Bad Request. Not Found.', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const deleteNodeParent = (options: Options) => { + return (options?.client ?? client).delete< + DeleteNodeParentResponse, + DeleteNodeParentError + >({ + ...options, + url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/parent", + }) +} /** * Create a node's product relationships * Creates relationships between the specified node and one or more products in a specified hierarchy. - * @param data The data for the request. - * @param data.hierarchyId A unique identifier for the hierarchy. - * @param data.nodeId A unique identifier for the node. - * @param data.requestBody - * @returns single_node Successfully returns the updated node - * @throws ApiError - */ -export const createNodeProductRelationship = (data: CreateNodeProductRelationshipData): CancelablePromise => { return __request(OpenAPI, { - method: 'POST', - url: '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/products', - path: { - hierarchyID: data.hierarchyId, - nodeID: data.nodeId - }, - body: data.requestBody, - mediaType: 'application/json', - errors: { - 403: 'Forbidden', - 404: 'Bad Request. Not Found.', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const createNodeProductRelationship = ( + options: Options, +) => { + return (options?.client ?? client).post< + CreateNodeProductRelationshipResponse, + CreateNodeProductRelationshipError + >({ + ...options, + url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/products", + }) +} /** * Deletes a node's product relationships - * @param data The data for the request. - * @param data.hierarchyId A unique identifier for the hierarchy. - * @param data.nodeId A unique identifier for the node. - * @param data.requestBody - * @returns single_node Successfully returns the updated node - * @throws ApiError - */ -export const deleteNodeProductRelationships = (data: DeleteNodeProductRelationshipsData): CancelablePromise => { return __request(OpenAPI, { - method: 'DELETE', - url: '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/products', - path: { - hierarchyID: data.hierarchyId, - nodeID: data.nodeId - }, - body: data.requestBody, - mediaType: 'application/json', - errors: { - 404: 'Bad Request. Not Found.', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const deleteNodeProductRelationships = ( + options: Options, +) => { + return (options?.client ?? client).delete< + DeleteNodeProductRelationshipsResponse, + DeleteNodeProductRelationshipsError + >({ + ...options, + url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/products", + }) +} /** * Get a node's products * Returns the products associated with the specified hierarchy node from a published catalog. Products must be in a live status. If the products have been curated using the update a hierarchy node endpoint, then the products are returned in the order specified in the `curated_products` attribute in the body of the update a hierarchy node request. A product that is curated has the "curated_product": true attribute displayed. * - * @param data The data for the request. - * @param data.hierarchyId A unique identifier for the hierarchy. - * @param data.nodeId A unique identifier for the node. - * @param data.pageOffset The number of records to offset the results by. - * @param data.pageLimit The number of records per page. The maximum limit is 100. - * @returns multi_product_response Successfully returns the node's products - * @throws ApiError - */ -export const getNodeProducts = (data: GetNodeProductsData): CancelablePromise => { return __request(OpenAPI, { - method: 'GET', - url: '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/products', - path: { - hierarchyID: data.hierarchyId, - nodeID: data.nodeId - }, - query: { - 'page[offset]': data.pageOffset, - 'page[limit]': data.pageLimit - }, - errors: { - 400: 'Bad request. The request failed validation.', - 404: 'Bad Request. Not Found.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const getNodeProducts = (options: Options) => { + return (options?.client ?? client).get< + GetNodeProductsResponse, + GetNodeProductsError + >({ + ...options, + url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/products", + }) +} /** * Duplicate a hierarchy @@ -1861,108 +1413,77 @@ export const getNodeProducts = (data: GetNodeProductsData): CancelablePromise => { return __request(OpenAPI, { - method: 'POST', - url: '/pcm/hierarchies/{hierarchyID}/duplicate_job', - path: { - hierarchyID: data.hierarchyId - }, - body: data.requestBody, - mediaType: 'application/json', - errors: { - 404: 'Bad Request. Not Found.', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const duplicateHierarchy = ( + options: Options, +) => { + return (options?.client ?? client).post< + DuplicateHierarchyResponse, + DuplicateHierarchyError + >({ + ...options, + url: "/pcm/hierarchies/{hierarchyID}/duplicate_job", + }) +} /** * Get All Product Tags * Retrieves all product tags for a store. A store can view the tags associated with the organization to which the store belongs. However, an organization can only view the tags associated with the organization. * * - * @returns multi_tag Returns all the product tags. - * @throws ApiError */ -export const getAllProductTags = (): CancelablePromise => { return __request(OpenAPI, { - method: 'GET', - url: '/pcm/tags', - errors: { - 400: 'Bad request. The request failed validation.', - 404: 'Bad Request. Not Found.', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; +export const getAllProductTags = (options?: Options) => { + return (options?.client ?? client).get< + GetAllProductTagsResponse, + GetAllProductTagsError + >({ + ...options, + url: "/pcm/tags", + }) +} /** * Get a Product Tag * Retrieves a product tag for a store. A store can view the tags associated with the organization to which the store belongs. However, an organization can only view the tags associated with the organization. - * @param data The data for the request. - * @param data.tagId A unique identifier for the tag. - * @returns single_tag Returns a product tag with the following attributes. - * @throws ApiError - */ -export const getProductTag = (data: GetProductTagData): CancelablePromise => { return __request(OpenAPI, { - method: 'GET', - url: '/pcm/tags/{tagID}', - path: { - tagID: data.tagId - }, - errors: { - 400: 'Bad request. The request failed validation.', - 404: 'Bad Request. Not Found.', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const getProductTag = (options: Options) => { + return (options?.client ?? client).get< + GetProductTagResponse, + GetProductTagError + >({ + ...options, + url: "/pcm/tags/{tagID}", + }) +} /** * Create a custom relationship * Create a custom relationship - * @param data The data for the request. - * @param data.requestBody - * @returns single_custom_relationship Returns a created custom relationship with the following attributes. - * @throws ApiError - */ -export const createCustomRelationship = (data: CreateCustomRelationshipData): CancelablePromise => { return __request(OpenAPI, { - method: 'POST', - url: '/pcm/custom_relationships', - body: data.requestBody, - mediaType: 'application/json', - errors: { - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; + */ +export const createCustomRelationship = ( + options: Options, +) => { + return (options?.client ?? client).post< + CreateCustomRelationshipResponse, + CreateCustomRelationshipError + >({ + ...options, + url: "/pcm/custom_relationships", + }) +} /** * Update a custom relationship * Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the custom relationship is not updated. - * @param data The data for the request. - * @param data.customRelationshipSlug A custom relationship slug. - * @param data.requestBody - * @returns single_custom_relationship Successfully returns the updated custom relationship - * @throws ApiError - */ -export const updateCustomRelationship = (data: UpdateCustomRelationshipData): CancelablePromise => { return __request(OpenAPI, { - method: 'PUT', - url: '/pcm/custom_relationships/{customRelationshipSlug}', - path: { - customRelationshipSlug: data.customRelationshipSlug - }, - body: data.requestBody, - mediaType: 'application/json', - errors: { - 403: 'Forbidden', - 404: 'Bad Request. Not Found.', - 422: 'Bad request. The request failed validation.', - 500: 'Internal server error. There was a system failure in the platform.' - } -}); }; \ No newline at end of file + */ +export const updateCustomRelationship = ( + options: Options, +) => { + return (options?.client ?? client).put< + UpdateCustomRelationshipResponse, + UpdateCustomRelationshipError + >({ + ...options, + url: "/pcm/custom_relationships/{customRelationshipSlug}", + }) +} diff --git a/packages/sdks/src/client/types.gen.ts b/packages/sdks/src/client/types.gen.ts index 15bedc33..e536cd61 100644 --- a/packages/sdks/src/client/types.gen.ts +++ b/packages/sdks/src/client/types.gen.ts @@ -1,4864 +1,5266 @@ // This file is auto-generated by @hey-api/openapi-ts -export type job = { +export type Job = { + /** + * A unique identifier generated when a job is created. + */ + id?: string + /** + * This represents the type of resource object being returned. Always `pim-job`. + */ + type?: "pim-job" + attributes?: { /** - * A unique identifier generated when a job is created. + * The date and time a job is started. */ - id?: string; + started_at?: string | null /** - * This represents the type of resource object being returned. Always `pim-job`. + * The date and time a job is completed. */ - type?: 'pim-job'; - attributes?: { - /** - * The date and time a job is started. - */ - started_at?: string | null; - /** - * The date and time a job is completed. - */ - completed_at?: string | null; - /** - * The date and time a job is created. - */ - created_at?: string; - /** - * The date and time a job is updated. - */ - updated_at?: string; - /** - * The status of a job. - * - * * `pending` - Commerce has received the request but is currently busy processing other requests. - * * `started` - Commerce has started processing the job. - * * `success` - The job has successfully completed. - * * `failed` - The job has failed. - * - */ - type?: 'child-products' | 'product-import' | 'product-export' | 'hierarchy-duplicate' | 'price-import'; - status?: 'pending' | 'cancelled' | 'started' | 'success' | 'failed'; - }; - meta?: { - /** - * Applies to all job types. A unique request ID is generated when a job is created. - */ - x_request_id?: string; - /** - * Applies to `hierarchy-duplicate` job types. The ID of the original hierarchy that you duplicated. - */ - copied_from?: string; - /** - * Applies to `hierarchy-duplicate` job types. The duplicated hierarchy ID. - */ - hierarchy_id?: string; - /** - * If the job type is `product_export`, a link to the file is created when running a job. - */ - file_locations?: Array<(string)> | null; - /** - * The entities included in the job. For example, if the job type is `product-export`, the PXM products included in the export. - */ - filter?: string; - }; -}; + completed_at?: string | null + /** + * The date and time a job is created. + */ + created_at?: string + /** + * The date and time a job is updated. + */ + updated_at?: string + /** + * The status of a job. + * + * * `pending` - Commerce has received the request but is currently busy processing other requests. + * * `started` - Commerce has started processing the job. + * * `success` - The job has successfully completed. + * * `failed` - The job has failed. + * + */ + type?: + | "child-products" + | "product-import" + | "product-export" + | "hierarchy-duplicate" + | "price-import" + status?: "pending" | "cancelled" | "started" | "success" | "failed" + } + meta?: { + /** + * Applies to all job types. A unique request ID is generated when a job is created. + */ + x_request_id?: string + /** + * Applies to `hierarchy-duplicate` job types. The ID of the original hierarchy that you duplicated. + */ + copied_from?: string + /** + * Applies to `hierarchy-duplicate` job types. The duplicated hierarchy ID. + */ + hierarchy_id?: string + /** + * If the job type is `product_export`, a link to the file is created when running a job. + */ + file_locations?: Array | null + /** + * The entities included in the job. For example, if the job type is `product-export`, the PXM products included in the export. + */ + filter?: string + } +} /** * This represents the type of resource object being returned. Always `pim-job`. */ -export type type = 'pim-job'; +export type type = "pim-job" -export type status = 'pending' | 'cancelled' | 'started' | 'success' | 'failed'; +export type status = "pending" | "cancelled" | "started" | "success" | "failed" -export type multi = { +export type Multi = { + /** + * An array of jobs. + */ + data?: Array + meta?: { /** - * An array of jobs. + * Contains the results for the entire collection. */ - data?: Array; - meta?: { - /** - * Contains the results for the entire collection. - */ - results?: { - /** - * Total number of results for the entire collection. - */ - total?: number; - }; - }; -}; + results?: { + /** + * Total number of results for the entire collection. + */ + total?: number + } + } +} -export type error = { - errors: Array<{ - /** - * The HTTP response code of the error. - */ - status: string; - /** - * A brief summary of the error. - */ - title: string; - /** - * Optional additional detail about the error. - */ - detail?: string; - /** - * Internal request ID. - */ - request_id?: string; - /** - * Additional supporting meta data for the error. - */ - meta?: { - [key: string]: unknown; - }; - }>; -}; +export type Error = { + errors: Array<{ + /** + * The HTTP response code of the error. + */ + status: string + /** + * A brief summary of the error. + */ + title: string + /** + * Optional additional detail about the error. + */ + detail?: string + /** + * Internal request ID. + */ + request_id?: string + /** + * Additional supporting meta data for the error. + */ + meta?: { + [key: string]: unknown + } + }> +} -export type single = { - data?: job; -}; +export type Single = { + data?: Job +} -export type errors = { +export type Errors = { + /** + * An array of job errors. + */ + data?: Array<{ /** - * An array of job errors. + * This represents the type of resource object being returned. Always `pim-job-error`. */ - data?: Array<{ - /** - * This represents the type of resource object being returned. Always `pim-job-error`. - */ - type?: 'pim-job-error'; - /** - * A unique identifier for a job error generated when a job error is created. - */ - id?: string; - attributes?: { - /** - * A description of an error message. - */ - message?: string; - }; - }>; -}; + type?: "pim-job-error" + /** + * A unique identifier for a job error generated when a job error is created. + */ + id?: string + attributes?: { + /** + * A description of an error message. + */ + message?: string + } + }> +} /** * You use the `custom_inputs` attribute to allow your shoppers to add custom text to a product when adding product items to their carts. This is useful, for example, if you have a product like a T-shirt that can be personalized or you sell greetings cards that can be printed with your shoppers personalized messages. See [Personalizing Products](/docs/api/pxm/products/create-product#personalizing-products). */ -export type product_custom_inputs = { - [key: string]: { - /** - * A name for the custom text field. - */ - name?: string; - /** - * The validation rules for the custom text. - */ - validation_rules?: unknown[]; - /** - * This represents the type of the resource being returned. - */ - type?: string; - /** - * The length of the custom input text field. - */ - options?: { - [key: string]: unknown; - }; - /** - * The number of characters the custom text field can be. You can specify a maximum length up to 255 characters, as the limit is 255 characters. - */ - max_length?: number; - /** - * `true` or `false` depending on whether the custom text is required. - */ - required?: boolean; - }; -}; - -/** - * You can build a combination of child products associated with a product, based on build rules that you specify. This is useful, for example, if you have a variation option that you do not sell. This makes managing and building your child products quick and easy. See [Using Build Rules](/docs/api/pxm/products/build-child-products#using-build-rules). - */ -export type product_build_rules = { +export type ProductCustomInputs = { + [key: string]: { + /** + * A name for the custom text field. + */ + name?: string /** - * Specifies the default behaviour, either `include` or `exclude`. + * The validation rules for the custom text. */ - default?: 'include' | 'exclude'; + validation_rules?: unknown[] /** - * An array of option IDs to include when child products are built. Each combination consists of a nested array of option IDs from one or more variations. Combinations of option IDs in the nested arrays must come from different variations. + * This represents the type of the resource being returned. */ - include?: Array>; + type?: string /** - * An array of option IDs to exclude when child products are built. Each combination consists of a nested array of option IDs from one or more variations. Combinations of option IDs in the nested arrays must come from different variations. + * The length of the custom input text field. */ - exclude?: Array>; -}; + options?: { + [key: string]: unknown + } + /** + * The number of characters the custom text field can be. You can specify a maximum length up to 255 characters, as the limit is 255 characters. + */ + max_length?: number + /** + * `true` or `false` depending on whether the custom text is required. + */ + required?: boolean + } +} + +/** + * You can build a combination of child products associated with a product, based on build rules that you specify. This is useful, for example, if you have a variation option that you do not sell. This makes managing and building your child products quick and easy. See [Using Build Rules](/docs/api/pxm/products/build-child-products#using-build-rules). + */ +export type ProductBuildRules = { + /** + * Specifies the default behaviour, either `include` or `exclude`. + */ + default?: "include" | "exclude" + /** + * An array of option IDs to include when child products are built. Each combination consists of a nested array of option IDs from one or more variations. Combinations of option IDs in the nested arrays must come from different variations. + */ + include?: Array> + /** + * An array of option IDs to exclude when child products are built. Each combination consists of a nested array of option IDs from one or more variations. Combinations of option IDs in the nested arrays must come from different variations. + */ + exclude?: Array> +} /** * Specifies the default behaviour, either `include` or `exclude`. */ -export type default = 'include' | 'exclude'; +export type Default = "include" | "exclude" /** * With Product Experience Manager, you can create and manage bundles. A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. See [Bundles](/docs/api/pxm/products/products#bundles). */ -export type product_bundle_components = { - [key: string]: { - /** - * The component name. The component name is the name that is displayed in your storefront. - */ - name?: string; - /** - * The product options included in a component. This can be the ID of another bundle. - */ - options?: Array<{ - /** - * The unique ID of the product you want to add to a component. - */ - id?: string; - /** - * This represents the type of object being returned. Always `product`. - */ - type?: string; - /** - * The number of this product option that a shopper must purchase. - */ - quantity?: number; - /** - * The sort order of the options. The `create a bundle` and `update a bundle` endpoints do not sort the options. You can use the `sort_order` attribute when programming your storefront to display the options in the order that you want. - */ - sort_order?: number; - /** - * Whether the product option is a default option in a bundle. Shoppers can select a bundle that specifies a default list of product options. See [Dynamic Bundles](/docs/api/pxm/products/products#dynamic-bundles). - */ - default?: boolean; - }>; - /** - * The minimum number of product options a shopper can select from this component. - */ - min?: number; - /** - * The maximum number of product options a shopper can select from this component. - */ - max?: number; - /** - * The sort order of the components. The `create a bundle` and `update a bundle` endpoints do not sort the components. You can use the `sort_order` attribute when programming your storefront to display the components in the order that you want. - */ - sort_order?: number; - }; -}; - -export type product_response = { +export type ProductBundleComponents = { + [key: string]: { + /** + * The component name. The component name is the name that is displayed in your storefront. + */ + name?: string + /** + * The product options included in a component. This can be the ID of another bundle. + */ + options?: Array<{ + /** + * The unique ID of the product you want to add to a component. + */ + id?: string + /** + * This represents the type of object being returned. Always `product`. + */ + type?: string + /** + * The number of this product option that a shopper must purchase. + */ + quantity?: number + /** + * The sort order of the options. The `create a bundle` and `update a bundle` endpoints do not sort the options. You can use the `sort_order` attribute when programming your storefront to display the options in the order that you want. + */ + sort_order?: number + /** + * Whether the product option is a default option in a bundle. Shoppers can select a bundle that specifies a default list of product options. See [Dynamic Bundles](/docs/api/pxm/products/products#dynamic-bundles). + */ + default?: boolean + }> + /** + * The minimum number of product options a shopper can select from this component. + */ + min?: number + /** + * The maximum number of product options a shopper can select from this component. + */ + max?: number + /** + * The sort order of the components. The `create a bundle` and `update a bundle` endpoints do not sort the components. You can use the `sort_order` attribute when programming your storefront to display the components in the order that you want. + */ + sort_order?: number + } +} + +export type ProductResponse = { + /** + * A unique product ID that is generated when you create the product. + */ + id?: string + /** + * This represents the type of resource object being returned. Always `product`. + */ + type?: "product" + attributes?: { + /** + * A name for the product. + */ + name?: string /** - * A unique product ID that is generated when you create the product. + * A description for the product. */ - id?: string; + description?: string /** - * This represents the type of resource object being returned. Always `product`. + * A label for the product that is used in the URL paths. A slug can contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. By default, the product name is used as the slug. */ - type?: 'product'; - attributes?: { - /** - * A name for the product. - */ - name?: string; - /** - * A description for the product. - */ - description?: string; - /** - * A label for the product that is used in the URL paths. A slug can contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. By default, the product name is used as the slug. - */ - slug?: string; - /** - * The unique stock keeping unit of the product. - */ - sku?: string; - /** - * The status for the product, either `draft` or `live`. - */ - status?: 'live' | 'draft'; - /** - * The commodity type, either `physical` or `digital`. - */ - commodity_type?: 'physical' | 'digital'; - /** - * The universal product code or european article number of the product. - */ - upc_ean?: string; - /** - * The manufacturer part number of the product. - */ - mpn?: string; - /** - * The unique attribute associated with the product. This could be an external reference from a separate company system, for example. The maximum length is 2048 characters. - */ - external_ref?: string; - /** - * Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. - */ - locales?: { - [key: string]: unknown; - }; - /** - * You can use product tags to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. A product can have up to 20 tags. A product tag can be up to 255 characters. Product tags must not contain any spaces or commas. - */ - tags?: Array<(string)>; - extensions?: { - [key: string]: { - [key: string]: (string | null | number | boolean); - }; - }; - custom_inputs?: product_custom_inputs; - build_rules?: product_build_rules; - components?: product_bundle_components; - }; - meta?: { - /** - * The date and time a product is created. - */ - created_at?: string; + slug?: string + /** + * The unique stock keeping unit of the product. + */ + sku?: string + /** + * The status for the product, either `draft` or `live`. + */ + status?: "live" | "draft" + /** + * The commodity type, either `physical` or `digital`. + */ + commodity_type?: "physical" | "digital" + /** + * The universal product code or european article number of the product. + */ + upc_ean?: string + /** + * The manufacturer part number of the product. + */ + mpn?: string + /** + * The unique attribute associated with the product. This could be an external reference from a separate company system, for example. The maximum length is 2048 characters. + */ + external_ref?: string + /** + * Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. + */ + locales?: { + [key: string]: unknown + } + /** + * You can use product tags to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. A product can have up to 20 tags. A product tag can be up to 255 characters. Product tags must not contain any spaces or commas. + */ + tags?: Array + extensions?: { + [key: string]: { + [key: string]: string | null | number | boolean + } + } + custom_inputs?: ProductCustomInputs + build_rules?: ProductBuildRules + components?: ProductBundleComponents + } + meta?: { + /** + * The date and time a product is created. + */ + created_at?: string + /** + * The date and time a product is updated. + */ + updated_at?: string + /** + * The resource owner, either `organization` or `store`. + */ + owner?: "organization" | "store" + /** + * A product's variations and the options defined for each variation. If you have specified `build_rules`, only the child products included in the `build_rules` are specified. + */ + variations?: Array<{ + /** + * A unique ID generated when a variation is created. + */ + id?: string + /** + * The name of a variation. + */ + name?: string + options?: Array<{ /** - * The date and time a product is updated. + * A unique ID that is generated an option is created. */ - updated_at?: string; + id?: string /** - * The resource owner, either `organization` or `store`. + * The name of an option. */ - owner?: 'organization' | 'store'; + name?: string /** - * A product's variations and the options defined for each variation. If you have specified `build_rules`, only the child products included in the `build_rules` are specified. + * A description of an option. */ - variations?: Array<{ - /** - * A unique ID generated when a variation is created. - */ - id?: string; - /** - * The name of a variation. - */ - name?: string; - options?: Array<{ - /** - * A unique ID that is generated an option is created. - */ - id?: string; - /** - * The name of an option. - */ - name?: string; - /** - * A description of an option. - */ - description?: string; - }>; - }>; - /** - * One of the following product types: - * - * - `standard` - A `standard` product is a standalone product. - * - `parent` - A `parent` product is a product that has child products that have been built using the `Build Child Products` endpoint. - * - `child` - When you configure product variations and variation options for `parent` products, the `child` products derived from the `parent` products are automatically created in Commerce. - * - `bundle` - A `bundle` is a purchasable product, comprising one or more standalone products (in other words, components) to be sold together. - * - */ - product_types?: Array<('parent' | 'child' | 'bundle' | 'standard')>; - /** - * The child products defined for a product. The order of the variations in the `variation_matrix` is the order of the variations in the array when the variations were linked to the product. For example, the first variation in the `variation_matrix` corresponds to the first variation in the array, and so on. You can use the `sort_order`attribute to sort the order of your variation and variation options in the `variation_matrix` object. See [Sorting the Order of Variations and Options](/docs/api/pxm/products/variations#sorting-the-order-of-variations-and-options) If no variations are defined for a product, the `variation_matrix` is empty. - */ - variation_matrix?: { - [key: string]: unknown; - }; - }; - /** - * Relationships are established between different product entities. For example, a `bundle` product and a `child` product are related to a `parent` product, as both are associated with it. - */ - relationships?: { - [key: string]: { - data?: Array<{ - /** - * A unique identifier for a resource. - */ - id?: string; - /** - * This represents the type of resource object being returned. - */ - type?: string; -}> | { + description?: string + }> + }> /** - * A unique identifier for a resource. + * One of the following product types: + * + * - `standard` - A `standard` product is a standalone product. + * - `parent` - A `parent` product is a product that has child products that have been built using the `Build Child Products` endpoint. + * - `child` - When you configure product variations and variation options for `parent` products, the `child` products derived from the `parent` products are automatically created in Commerce. + * - `bundle` - A `bundle` is a purchasable product, comprising one or more standalone products (in other words, components) to be sold together. + * */ - id?: string; + product_types?: Array<"parent" | "child" | "bundle" | "standard"> /** - * This represents the type of resource object being returned. + * The child products defined for a product. The order of the variations in the `variation_matrix` is the order of the variations in the array when the variations were linked to the product. For example, the first variation in the `variation_matrix` corresponds to the first variation in the array, and so on. You can use the `sort_order`attribute to sort the order of your variation and variation options in the `variation_matrix` object. See [Sorting the Order of Variations and Options](/docs/api/pxm/products/variations#sorting-the-order-of-variations-and-options) If no variations are defined for a product, the `variation_matrix` is empty. */ - type?: string; -} | null; + variation_matrix?: { + [key: string]: unknown + } + } + /** + * Relationships are established between different product entities. For example, a `bundle` product and a `child` product are related to a `parent` product, as both are associated with it. + */ + relationships?: { + [key: string]: { + data?: + | Array<{ + /** + * A unique identifier for a resource. + */ + id?: string /** - * Links are used to allow you to move between requests. Single entities use a `self` parameter with a link to that specific resource. Sometimes, there are not enough entities for a project to fill multiple pages. In this situation, we return some defaults. - * - * | Property | Description | - * | :--- | :--- | - * | `current` | Always the current page. | - * | `first` | Always the first page. | - * | `last` | `null` if there is only one page. | - * | `prev` | `null` if the user is on the first page. | - * | `next` | `null` if there is only one page. | - * + * This represents the type of resource object being returned. */ - links?: { - [key: string]: (string); - }; - }; - }; -}; + type?: string + }> + | { + /** + * A unique identifier for a resource. + */ + id?: string + /** + * This represents the type of resource object being returned. + */ + type?: string + } + | null + /** + * Links are used to allow you to move between requests. Single entities use a `self` parameter with a link to that specific resource. Sometimes, there are not enough entities for a project to fill multiple pages. In this situation, we return some defaults. + * + * | Property | Description | + * | :--- | :--- | + * | `current` | Always the current page. | + * | `first` | Always the first page. | + * | `last` | `null` if there is only one page. | + * | `prev` | `null` if the user is on the first page. | + * | `next` | `null` if there is only one page. | + * + */ + links?: { + [key: string]: string + } + } + } +} /** * This represents the type of resource object being returned. Always `product`. */ -export type type2 = 'product'; +export type type2 = "product" /** * The status for the product, either `draft` or `live`. */ -export type status2 = 'live' | 'draft'; +export type status2 = "live" | "draft" /** * The commodity type, either `physical` or `digital`. */ -export type commodity_type = 'physical' | 'digital'; +export type commodity_type = "physical" | "digital" /** * The resource owner, either `organization` or `store`. */ -export type owner = 'organization' | 'store'; +export type owner = "organization" | "store" -export type multi_product_response = { - data?: Array; +export type MultiProductResponse = { + data?: Array + /** + * Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. + */ + included?: { /** * Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. */ - included?: { - /** - * Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. - */ - component_products?: Array; - }; - meta?: { - /** - * Contains the results for the entire collection. - */ - results?: { - /** - * Total number of results for the entire collection. - */ - total?: number; - }; - }; -}; + component_products?: Array + } + meta?: { + /** + * Contains the results for the entire collection. + */ + results?: { + /** + * Total number of results for the entire collection. + */ + total?: number + } + } +} /** * Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. */ -export type product_locales = { - [key: string]: { - /** - * A localized name for the product. - */ - name: string; - /** - * A localized description for the product. - */ - description?: string; - }; -}; - -export type product_attributes = { - /** - * The unique attribute associated with the product. This could be an external reference from a separate company system, for example. The maximum length is 2048 characters. +export type ProductLocales = { + [key: string]: { + /** + * A localized name for the product. + */ + name: string + /** + * A localized description for the product. + */ + description?: string + } +} + +export type ProductAttributes = { + /** + * The unique attribute associated with the product. This could be an external reference from a separate company system, for example. The maximum length is 2048 characters. + */ + external_ref?: string + /** + * The product name to display to customers. + */ + name?: string + /** + * A description for the product. + */ + description?: string + /** + * The unique slug of the product. A slug can contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + */ + slug?: string + /** + * The unique stock keeping unit of the product. + */ + sku?: string + /** + * The status for the product, either `draft` or `live`. Default is `draft`. + */ + status?: "live" | "draft" + /** + * The commodity type, either `physical` or `digital`. + */ + commodity_type?: "physical" | "digital" + /** + * The universal product code or european article number of the product. + */ + upc_ean?: string + /** + * The manufacturer part number of the product. + */ + mpn?: string + /** + * You can use product tags to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. A product can have up to 20 tags. A product tag can be up to 255 characters. Product tags must not contain any spaces or commas. See [Product Tags](/docs/api/pxm/products/product-tags). + */ + tags?: Array + build_rules?: ProductBuildRules + locales?: ProductLocales + custom_inputs?: ProductCustomInputs + components?: ProductBundleComponents +} + +export type CreateProductRequest = { + data: { + /** + * This represents the type of resource being returned. Always `product`. + */ + type: "product" + attributes: ProductAttributes + /** + * Relationships are established between different product entities. */ - external_ref?: string; + relationships?: { + variations?: { + data?: Array<{ + /** + * A unique identifier for a resource. + */ + id?: string + /** + * This represents the type of resource object being returned. + */ + type?: string + }> + } + } + } +} + +export type SingleProductResponse = { + data?: ProductResponse + /** + * Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. + */ + included?: { + /** + * A list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. + */ + component_products?: Array + } +} + +export type UpdateProductRequest = { + data: { /** - * The product name to display to customers. + * This represents the type of resource object being returned. Always `product`. */ - name?: string; + type: "product" + /** + * The unique identifier of the product. Must match the product ID specified in the request path. + */ + id: string + attributes: ProductAttributes + } +} + +export type Attributes = { + /** + * The name of the node, such as `Ranges` or `Refrigerators`. Names must be unique among sibling nodes in the hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies. + */ + name?: string + /** + * A description for a node. + */ + description?: string + /** + * A slug for the node. Slugs must be unique among sibling nodes in the hierarchy. Otherwise, a slug can be non-unique within the hierarchy and across multiple hierarchies. + */ + slug?: string + /** + * You can curate your products in your nodes product lists. Product curation allows you to promote specific products within each node in a hierarchy, enabling you to create unique product collections in your storefront. + */ + curated_products?: Array + /** + * Product Experience Manager supports localization of hierarchies and nodes. If you store supports multiple languages, you can localize hierarchy and node names and descriptions. + */ + locales?: { + [key: string]: { + /** + * A localized hierarchy or node name. + */ + name?: string + /** + * A localized hierarchy or node description. + */ + description?: string + } + } +} + +/** + * Relationships allow you to move between requests. Includes links to the child nodes and products associated with a hierarchy or node. + */ +export type Relationships = { + /** + * The child nodes related to the resource. + */ + children?: { /** - * A description for the product. + * An array of child nodes. */ - description?: string; + data?: unknown[] /** - * The unique slug of the product. A slug can contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + * Links allow you to move between requests. */ - slug?: string; + links?: { + /** + * A link to a related resource. + */ + related?: string + } + } + /** + * The parent node related to the resource + */ + parent?: { /** - * The unique stock keeping unit of the product. + * The parent node */ - sku?: string; + data?: { + /** + * This represents the type of resource object being returned. Always `node`. + */ + type: "node" + /** + * The unique identifier of a node. + */ + id: string + } + } + /** + * The products related to the resource. + */ + products?: { + /** + * An array of products. + */ + data?: unknown[] + /** + * Links allow you to move between requests. + */ + links?: { + /** + * A link to a related resource. + */ + related?: string + } + } +} + +/** + * This represents the type of resource object being returned. Always `node`. + */ +export type type3 = "node" + +export type Node = { + /** + * The unique identifier of a node. + */ + id?: string + /** + * This represents the type of resource object being returned. Always `node`. + */ + type?: "node" + attributes?: Attributes + relationships?: Relationships + meta?: { /** - * The status for the product, either `draft` or `live`. Default is `draft`. + * The sort order value. The node with the highest value of `sort_order` is displayed first. For example, a node with a `sort_order` value of `3` appears before a node with a `sort_order` value of `2`. See [Sorting Nodes in a hierarchy](/docs/api/pxm/products/create-node#sorting-nodes-in-a-hierarchy). */ - status?: 'live' | 'draft'; + sort_order?: number /** - * The commodity type, either `physical` or `digital`. + * The date and time a node is created. */ - commodity_type?: 'physical' | 'digital'; + created_at?: string /** - * The universal product code or european article number of the product. + * The date and time a node was updated. */ - upc_ean?: string; + updated_at?: string /** - * The manufacturer part number of the product. + * The name of the parent of the node if one exists. */ - mpn?: string; + parent_name?: string /** - * You can use product tags to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. A product can have up to 20 tags. A product tag can be up to 255 characters. Product tags must not contain any spaces or commas. See [Product Tags](/docs/api/pxm/products/product-tags). + * The node owner, either `organization` or `store`. */ - tags?: Array<(string)>; - build_rules?: product_build_rules; - locales?: product_locales; - custom_inputs?: product_custom_inputs; - components?: product_bundle_components; -}; + owner?: "store" | "organization" + } +} -export type create_product_request = { - data: { - /** - * This represents the type of resource being returned. Always `product`. - */ - type: 'product'; - attributes: product_attributes; - /** - * Relationships are established between different product entities. - */ - relationships?: { - variations?: { - data?: Array<{ - /** - * A unique identifier for a resource. - */ - id?: string; - /** - * This represents the type of resource object being returned. - */ - type?: string; - }>; - }; - }; - }; -}; - -export type single_product_response = { - data?: product_response; +export type MultiMeta = { + /** + * Contains the results for the entire collection. + */ + results?: { /** - * Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. + * Total number of results for the entire collection. */ - included?: { - /** - * A list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. - */ - component_products?: Array; - }; -}; + total?: number + } +} -export type update_product_request = { - data: { - /** - * This represents the type of resource object being returned. Always `product`. - */ - type: 'product'; - /** - * The unique identifier of the product. Must match the product ID specified in the request path. - */ - id: string; - attributes: product_attributes; - }; -}; +/** + * Links are used to allow you to move between requests. + */ +export type MultiLinks = { + /** + * Always the first page. + */ + first?: string + /** + * This is `null` if there is only one page. + */ + last?: string + /** + * This is `null` if there is only one page. + */ + next?: string + /** + * This is `null` if you on the first page. + */ + prev?: string +} -export type attributes = { +export type MultiNodes = { + /** + * An array of nodes. + */ + data?: Array + meta?: MultiMeta + links?: MultiLinks +} + +export type TemplateResponse = { + data?: Array<{ /** - * The name of the node, such as `Ranges` or `Refrigerators`. Names must be unique among sibling nodes in the hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies. + * A unique identifier for a template generated when a template is created. */ - name?: string; + id?: string /** - * A description for a node. + * This represents the type of resource object being returned. Always `template`. */ - description?: string; + type?: "template" + }> +} + +export type ProductTemplatesRequest = { + data?: Array<{ /** - * A slug for the node. Slugs must be unique among sibling nodes in the hierarchy. Otherwise, a slug can be non-unique within the hierarchy and across multiple hierarchies. + * The unique identifier of a template. */ - slug?: string; + id?: string /** - * You can curate your products in your nodes product lists. Product curation allows you to promote specific products within each node in a hierarchy, enabling you to create unique product collections in your storefront. + * This represents the type of resource object being returned. Always `template'. */ - curated_products?: Array<(string)>; + type?: "template" + }> +} + +export type ComponentProductsResponse = { + data?: Array<{ /** - * Product Experience Manager supports localization of hierarchies and nodes. If you store supports multiple languages, you can localize hierarchy and node names and descriptions. + * The unique identifier of a product component generated when a product is created. */ - locales?: { - [key: string]: { - /** - * A localized hierarchy or node name. - */ - name?: string; - /** - * A localized hierarchy or node description. - */ - description?: string; - }; - }; -}; + id?: string + /** + * This represents the type of resource object being returned. Always `product`. + */ + type?: "product" + }> +} -/** - * Relationships allow you to move between requests. Includes links to the child nodes and products associated with a hierarchy or node. - */ -export type relationships = { +export type FileResponse = { + data?: Array<{ /** - * The child nodes related to the resource. + * The unique identifier of the new file. */ - children?: { - /** - * An array of child nodes. - */ - data?: unknown[]; - /** - * Links allow you to move between requests. - */ - links?: { - /** - * A link to a related resource. - */ - related?: string; - }; - }; + id?: string /** - * The parent node related to the resource + * This represents the type of resource object being returned. Always `file`. */ - parent?: { - /** - * The parent node - */ - data?: { - /** - * This represents the type of resource object being returned. Always `node`. - */ - type: 'node'; - /** - * The unique identifier of a node. - */ - id: string; - }; - }; + type?: "file" + }> +} + +export type ProductFilesRequest = { + data?: Array<{ /** - * The products related to the resource. + * A unique identifier for a file generated when a file is created. */ - products?: { - /** - * An array of products. - */ - data?: unknown[]; - /** - * Links allow you to move between requests. - */ - links?: { - /** - * A link to a related resource. - */ - related?: string; - }; - }; -}; + id?: string + /** + * This represents the type of resource being returned. Always `file`. + */ + type?: "file" + meta?: { + /** + * The files associated with a product. + */ + tags?: Array + } + }> +} + +export type VariationsResponse = { + data?: Array<{ + /** + * A unique identifier generated when a variation is created. + */ + id?: string + /** + * This represents the type of resource object being returned. Always `product-variation`. + */ + type?: "product-variation" + meta?: { + /** + * The date and time a resource is created. + */ + created_at?: string + } + }> +} + +export type ProductVariationsRequest = { + data?: Array<{ + /** + * The ID of the product variation. + */ + id?: string + /** + * This represents the type of resource being returned. Always `product-variation`. + */ + type?: "product-variation" + }> +} + +export type MainImageResponse = { + data?: Array<{ + /** + * A unique identifier for the image file generated automatically when a file is created. + */ + id?: string + /** + * This represents the type of resource object being returned. Always `file`. + */ + type?: string + }> +} + +export type ReplaceMainImageRequest = { + data?: Array<{ + /** + * The ID of the new image file. + */ + id?: string + type?: "file" + }> +} + +export type MainImageRequest = { + data?: { + /** + * The ID of the image file. + */ + id?: string + /** + * This represents the type of resource being returned. Always `file`. + */ + type?: "file" + } +} /** - * This represents the type of resource object being returned. Always `node`. + * This represents the type of resource being returned. Always `file`. */ -export type type3 = 'node'; +export type type4 = "file" -export type node = { +export type MultiVariations = { + data?: Array<{ /** - * The unique identifier of a node. + * A unique identifier for a variation. */ - id?: string; + id?: string /** - * This represents the type of resource object being returned. Always `node`. + * This represents the type of resource object being returned. Always `product-variation`. */ - type?: 'node'; - attributes?: attributes; - relationships?: relationships; + type?: "product-variation" + attributes?: { + /** + * The name of a variation. + */ + name?: string + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + */ + sort_order?: number + } meta?: { + options?: Array<{ /** - * The sort order value. The node with the highest value of `sort_order` is displayed first. For example, a node with a `sort_order` value of `3` appears before a node with a `sort_order` value of `2`. See [Sorting Nodes in a hierarchy](/docs/api/pxm/products/create-node#sorting-nodes-in-a-hierarchy). + * A unique ID that is generated when an option is created. */ - sort_order?: number; + id?: string /** - * The date and time a node is created. + * A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. */ - created_at?: string; + name?: string /** - * The date and time a node was updated. + * A human recognizable description of the option. */ - updated_at?: string; + description?: string /** - * The name of the parent of the node if one exists. + * The date and time an option is created. */ - parent_name?: string; + created_at?: string /** - * The node owner, either `organization` or `store`. + * The date and time an option is updated. */ - owner?: 'store' | 'organization'; - }; -}; - -export type multi_meta = { + updated_at?: string + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + */ + sort_order?: number + }> + /** + * The owner of the resource, either `organization` or `store`. + */ + owner?: "organization" | "store" + /** + * The date and time a variation is created. + */ + created_at?: string + /** + * The date and time a variation is updated. + */ + updated_at?: string + } + }> + meta?: { /** * Contains the results for the entire collection. */ results?: { - /** - * Total number of results for the entire collection. - */ - total?: number; - }; -}; + /** + * Total number of results for the entire collection. + */ + total?: number + } + } +} + +export type CreateVariation = { + data: { + /** + * This represents the type of resource object being returned. Always `product-variation`. + */ + type: "product-variation" + attributes: { + /** + * The variation name. + */ + name?: string + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. + * + * The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. + * + * You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + * + * You must rebuild your products for the sort order changes to take effect. + * + */ + sort_order?: number + } + } +} /** - * Links are used to allow you to move between requests. + * This represents the type of resource object being returned. Always `product-variation`. */ -export type multi_links = { +export type type5 = "product-variation" + +export type CreatedVariation = { + data: { + /** + * A unique identifier generated when a variation is created. + */ + id: string + /** + * This represents the type of resource object being returned. Always `product-variation`. + */ + type: "product-variation" + attributes: { + /** + * A human-recognizable identifier for a variation. + */ + name?: string + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + */ + sort_order?: number + } + meta: { + /** + * The owner of the resource, either `organization` or `store`. + */ + owner?: "organization" | "store" + /** + * The date and time a variation is created. + */ + created_at?: string + /** + * The date and time a variation is updated. + */ + updated_at?: string + } + } +} + +export type SingleVariation = { + data: { + /** + * A unique identifier for a variation. + */ + id: string + /** + * This represents the type of resource object being returned. Always `product-variation`. + */ + type: "product-variation" + attributes: { + /** + * The name for a variation. + */ + name?: string + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + */ + sort_order?: number + } + meta: { + /** + * A variation option represents an option for selection for a single product-variation. For example, if your variation is `color`, you might have three possible options; red, green, and blue. + */ + options?: Array<{ + /** + * A unique ID that is generated an option is created. + */ + id?: string + /** + * A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + */ + name?: string + /** + * A description for an option. + */ + description?: string + /** + * The date and time an option is created. + */ + created_at?: string + /** + * The date and time an option is updated. + */ + updated_at?: string + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + */ + sort_order?: number + }> + /** + * The owner of the resource, either `organization` or `store`. + */ + owner?: "organization" | "store" + /** + * The date and time a variation is created. + */ + created_at?: string + /** + * The date and time a variation is updated. + */ + updated_at?: string + } + } +} + +export type UpdateVariation = { + data: { + /** + * This represents the type of resource object being returned. Always `product-variation`. + */ + type: "product-variation" + attributes: { + /** + * The variation name. + */ + name?: string + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. + * + * The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. + * + * You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + * + * You must rebuild your products for the sort order changes to take effect. + * + */ + sort_order?: number + } + /** + * The unique identifier of the variation. Must match the variation ID specified in the request path. + */ + id: string + } +} + +export type MultiOptions = { + data?: Array<{ /** - * Always the first page. + * A unique identifier generated when an option is created. */ - first?: string; + id?: string /** - * This is `null` if there is only one page. + * This represents the type of resource object being returned. Always `product-variation-option`. */ - last?: string; + type?: "product-variation-option" + attributes?: { + /** + * A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + */ + name?: string + /** + * A human-recognizable description for the option. + */ + description?: string + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + */ + sort_order?: number + } + meta?: { + /** + * The owner of a resource, either `organization` or `store`. + */ + owner?: "organization" | "store" + /** + * The date and time an option is created. + */ + created_at?: string + /** + * The date and time an option is updated. + */ + updated_at?: string + } + }> + meta?: { /** - * This is `null` if there is only one page. + * Contains the results for the entire collection. */ - next?: string; + results?: { + /** + * Total number of results for the entire collection. + */ + total?: number + } + } +} + +export type CreateOption = { + data: { + /** + * This represents the type of resource object being returned. Always `product-variation-option`. + */ + type: "product-variation-option" + attributes: { + /** + * A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + */ + name?: string + /** + * By default, variations and variation options are sorted alphabetically. You can use the `sort_order` attribute to sort the order of your variation and variation options in the `variation_matrix`. + * + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. + * + * The variation option with the highest value of `sort_order` is displayed first. For example, a variation option with a `sort_order` value of `3` appears before a variation option with a `sort_order` value of `2`. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, and so on, zero or negative numbers. + * + * You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + * + * You must rebuild your products for the sort order changes to take effect. + * + */ + sort_order?: number + /** + * A description of a product variation option. + */ + description?: string + } + } +} + +/** + * This represents the type of resource object being returned. Always `product-variation-option`. + */ +export type type6 = "product-variation-option" + +export type CreatedOption = { + data: { + /** + * A unique identifier that is generated when an option is created. + */ + id?: string + /** + * This represents the type of resource object being returned. Always `product-variation-option`. + */ + type: "product-variation-option" + attributes: { + /** + * A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + */ + name?: string + /** + * A human-recognizable description for the option. + */ + description?: string + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + */ + sort_order?: number + } + meta?: { + /** + * The owner of a resource, either `organization` or `store`. + */ + owner?: "organization" | "store" + /** + * The date and time an option is created. + */ + created_at?: string + /** + * The date and time an option is updated. + */ + updated_at?: string + } + } +} + +export type SingleOption = { + data: { + /** + * The unique identifier generated when an option is created. + */ + id: string + /** + * This represents the type of resource object being returned. Always `product-variation-option`. + */ + type: "product-variation-option" + /** + * A variation option represents an option for selection for a single product-variation. For example, if your variation is `color`, you might have three possible options; red, green, and blue. + */ + attributes: { + /** + * A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + */ + name?: string + /** + * A human-recognizable description for the option. + */ + description?: string + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + */ + sort_order?: number + } + meta: { + /** + * The owner of a resource, either `organization` or `store`. + */ + owner?: "organization" | "store" + /** + * The date and time an option is created. + */ + created_at?: string + /** + * The date and time an option is updated. + */ + updated_at?: string + } + } +} + +export type UpdateOption = { + data: { + /** + * This represents the type of resource object being returned. Always `product-variation-option`. + */ + type: "product-variation-option" + attributes: { + /** + * A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + */ + name?: string + /** + * The description of the option. + */ + description?: string + /** + * By default, variations and variation options are sorted alphabetically. You can use the `sort_order` attribute to sort the order of your variation and variation options in the `variation_matrix`. The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. + * + * The variation option with the highest value of `sort_order` is displayed first. For example, a variation option with a `sort_order` value of `3` appears before a variation option with a `sort_order` value of `2`. + * + * You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, and so on, zero or negative numbers. + * + * You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + * + * You must rebuild your products for the sort order changes to take effect. + * + */ + sort_order?: number + } + /** + * The unique identifier of the option. Must match the option ID specified in the request path. + */ + id: string + } +} + +export type MultiModifiers = { + data?: Array<{ + /** + * A unique identifier for a modifier that is generated automatically when a modifier is created. + */ + id?: string + /** + * This represents the type of resource object being returned. Always `product-variation-modifier'. + */ + type?: "product-variation-modifier" + attributes?: { + /** + * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + * + * | Modifier | Data Type | Effect | + * | :--- | :--- | :--- | + * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | + * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | + * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | + * | `description_equals` | `string` | Overrides the description of the child product. | + * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | + * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | + * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | + * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | + * | `price_increment` | `string` | Increases the price of the child product. | + * | `price_decrement` | `string` | Decreases the price of the child product. | + * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | + * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `sku_equals` | `string` | Sets the SKU of the child product. | + * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | + * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | + * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | + * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | + * + */ + type?: + | "commodity_type" + | "status" + | "price" + | "name_append" + | "name_prepend" + | "name_equals" + | "sku_append" + | "sku_prepend" + | "sku_equals" + | "sku_builder" + | "slug_append" + | "slug_prepend" + | "slug_equals" + | "slug_builder" + | "description_append" + | "description_prepend" + | "description_equals" + | "custom_inputs_equals" + | "build_rules_equals" + | "locales_equals" + | "upc_ean_equals" + | "mpn_equals" + | "external_ref_equals" + /** + * Required for non-builder modifiers. The value of the modifier type. + */ + value?: string + /** + * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. + */ + seek?: string + /** + * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. + */ + set?: string + /** + * The name of the modifier. + */ + reference_name?: string + } + meta?: { + /** + * The owner of a resource, either `organization` or `store`. + */ + owner?: "store" | "organization" + } + }> + meta?: { /** - * This is `null` if you on the first page. + * Contains the results for the entire collection. */ - prev?: string; -}; + results?: { + /** + * Total number of results for the entire collection. + */ + total?: number + } + } +} + +/** + * Use modifiers to change the properties of child products that are inherited from a parent product. With modifiers, you only need to have one parent product with a variation attached to the product. + */ +export type CreateModifier = { + data: { + /** + * This represents the type of resource object being returned. Always `product-variation-modifier`. + */ + type: "product-variation-modifier" + attributes: { + /** + * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + * + * | Modifier | Data Type | Effect | + * | :--- | :--- | :--- | + * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | + * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | + * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | + * | `description_equals` | `string` | Overrides the description of the child product. | + * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | + * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | + * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | + * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | + * | `price_increment` | `string` | Increases the price of the child product. | + * | `price_decrement` | `string` | Decreases the price of the child product. | + * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | + * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `sku_equals` | `string` | Sets the SKU of the child product. | + * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | + * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | + * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | + * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | + * + */ + type: + | "commodity_type" + | "status" + | "price" + | "name_append" + | "name_prepend" + | "name_equals" + | "sku_append" + | "sku_prepend" + | "sku_equals" + | "sku_builder" + | "slug_append" + | "slug_prepend" + | "slug_equals" + | "slug_builder" + | "description_append" + | "description_prepend" + | "description_equals" + | "custom_inputs_equals" + | "build_rules_equals" + | "locales_equals" + | "upc_ean_equals" + | "mpn_equals" + | "external_ref_equals" + /** + * Required for non-builder modifiers. The value of the modifier type. + */ + value?: string + /** + * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. + */ + seek?: string + /** + * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. + */ + set?: string + /** + * A name for the modifier. + */ + reference_name?: string + } + } +} + +/** + * This represents the type of resource object being returned. Always `product-variation-modifier`. + */ +export type type7 = "product-variation-modifier" -export type multi_nodes = { +export type CreatedModifier = { + data?: { + /** + * A unique identifier for a modifier that is generated automatically when a modifier is created. + */ + id?: string /** - * An array of nodes. + * This represents the type of resource object being returned. Always `product-variation-modifier'. */ - data?: Array; - meta?: multi_meta; - links?: multi_links; -}; + type?: "product-variation-modifier" + attributes?: { + /** + * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + * + * | Modifier | Data Type | Effect | + * | :--- | :--- | :--- | + * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | + * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | + * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | + * | `description_equals` | `string` | Overrides the description of the child product. | + * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | + * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | + * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | + * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | + * | `price_increment` | `string` | Increases the price of the child product. | + * | `price_decrement` | `string` | Decreases the price of the child product. | + * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | + * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `sku_equals` | `string` | Sets the SKU of the child product. | + * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | + * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | + * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | + * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | + * + */ + type?: + | "commodity_type" + | "status" + | "price" + | "name_append" + | "name_prepend" + | "name_equals" + | "sku_append" + | "sku_prepend" + | "sku_equals" + | "sku_builder" + | "slug_append" + | "slug_prepend" + | "slug_equals" + | "slug_builder" + | "description_append" + | "description_prepend" + | "description_equals" + | "custom_inputs_equals" + | "build_rules_equals" + | "locales_equals" + | "upc_ean_equals" + | "mpn_equals" + | "external_ref_equals" + /** + * Required for non-builder modifiers. The value of the modifier type. + */ + value?: string + /** + * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. + */ + seek?: string + /** + * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. + */ + set?: string + /** + * The name of the modifier. + */ + reference_name?: string + } + meta?: { + /** + * The owner of the resource, either `organization` or `store`. + */ + owner?: "organization" | "store" + } + } +} -export type template_response = { - data?: Array<{ - /** - * A unique identifier for a template generated when a template is created. - */ - id?: string; - /** - * This represents the type of resource object being returned. Always `template`. - */ - type?: 'template'; - }>; -}; +export type SingleModifier = { + data?: { + /** + * A unique identifier for a modifier that is generated automatically when a modifier is created. + */ + id?: string + /** + * This represents the type of resource object being returned. Always `product-variation-modifier'. + */ + type?: "product-variation-modifier" + attributes?: { + /** + * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + * + * | Modifier | Data Type | Effect | + * | :--- | :--- | :--- | + * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | + * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | + * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | + * | `description_equals` | `string` | Overrides the description of the child product. | + * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | + * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | + * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | + * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | + * | `price_increment` | `string` | Increases the price of the child product. | + * | `price_decrement` | `string` | Decreases the price of the child product. | + * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | + * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `sku_equals` | `string` | Sets the SKU of the child product. | + * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | + * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | + * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | + * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | + * + */ + type?: + | "commodity_type" + | "status" + | "price" + | "name_append" + | "name_prepend" + | "name_equals" + | "sku_append" + | "sku_prepend" + | "sku_equals" + | "sku_builder" + | "slug_append" + | "slug_prepend" + | "slug_equals" + | "slug_builder" + | "description_append" + | "description_prepend" + | "description_equals" + | "custom_inputs_equals" + | "build_rules_equals" + | "locales_equals" + | "upc_ean_equals" + | "mpn_equals" + | "external_ref_equals" + /** + * Required for non-builder modifiers. The value of the modifier type. + */ + value?: string + /** + * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. + */ + seek?: string + /** + * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. + */ + set?: string + /** + * The name of the modifier. + */ + reference_name?: string + } + /** + * The owner of the resource, either `organization` or `store`. + */ + meta?: { + owner?: "organization" | "store" + } + } +} + +export type UpdateModifier = { + data: { + /** + * This represents the type of resource object being returned. Always `product-variation-modifier`. + */ + type: "product-variation-modifier" + attributes: { + /** + * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + * + * | Modifier | Data Type | Effect | + * | :--- | :--- | :--- | + * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | + * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | + * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | + * | `description_equals` | `string` | Overrides the description of the child product. | + * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | + * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | + * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | + * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | + * | `price_increment` | `string` | Increases the price of the child product. | + * | `price_decrement` | `string` | Decreases the price of the child product. | + * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | + * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `sku_equals` | `string` | Sets the SKU of the child product. | + * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | + * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | + * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | + * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | + * + */ + type: + | "commodity_type" + | "status" + | "price" + | "name_append" + | "name_prepend" + | "name_equals" + | "sku_append" + | "sku_prepend" + | "sku_equals" + | "sku_builder" + | "slug_append" + | "slug_prepend" + | "slug_equals" + | "slug_builder" + | "description_append" + | "description_prepend" + | "description_equals" + | "custom_inputs_equals" + | "build_rules_equals" + | "locales_equals" + | "upc_ean_equals" + | "mpn_equals" + | "external_ref_equals" + /** + * Required for non-builder modifiers. The value of the modifier type. + */ + value?: string + /** + * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. + */ + seek?: string + /** + * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. + */ + set?: string + /** + * The name of the modifier. + */ + reference_name?: string + } + /** + * The unique identifier of the modifier. Must match the modifier ID specified in the request path. + */ + id: string + } +} + +export type AttributesHierarchy = { + /** + * The name of a hierarchy, such as `Major Appliances`. + */ + name?: string + /** + * A description for a hierarchy. + */ + description?: string + /** + * A unique slug for a hierarchy. + */ + slug?: string + /** + * Product Experience Manager supports localization of hierarchies and nodes. If you store supports multiple languages, you can localize hierarchy and node names and descriptions. + */ + locales?: { + [key: string]: { + /** + * A localized hierarchy or node name. + */ + name?: string + /** + * A localized hierarchy or node description. + */ + description?: string + } + } +} + +export type RelationshipsHierarchy = { + /** + * The child nodes related to the hierarchy. + */ + children?: { + /** + * An array of child nodes. + */ + data?: unknown[] + /** + * Links allow you to move between requests. + */ + links?: { + /** + * A link to a related resource. + */ + related?: string + } + } +} + +export type Hierarchy = { + /** + * A unique identifier generated when a hierarchy is created. + */ + id?: string + /** + * This represents the type of resource object being returned. Always `hierarchy`. + */ + type?: "hierarchy" + attributes?: AttributesHierarchy + relationships?: RelationshipsHierarchy + meta?: { + /** + * The date and time a hierarchy is created. + */ + created_at?: string + /** + * The date and time a hierarchy is updated. + */ + updated_at?: string + /** + * The owner of a resource, either `organization` or `store`. + */ + owner?: "store" | "organization" + } +} -export type product_templates_request = { - data?: Array<{ - /** - * The unique identifier of a template. - */ - id?: string; - /** - * This represents the type of resource object being returned. Always `template'. - */ - type?: 'template'; - }>; -}; +/** + * This represents the type of resource object being returned. Always `hierarchy`. + */ +export type type8 = "hierarchy" + +export type MultiHierarchy = { + data?: Array + links?: MultiLinks + meta?: MultiMeta +} + +export type ReqAttributesHierarchy = { + /** + * The name of the hierarchy, such as `Major Appliances`. + */ + name?: string + /** + * A description of the hierarchy. + */ + description?: string + /** + * A unique slug for the hierarchy. + */ + slug?: string + /** + * Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. + */ + locales?: { + [key: string]: { + /** + * A localized name for the hierarchy. + */ + name?: string + /** + * A localized description for the hierarchy. + */ + description?: string + } + } +} + +export type CreateHierarchy = { + data?: { + /** + * This represents the type of resource object being returned. Always `hierarchy`. + */ + type: "hierarchy" + attributes: ReqAttributesHierarchy + } +} -export type component_products_response = { - data?: Array<{ - /** - * The unique identifier of a product component generated when a product is created. - */ - id?: string; - /** - * This represents the type of resource object being returned. Always `product`. - */ - type?: 'product'; - }>; -}; +export type SingleHierarchy = { + data?: Hierarchy +} -export type file_response = { - data?: Array<{ - /** - * The unique identifier of the new file. - */ - id?: string; - /** - * This represents the type of resource object being returned. Always `file`. - */ - type?: 'file'; - }>; -}; +export type UpdateHierarchy = { + data: { + /** + * The unique identifier of the hierarchy. Must match the hierarchy ID specified in the request path. + */ + id: string + /** + * This represents the type of resource object being returned. Always `hierarchy`. + */ + type: "hierarchy" + attributes: ReqAttributesHierarchy + } +} + +export type AttributesNodes = { + /** + * The name of the node, such as `Ranges` or `Refrigerators`. Names must be unique among sibling nodes in the hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies. + */ + name?: string + /** + * A description of the node. + */ + description?: string + /** + * A slug for the node. Slugs must be unique among sibling nodes in the hierarchy. Otherwise, a slug can be non-unique within the hierarchy and across multiple hierarchies. + */ + slug?: string + /** + * You can curate your products in your nodes product lists. Product curation allows you to promote specific products within each node in a hierarchy, enabling you to create unique product collections in your storefront. See [Curating Products in a node](/docs/api/pxm/products/create-node#curating-products-in-a-node). + */ + curated_products?: Array + /** + * Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. + */ + locales?: { + [key: string]: { + /** + * A localized name for the node. + */ + name?: string + /** + * A localized description for the node. + */ + description?: string + } + } +} + +export type CreateNode = { + data?: { + /** + * This represents the type of resource object being returned. Always `node`. + */ + type: "node" + attributes: AttributesNodes + meta?: { + /** + * You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. The `sort_order` for each node. This value determines the order of nodes in the response for the `Get a Node’s Children` request. The node with the highest value of sort_order is displayed first. For example, a node with a sort_order value of 3 appears before a node with a sort_order value of 2. + * + * - If you don’t provide `sort_order` when creating nodes, all child nodes in the response for `Get a Node’s Children` request are ordered by the `updated_at` time in descending order, with the most recently updated child node first. + * - If you set `sort_order` for only a few child nodes or not all, the child nodes with a `sort_order` value appear first and then other child nodes appear in the order of `updated_at` time. See [Sorting Nodes in a hierarchy](). + * + */ + sort_order?: number + } + } +} -export type product_files_request = { - data?: Array<{ - /** - * A unique identifier for a file generated when a file is created. - */ - id?: string; - /** - * This represents the type of resource being returned. Always `file`. - */ - type?: 'file'; - meta?: { - /** - * The files associated with a product. - */ - tags?: Array<(string)>; - }; - }>; -}; +export type SingleNode = { + data?: Node +} -export type variations_response = { - data?: Array<{ - /** - * A unique identifier generated when a variation is created. - */ - id?: string; - /** - * This represents the type of resource object being returned. Always `product-variation`. - */ - type?: 'product-variation'; - meta?: { - /** - * The date and time a resource is created. - */ - created_at?: string; - }; - }>; -}; +export type UpdateNode = { + data?: { + /** + * The unique identifier of the node. Must match the node ID specified in the request path. + */ + id: string + /** + * This represents the type of resource object being returned. Always `node`. + */ + type: "node" + attributes: AttributesNodes + meta?: { + /** + * You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. The `sort_order` for each node. This value determines the order of nodes in the response for the `Get a Node’s Children` request. The node with the highest value of sort_order is displayed first. For example, a node with a sort_order value of 3 appears before a node with a sort_order value of 2. + * + * - If you don’t provide `sort_order` when creating nodes, all child nodes in the response for `Get a Node’s Children` request are ordered by the `updated_at` time in descending order, with the most recently updated child node first. + * - If you set `sort_order` for only a few child nodes or not all, the child nodes with a `sort_order` value appear first and then other child nodes appear in the order of `updated_at` time. + * + */ + sort_order?: number + } + } +} -export type product_variations_request = { - data?: Array<{ - /** - * The ID of the product variation. - */ - id?: string; - /** - * This represents the type of resource being returned. Always `product-variation`. - */ - type?: 'product-variation'; - }>; -}; +export type NodeChildren = { + data?: Array<{ + /** + * The unique identifier of the child node. Must not match the node ID specified in the request path. + */ + id: string + /** + * This represents the type of resource object being returned. Always `node`. + */ + type: "node" + }> +} -export type main_image_response = { - data?: Array<{ - /** - * A unique identifier for the image file generated automatically when a file is created. - */ - id?: string; - /** - * This represents the type of resource object being returned. Always `file`. - */ - type?: string; - }>; -}; +export type NodeParent = { + data?: { + /** + * The unique identifier of the new parent node. Must not match the node ID specified in the request path. + */ + id: string + /** + * This represents the type of resource object being returned. Always `node`. + */ + type: "node" + } +} -export type replace_main_image_request = { - data?: Array<{ - /** - * The ID of the new image file. - */ - id?: string; - type?: 'file'; - }>; -}; +export type NodeProducts = { + data?: Array<{ + /** + * The unique identifier of the product to be attached to the node. + */ + id: string + /** + * This represents the type of resource object being returned. Always `product`. + */ + type: "product" + }> +} -export type main_image_request = { - data?: { - /** - * The ID of the image file. - */ - id?: string; - /** - * This represents the type of resource being returned. Always `file`. - */ - type?: 'file'; - }; -}; +export type DuplicateJob = { + data?: { + /** + * This represents the type of resource object being returned. Always `hierarchy`. + */ + type?: "hierarchy" + attributes?: { + /** + * The name of the duplicate hierarchy. The maximum length is 1000 characters. + */ + name?: string + /** + * A description of the duplicate hierarchy. + */ + description?: string + /** + * Specify `true` if you want the product associations in the existing nodes associated in your duplicated hierarchy. If not, specify `false`. + */ + include_products?: boolean + } + } +} + +export type Tag = { + /** + * A unique identifier generated when a tag is created. + */ + id?: string + /** + * This represents the type of resource object being returned. Always `tag`. + */ + type?: "tag" + attributes?: { + /** + * The text value of the tag. + */ + value?: string + } + meta?: { + /** + * A unique request ID is generated when a tag is created. + */ + x_request_id?: string + /** + * The date and time a tag is created. + */ + created_at?: string + /** + * The date and time a tag is updated. + */ + updated_at?: string + /** + * The owner of a resource, either `organization` or `store`. + */ + owner?: "store" | "organization" + } +} /** - * This represents the type of resource being returned. Always `file`. + * This represents the type of resource object being returned. Always `tag`. */ -export type type4 = 'file'; +export type type9 = "tag" -export type multi_variations = { - data?: Array<{ - /** - * A unique identifier for a variation. - */ - id?: string; - /** - * This represents the type of resource object being returned. Always `product-variation`. - */ - type?: 'product-variation'; - attributes?: { - /** - * The name of a variation. - */ - name?: string; - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - */ - sort_order?: number; - }; - meta?: { - options?: Array<{ - /** - * A unique ID that is generated when an option is created. - */ - id?: string; - /** - * A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. - */ - name?: string; - /** - * A human recognizable description of the option. - */ - description?: string; - /** - * The date and time an option is created. - */ - created_at?: string; - /** - * The date and time an option is updated. - */ - updated_at?: string; - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - */ - sort_order?: number; - }>; - /** - * The owner of the resource, either `organization` or `store`. - */ - owner?: 'organization' | 'store'; - /** - * The date and time a variation is created. - */ - created_at?: string; - /** - * The date and time a variation is updated. - */ - updated_at?: string; - }; - }>; - meta?: { - /** - * Contains the results for the entire collection. - */ - results?: { - /** - * Total number of results for the entire collection. - */ - total?: number; - }; - }; -}; +export type MultiTag = { + /** + * An array of tags. + */ + data?: Array + meta?: { + /** + * Contains the results for the entire collection. + */ + results?: { + /** + * Total number of results for the entire collection. + */ + total?: number + } + } +} + +export type SingleTag = { + data?: Tag +} + +export type ReqAttributesCustomRelationship = { + /** + * The name of the custom relationship, such as `Kitchen electrics`. + */ + name?: string + /** + * A description of the custom relationship. + */ + description?: string + /** + * A unique slug for the custom relationship. Must match the slug specified in the request path. + */ + slug?: string +} + +export type CreateCustomRelationship = { + data?: { + /** + * This represents the type of resource object being returned. Always `custom-relationship`. + */ + type: "custom-relationship" + attributes: ReqAttributesCustomRelationship + } +} -export type create_variation = { - data: { - /** - * This represents the type of resource object being returned. Always `product-variation`. - */ - type: 'product-variation'; - attributes: { - /** - * The variation name. - */ - name?: string; - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. - * - * The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. - * - * You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - * - * You must rebuild your products for the sort order changes to take effect. - * - */ - sort_order?: number; - }; - }; -}; +/** + * This represents the type of resource object being returned. Always `custom-relationship`. + */ +export type type10 = "custom-relationship" + +export type AttributesCustomRelationship = { + /** + * The name of the custom relationship, such as `Kitchen electrics`. + */ + name?: string + /** + * A description of the custom relationship. + */ + description?: string + /** + * A unique slug for the custom relationship. + */ + slug?: string +} + +export type CustomRelationship = { + /** + * A unique identifier generated when a custom relationship is created. + */ + id?: string + /** + * This represents the type of resource object being returned. Always `hierarchy`. + */ + type?: "custom-relationship" + attributes?: AttributesCustomRelationship + meta?: { + /** + * The owner of the resource. + */ + owner?: string + timestamps?: { + /** + * The date and time the resource is created. + */ + created_at?: string + /** + * The date and time the resource is updated. + */ + updated_at?: string + } + } +} + +export type SingleCustomRelationship = { + data?: CustomRelationship +} + +export type UpdateCustomRelationship = { + data: { + /** + * The unique identifier of the custom relationship. + */ + id: string + /** + * This represents the type of resource object being returned. Always `custom-relationship`. + */ + type: "custom-relationship" + attributes: ReqAttributesCustomRelationship + } +} /** - * This represents the type of resource object being returned. Always `product-variation`. + * A unique identifier for the job. */ -export type type5 = 'product-variation'; +export type ParameterJobId = string -export type created_variation = { - data: { - /** - * A unique identifier generated when a variation is created. - */ - id: string; - /** - * This represents the type of resource object being returned. Always `product-variation`. - */ - type: 'product-variation'; - attributes: { - /** - * A human-recognizable identifier for a variation. - */ - name?: string; - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - */ - sort_order?: number; - }; - meta: { - /** - * The owner of the resource, either `organization` or `store`. - */ - owner?: 'organization' | 'store'; - /** - * The date and time a variation is created. - */ - created_at?: string; - /** - * The date and time a variation is updated. - */ - updated_at?: string; - }; - }; -}; +/** + * The number of records to offset the results by. + */ +export type ParameterPageOffset = number -export type single_variation = { - data: { - /** - * A unique identifier for a variation. - */ - id: string; - /** - * This represents the type of resource object being returned. Always `product-variation`. - */ - type: 'product-variation'; - attributes: { - /** - * The name for a variation. - */ - name?: string; - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - */ - sort_order?: number; - }; - meta: { - /** - * A variation option represents an option for selection for a single product-variation. For example, if your variation is `color`, you might have three possible options; red, green, and blue. - */ - options?: Array<{ - /** - * A unique ID that is generated an option is created. - */ - id?: string; - /** - * A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. - */ - name?: string; - /** - * A description for an option. - */ - description?: string; - /** - * The date and time an option is created. - */ - created_at?: string; - /** - * The date and time an option is updated. - */ - updated_at?: string; - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - */ - sort_order?: number; - }>; - /** - * The owner of the resource, either `organization` or `store`. - */ - owner?: 'organization' | 'store'; - /** - * The date and time a variation is created. - */ - created_at?: string; - /** - * The date and time a variation is updated. - */ - updated_at?: string; - }; - }; -}; +/** + * The number of records per page. The maximum limit is 100. + */ +export type ParameterPageLimit = number -export type update_variation = { - data: { - /** - * This represents the type of resource object being returned. Always `product-variation`. - */ - type: 'product-variation'; - attributes: { - /** - * The variation name. - */ - name?: string; - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. - * - * The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. - * - * You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - * - * You must rebuild your products for the sort order changes to take effect. - * - */ - sort_order?: number; - }; - /** - * The unique identifier of the variation. Must match the variation ID specified in the request path. - */ - id: string; - }; -}; +/** + * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering). + * + * For more information about the attributes and operators that are supported, see [Get all products](/docs/api/pxm/products/get-all-products). + * + */ +export type ParameterFilterproduct = string -export type multi_options = { - data?: Array<{ - /** - * A unique identifier generated when an option is created. - */ - id?: string; - /** - * This represents the type of resource object being returned. Always `product-variation-option`. - */ - type?: 'product-variation-option'; - attributes?: { - /** - * A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. - */ - name?: string; - /** - * A human-recognizable description for the option. - */ - description?: string; - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - */ - sort_order?: number; - }; - meta?: { - /** - * The owner of a resource, either `organization` or `store`. - */ - owner?: 'organization' | 'store'; - /** - * The date and time an option is created. - */ - created_at?: string; - /** - * The date and time an option is updated. - */ - updated_at?: string; - }; - }>; - meta?: { - /** - * Contains the results for the entire collection. - */ - results?: { - /** - * Total number of results for the entire collection. - */ - total?: number; - }; - }; -}; +/** + * Using the include parameter, you can retrieve top-level resources. + * + * - Files or main image. For example, `include=files,main_image`. + * - Component product data. For example, `include=component_products`. + * - Key attribute data, such as SKU or slug. + * + */ +export type ParameterInclude = string -export type create_option = { - data: { - /** - * This represents the type of resource object being returned. Always `product-variation-option`. - */ - type: 'product-variation-option'; - attributes: { - /** - * A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. - */ - name?: string; - /** - * By default, variations and variation options are sorted alphabetically. You can use the `sort_order` attribute to sort the order of your variation and variation options in the `variation_matrix`. - * - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. - * - * The variation option with the highest value of `sort_order` is displayed first. For example, a variation option with a `sort_order` value of `3` appears before a variation option with a `sort_order` value of `2`. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, and so on, zero or negative numbers. - * - * You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - * - * You must rebuild your products for the sort order changes to take effect. - * - */ - sort_order?: number; - /** - * A description of a product variation option. - */ - description?: string; - }; - }; -}; +/** + * Set to `true` if you want to use a template slug instead of a template ID when exporting products that have custom data. + */ +export type ParameterUseTemplateSlugs = boolean /** - * This represents the type of resource object being returned. Always `product-variation-option`. + * + * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering), but you must go to a specific endpoint to understand the attributes and operators an endpoint supports. + * + * For more information about the attributes and operators that this endpoint supports, see [Export Products](/docs/api/pxm/products/export-products). + * */ -export type type6 = 'product-variation-option'; +export type ParameterFilterexport = string -export type created_option = { - data: { - /** - * A unique identifier that is generated when an option is created. - */ - id?: string; - /** - * This represents the type of resource object being returned. Always `product-variation-option`. - */ - type: 'product-variation-option'; - attributes: { - /** - * A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. - */ - name?: string; - /** - * A human-recognizable description for the option. - */ - description?: string; - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - */ - sort_order?: number; - }; - meta?: { - /** - * The owner of a resource, either `organization` or `store`. - */ - owner?: 'organization' | 'store'; - /** - * The date and time an option is created. - */ - created_at?: string; - /** - * The date and time an option is updated. - */ - updated_at?: string; - }; - }; -}; +/** + * A unique identifier for the product. + */ +export type ParameterProductId = string -export type single_option = { - data: { - /** - * The unique identifier generated when an option is created. - */ - id: string; - /** - * This represents the type of resource object being returned. Always `product-variation-option`. - */ - type: 'product-variation-option'; - /** - * A variation option represents an option for selection for a single product-variation. For example, if your variation is `color`, you might have three possible options; red, green, and blue. - */ - attributes: { - /** - * A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. - */ - name?: string; - /** - * A human-recognizable description for the option. - */ - description?: string; - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - */ - sort_order?: number; - }; - meta: { - /** - * The owner of a resource, either `organization` or `store`. - */ - owner?: 'organization' | 'store'; - /** - * The date and time an option is created. - */ - created_at?: string; - /** - * The date and time an option is updated. - */ - updated_at?: string; - }; - }; -}; +/** + * A unique identifier for the variation. + */ +export type ParameterVariationId = string -export type update_option = { - data: { - /** - * This represents the type of resource object being returned. Always `product-variation-option`. - */ - type: 'product-variation-option'; - attributes: { - /** - * A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. - */ - name?: string; - /** - * The description of the option. - */ - description?: string; - /** - * By default, variations and variation options are sorted alphabetically. You can use the `sort_order` attribute to sort the order of your variation and variation options in the `variation_matrix`. The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. - * - * The variation option with the highest value of `sort_order` is displayed first. For example, a variation option with a `sort_order` value of `3` appears before a variation option with a `sort_order` value of `2`. - * - * You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, and so on, zero or negative numbers. - * - * You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - * - * You must rebuild your products for the sort order changes to take effect. - * - */ - sort_order?: number; - }; - /** - * The unique identifier of the option. Must match the option ID specified in the request path. - */ - id: string; - }; -}; +/** + * A unique identifier for the option. + */ +export type ParameterOptionId = string -export type multi_modifiers = { - data?: Array<{ - /** - * A unique identifier for a modifier that is generated automatically when a modifier is created. - */ - id?: string; - /** - * This represents the type of resource object being returned. Always `product-variation-modifier'. - */ - type?: 'product-variation-modifier'; - attributes?: { - /** - * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. - * - * | Modifier | Data Type | Effect | - * | :--- | :--- | :--- | - * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | - * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | - * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | - * | `description_equals` | `string` | Overrides the description of the child product. | - * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | - * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | - * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | - * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | - * | `price_increment` | `string` | Increases the price of the child product. | - * | `price_decrement` | `string` | Decreases the price of the child product. | - * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | - * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `sku_equals` | `string` | Sets the SKU of the child product. | - * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | - * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | - * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | - * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | - * - */ - type?: 'commodity_type' | 'status' | 'price' | 'name_append' | 'name_prepend' | 'name_equals' | 'sku_append' | 'sku_prepend' | 'sku_equals' | 'sku_builder' | 'slug_append' | 'slug_prepend' | 'slug_equals' | 'slug_builder' | 'description_append' | 'description_prepend' | 'description_equals' | 'custom_inputs_equals' | 'build_rules_equals' | 'locales_equals' | 'upc_ean_equals' | 'mpn_equals' | 'external_ref_equals'; - /** - * Required for non-builder modifiers. The value of the modifier type. - */ - value?: string; - /** - * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. - */ - seek?: string; - /** - * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. - */ - set?: string; - /** - * The name of the modifier. - */ - reference_name?: string; - }; - meta?: { - /** - * The owner of a resource, either `organization` or `store`. - */ - owner?: 'store' | 'organization'; - }; - }>; - meta?: { - /** - * Contains the results for the entire collection. - */ - results?: { - /** - * Total number of results for the entire collection. - */ - total?: number; - }; - }; -}; +/** + * A unique identifier for the modifier. + */ +export type ParameterModifierId = string /** - * Use modifiers to change the properties of child products that are inherited from a parent product. With modifiers, you only need to have one parent product with a variation attached to the product. + * A unique identifier for the hierarchy. */ -export type create_modifier = { - data: { - /** - * This represents the type of resource object being returned. Always `product-variation-modifier`. - */ - type: 'product-variation-modifier'; - attributes: { - /** - * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. - * - * | Modifier | Data Type | Effect | - * | :--- | :--- | :--- | - * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | - * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | - * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | - * | `description_equals` | `string` | Overrides the description of the child product. | - * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | - * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | - * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | - * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | - * | `price_increment` | `string` | Increases the price of the child product. | - * | `price_decrement` | `string` | Decreases the price of the child product. | - * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | - * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `sku_equals` | `string` | Sets the SKU of the child product. | - * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | - * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | - * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | - * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | - * - */ - type: 'commodity_type' | 'status' | 'price' | 'name_append' | 'name_prepend' | 'name_equals' | 'sku_append' | 'sku_prepend' | 'sku_equals' | 'sku_builder' | 'slug_append' | 'slug_prepend' | 'slug_equals' | 'slug_builder' | 'description_append' | 'description_prepend' | 'description_equals' | 'custom_inputs_equals' | 'build_rules_equals' | 'locales_equals' | 'upc_ean_equals' | 'mpn_equals' | 'external_ref_equals'; - /** - * Required for non-builder modifiers. The value of the modifier type. - */ - value?: string; - /** - * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. - */ - seek?: string; - /** - * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. - */ - set?: string; - /** - * A name for the modifier. - */ - reference_name?: string; - }; - }; -}; +export type ParameterHierarchyId = string /** - * This represents the type of resource object being returned. Always `product-variation-modifier`. + * A unique identifier for the node. */ -export type type7 = 'product-variation-modifier'; +export type ParameterNodeId = string -export type created_modifier = { - data?: { - /** - * A unique identifier for a modifier that is generated automatically when a modifier is created. - */ - id?: string; - /** - * This represents the type of resource object being returned. Always `product-variation-modifier'. - */ - type?: 'product-variation-modifier'; - attributes?: { - /** - * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. - * - * | Modifier | Data Type | Effect | - * | :--- | :--- | :--- | - * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | - * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | - * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | - * | `description_equals` | `string` | Overrides the description of the child product. | - * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | - * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | - * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | - * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | - * | `price_increment` | `string` | Increases the price of the child product. | - * | `price_decrement` | `string` | Decreases the price of the child product. | - * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | - * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `sku_equals` | `string` | Sets the SKU of the child product. | - * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | - * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | - * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | - * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | - * - */ - type?: 'commodity_type' | 'status' | 'price' | 'name_append' | 'name_prepend' | 'name_equals' | 'sku_append' | 'sku_prepend' | 'sku_equals' | 'sku_builder' | 'slug_append' | 'slug_prepend' | 'slug_equals' | 'slug_builder' | 'description_append' | 'description_prepend' | 'description_equals' | 'custom_inputs_equals' | 'build_rules_equals' | 'locales_equals' | 'upc_ean_equals' | 'mpn_equals' | 'external_ref_equals'; - /** - * Required for non-builder modifiers. The value of the modifier type. - */ - value?: string; - /** - * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. - */ - seek?: string; - /** - * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. - */ - set?: string; - /** - * The name of the modifier. - */ - reference_name?: string; - }; - meta?: { - /** - * The owner of the resource, either `organization` or `store`. - */ - owner?: 'organization' | 'store'; - }; - }; -}; +/** + * A unique identifier for the tag. + */ +export type ParameterTagId = string -export type single_modifier = { - data?: { - /** - * A unique identifier for a modifier that is generated automatically when a modifier is created. - */ - id?: string; - /** - * This represents the type of resource object being returned. Always `product-variation-modifier'. - */ - type?: 'product-variation-modifier'; - attributes?: { - /** - * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. - * - * | Modifier | Data Type | Effect | - * | :--- | :--- | :--- | - * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | - * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | - * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | - * | `description_equals` | `string` | Overrides the description of the child product. | - * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | - * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | - * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | - * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | - * | `price_increment` | `string` | Increases the price of the child product. | - * | `price_decrement` | `string` | Decreases the price of the child product. | - * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | - * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `sku_equals` | `string` | Sets the SKU of the child product. | - * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | - * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | - * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | - * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | - * - */ - type?: 'commodity_type' | 'status' | 'price' | 'name_append' | 'name_prepend' | 'name_equals' | 'sku_append' | 'sku_prepend' | 'sku_equals' | 'sku_builder' | 'slug_append' | 'slug_prepend' | 'slug_equals' | 'slug_builder' | 'description_append' | 'description_prepend' | 'description_equals' | 'custom_inputs_equals' | 'build_rules_equals' | 'locales_equals' | 'upc_ean_equals' | 'mpn_equals' | 'external_ref_equals'; - /** - * Required for non-builder modifiers. The value of the modifier type. - */ - value?: string; - /** - * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. - */ - seek?: string; - /** - * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. - */ - set?: string; - /** - * The name of the modifier. - */ - reference_name?: string; - }; - /** - * The owner of the resource, either `organization` or `store`. - */ - meta?: { - owner?: 'organization' | 'store'; - }; - }; -}; +/** + * A custom relationship slug. + */ +export type ParameterCustomRelationshipSlug = string -export type update_modifier = { - data: { - /** - * This represents the type of resource object being returned. Always `product-variation-modifier`. - */ - type: 'product-variation-modifier'; - attributes: { - /** - * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. - * - * | Modifier | Data Type | Effect | - * | :--- | :--- | :--- | - * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | - * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | - * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | - * | `description_equals` | `string` | Overrides the description of the child product. | - * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | - * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | - * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | - * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | - * | `price_increment` | `string` | Increases the price of the child product. | - * | `price_decrement` | `string` | Decreases the price of the child product. | - * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | - * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `sku_equals` | `string` | Sets the SKU of the child product. | - * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | - * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | - * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | - * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | - * - */ - type: 'commodity_type' | 'status' | 'price' | 'name_append' | 'name_prepend' | 'name_equals' | 'sku_append' | 'sku_prepend' | 'sku_equals' | 'sku_builder' | 'slug_append' | 'slug_prepend' | 'slug_equals' | 'slug_builder' | 'description_append' | 'description_prepend' | 'description_equals' | 'custom_inputs_equals' | 'build_rules_equals' | 'locales_equals' | 'upc_ean_equals' | 'mpn_equals' | 'external_ref_equals'; - /** - * Required for non-builder modifiers. The value of the modifier type. - */ - value?: string; - /** - * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. - */ - seek?: string; - /** - * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. - */ - set?: string; - /** - * The name of the modifier. - */ - reference_name?: string; - }; - /** - * The unique identifier of the modifier. Must match the modifier ID specified in the request path. - */ - id: string; - }; -}; +export type GetAllJobsResponse = Multi -export type attributes_hierarchy = { - /** - * The name of a hierarchy, such as `Major Appliances`. - */ - name?: string; - /** - * A description for a hierarchy. - */ - description?: string; +export type GetAllJobsError = Error + +export type GetJobData = { + path: { /** - * A unique slug for a hierarchy. + * A unique identifier for the job. */ - slug?: string; + jobID: string + } +} + +export type GetJobResponse = Single + +export type GetJobError = Error + +export type CancelJobData = { + body?: { + [key: string]: unknown + } + path: { /** - * Product Experience Manager supports localization of hierarchies and nodes. If you store supports multiple languages, you can localize hierarchy and node names and descriptions. + * A unique identifier for the job. */ - locales?: { - [key: string]: { - /** - * A localized hierarchy or node name. - */ - name?: string; - /** - * A localized hierarchy or node description. - */ - description?: string; - }; - }; -}; + jobID: string + } +} + +export type CancelJobResponse = Single -export type relationships_hierarchy = { +export type CancelJobError = Error + +export type GetJobErrorsData = { + path: { /** - * The child nodes related to the hierarchy. + * A unique identifier for the job. */ - children?: { - /** - * An array of child nodes. - */ - data?: unknown[]; - /** - * Links allow you to move between requests. - */ - links?: { - /** - * A link to a related resource. - */ - related?: string; - }; - }; -}; + jobID: string + } +} -export type hierarchy = { - /** - * A unique identifier generated when a hierarchy is created. - */ - id?: string; - /** - * This represents the type of resource object being returned. Always `hierarchy`. - */ - type?: 'hierarchy'; - attributes?: attributes_hierarchy; - relationships?: relationships_hierarchy; - meta?: { - /** - * The date and time a hierarchy is created. - */ - created_at?: string; - /** - * The date and time a hierarchy is updated. - */ - updated_at?: string; - /** - * The owner of a resource, either `organization` or `store`. - */ - owner?: 'store' | 'organization'; - }; -}; +export type GetJobErrorsResponse = Errors -/** - * This represents the type of resource object being returned. Always `hierarchy`. - */ -export type type8 = 'hierarchy'; +export type GetJobErrorsError = Error + +export type CreateProductData = { + body: CreateProductRequest +} -export type multi_hierarchy = { - data?: Array; - links?: multi_links; - meta?: multi_meta; -}; +export type CreateProductResponse = SingleProductResponse -export type req_attributes_hierarchy = { +export type CreateProductError = Error + +export type GetAllProductsData = { + query?: { /** - * The name of the hierarchy, such as `Major Appliances`. + * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering). + * + * For more information about the attributes and operators that are supported, see [Get all products](/docs/api/pxm/products/get-all-products). + * */ - name?: string; + filter?: string /** - * A description of the hierarchy. + * Using the include parameter, you can retrieve top-level resources. + * + * - Files or main image. For example, `include=files,main_image`. + * - Component product data. For example, `include=component_products`. + * - Key attribute data, such as SKU or slug. + * */ - description?: string; + include?: string /** - * A unique slug for the hierarchy. + * The number of records per page. The maximum limit is 100. */ - slug?: string; + "page[limit]"?: number /** - * Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. + * The number of records to offset the results by. */ - locales?: { - [key: string]: { - /** - * A localized name for the hierarchy. - */ - name?: string; - /** - * A localized description for the hierarchy. - */ - description?: string; - }; - }; -}; + "page[offset]"?: number + } +} -export type create_hierarchy = { - data?: { - /** - * This represents the type of resource object being returned. Always `hierarchy`. - */ - type: 'hierarchy'; - attributes: req_attributes_hierarchy; - }; -}; - -export type single_hierarchy = { - data?: hierarchy; -}; +export type GetAllProductsResponse = MultiProductResponse -export type update_hierarchy = { - data: { - /** - * The unique identifier of the hierarchy. Must match the hierarchy ID specified in the request path. - */ - id: string; - /** - * This represents the type of resource object being returned. Always `hierarchy`. - */ - type: 'hierarchy'; - attributes: req_attributes_hierarchy; - }; -}; +export type GetAllProductsError = Error -export type attributes_nodes = { +export type ImportProductsData = { + body?: { /** - * The name of the node, such as `Ranges` or `Refrigerators`. Names must be unique among sibling nodes in the hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies. + * The file you want to upload. Ensure that the file format is Comma Separated Values (CSV). */ - name?: string; + file?: Blob | File + } +} + +export type ImportProductsResponse = Single + +export type ImportProductsError = Error + +export type ExportProductsData = { + body?: { + [key: string]: unknown + } + query?: { /** - * A description of the node. + * + * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering), but you must go to a specific endpoint to understand the attributes and operators an endpoint supports. + * + * For more information about the attributes and operators that this endpoint supports, see [Export Products](/docs/api/pxm/products/export-products). + * */ - description?: string; + filter?: string /** - * A slug for the node. Slugs must be unique among sibling nodes in the hierarchy. Otherwise, a slug can be non-unique within the hierarchy and across multiple hierarchies. + * Set to `true` if you want to use a template slug instead of a template ID when exporting products that have custom data. */ - slug?: string; + useTemplateSlugs?: boolean + } +} + +export type ExportProductsResponse = Single + +export type ExportProductsError = Error + +export type GetProductData = { + path: { /** - * You can curate your products in your nodes product lists. Product curation allows you to promote specific products within each node in a hierarchy, enabling you to create unique product collections in your storefront. See [Curating Products in a node](/docs/api/pxm/products/create-node#curating-products-in-a-node). + * A unique identifier for the product. */ - curated_products?: Array<(string)>; + productID: string + } + query?: { /** - * Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. + * Using the include parameter, you can retrieve top-level resources. + * + * - Files or main image. For example, `include=files,main_image`. + * - Component product data. For example, `include=component_products`. + * - Key attribute data, such as SKU or slug. + * */ - locales?: { - [key: string]: { - /** - * A localized name for the node. - */ - name?: string; - /** - * A localized description for the node. - */ - description?: string; - }; - }; -}; + include?: string + } +} -export type create_node = { - data?: { - /** - * This represents the type of resource object being returned. Always `node`. - */ - type: 'node'; - attributes: attributes_nodes; - meta?: { - /** - * You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. The `sort_order` for each node. This value determines the order of nodes in the response for the `Get a Node’s Children` request. The node with the highest value of sort_order is displayed first. For example, a node with a sort_order value of 3 appears before a node with a sort_order value of 2. - * - * - If you don’t provide `sort_order` when creating nodes, all child nodes in the response for `Get a Node’s Children` request are ordered by the `updated_at` time in descending order, with the most recently updated child node first. - * - If you set `sort_order` for only a few child nodes or not all, the child nodes with a `sort_order` value appear first and then other child nodes appear in the order of `updated_at` time. See [Sorting Nodes in a hierarchy](). - * - */ - sort_order?: number; - }; - }; -}; +export type GetProductResponse = SingleProductResponse -export type single_node = { - data?: node; -}; +export type GetProductError = Error -export type update_node = { - data?: { - /** - * The unique identifier of the node. Must match the node ID specified in the request path. - */ - id: string; - /** - * This represents the type of resource object being returned. Always `node`. - */ - type: 'node'; - attributes: attributes_nodes; - meta?: { - /** - * You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. The `sort_order` for each node. This value determines the order of nodes in the response for the `Get a Node’s Children` request. The node with the highest value of sort_order is displayed first. For example, a node with a sort_order value of 3 appears before a node with a sort_order value of 2. - * - * - If you don’t provide `sort_order` when creating nodes, all child nodes in the response for `Get a Node’s Children` request are ordered by the `updated_at` time in descending order, with the most recently updated child node first. - * - If you set `sort_order` for only a few child nodes or not all, the child nodes with a `sort_order` value appear first and then other child nodes appear in the order of `updated_at` time. - * - */ - sort_order?: number; - }; - }; -}; +export type UpdateProductData = { + body?: UpdateProductRequest + path: { + /** + * A unique identifier for the product. + */ + productID: string + } +} -export type node_children = { - data?: Array<{ - /** - * The unique identifier of the child node. Must not match the node ID specified in the request path. - */ - id: string; - /** - * This represents the type of resource object being returned. Always `node`. - */ - type: 'node'; - }>; -}; +export type UpdateProductResponse = SingleProductResponse -export type node_parent = { - data?: { - /** - * The unique identifier of the new parent node. Must not match the node ID specified in the request path. - */ - id: string; - /** - * This represents the type of resource object being returned. Always `node`. - */ - type: 'node'; - }; -}; +export type UpdateProductError = Error -export type node_products = { - data?: Array<{ - /** - * The unique identifier of the product to be attached to the node. - */ - id: string; - /** - * This represents the type of resource object being returned. Always `product`. - */ - type: 'product'; - }>; -}; +export type DeleteProductData = { + path: { + /** + * A unique identifier for the product. + */ + productID: string + } +} -export type duplicate_job = { - data?: { - /** - * This represents the type of resource object being returned. Always `hierarchy`. - */ - type?: 'hierarchy'; - attributes?: { - /** - * The name of the duplicate hierarchy. The maximum length is 1000 characters. - */ - name?: string; - /** - * A description of the duplicate hierarchy. - */ - description?: string; - /** - * Specify `true` if you want the product associations in the existing nodes associated in your duplicated hierarchy. If not, specify `false`. - */ - include_products?: boolean; - }; - }; -}; +export type DeleteProductResponse = void + +export type DeleteProductError = Error -export type tag = { +export type AttachNodesData = { + body: { + data: { + /** + * Filters applied to search for appropriate products to attach to a node. See [Attach multiple nodes](/docs/api/pxm/products/attach-nodes). + * + */ + filter: string + /** + * A list of node unique identifiers that you want to assign to the products. + */ + node_ids: Array + } + } +} + +export type AttachNodesResponse = { + meta?: { /** - * A unique identifier generated when a tag is created. + * Number of nodes assigned to the products. */ - id?: string; + nodes_attached?: number /** - * This represents the type of resource object being returned. Always `tag`. + * A list of node unique identifiers that could not be identified. */ - type?: 'tag'; - attributes?: { - /** - * The text value of the tag. - */ - value?: string; - }; - meta?: { - /** - * A unique request ID is generated when a tag is created. - */ - x_request_id?: string; - /** - * The date and time a tag is created. - */ - created_at?: string; - /** - * The date and time a tag is updated. - */ - updated_at?: string; - /** - * The owner of a resource, either `organization` or `store`. - */ - owner?: 'store' | 'organization'; - }; -}; + nodes_not_found?: Array + } +} -/** - * This represents the type of resource object being returned. Always `tag`. - */ -export type type9 = 'tag'; +export type AttachNodesError = Error + +export type DetachNodesData = { + body: { + data: { + /** + * You can apply filters to search for the appropriate products to detach. See [Detach multiple nodes](/docs/api/pxm/products/detach-nodes). + * + */ + filter: string + /** + * A list of node unique identifiers that you want to assign to the products. + */ + node_ids: Array + } + } +} -export type multi_tag = { +export type DetachNodesResponse = { + meta?: { /** - * An array of tags. + * Number of nodes dissociated from the products. */ - data?: Array; - meta?: { - /** - * Contains the results for the entire collection. - */ - results?: { - /** - * Total number of results for the entire collection. - */ - total?: number; - }; - }; -}; + nodes_detached?: number + /** + * A list of node unique identifiers that could not be identified. + */ + nodes_not_found?: Array + } +} -export type single_tag = { - data?: tag; -}; +export type DetachNodesError = Error -export type req_attributes_custom_relationship = { +export type GetProductsNodesData = { + path: { /** - * The name of the custom relationship, such as `Kitchen electrics`. + * A unique identifier for the product. */ - name?: string; + productID: string + } + query?: { /** - * A description of the custom relationship. + * The number of records per page. The maximum limit is 100. */ - description?: string; + "page[limit]"?: number /** - * A unique slug for the custom relationship. Must match the slug specified in the request path. + * The number of records to offset the results by. */ - slug?: string; -}; + "page[offset]"?: number + } +} -export type create_custom_relationship = { - data?: { - /** - * This represents the type of resource object being returned. Always `custom-relationship`. - */ - type: 'custom-relationship'; - attributes: req_attributes_custom_relationship; - }; -}; +export type GetProductsNodesResponse = MultiNodes -/** - * This represents the type of resource object being returned. Always `custom-relationship`. - */ -export type type10 = 'custom-relationship'; +export type GetProductsNodesError = Error -export type attributes_custom_relationship = { +export type BuildChildProductsData = { + body?: { + [key: string]: unknown + } + path: { /** - * The name of the custom relationship, such as `Kitchen electrics`. + * A unique identifier for the product. */ - name?: string; + productID: string + } +} + +export type BuildChildProductsResponse = unknown + +export type BuildChildProductsError = Error + +export type GetChildProductsData = { + path: { /** - * A description of the custom relationship. + * A unique identifier for the product. */ - description?: string; + productID: string + } +} + +export type GetChildProductsResponse = MultiProductResponse + +export type GetChildProductsError = Error + +export type CreateProductTemplateRelationshipData = { + body?: ProductTemplatesRequest + path: { /** - * A unique slug for the custom relationship. + * A unique identifier for the product. */ - slug?: string; -}; + productID: string + } +} -export type custom_relationship = { +export type CreateProductTemplateRelationshipResponse = TemplateResponse + +export type CreateProductTemplateRelationshipError = Error + +export type GetProductTemplateRelationshipsData = { + path: { /** - * A unique identifier generated when a custom relationship is created. + * A unique identifier for the product. */ - id?: string; + productID: string + } +} + +export type GetProductTemplateRelationshipsResponse = TemplateResponse + +export type GetProductTemplateRelationshipsError = Error + +export type DeleteProductTemplateRelationshipData = { + body?: ProductTemplatesRequest + path: { /** - * This represents the type of resource object being returned. Always `hierarchy`. + * A unique identifier for the product. */ - type?: 'custom-relationship'; - attributes?: attributes_custom_relationship; - meta?: { - /** - * The owner of the resource. - */ - owner?: string; - timestamps?: { - /** - * The date and time the resource is created. - */ - created_at?: string; - /** - * The date and time the resource is updated. - */ - updated_at?: string; - }; - }; -}; + productID: string + } +} -export type single_custom_relationship = { - data?: custom_relationship; -}; +export type DeleteProductTemplateRelationshipResponse = void -export type update_custom_relationship = { - data: { - /** - * The unique identifier of the custom relationship. - */ - id: string; - /** - * This represents the type of resource object being returned. Always `custom-relationship`. - */ - type: 'custom-relationship'; - attributes: req_attributes_custom_relationship; - }; -}; +export type DeleteProductTemplateRelationshipError = Error -/** - * A unique identifier for the job. - */ -export type Parameterjob_id = string; +export type GetProductComponentProductsRelationshipsData = { + path: { + /** + * A unique identifier for the product. + */ + productID: string + } +} -/** - * The number of records to offset the results by. - */ -export type Parameterpage_offset = number; +export type GetProductComponentProductsRelationshipsResponse = + ComponentProductsResponse -/** - * The number of records per page. The maximum limit is 100. - */ -export type Parameterpage_limit = number; +export type GetProductComponentProductsRelationshipsError = Error -/** - * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering). - * - * For more information about the attributes and operators that are supported, see [Get all products](/docs/api/pxm/products/get-all-products). - * - */ -export type Parameterfilterproduct = string; +export type GetProductFileRelationshipsData = { + path: { + /** + * A unique identifier for the product. + */ + productID: string + } +} -/** - * Using the include parameter, you can retrieve top-level resources. - * - * - Files or main image. For example, `include=files,main_image`. - * - Component product data. For example, `include=component_products`. - * - Key attribute data, such as SKU or slug. - * - */ -export type Parameterinclude = string; +export type GetProductFileRelationshipsResponse = FileResponse -/** - * Set to `true` if you want to use a template slug instead of a template ID when exporting products that have custom data. - */ -export type ParameteruseTemplateSlugs = boolean; +export type GetProductFileRelationshipsError = Error -/** - * - * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering), but you must go to a specific endpoint to understand the attributes and operators an endpoint supports. - * - * For more information about the attributes and operators that this endpoint supports, see [Export Products](/docs/api/pxm/products/export-products). - * - */ -export type Parameterfilterexport = string; +export type CreateProductFileRelationshipsData = { + body?: ProductFilesRequest + path: { + /** + * A unique identifier for the product. + */ + productID: string + } +} -/** - * A unique identifier for the product. - */ -export type Parameterproduct_id = string; +export type CreateProductFileRelationshipsResponse = void -/** - * A unique identifier for the variation. - */ -export type Parametervariation_id = string; +export type CreateProductFileRelationshipsError = Error -/** - * A unique identifier for the option. - */ -export type Parameteroption_id = string; +export type UpdateProductFileRelationshipsData = { + body?: ProductFilesRequest + path: { + /** + * A unique identifier for the product. + */ + productID: string + } +} -/** - * A unique identifier for the modifier. - */ -export type Parametermodifier_id = string; +export type UpdateProductFileRelationshipsResponse = void -/** - * A unique identifier for the hierarchy. - */ -export type Parameterhierarchy_id = string; - -/** - * A unique identifier for the node. - */ -export type Parameternode_id = string; - -/** - * A unique identifier for the tag. - */ -export type Parametertag_id = string; - -/** - * A custom relationship slug. - */ -export type Parametercustom_relationship_slug = string; - -export type GetAllJobsResponse = multi; - -export type GetJobData = { - /** - * A unique identifier for the job. - */ - jobId: string; -}; - -export type GetJobResponse = single; - -export type CancelJobData = { - /** - * A unique identifier for the job. - */ - jobId: string; - requestBody?: { - [key: string]: unknown; - }; -}; - -export type CancelJobResponse = single; - -export type GetJobErrorsData = { - /** - * A unique identifier for the job. - */ - jobId: string; -}; - -export type GetJobErrorsResponse = errors; - -export type CreateProductData = { - requestBody: create_product_request; -}; - -export type CreateProductResponse = single_product_response; - -export type GetAllProductsData = { - /** - * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering). - * - * For more information about the attributes and operators that are supported, see [Get all products](/docs/api/pxm/products/get-all-products). - * - */ - filter?: string; - /** - * Using the include parameter, you can retrieve top-level resources. - * - * - Files or main image. For example, `include=files,main_image`. - * - Component product data. For example, `include=component_products`. - * - Key attribute data, such as SKU or slug. - * - */ - include?: string; - /** - * The number of records per page. The maximum limit is 100. - */ - pageLimit?: number; - /** - * The number of records to offset the results by. - */ - pageOffset?: number; -}; - -export type GetAllProductsResponse = multi_product_response; - -export type ImportProductsData = { - formData?: { - /** - * The file you want to upload. Ensure that the file format is Comma Separated Values (CSV). - */ - file?: (Blob | File); - }; -}; - -export type ImportProductsResponse = single; - -export type ExportProductsData = { - /** - * - * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering), but you must go to a specific endpoint to understand the attributes and operators an endpoint supports. - * - * For more information about the attributes and operators that this endpoint supports, see [Export Products](/docs/api/pxm/products/export-products). - * - */ - filter?: string; - requestBody?: { - [key: string]: unknown; - }; - /** - * Set to `true` if you want to use a template slug instead of a template ID when exporting products that have custom data. - */ - useTemplateSlugs?: boolean; -}; - -export type ExportProductsResponse = single; - -export type GetProductData = { - /** - * Using the include parameter, you can retrieve top-level resources. - * - * - Files or main image. For example, `include=files,main_image`. - * - Component product data. For example, `include=component_products`. - * - Key attribute data, such as SKU or slug. - * - */ - include?: string; - /** - * A unique identifier for the product. - */ - productId: string; -}; - -export type GetProductResponse = single_product_response; - -export type UpdateProductData = { - /** - * A unique identifier for the product. - */ - productId: string; - requestBody?: update_product_request; -}; - -export type UpdateProductResponse = single_product_response; - -export type DeleteProductData = { - /** - * A unique identifier for the product. - */ - productId: string; -}; - -export type DeleteProductResponse = void; - -export type AttachNodesData = { - requestBody: { - data: { - /** - * Filters applied to search for appropriate products to attach to a node. See [Attach multiple nodes](/docs/api/pxm/products/attach-nodes). - * - */ - filter: string; - /** - * A list of node unique identifiers that you want to assign to the products. - */ - node_ids: Array<(string)>; - }; - }; -}; - -export type AttachNodesResponse = { - meta?: { - /** - * Number of nodes assigned to the products. - */ - nodes_attached?: number; - /** - * A list of node unique identifiers that could not be identified. - */ - nodes_not_found?: Array<(string)>; - }; -}; - -export type DetachNodesData = { - requestBody: { - data: { - /** - * You can apply filters to search for the appropriate products to detach. See [Detach multiple nodes](/docs/api/pxm/products/detach-nodes). - * - */ - filter: string; - /** - * A list of node unique identifiers that you want to assign to the products. - */ - node_ids: Array<(string)>; - }; - }; -}; - -export type DetachNodesResponse = { - meta?: { - /** - * Number of nodes dissociated from the products. - */ - nodes_detached?: number; - /** - * A list of node unique identifiers that could not be identified. - */ - nodes_not_found?: Array<(string)>; - }; -}; - -export type GetProductsNodesData = { - /** - * The number of records per page. The maximum limit is 100. - */ - pageLimit?: number; - /** - * The number of records to offset the results by. - */ - pageOffset?: number; - /** - * A unique identifier for the product. - */ - productId: string; -}; - -export type GetProductsNodesResponse = multi_nodes; - -export type BuildChildProductsData = { - /** - * A unique identifier for the product. - */ - productId: string; - requestBody?: { - [key: string]: unknown; - }; -}; - -export type BuildChildProductsResponse = unknown; - -export type GetChildProductsData = { - /** - * A unique identifier for the product. - */ - productId: string; -}; - -export type GetChildProductsResponse = multi_product_response; - -export type CreateProductTemplateRelationshipData = { - /** - * A unique identifier for the product. - */ - productId: string; - requestBody?: product_templates_request; -}; - -export type CreateProductTemplateRelationshipResponse = template_response; - -export type GetProductTemplateRelationshipsData = { - /** - * A unique identifier for the product. - */ - productId: string; -}; - -export type GetProductTemplateRelationshipsResponse = template_response; - -export type DeleteProductTemplateRelationshipData = { - /** - * A unique identifier for the product. - */ - productId: string; - requestBody?: product_templates_request; -}; - -export type DeleteProductTemplateRelationshipResponse = void; - -export type GetProductComponentProductsRelationshipsData = { - /** - * A unique identifier for the product. - */ - productId: string; -}; - -export type GetProductComponentProductsRelationshipsResponse = component_products_response; - -export type GetProductFileRelationshipsData = { - /** - * A unique identifier for the product. - */ - productId: string; -}; - -export type GetProductFileRelationshipsResponse = file_response; - -export type CreateProductFileRelationshipsData = { - /** - * A unique identifier for the product. - */ - productId: string; - requestBody?: product_files_request; -}; - -export type CreateProductFileRelationshipsResponse = void; - -export type UpdateProductFileRelationshipsData = { - /** - * A unique identifier for the product. - */ - productId: string; - requestBody?: product_files_request; -}; - -export type UpdateProductFileRelationshipsResponse = void; +export type UpdateProductFileRelationshipsError = Error export type DeleteProductFileRelationshipsData = { + body?: ProductFilesRequest + path: { /** * A unique identifier for the product. */ - productId: string; - requestBody?: product_files_request; -}; + productID: string + } +} + +export type DeleteProductFileRelationshipsResponse = void -export type DeleteProductFileRelationshipsResponse = void; +export type DeleteProductFileRelationshipsError = Error export type CreateProductVariationRelationshipsData = { + body?: ProductVariationsRequest + path: { /** * A unique identifier for the product. */ - productId: string; - requestBody?: product_variations_request; -}; + productID: string + } +} -export type CreateProductVariationRelationshipsResponse = void; +export type CreateProductVariationRelationshipsResponse = void + +export type CreateProductVariationRelationshipsError = Error export type GetProductVariationRelationshipsData = { + path: { /** * A unique identifier for the product. */ - productId: string; -}; + productID: string + } +} + +export type GetProductVariationRelationshipsResponse = VariationsResponse -export type GetProductVariationRelationshipsResponse = variations_response; +export type GetProductVariationRelationshipsError = Error export type UpdateProductVariationRelationshipsData = { + body?: ProductVariationsRequest + path: { /** * A unique identifier for the product. */ - productId: string; - requestBody?: product_variations_request; -}; + productID: string + } +} -export type UpdateProductVariationRelationshipsResponse = void; +export type UpdateProductVariationRelationshipsResponse = void + +export type UpdateProductVariationRelationshipsError = Error export type DeleteProductVariationRelationshipsData = { + body?: ProductVariationsRequest + path: { /** * A unique identifier for the product. */ - productId: string; - requestBody?: product_variations_request; -}; + productID: string + } +} + +export type DeleteProductVariationRelationshipsResponse = void -export type DeleteProductVariationRelationshipsResponse = void; +export type DeleteProductVariationRelationshipsError = Error export type CreateProductMainImageRelationshipsData = { + body?: MainImageRequest + path: { /** * A unique identifier for the product. */ - productId: string; - requestBody?: main_image_request; -}; + productID: string + } +} -export type CreateProductMainImageRelationshipsResponse = void; +export type CreateProductMainImageRelationshipsResponse = void + +export type CreateProductMainImageRelationshipsError = Error export type GetProductMainImageRelationshipsData = { + path: { /** * A unique identifier for the product. */ - productId: string; -}; + productID: string + } +} + +export type GetProductMainImageRelationshipsResponse = MainImageResponse -export type GetProductMainImageRelationshipsResponse = main_image_response; +export type GetProductMainImageRelationshipsError = Error export type UpdateProductMainImageRelationshipsData = { + body?: ReplaceMainImageRequest + path: { /** * A unique identifier for the product. */ - productId: string; - requestBody?: replace_main_image_request; -}; + productID: string + } +} -export type UpdateProductMainImageRelationshipsResponse = void; +export type UpdateProductMainImageRelationshipsResponse = void + +export type UpdateProductMainImageRelationshipsError = Error export type DeleteProductMainImageRelationshipsData = { + path: { /** * A unique identifier for the product. */ - productId: string; -}; + productID: string + } +} + +export type DeleteProductMainImageRelationshipsResponse = void -export type DeleteProductMainImageRelationshipsResponse = void; +export type DeleteProductMainImageRelationshipsError = Error export type CreateVariationData = { - requestBody: create_variation; -}; + body: CreateVariation +} -export type CreateVariationResponse = created_variation; +export type CreateVariationResponse = CreatedVariation + +export type CreateVariationError = Error export type GetAllVariationsData = { + query?: { /** * The number of records per page. The maximum limit is 100. */ - pageLimit?: number; + "page[limit]"?: number /** * The number of records to offset the results by. */ - pageOffset?: number; -}; + "page[offset]"?: number + } +} + +export type GetAllVariationsResponse = MultiVariations -export type GetAllVariationsResponse = multi_variations; +export type GetAllVariationsError = Error export type GetVariationData = { + path: { /** * A unique identifier for the variation. */ - variationId: string; -}; + variationID: string + } +} -export type GetVariationResponse = single_variation; +export type GetVariationResponse = SingleVariation + +export type GetVariationError = Error export type UpdateVariationData = { - requestBody?: update_variation; + body?: UpdateVariation + path: { /** * A unique identifier for the variation. */ - variationId: string; -}; + variationID: string + } +} + +export type UpdateVariationResponse = SingleVariation -export type UpdateVariationResponse = single_variation; +export type UpdateVariationError = Error export type DeleteVariationData = { + path: { /** * A unique identifier for the variation. */ - variationId: string; -}; + variationID: string + } +} -export type DeleteVariationResponse = void; +export type DeleteVariationResponse = void + +export type DeleteVariationError = Error export type CreateVariationOptionData = { - requestBody?: create_option; + body?: CreateOption + path: { /** * A unique identifier for the variation. */ - variationId: string; -}; + variationID: string + } +} + +export type CreateVariationOptionResponse = CreatedOption -export type CreateVariationOptionResponse = created_option; +export type CreateVariationOptionError = Error export type GetAllVariationOptionsData = { + path: { /** - * The number of records per page. The maximum limit is 100. + * A unique identifier for the variation. */ - pageLimit?: number; + variationID: string + } + query?: { /** - * The number of records to offset the results by. + * The number of records per page. The maximum limit is 100. */ - pageOffset?: number; + "page[limit]"?: number /** - * A unique identifier for the variation. + * The number of records to offset the results by. */ - variationId: string; -}; + "page[offset]"?: number + } +} -export type GetAllVariationOptionsResponse = multi_options; +export type GetAllVariationOptionsResponse = MultiOptions + +export type GetAllVariationOptionsError = Error export type GetVariationOptionData = { + path: { /** * A unique identifier for the option. */ - optionId: string; + optionID: string /** * A unique identifier for the variation. */ - variationId: string; -}; + variationID: string + } +} + +export type GetVariationOptionResponse = SingleOption -export type GetVariationOptionResponse = single_option; +export type GetVariationOptionError = Error export type UpdateVariationOptionData = { + body?: UpdateOption + path: { /** * A unique identifier for the option. */ - optionId: string; - requestBody?: update_option; + optionID: string /** * A unique identifier for the variation. */ - variationId: string; -}; + variationID: string + } +} -export type UpdateVariationOptionResponse = single_option; +export type UpdateVariationOptionResponse = SingleOption + +export type UpdateVariationOptionError = Error export type DeleteVariationOptionData = { + path: { /** * A unique identifier for the option. */ - optionId: string; + optionID: string /** * A unique identifier for the variation. */ - variationId: string; -}; + variationID: string + } +} + +export type DeleteVariationOptionResponse = void -export type DeleteVariationOptionResponse = void; +export type DeleteVariationOptionError = Error export type CreateModifierData = { + body?: CreateModifier + path: { /** * A unique identifier for the option. */ - optionId: string; - requestBody?: create_modifier; + optionID: string /** * A unique identifier for the variation. */ - variationId: string; -}; + variationID: string + } +} -export type CreateModifierResponse = created_modifier; +export type CreateModifierResponse = CreatedModifier + +export type CreateModifierError = Error export type GetAllModifiersData = { + path: { /** * A unique identifier for the option. */ - optionId: string; + optionID: string /** - * The number of records per page. The maximum limit is 100. + * A unique identifier for the variation. */ - pageLimit?: number; + variationID: string + } + query?: { /** - * The number of records to offset the results by. + * The number of records per page. The maximum limit is 100. */ - pageOffset?: number; + "page[limit]"?: number /** - * A unique identifier for the variation. + * The number of records to offset the results by. */ - variationId: string; -}; + "page[offset]"?: number + } +} + +export type GetAllModifiersResponse = MultiModifiers -export type GetAllModifiersResponse = multi_modifiers; +export type GetAllModifiersError = Error export type GetModifierData = { + path: { /** * A unique identifier for the modifier. */ - modifierId: string; + modifierID: string /** * A unique identifier for the option. */ - optionId: string; + optionID: string /** * A unique identifier for the variation. */ - variationId: string; -}; + variationID: string + } +} -export type GetModifierResponse = single_modifier; +export type GetModifierResponse = SingleModifier + +export type GetModifierError = Error export type UpdateModifierData = { + body?: UpdateModifier + path: { /** * A unique identifier for the modifier. */ - modifierId: string; + modifierID: string /** * A unique identifier for the option. */ - optionId: string; - requestBody?: update_modifier; + optionID: string /** * A unique identifier for the variation. */ - variationId: string; -}; + variationID: string + } +} + +export type UpdateModifierResponse = SingleModifier -export type UpdateModifierResponse = single_modifier; +export type UpdateModifierError = Error export type DeleteModifierData = { + path: { /** * A unique identifier for the modifier. */ - modifierId: string; + modifierID: string /** * A unique identifier for the option. */ - optionId: string; + optionID: string /** * A unique identifier for the variation. */ - variationId: string; -}; + variationID: string + } +} -export type DeleteModifierResponse = void; +export type DeleteModifierResponse = void + +export type DeleteModifierError = Error export type CreateHierarchyData = { - requestBody: create_hierarchy; -}; + body: CreateHierarchy +} + +export type CreateHierarchyResponse = SingleHierarchy -export type CreateHierarchyResponse = single_hierarchy; +export type CreateHierarchyError = Error export type GetHierarchyData = { + query?: { /** * The number of records per page. The maximum limit is 100. */ - pageLimit?: number; + "page[limit]"?: number /** * The number of records to offset the results by. */ - pageOffset?: number; -}; + "page[offset]"?: number + } +} -export type GetHierarchyResponse = multi_hierarchy; +export type GetHierarchyResponse = MultiHierarchy + +export type GetHierarchyError = Error export type GetHierarchyChildData = { + path: { /** * A unique identifier for the hierarchy. */ - hierarchyId: string; -}; + hierarchyID: string + } +} + +export type GetHierarchyChildResponse = SingleHierarchy -export type GetHierarchyChildResponse = single_hierarchy; +export type GetHierarchyChildError = Error export type UpdateHierarchyData = { + body: UpdateHierarchy + path: { /** * A unique identifier for the hierarchy. */ - hierarchyId: string; - requestBody: update_hierarchy; -}; + hierarchyID: string + } +} -export type UpdateHierarchyResponse = single_hierarchy; +export type UpdateHierarchyResponse = SingleHierarchy + +export type UpdateHierarchyError = Error export type DeleteHierarchyData = { + path: { /** * A unique identifier for the hierarchy. */ - hierarchyId: string; -}; + hierarchyID: string + } +} + +export type DeleteHierarchyResponse = void -export type DeleteHierarchyResponse = void; +export type DeleteHierarchyError = Error export type CreateNodeData = { + body?: CreateNode + path: { /** * A unique identifier for the hierarchy. */ - hierarchyId: string; - requestBody?: create_node; -}; + hierarchyID: string + } +} -export type CreateNodeResponse = single_node; +export type CreateNodeResponse = SingleNode + +export type CreateNodeError = Error export type GetAllNodesInHierarchyData = { + path: { /** * A unique identifier for the hierarchy. */ - hierarchyId: string; + hierarchyID: string + } + query?: { /** * The number of records per page. The maximum limit is 100. */ - pageLimit?: number; + "page[limit]"?: number /** * The number of records to offset the results by. */ - pageOffset?: number; -}; + "page[offset]"?: number + } +} + +export type GetAllNodesInHierarchyResponse = MultiNodes -export type GetAllNodesInHierarchyResponse = multi_nodes; +export type GetAllNodesInHierarchyError = Error export type GetHierarchyNodeData = { + path: { /** * A unique identifier for the hierarchy. */ - hierarchyId: string; + hierarchyID: string /** * A unique identifier for the node. */ - nodeId: string; -}; + nodeID: string + } +} -export type GetHierarchyNodeResponse = single_node; +export type GetHierarchyNodeResponse = SingleNode + +export type GetHierarchyNodeError = Error export type UpdateNodeData = { + body?: UpdateNode + path: { /** * A unique identifier for the hierarchy. */ - hierarchyId: string; + hierarchyID: string /** * A unique identifier for the node. */ - nodeId: string; - requestBody?: update_node; -}; + nodeID: string + } +} + +export type UpdateNodeResponse = SingleNode -export type UpdateNodeResponse = single_node; +export type UpdateNodeError = Error export type DeleteNodeData = { + path: { /** * A unique identifier for the hierarchy. */ - hierarchyId: string; + hierarchyID: string /** * A unique identifier for the node. */ - nodeId: string; -}; + nodeID: string + } +} -export type DeleteNodeResponse = void; +export type DeleteNodeResponse = void + +export type DeleteNodeError = Error export type GetAllChildrenData = { + path: { /** * A unique identifier for the hierarchy. */ - hierarchyId: string; + hierarchyID: string + } + query?: { /** * The number of records per page. The maximum limit is 100. */ - pageLimit?: number; + "page[limit]"?: number /** * The number of records to offset the results by. */ - pageOffset?: number; -}; + "page[offset]"?: number + } +} + +export type GetAllChildrenResponse = MultiNodes -export type GetAllChildrenResponse = multi_nodes; +export type GetAllChildrenError = Error export type CreateNodeChildRelationshipsData = { + body?: NodeChildren + path: { /** * A unique identifier for the hierarchy. */ - hierarchyId: string; + hierarchyID: string /** * A unique identifier for the node. */ - nodeId: string; - requestBody?: node_children; -}; + nodeID: string + } +} -export type CreateNodeChildRelationshipsResponse = single_node; +export type CreateNodeChildRelationshipsResponse = SingleNode + +export type CreateNodeChildRelationshipsError = Error export type GetAllNodeChildrenData = { + path: { /** * A unique identifier for the hierarchy. */ - hierarchyId: string; + hierarchyID: string /** * A unique identifier for the node. */ - nodeId: string; + nodeID: string + } + query?: { /** * The number of records per page. The maximum limit is 100. */ - pageLimit?: number; + "page[limit]"?: number /** * The number of records to offset the results by. */ - pageOffset?: number; -}; + "page[offset]"?: number + } +} + +export type GetAllNodeChildrenResponse = MultiNodes -export type GetAllNodeChildrenResponse = multi_nodes; +export type GetAllNodeChildrenError = Error export type UpdateNodeParentData = { + body?: NodeParent + path: { /** * A unique identifier for the hierarchy. */ - hierarchyId: string; + hierarchyID: string /** * A unique identifier for the node. */ - nodeId: string; - requestBody?: node_parent; -}; + nodeID: string + } +} -export type UpdateNodeParentResponse = void; +export type UpdateNodeParentResponse = void + +export type UpdateNodeParentError = Error export type DeleteNodeParentData = { + path: { /** * A unique identifier for the hierarchy. */ - hierarchyId: string; + hierarchyID: string /** * A unique identifier for the node. */ - nodeId: string; -}; + nodeID: string + } +} + +export type DeleteNodeParentResponse = void -export type DeleteNodeParentResponse = void; +export type DeleteNodeParentError = Error export type CreateNodeProductRelationshipData = { + body?: NodeProducts + path: { /** * A unique identifier for the hierarchy. */ - hierarchyId: string; + hierarchyID: string /** * A unique identifier for the node. */ - nodeId: string; - requestBody?: node_products; -}; + nodeID: string + } +} -export type CreateNodeProductRelationshipResponse = single_node; +export type CreateNodeProductRelationshipResponse = SingleNode + +export type CreateNodeProductRelationshipError = Error export type DeleteNodeProductRelationshipsData = { + body?: NodeProducts + path: { /** * A unique identifier for the hierarchy. */ - hierarchyId: string; + hierarchyID: string /** * A unique identifier for the node. */ - nodeId: string; - requestBody?: node_products; -}; + nodeID: string + } +} + +export type DeleteNodeProductRelationshipsResponse = SingleNode -export type DeleteNodeProductRelationshipsResponse = single_node; +export type DeleteNodeProductRelationshipsError = Error export type GetNodeProductsData = { + path: { /** * A unique identifier for the hierarchy. */ - hierarchyId: string; + hierarchyID: string /** * A unique identifier for the node. */ - nodeId: string; + nodeID: string + } + query?: { /** * The number of records per page. The maximum limit is 100. */ - pageLimit?: number; + "page[limit]"?: number /** * The number of records to offset the results by. */ - pageOffset?: number; -}; + "page[offset]"?: number + } +} -export type GetNodeProductsResponse = multi_product_response; +export type GetNodeProductsResponse = MultiProductResponse + +export type GetNodeProductsError = Error export type DuplicateHierarchyData = { + body: DuplicateJob + path: { /** * A unique identifier for the hierarchy. */ - hierarchyId: string; - requestBody: duplicate_job; -}; + hierarchyID: string + } +} + +export type DuplicateHierarchyResponse = Single -export type DuplicateHierarchyResponse = single; +export type DuplicateHierarchyError = Error -export type GetAllProductTagsResponse = multi_tag; +export type GetAllProductTagsResponse = MultiTag + +export type GetAllProductTagsError = Error export type GetProductTagData = { + path: { /** * A unique identifier for the tag. */ - tagId: string; -}; + tagID: string + } +} + +export type GetProductTagResponse = SingleTag -export type GetProductTagResponse = single_tag; +export type GetProductTagError = Error export type CreateCustomRelationshipData = { - requestBody: create_custom_relationship; -}; + body: CreateCustomRelationship +} -export type CreateCustomRelationshipResponse = single_custom_relationship; +export type CreateCustomRelationshipResponse = SingleCustomRelationship + +export type CreateCustomRelationshipError = Error export type UpdateCustomRelationshipData = { + body: UpdateCustomRelationship + path: { /** * A custom relationship slug. */ - customRelationshipSlug: string; - requestBody: update_custom_relationship; -}; + customRelationshipSlug: string + } +} + +export type UpdateCustomRelationshipResponse = SingleCustomRelationship -export type UpdateCustomRelationshipResponse = single_custom_relationship; +export type UpdateCustomRelationshipError = Error export type $OpenApiTs = { - '/pcm/jobs': { - get: { - res: { - /** - * Returns all the jobs. - */ - 200: multi; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/jobs/{jobID}': { - get: { - req: GetJobData; - res: { - /** - * Returns a job with the following attributes. - */ - 200: single; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/jobs/{jobID}/cancel': { - post: { - req: CancelJobData; - res: { - /** - * Successfully cancelled job - */ - 200: single; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/jobs/{jobID}/errors': { - get: { - req: GetJobErrorsData; - res: { - /** - * Successful - */ - 200: errors; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/products': { - post: { - req: CreateProductData; - res: { - /** - * Creates a product with the following attributes. - */ - 201: single_product_response; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - get: { - req: GetAllProductsData; - res: { - /** - * Returns a list of all products. - */ - 200: multi_product_response; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/products/import': { - post: { - req: ImportProductsData; - res: { - /** - * Import started - */ - 201: single; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/products/export': { - post: { - req: ExportProductsData; - res: { - /** - * Export started - */ - 201: single; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/products/{productID}': { - get: { - req: GetProductData; - res: { - /** - * Returns a product by its identifier. - */ - 200: single_product_response; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - put: { - req: UpdateProductData; - res: { - /** - * Updates a product with the following attributes. - */ - 200: single_product_response; - /** - * Forbidden - */ - 403: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Write conflict detected - */ - 409: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - delete: { - req: DeleteProductData; - res: { - /** - * Deletes the specified product. - */ - 204: void; - /** - * Forbidden - */ - 403: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/products/attach_nodes': { - post: { - req: AttachNodesData; - res: { - /** - * This request assigns the products that you have selected to multiple hierarchies and their children nodes and returns the following. - */ - 200: { - meta?: { - /** - * Number of nodes assigned to the products. - */ - nodes_attached?: number; - /** - * A list of node unique identifiers that could not be identified. - */ - nodes_not_found?: Array<(string)>; - }; - }; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/products/detach_nodes': { - post: { - req: DetachNodesData; - res: { - /** - * The request dissociates the products that you have selected from multiple hierarchies and their children and returns the following. - */ - 200: { - meta?: { - /** - * Number of nodes dissociated from the products. - */ - nodes_detached?: number; - /** - * A list of node unique identifiers that could not be identified. - */ - nodes_not_found?: Array<(string)>; - }; - }; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/products/{productID}/nodes': { - get: { - req: GetProductsNodesData; - res: { - /** - * Successfully returns the product's nodes. - */ - 200: multi_nodes; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/products/{productID}/build': { - post: { - req: BuildChildProductsData; - res: { - /** - * Successfully started building child products - */ - 201: unknown; - /** - * Forbidden - */ - 403: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/products/{productID}/children': { - get: { - req: GetChildProductsData; - res: { - /** - * Returns a list of child products for the specified parent product ID. - */ - 200: multi_product_response; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/products/{productID}/relationships/templates': { - post: { - req: CreateProductTemplateRelationshipData; - res: { - /** - * Returns a created product template relationship. - */ - 201: template_response; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Forbidden - */ - 403: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Write conflict detected - */ - 409: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - get: { - req: GetProductTemplateRelationshipsData; - res: { - /** - * Returns all product template relationships - */ - 200: template_response; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Forbidden - */ - 403: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Write conflict detected - */ - 409: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - delete: { - req: DeleteProductTemplateRelationshipData; - res: { - /** - * No Content - */ - 204: void; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Forbidden - */ - 403: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Write conflict detected - */ - 409: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/products/{productID}/relationships/component_products': { - get: { - req: GetProductComponentProductsRelationshipsData; - res: { - /** - * Returns all Component Products relationships - */ - 200: component_products_response; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Forbidden - */ - 403: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Write conflict detected - */ - 409: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/products/{productID}/relationships/files': { - get: { - req: GetProductFileRelationshipsData; - res: { - /** - * Returns all product file relationships. - */ - 200: file_response; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Forbidden - */ - 403: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Write conflict detected - */ - 409: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - post: { - req: CreateProductFileRelationshipsData; - res: { - /** - * No Content - */ - 204: void; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Forbidden - */ - 403: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Write conflict detected - */ - 409: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - put: { - req: UpdateProductFileRelationshipsData; - res: { - /** - * No Content - */ - 204: void; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Forbidden - */ - 403: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Write conflict detected - */ - 409: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - delete: { - req: DeleteProductFileRelationshipsData; - res: { - /** - * No Content - */ - 204: void; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Forbidden - */ - 403: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Write conflict detected - */ - 409: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/products/{productID}/relationships/variations': { - post: { - req: CreateProductVariationRelationshipsData; - res: { - /** - * No Content - */ - 204: void; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Forbidden - */ - 403: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Write conflict detected - */ - 409: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - get: { - req: GetProductVariationRelationshipsData; - res: { - /** - * Returns all product variation relationships - */ - 200: variations_response; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Forbidden - */ - 403: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Write conflict detected - */ - 409: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - put: { - req: UpdateProductVariationRelationshipsData; - res: { - /** - * No Content - */ - 204: void; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Forbidden - */ - 403: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Write conflict detected - */ - 409: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - delete: { - req: DeleteProductVariationRelationshipsData; - res: { - /** - * No Content - */ - 204: void; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Forbidden - */ - 403: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Write conflict detected - */ - 409: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/products/{productID}/relationships/main_image': { - post: { - req: CreateProductMainImageRelationshipsData; - res: { - /** - * No Content - */ - 204: void; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Forbidden - */ - 403: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Write conflict detected - */ - 409: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - get: { - req: GetProductMainImageRelationshipsData; - res: { - /** - * Returns all product variation relationships - */ - 200: main_image_response; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Forbidden - */ - 403: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Write conflict detected - */ - 409: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - put: { - req: UpdateProductMainImageRelationshipsData; - res: { - /** - * No Content - */ - 204: void; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Forbidden - */ - 403: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Write conflict detected - */ - 409: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - delete: { - req: DeleteProductMainImageRelationshipsData; - res: { - /** - * No Content - */ - 204: void; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Forbidden - */ - 403: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Write conflict detected - */ - 409: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/variations': { - post: { - req: CreateVariationData; - res: { - /** - * Returns a created variation with the following attributes. - */ - 201: created_variation; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - get: { - req: GetAllVariationsData; - res: { - /** - * Returns all variations. - */ - 200: multi_variations; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/variations/{variationID}': { - get: { - req: GetVariationData; - res: { - /** - * Returns the specified variation. - */ - 200: single_variation; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - put: { - req: UpdateVariationData; - res: { - /** - * Returns an updated variation with the following attributes. - */ - 200: single_variation; - /** - * Forbidden - */ - 403: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Write conflict detected - */ - 409: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - delete: { - req: DeleteVariationData; - res: { - /** - * No Content - */ - 204: void; - /** - * Forbidden - */ - 403: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/variations/{variationID}/options': { - post: { - req: CreateVariationOptionData; - res: { - /** - * Successfully returns the created variation option - */ - 201: created_option; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - get: { - req: GetAllVariationOptionsData; - res: { - /** - * Successfully returns all variation options - */ - 200: multi_options; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/variations/{variationID}/options/{optionID}': { - get: { - req: GetVariationOptionData; - res: { - /** - * Successfully returns the variation option - */ - 200: single_option; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - put: { - req: UpdateVariationOptionData; - res: { - /** - * Successfully returns the updated variation option - */ - 200: single_option; - /** - * Forbidden - */ - 403: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Write conflict detected - */ - 409: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - delete: { - req: DeleteVariationOptionData; - res: { - /** - * No Content - */ - 204: void; - /** - * Forbidden - */ - 403: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/variations/{variationID}/options/{optionID}/modifiers': { - post: { - req: CreateModifierData; - res: { - /** - * Successfully returns the created modifier - */ - 201: created_modifier; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - get: { - req: GetAllModifiersData; - res: { - /** - * Successfully returns all variation modifiers - */ - 200: multi_modifiers; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/variations/{variationID}/options/{optionID}/modifiers/{modifierID}': { - get: { - req: GetModifierData; - res: { - /** - * Returns the specified modifier. - */ - 200: single_modifier; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - put: { - req: UpdateModifierData; - res: { - /** - * Successfully returns the updated modifier - */ - 200: single_modifier; - /** - * Forbidden - */ - 403: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Write conflict detected - */ - 409: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - delete: { - req: DeleteModifierData; - res: { - /** - * No Content - */ - 204: void; - /** - * Forbidden - */ - 403: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/hierarchies': { - post: { - req: CreateHierarchyData; - res: { - /** - * Returns a created hierarchy with the following attributes. - */ - 201: single_hierarchy; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - get: { - req: GetHierarchyData; - res: { - /** - * Returns a list of all hierarchies. - */ - 200: multi_hierarchy; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/hierarchies/{hierarchyID}': { - get: { - req: GetHierarchyChildData; - res: { - /** - * Returns a hierarchy with the following attributes. - */ - 200: single_hierarchy; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - put: { - req: UpdateHierarchyData; - res: { - /** - * Successfully returns the updated hierarchy - */ - 200: single_hierarchy; - /** - * Forbidden - */ - 403: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - delete: { - req: DeleteHierarchyData; - res: { - /** - * No Content - */ - 204: void; - /** - * Forbidden - */ - 403: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/hierarchies/{hierarchyID}/nodes': { - post: { - req: CreateNodeData; - res: { - /** - * Successfully returns the created node - */ - 201: single_node; - /** - * Forbidden - */ - 403: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - get: { - req: GetAllNodesInHierarchyData; - res: { - /** - * Successfully returns the node's children - */ - 200: multi_nodes; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}': { - get: { - req: GetHierarchyNodeData; - res: { - /** - * Returns a node with the following attributes. - */ - 200: single_node; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - put: { - req: UpdateNodeData; - res: { - /** - * Successfully returns the updated node - */ - 200: single_node; - /** - * Forbidden - */ - 403: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - delete: { - req: DeleteNodeData; - res: { - /** - * No Content - */ - 204: void; - /** - * Forbidden - */ - 403: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/hierarchies/{hierarchyID}/children': { - get: { - req: GetAllChildrenData; - res: { - /** - * Returns the hierarchy's children. - */ - 200: multi_nodes; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/children': { - post: { - req: CreateNodeChildRelationshipsData; - res: { - /** - * Successfully returns the node's children - */ - 200: single_node; - /** - * Forbidden - */ - 403: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/children': { - get: { - req: GetAllNodeChildrenData; - res: { - /** - * Successfully returns the node's children - */ - 200: multi_nodes; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/parent': { - put: { - req: UpdateNodeParentData; - res: { - /** - * No Content - */ - 204: void; - /** - * Forbidden - */ - 403: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - delete: { - req: DeleteNodeParentData; - res: { - /** - * No Content - */ - 204: void; - /** - * Forbidden - */ - 403: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/products': { - post: { - req: CreateNodeProductRelationshipData; - res: { - /** - * Successfully returns the updated node - */ - 201: single_node; - /** - * Forbidden - */ - 403: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - delete: { - req: DeleteNodeProductRelationshipsData; - res: { - /** - * Successfully returns the updated node - */ - 200: single_node; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/products': { - get: { - req: GetNodeProductsData; - res: { - /** - * Successfully returns the node's products - */ - 200: multi_product_response; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/hierarchies/{hierarchyID}/duplicate_job': { - post: { - req: DuplicateHierarchyData; - res: { - /** - * Successfully returns the duplicate hierarchy job ID - */ - 201: single; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/tags': { - get: { - res: { - /** - * Returns all the product tags. - */ - 200: multi_tag; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/tags/{tagID}': { - get: { - req: GetProductTagData; - res: { - /** - * Returns a product tag with the following attributes. - */ - 200: single_tag; - /** - * Bad request. The request failed validation. - */ - 400: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/custom_relationships': { - post: { - req: CreateCustomRelationshipData; - res: { - /** - * Returns a created custom relationship with the following attributes. - */ - 201: single_custom_relationship; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; - '/pcm/custom_relationships/{customRelationshipSlug}': { - put: { - req: UpdateCustomRelationshipData; - res: { - /** - * Successfully returns the updated custom relationship - */ - 200: single_custom_relationship; - /** - * Forbidden - */ - 403: error; - /** - * Bad Request. Not Found. - */ - 404: error; - /** - * Bad request. The request failed validation. - */ - 422: error; - /** - * Internal server error. There was a system failure in the platform. - */ - 500: error; - }; - }; - }; -}; \ No newline at end of file + "/pcm/jobs": { + get: { + res: { + /** + * Returns all the jobs. + */ + "200": Multi + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/jobs/{jobID}": { + get: { + req: GetJobData + res: { + /** + * Returns a job with the following attributes. + */ + "200": Single + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/jobs/{jobID}/cancel": { + post: { + req: CancelJobData + res: { + /** + * Successfully cancelled job + */ + "200": Single + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/jobs/{jobID}/errors": { + get: { + req: GetJobErrorsData + res: { + /** + * Successful + */ + "200": Errors + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/products": { + post: { + req: CreateProductData + res: { + /** + * Creates a product with the following attributes. + */ + "201": SingleProductResponse + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + get: { + req: GetAllProductsData + res: { + /** + * Returns a list of all products. + */ + "200": MultiProductResponse + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/products/import": { + post: { + req: ImportProductsData + res: { + /** + * Import started + */ + "201": Single + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/products/export": { + post: { + req: ExportProductsData + res: { + /** + * Export started + */ + "201": Single + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/products/{productID}": { + get: { + req: GetProductData + res: { + /** + * Returns a product by its identifier. + */ + "200": SingleProductResponse + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + put: { + req: UpdateProductData + res: { + /** + * Updates a product with the following attributes. + */ + "200": SingleProductResponse + /** + * Forbidden + */ + "403": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Write conflict detected + */ + "409": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + delete: { + req: DeleteProductData + res: { + /** + * Deletes the specified product. + */ + "204": void + /** + * Forbidden + */ + "403": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/products/attach_nodes": { + post: { + req: AttachNodesData + res: { + /** + * This request assigns the products that you have selected to multiple hierarchies and their children nodes and returns the following. + */ + "200": { + meta?: { + /** + * Number of nodes assigned to the products. + */ + nodes_attached?: number + /** + * A list of node unique identifiers that could not be identified. + */ + nodes_not_found?: Array + } + } + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/products/detach_nodes": { + post: { + req: DetachNodesData + res: { + /** + * The request dissociates the products that you have selected from multiple hierarchies and their children and returns the following. + */ + "200": { + meta?: { + /** + * Number of nodes dissociated from the products. + */ + nodes_detached?: number + /** + * A list of node unique identifiers that could not be identified. + */ + nodes_not_found?: Array + } + } + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/products/{productID}/nodes": { + get: { + req: GetProductsNodesData + res: { + /** + * Successfully returns the product's nodes. + */ + "200": MultiNodes + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/products/{productID}/build": { + post: { + req: BuildChildProductsData + res: { + /** + * Successfully started building child products + */ + "201": unknown + /** + * Forbidden + */ + "403": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/products/{productID}/children": { + get: { + req: GetChildProductsData + res: { + /** + * Returns a list of child products for the specified parent product ID. + */ + "200": MultiProductResponse + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/products/{productID}/relationships/templates": { + post: { + req: CreateProductTemplateRelationshipData + res: { + /** + * Returns a created product template relationship. + */ + "201": TemplateResponse + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Forbidden + */ + "403": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Write conflict detected + */ + "409": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + get: { + req: GetProductTemplateRelationshipsData + res: { + /** + * Returns all product template relationships + */ + "200": TemplateResponse + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Forbidden + */ + "403": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Write conflict detected + */ + "409": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + delete: { + req: DeleteProductTemplateRelationshipData + res: { + /** + * No Content + */ + "204": void + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Forbidden + */ + "403": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Write conflict detected + */ + "409": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/products/{productID}/relationships/component_products": { + get: { + req: GetProductComponentProductsRelationshipsData + res: { + /** + * Returns all Component Products relationships + */ + "200": ComponentProductsResponse + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Forbidden + */ + "403": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Write conflict detected + */ + "409": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/products/{productID}/relationships/files": { + get: { + req: GetProductFileRelationshipsData + res: { + /** + * Returns all product file relationships. + */ + "200": FileResponse + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Forbidden + */ + "403": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Write conflict detected + */ + "409": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + post: { + req: CreateProductFileRelationshipsData + res: { + /** + * No Content + */ + "204": void + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Forbidden + */ + "403": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Write conflict detected + */ + "409": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + put: { + req: UpdateProductFileRelationshipsData + res: { + /** + * No Content + */ + "204": void + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Forbidden + */ + "403": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Write conflict detected + */ + "409": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + delete: { + req: DeleteProductFileRelationshipsData + res: { + /** + * No Content + */ + "204": void + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Forbidden + */ + "403": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Write conflict detected + */ + "409": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/products/{productID}/relationships/variations": { + post: { + req: CreateProductVariationRelationshipsData + res: { + /** + * No Content + */ + "204": void + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Forbidden + */ + "403": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Write conflict detected + */ + "409": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + get: { + req: GetProductVariationRelationshipsData + res: { + /** + * Returns all product variation relationships + */ + "200": VariationsResponse + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Forbidden + */ + "403": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Write conflict detected + */ + "409": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + put: { + req: UpdateProductVariationRelationshipsData + res: { + /** + * No Content + */ + "204": void + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Forbidden + */ + "403": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Write conflict detected + */ + "409": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + delete: { + req: DeleteProductVariationRelationshipsData + res: { + /** + * No Content + */ + "204": void + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Forbidden + */ + "403": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Write conflict detected + */ + "409": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/products/{productID}/relationships/main_image": { + post: { + req: CreateProductMainImageRelationshipsData + res: { + /** + * No Content + */ + "204": void + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Forbidden + */ + "403": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Write conflict detected + */ + "409": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + get: { + req: GetProductMainImageRelationshipsData + res: { + /** + * Returns all product variation relationships + */ + "200": MainImageResponse + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Forbidden + */ + "403": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Write conflict detected + */ + "409": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + put: { + req: UpdateProductMainImageRelationshipsData + res: { + /** + * No Content + */ + "204": void + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Forbidden + */ + "403": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Write conflict detected + */ + "409": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + delete: { + req: DeleteProductMainImageRelationshipsData + res: { + /** + * No Content + */ + "204": void + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Forbidden + */ + "403": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Write conflict detected + */ + "409": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/variations": { + post: { + req: CreateVariationData + res: { + /** + * Returns a created variation with the following attributes. + */ + "201": CreatedVariation + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + get: { + req: GetAllVariationsData + res: { + /** + * Returns all variations. + */ + "200": MultiVariations + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/variations/{variationID}": { + get: { + req: GetVariationData + res: { + /** + * Returns the specified variation. + */ + "200": SingleVariation + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + put: { + req: UpdateVariationData + res: { + /** + * Returns an updated variation with the following attributes. + */ + "200": SingleVariation + /** + * Forbidden + */ + "403": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Write conflict detected + */ + "409": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + delete: { + req: DeleteVariationData + res: { + /** + * No Content + */ + "204": void + /** + * Forbidden + */ + "403": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/variations/{variationID}/options": { + post: { + req: CreateVariationOptionData + res: { + /** + * Successfully returns the created variation option + */ + "201": CreatedOption + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + get: { + req: GetAllVariationOptionsData + res: { + /** + * Successfully returns all variation options + */ + "200": MultiOptions + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/variations/{variationID}/options/{optionID}": { + get: { + req: GetVariationOptionData + res: { + /** + * Successfully returns the variation option + */ + "200": SingleOption + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + put: { + req: UpdateVariationOptionData + res: { + /** + * Successfully returns the updated variation option + */ + "200": SingleOption + /** + * Forbidden + */ + "403": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Write conflict detected + */ + "409": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + delete: { + req: DeleteVariationOptionData + res: { + /** + * No Content + */ + "204": void + /** + * Forbidden + */ + "403": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/variations/{variationID}/options/{optionID}/modifiers": { + post: { + req: CreateModifierData + res: { + /** + * Successfully returns the created modifier + */ + "201": CreatedModifier + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + get: { + req: GetAllModifiersData + res: { + /** + * Successfully returns all variation modifiers + */ + "200": MultiModifiers + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/variations/{variationID}/options/{optionID}/modifiers/{modifierID}": { + get: { + req: GetModifierData + res: { + /** + * Returns the specified modifier. + */ + "200": SingleModifier + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + put: { + req: UpdateModifierData + res: { + /** + * Successfully returns the updated modifier + */ + "200": SingleModifier + /** + * Forbidden + */ + "403": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Write conflict detected + */ + "409": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + delete: { + req: DeleteModifierData + res: { + /** + * No Content + */ + "204": void + /** + * Forbidden + */ + "403": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/hierarchies": { + post: { + req: CreateHierarchyData + res: { + /** + * Returns a created hierarchy with the following attributes. + */ + "201": SingleHierarchy + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + get: { + req: GetHierarchyData + res: { + /** + * Returns a list of all hierarchies. + */ + "200": MultiHierarchy + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/hierarchies/{hierarchyID}": { + get: { + req: GetHierarchyChildData + res: { + /** + * Returns a hierarchy with the following attributes. + */ + "200": SingleHierarchy + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + put: { + req: UpdateHierarchyData + res: { + /** + * Successfully returns the updated hierarchy + */ + "200": SingleHierarchy + /** + * Forbidden + */ + "403": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + delete: { + req: DeleteHierarchyData + res: { + /** + * No Content + */ + "204": void + /** + * Forbidden + */ + "403": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/hierarchies/{hierarchyID}/nodes": { + post: { + req: CreateNodeData + res: { + /** + * Successfully returns the created node + */ + "201": SingleNode + /** + * Forbidden + */ + "403": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + get: { + req: GetAllNodesInHierarchyData + res: { + /** + * Successfully returns the node's children + */ + "200": MultiNodes + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}": { + get: { + req: GetHierarchyNodeData + res: { + /** + * Returns a node with the following attributes. + */ + "200": SingleNode + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + put: { + req: UpdateNodeData + res: { + /** + * Successfully returns the updated node + */ + "200": SingleNode + /** + * Forbidden + */ + "403": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + delete: { + req: DeleteNodeData + res: { + /** + * No Content + */ + "204": void + /** + * Forbidden + */ + "403": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/hierarchies/{hierarchyID}/children": { + get: { + req: GetAllChildrenData + res: { + /** + * Returns the hierarchy's children. + */ + "200": MultiNodes + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/children": { + post: { + req: CreateNodeChildRelationshipsData + res: { + /** + * Successfully returns the node's children + */ + "200": SingleNode + /** + * Forbidden + */ + "403": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/children": { + get: { + req: GetAllNodeChildrenData + res: { + /** + * Successfully returns the node's children + */ + "200": MultiNodes + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/parent": { + put: { + req: UpdateNodeParentData + res: { + /** + * No Content + */ + "204": void + /** + * Forbidden + */ + "403": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + delete: { + req: DeleteNodeParentData + res: { + /** + * No Content + */ + "204": void + /** + * Forbidden + */ + "403": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/products": { + post: { + req: CreateNodeProductRelationshipData + res: { + /** + * Successfully returns the updated node + */ + "201": SingleNode + /** + * Forbidden + */ + "403": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + delete: { + req: DeleteNodeProductRelationshipsData + res: { + /** + * Successfully returns the updated node + */ + "200": SingleNode + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/products": { + get: { + req: GetNodeProductsData + res: { + /** + * Successfully returns the node's products + */ + "200": MultiProductResponse + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/hierarchies/{hierarchyID}/duplicate_job": { + post: { + req: DuplicateHierarchyData + res: { + /** + * Successfully returns the duplicate hierarchy job ID + */ + "201": Single + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/tags": { + get: { + res: { + /** + * Returns all the product tags. + */ + "200": MultiTag + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/tags/{tagID}": { + get: { + req: GetProductTagData + res: { + /** + * Returns a product tag with the following attributes. + */ + "200": SingleTag + /** + * Bad request. The request failed validation. + */ + "400": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/custom_relationships": { + post: { + req: CreateCustomRelationshipData + res: { + /** + * Returns a created custom relationship with the following attributes. + */ + "201": SingleCustomRelationship + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } + "/pcm/custom_relationships/{customRelationshipSlug}": { + put: { + req: UpdateCustomRelationshipData + res: { + /** + * Successfully returns the updated custom relationship + */ + "200": SingleCustomRelationship + /** + * Forbidden + */ + "403": Error + /** + * Bad Request. Not Found. + */ + "404": Error + /** + * Bad request. The request failed validation. + */ + "422": Error + /** + * Internal server error. There was a system failure in the platform. + */ + "500": Error + } + } + } +} diff --git a/packages/sdks/tsconfig.json b/packages/sdks/tsconfig.json index 75dcaeac..a7fc6fbf 100644 --- a/packages/sdks/tsconfig.json +++ b/packages/sdks/tsconfig.json @@ -1,103 +1,25 @@ { "compilerOptions": { - /* Visit https://aka.ms/tsconfig to read more about this file */ - - /* Projects */ - // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ - // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ - // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ - // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ - // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ - // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ - - /* Language and Environment */ - "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ - // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ - // "jsx": "preserve", /* Specify what JSX code is generated. */ - // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ - // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ - // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ - // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ - // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ - // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ - // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ - // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ - // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ - - /* Modules */ - "module": "commonjs", /* Specify what module code is generated. */ - // "rootDir": "./", /* Specify the root folder within your source files. */ - // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ - // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ - // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ - // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ - // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ - // "types": [], /* Specify type package names to be included without being referenced in a source file. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ - // "resolveJsonModule": true, /* Enable importing .json files. */ - // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ - - /* JavaScript Support */ - // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ - // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ - // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ - - /* Emit */ - // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ - // "declarationMap": true, /* Create sourcemaps for d.ts files. */ - // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ - // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ - // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ - // "outDir": "./", /* Specify an output folder for all emitted files. */ - // "removeComments": true, /* Disable emitting comments. */ - // "noEmit": true, /* Disable emitting files from a compilation. */ - // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ - // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ - // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ - // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ - // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ - // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ - // "newLine": "crlf", /* Set the newline character for emitting files. */ - // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ - // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ - // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ - // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ - // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ - // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ - - /* Interop Constraints */ - // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ - // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ - "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ - // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ - "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ - - /* Type Checking */ - "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ - // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ - // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ - // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ - // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ - // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ - // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ - // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ - // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ - // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ - // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ - // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ - // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ - // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ - // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ - // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ - // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ - - /* Completeness */ - // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ - "skipLibCheck": true /* Skip type checking all .d.ts files. */ - } + "target": "ES2020", + "useDefineForClassFields": true, + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "module": "ESNext", + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "react-jsx", + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true + }, + "include": ["src"], + "references": [{ "path": "./tsconfig.node.json" }] } diff --git a/packages/sdks/tsconfig.node.json b/packages/sdks/tsconfig.node.json new file mode 100644 index 00000000..97ede7ee --- /dev/null +++ b/packages/sdks/tsconfig.node.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "composite": true, + "skipLibCheck": true, + "module": "ESNext", + "moduleResolution": "bundler", + "allowSyntheticDefaultImports": true, + "strict": true + }, + "include": ["vite.config.ts"] +} diff --git a/tsconfig.json b/tsconfig.json index be86ea9a..a7fc6fbf 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,38 +1,25 @@ { "compilerOptions": { - "baseUrl": "tsconfig", - "lib": ["es2018", "dom"], - "module": "commonjs", - "moduleResolution": "node", - "noEmitOnError": true, - "noFallthroughCasesInSwitch": true, - "noImplicitAny": true, - "noImplicitThis": true, - "noUnusedParameters": false, - "noUnusedLocals": false, - "rootDir": ".", - "rootDirs": [ - ".", "./dist-schema"], - "skipDefaultLibCheck": true, + "target": "ES2020", + "useDefineForClassFields": true, + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "module": "ESNext", "skipLibCheck": true, - "sourceMap": true, - "strictNullChecks": true, - "target": "es2019", - "types": ["node", "jest", "jest-extended"], - "esModuleInterop": true, - "jsx": "react" + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "react-jsx", + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true }, - "files": ["node_modules/jest-extended/types/index.d.ts"], - "include": ["./**/*"], - "exclude": [ - "./*/files/**/*", - "./*/other-files/**/*", - "./*/project-files/**/*", - "./*/schematic-files/**/*", - "packages/d2c-schematics/node_modules", - "dist", - "**/node_modules/**/*", - "**/dist/**/*", - "**/*/*.test.ts" - ] + "include": ["src"], + "references": [{ "path": "./tsconfig.node.json" }] } From 23ecb0211b0c8d8b44eb5b606203d72fe2aa39d2 Mon Sep 17 00:00:00 2001 From: Robert Field Date: Fri, 12 Jul 2024 14:21:55 +0100 Subject: [PATCH 03/30] feat: create root index --- .../sdks/openapi-ts-error-1720105320904.log | 5 - packages/sdks/openapi-ts.config.ts | 1 + packages/sdks/package.json | 20 +- packages/sdks/src/client/services.gen.ts | 486 +++++++------ packages/sdks/src/client/types.gen.ts | 665 +++++++++++++++++- packages/sdks/src/index.ts | 3 + packages/sdks/tsconfig.json | 1 + packages/sdks/tsconfig.node.json | 6 +- tsconfig.json | 53 +- 9 files changed, 972 insertions(+), 268 deletions(-) delete mode 100644 packages/sdks/openapi-ts-error-1720105320904.log create mode 100644 packages/sdks/src/index.ts diff --git a/packages/sdks/openapi-ts-error-1720105320904.log b/packages/sdks/openapi-ts-error-1720105320904.log deleted file mode 100644 index c264bc2a..00000000 --- a/packages/sdks/openapi-ts-error-1720105320904.log +++ /dev/null @@ -1,5 +0,0 @@ -Error opening file "/Users/robert.field/Documents/Projects/EP/muse/composable-frontend/packages/sdks/path/to/openapi.json" -ENOENT: no such file or directory, open '/Users/robert.field/Documents/Projects/EP/muse/composable-frontend/packages/sdks/path/to/openapi.json' -JSONParserError: Error opening file "/Users/robert.field/Documents/Projects/EP/muse/composable-frontend/packages/sdks/path/to/openapi.json" -ENOENT: no such file or directory, open '/Users/robert.field/Documents/Projects/EP/muse/composable-frontend/packages/sdks/path/to/openapi.json' - at Object.read (/Users/robert.field/Documents/Projects/EP/muse/composable-frontend/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.6.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolvers/file.js:61:19) \ No newline at end of file diff --git a/packages/sdks/openapi-ts.config.ts b/packages/sdks/openapi-ts.config.ts index f9993994..942e27f7 100644 --- a/packages/sdks/openapi-ts.config.ts +++ b/packages/sdks/openapi-ts.config.ts @@ -7,5 +7,6 @@ export default defineConfig({ types: { name: "PascalCase", enums: false, + dates: "types+transform", }, }) diff --git a/packages/sdks/package.json b/packages/sdks/package.json index a05b7795..8f36cb12 100644 --- a/packages/sdks/package.json +++ b/packages/sdks/package.json @@ -1,14 +1,28 @@ { "name": "@field123/sdks-temp", "version": "0.0.1", + "private": true, "description": "", - "main": "index.js", + "main": "dist/index.js", "scripts": { + "build": "tsc -p tsconfig.node.json", "openapi-ts": "openapi-ts" }, + "exports": { + ".": { + "types": "./dist/index.d.ts", + "node": { + "import": "./dist/index.js", + "require": "./dist/index.js" + }, + "default": "./dist/index.js" + }, + "./package.json": "./package.json" + }, + "files": [ + "dist/**" + ], "keywords": [], - "author": "Robert Field", - "license": "ISC", "devDependencies": { "@hey-api/openapi-ts": "^0.48.2", "typescript": "^5.5.3" diff --git a/packages/sdks/src/client/services.gen.ts b/packages/sdks/src/client/services.gen.ts index 1ee6ed81..c1c40147 100644 --- a/packages/sdks/src/client/services.gen.ts +++ b/packages/sdks/src/client/services.gen.ts @@ -5,215 +5,249 @@ import { type Options, formDataBodySerializer, } from "@hey-api/client-fetch" -import type { - GetAllJobsError, - GetAllJobsResponse, - GetJobData, - GetJobError, - GetJobResponse, - CancelJobData, - CancelJobError, - CancelJobResponse, - GetJobErrorsData, - GetJobErrorsError, - GetJobErrorsResponse, - CreateProductData, - CreateProductError, - CreateProductResponse, - GetAllProductsData, - GetAllProductsError, - GetAllProductsResponse, - ImportProductsData, - ImportProductsError, - ImportProductsResponse, - ExportProductsData, - ExportProductsError, - ExportProductsResponse, - GetProductData, - GetProductError, - GetProductResponse, - UpdateProductData, - UpdateProductError, - UpdateProductResponse, - DeleteProductData, - DeleteProductError, - DeleteProductResponse, - AttachNodesData, - AttachNodesError, - AttachNodesResponse, - DetachNodesData, - DetachNodesError, - DetachNodesResponse, - GetProductsNodesData, - GetProductsNodesError, - GetProductsNodesResponse, - BuildChildProductsData, - BuildChildProductsError, - BuildChildProductsResponse, - GetChildProductsData, - GetChildProductsError, - GetChildProductsResponse, - CreateProductTemplateRelationshipData, - CreateProductTemplateRelationshipError, - CreateProductTemplateRelationshipResponse, - GetProductTemplateRelationshipsData, - GetProductTemplateRelationshipsError, - GetProductTemplateRelationshipsResponse, - DeleteProductTemplateRelationshipData, - DeleteProductTemplateRelationshipError, - DeleteProductTemplateRelationshipResponse, - GetProductComponentProductsRelationshipsData, - GetProductComponentProductsRelationshipsError, - GetProductComponentProductsRelationshipsResponse, - GetProductFileRelationshipsData, - GetProductFileRelationshipsError, - GetProductFileRelationshipsResponse, - CreateProductFileRelationshipsData, - CreateProductFileRelationshipsError, - CreateProductFileRelationshipsResponse, - UpdateProductFileRelationshipsData, - UpdateProductFileRelationshipsError, - UpdateProductFileRelationshipsResponse, - DeleteProductFileRelationshipsData, - DeleteProductFileRelationshipsError, - DeleteProductFileRelationshipsResponse, - CreateProductVariationRelationshipsData, - CreateProductVariationRelationshipsError, - CreateProductVariationRelationshipsResponse, - GetProductVariationRelationshipsData, - GetProductVariationRelationshipsError, - GetProductVariationRelationshipsResponse, - UpdateProductVariationRelationshipsData, - UpdateProductVariationRelationshipsError, - UpdateProductVariationRelationshipsResponse, - DeleteProductVariationRelationshipsData, - DeleteProductVariationRelationshipsError, - DeleteProductVariationRelationshipsResponse, - CreateProductMainImageRelationshipsData, - CreateProductMainImageRelationshipsError, - CreateProductMainImageRelationshipsResponse, - GetProductMainImageRelationshipsData, - GetProductMainImageRelationshipsError, - GetProductMainImageRelationshipsResponse, - UpdateProductMainImageRelationshipsData, - UpdateProductMainImageRelationshipsError, - UpdateProductMainImageRelationshipsResponse, - DeleteProductMainImageRelationshipsData, - DeleteProductMainImageRelationshipsError, - DeleteProductMainImageRelationshipsResponse, - CreateVariationData, - CreateVariationError, - CreateVariationResponse, - GetAllVariationsData, - GetAllVariationsError, - GetAllVariationsResponse, - GetVariationData, - GetVariationError, - GetVariationResponse, - UpdateVariationData, - UpdateVariationError, - UpdateVariationResponse, - DeleteVariationData, - DeleteVariationError, - DeleteVariationResponse, - CreateVariationOptionData, - CreateVariationOptionError, - CreateVariationOptionResponse, - GetAllVariationOptionsData, - GetAllVariationOptionsError, - GetAllVariationOptionsResponse, - GetVariationOptionData, - GetVariationOptionError, - GetVariationOptionResponse, - UpdateVariationOptionData, - UpdateVariationOptionError, - UpdateVariationOptionResponse, - DeleteVariationOptionData, - DeleteVariationOptionError, - DeleteVariationOptionResponse, - CreateModifierData, - CreateModifierError, - CreateModifierResponse, - GetAllModifiersData, - GetAllModifiersError, - GetAllModifiersResponse, - GetModifierData, - GetModifierError, - GetModifierResponse, - UpdateModifierData, - UpdateModifierError, - UpdateModifierResponse, - DeleteModifierData, - DeleteModifierError, - DeleteModifierResponse, - CreateHierarchyData, - CreateHierarchyError, - CreateHierarchyResponse, - GetHierarchyData, - GetHierarchyError, - GetHierarchyResponse, - GetHierarchyChildData, - GetHierarchyChildError, - GetHierarchyChildResponse, - UpdateHierarchyData, - UpdateHierarchyError, - UpdateHierarchyResponse, - DeleteHierarchyData, - DeleteHierarchyError, - DeleteHierarchyResponse, - CreateNodeData, - CreateNodeError, - CreateNodeResponse, - GetAllNodesInHierarchyData, - GetAllNodesInHierarchyError, - GetAllNodesInHierarchyResponse, - GetHierarchyNodeData, - GetHierarchyNodeError, - GetHierarchyNodeResponse, - UpdateNodeData, - UpdateNodeError, - UpdateNodeResponse, - DeleteNodeData, - DeleteNodeError, - DeleteNodeResponse, - GetAllChildrenData, - GetAllChildrenError, - GetAllChildrenResponse, - CreateNodeChildRelationshipsData, - CreateNodeChildRelationshipsError, - CreateNodeChildRelationshipsResponse, - GetAllNodeChildrenData, - GetAllNodeChildrenError, - GetAllNodeChildrenResponse, - UpdateNodeParentData, - UpdateNodeParentError, - UpdateNodeParentResponse, - DeleteNodeParentData, - DeleteNodeParentError, - DeleteNodeParentResponse, - CreateNodeProductRelationshipData, - CreateNodeProductRelationshipError, - CreateNodeProductRelationshipResponse, - DeleteNodeProductRelationshipsData, - DeleteNodeProductRelationshipsError, - DeleteNodeProductRelationshipsResponse, - GetNodeProductsData, - GetNodeProductsError, - GetNodeProductsResponse, - DuplicateHierarchyData, - DuplicateHierarchyError, - DuplicateHierarchyResponse, - GetAllProductTagsError, - GetAllProductTagsResponse, - GetProductTagData, - GetProductTagError, - GetProductTagResponse, - CreateCustomRelationshipData, - CreateCustomRelationshipError, - CreateCustomRelationshipResponse, - UpdateCustomRelationshipData, - UpdateCustomRelationshipError, - UpdateCustomRelationshipResponse, +import { + type GetAllJobsError, + type GetAllJobsResponse, + type GetJobData, + type GetJobError, + type GetJobResponse, + type CancelJobData, + type CancelJobError, + type CancelJobResponse, + type GetJobErrorsData, + type GetJobErrorsError, + type GetJobErrorsResponse, + type CreateProductData, + type CreateProductError, + type CreateProductResponse, + type GetAllProductsData, + type GetAllProductsError, + type GetAllProductsResponse, + type ImportProductsData, + type ImportProductsError, + type ImportProductsResponse, + type ExportProductsData, + type ExportProductsError, + type ExportProductsResponse, + type GetProductData, + type GetProductError, + type GetProductResponse, + type UpdateProductData, + type UpdateProductError, + type UpdateProductResponse, + type DeleteProductData, + type DeleteProductError, + type DeleteProductResponse, + type AttachNodesData, + type AttachNodesError, + type AttachNodesResponse, + type DetachNodesData, + type DetachNodesError, + type DetachNodesResponse, + type GetProductsNodesData, + type GetProductsNodesError, + type GetProductsNodesResponse, + type BuildChildProductsData, + type BuildChildProductsError, + type BuildChildProductsResponse, + type GetChildProductsData, + type GetChildProductsError, + type GetChildProductsResponse, + type CreateProductTemplateRelationshipData, + type CreateProductTemplateRelationshipError, + type CreateProductTemplateRelationshipResponse, + type GetProductTemplateRelationshipsData, + type GetProductTemplateRelationshipsError, + type GetProductTemplateRelationshipsResponse, + type DeleteProductTemplateRelationshipData, + type DeleteProductTemplateRelationshipError, + type DeleteProductTemplateRelationshipResponse, + type GetProductComponentProductsRelationshipsData, + type GetProductComponentProductsRelationshipsError, + type GetProductComponentProductsRelationshipsResponse, + type GetProductFileRelationshipsData, + type GetProductFileRelationshipsError, + type GetProductFileRelationshipsResponse, + type CreateProductFileRelationshipsData, + type CreateProductFileRelationshipsError, + type CreateProductFileRelationshipsResponse, + type UpdateProductFileRelationshipsData, + type UpdateProductFileRelationshipsError, + type UpdateProductFileRelationshipsResponse, + type DeleteProductFileRelationshipsData, + type DeleteProductFileRelationshipsError, + type DeleteProductFileRelationshipsResponse, + type CreateProductVariationRelationshipsData, + type CreateProductVariationRelationshipsError, + type CreateProductVariationRelationshipsResponse, + type GetProductVariationRelationshipsData, + type GetProductVariationRelationshipsError, + type GetProductVariationRelationshipsResponse, + type UpdateProductVariationRelationshipsData, + type UpdateProductVariationRelationshipsError, + type UpdateProductVariationRelationshipsResponse, + type DeleteProductVariationRelationshipsData, + type DeleteProductVariationRelationshipsError, + type DeleteProductVariationRelationshipsResponse, + type CreateProductMainImageRelationshipsData, + type CreateProductMainImageRelationshipsError, + type CreateProductMainImageRelationshipsResponse, + type GetProductMainImageRelationshipsData, + type GetProductMainImageRelationshipsError, + type GetProductMainImageRelationshipsResponse, + type UpdateProductMainImageRelationshipsData, + type UpdateProductMainImageRelationshipsError, + type UpdateProductMainImageRelationshipsResponse, + type DeleteProductMainImageRelationshipsData, + type DeleteProductMainImageRelationshipsError, + type DeleteProductMainImageRelationshipsResponse, + type CreateVariationData, + type CreateVariationError, + type CreateVariationResponse, + type GetAllVariationsData, + type GetAllVariationsError, + type GetAllVariationsResponse, + type GetVariationData, + type GetVariationError, + type GetVariationResponse, + type UpdateVariationData, + type UpdateVariationError, + type UpdateVariationResponse, + type DeleteVariationData, + type DeleteVariationError, + type DeleteVariationResponse, + type CreateVariationOptionData, + type CreateVariationOptionError, + type CreateVariationOptionResponse, + type GetAllVariationOptionsData, + type GetAllVariationOptionsError, + type GetAllVariationOptionsResponse, + type GetVariationOptionData, + type GetVariationOptionError, + type GetVariationOptionResponse, + type UpdateVariationOptionData, + type UpdateVariationOptionError, + type UpdateVariationOptionResponse, + type DeleteVariationOptionData, + type DeleteVariationOptionError, + type DeleteVariationOptionResponse, + type CreateModifierData, + type CreateModifierError, + type CreateModifierResponse, + type GetAllModifiersData, + type GetAllModifiersError, + type GetAllModifiersResponse, + type GetModifierData, + type GetModifierError, + type GetModifierResponse, + type UpdateModifierData, + type UpdateModifierError, + type UpdateModifierResponse, + type DeleteModifierData, + type DeleteModifierError, + type DeleteModifierResponse, + type CreateHierarchyData, + type CreateHierarchyError, + type CreateHierarchyResponse, + type GetHierarchyData, + type GetHierarchyError, + type GetHierarchyResponse, + type GetHierarchyChildData, + type GetHierarchyChildError, + type GetHierarchyChildResponse, + type UpdateHierarchyData, + type UpdateHierarchyError, + type UpdateHierarchyResponse, + type DeleteHierarchyData, + type DeleteHierarchyError, + type DeleteHierarchyResponse, + type CreateNodeData, + type CreateNodeError, + type CreateNodeResponse, + type GetAllNodesInHierarchyData, + type GetAllNodesInHierarchyError, + type GetAllNodesInHierarchyResponse, + type GetHierarchyNodeData, + type GetHierarchyNodeError, + type GetHierarchyNodeResponse, + type UpdateNodeData, + type UpdateNodeError, + type UpdateNodeResponse, + type DeleteNodeData, + type DeleteNodeError, + type DeleteNodeResponse, + type GetAllChildrenData, + type GetAllChildrenError, + type GetAllChildrenResponse, + type CreateNodeChildRelationshipsData, + type CreateNodeChildRelationshipsError, + type CreateNodeChildRelationshipsResponse, + type GetAllNodeChildrenData, + type GetAllNodeChildrenError, + type GetAllNodeChildrenResponse, + type UpdateNodeParentData, + type UpdateNodeParentError, + type UpdateNodeParentResponse, + type DeleteNodeParentData, + type DeleteNodeParentError, + type DeleteNodeParentResponse, + type CreateNodeProductRelationshipData, + type CreateNodeProductRelationshipError, + type CreateNodeProductRelationshipResponse, + type DeleteNodeProductRelationshipsData, + type DeleteNodeProductRelationshipsError, + type DeleteNodeProductRelationshipsResponse, + type GetNodeProductsData, + type GetNodeProductsError, + type GetNodeProductsResponse, + type DuplicateHierarchyData, + type DuplicateHierarchyError, + type DuplicateHierarchyResponse, + type GetAllProductTagsError, + type GetAllProductTagsResponse, + type GetProductTagData, + type GetProductTagError, + type GetProductTagResponse, + type CreateCustomRelationshipData, + type CreateCustomRelationshipError, + type CreateCustomRelationshipResponse, + type UpdateCustomRelationshipData, + type UpdateCustomRelationshipError, + type UpdateCustomRelationshipResponse, + GetAllJobsResponseTransformer, + GetJobResponseTransformer, + CancelJobResponseTransformer, + CreateProductResponseTransformer, + GetAllProductsResponseTransformer, + ImportProductsResponseTransformer, + ExportProductsResponseTransformer, + GetProductResponseTransformer, + UpdateProductResponseTransformer, + GetProductsNodesResponseTransformer, + GetChildProductsResponseTransformer, + CreateVariationResponseTransformer, + CreateVariationOptionResponseTransformer, + GetVariationOptionResponseTransformer, + UpdateVariationOptionResponseTransformer, + CreateHierarchyResponseTransformer, + GetHierarchyResponseTransformer, + GetHierarchyChildResponseTransformer, + UpdateHierarchyResponseTransformer, + CreateNodeResponseTransformer, + GetAllNodesInHierarchyResponseTransformer, + GetHierarchyNodeResponseTransformer, + UpdateNodeResponseTransformer, + GetAllChildrenResponseTransformer, + CreateNodeChildRelationshipsResponseTransformer, + GetAllNodeChildrenResponseTransformer, + CreateNodeProductRelationshipResponseTransformer, + DeleteNodeProductRelationshipsResponseTransformer, + GetNodeProductsResponseTransformer, + DuplicateHierarchyResponseTransformer, + GetAllProductTagsResponseTransformer, + GetProductTagResponseTransformer, + CreateCustomRelationshipResponseTransformer, + UpdateCustomRelationshipResponseTransformer, } from "./types.gen" /** @@ -224,6 +258,7 @@ export const getAllJobs = (options?: Options) => { return (options?.client ?? client).get({ ...options, url: "/pcm/jobs", + responseTransformer: GetAllJobsResponseTransformer, }) } @@ -234,6 +269,7 @@ export const getJob = (options: Options) => { return (options?.client ?? client).get({ ...options, url: "/pcm/jobs/{jobID}", + responseTransformer: GetJobResponseTransformer, }) } @@ -248,6 +284,7 @@ export const cancelJob = (options: Options) => { return (options?.client ?? client).post({ ...options, url: "/pcm/jobs/{jobID}/cancel", + responseTransformer: CancelJobResponseTransformer, }) } @@ -311,6 +348,7 @@ export const createProduct = (options: Options) => { >({ ...options, url: "/pcm/products", + responseTransformer: CreateProductResponseTransformer, }) } @@ -340,6 +378,7 @@ export const getAllProducts = (options?: Options) => { >({ ...options, url: "/pcm/products", + responseTransformer: GetAllProductsResponseTransformer, }) } @@ -376,6 +415,7 @@ export const importProducts = (options?: Options) => { ...options, ...formDataBodySerializer, url: "/pcm/products/import", + responseTransformer: ImportProductsResponseTransformer, }) } @@ -406,6 +446,7 @@ export const exportProducts = (options?: Options) => { >({ ...options, url: "/pcm/products/export", + responseTransformer: ExportProductsResponseTransformer, }) } @@ -420,6 +461,7 @@ export const getProduct = (options: Options) => { return (options?.client ?? client).get({ ...options, url: "/pcm/products/{productID}", + responseTransformer: GetProductResponseTransformer, }) } @@ -434,6 +476,7 @@ export const updateProduct = (options: Options) => { >({ ...options, url: "/pcm/products/{productID}", + responseTransformer: UpdateProductResponseTransformer, }) } @@ -512,6 +555,7 @@ export const getProductsNodes = (options: Options) => { >({ ...options, url: "/pcm/products/{productID}/nodes", + responseTransformer: GetProductsNodesResponseTransformer, }) } @@ -589,6 +633,7 @@ export const getChildProducts = (options: Options) => { >({ ...options, url: "/pcm/products/{productID}/children", + responseTransformer: GetChildProductsResponseTransformer, }) } @@ -846,6 +891,7 @@ export const createVariation = (options: Options) => { >({ ...options, url: "/pcm/variations", + responseTransformer: CreateVariationResponseTransformer, }) } @@ -914,6 +960,7 @@ export const createVariationOption = ( >({ ...options, url: "/pcm/variations/{variationID}/options", + responseTransformer: CreateVariationOptionResponseTransformer, }) } @@ -944,6 +991,7 @@ export const getVariationOption = ( >({ ...options, url: "/pcm/variations/{variationID}/options/{optionID}", + responseTransformer: GetVariationOptionResponseTransformer, }) } @@ -959,6 +1007,7 @@ export const updateVariationOption = ( >({ ...options, url: "/pcm/variations/{variationID}/options/{optionID}", + responseTransformer: UpdateVariationOptionResponseTransformer, }) } @@ -1054,6 +1103,7 @@ export const createHierarchy = (options: Options) => { >({ ...options, url: "/pcm/hierarchies", + responseTransformer: CreateHierarchyResponseTransformer, }) } @@ -1068,6 +1118,7 @@ export const getHierarchy = (options?: Options) => { >({ ...options, url: "/pcm/hierarchies", + responseTransformer: GetHierarchyResponseTransformer, }) } @@ -1082,6 +1133,7 @@ export const getHierarchyChild = (options: Options) => { >({ ...options, url: "/pcm/hierarchies/{hierarchyID}", + responseTransformer: GetHierarchyChildResponseTransformer, }) } @@ -1096,6 +1148,7 @@ export const updateHierarchy = (options: Options) => { >({ ...options, url: "/pcm/hierarchies/{hierarchyID}", + responseTransformer: UpdateHierarchyResponseTransformer, }) } @@ -1159,6 +1212,7 @@ export const createNode = (options: Options) => { return (options?.client ?? client).post({ ...options, url: "/pcm/hierarchies/{hierarchyID}/nodes", + responseTransformer: CreateNodeResponseTransformer, }) } @@ -1175,6 +1229,7 @@ export const getAllNodesInHierarchy = ( >({ ...options, url: "/pcm/hierarchies/{hierarchyID}/nodes", + responseTransformer: GetAllNodesInHierarchyResponseTransformer, }) } @@ -1189,6 +1244,7 @@ export const getHierarchyNode = (options: Options) => { >({ ...options, url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}", + responseTransformer: GetHierarchyNodeResponseTransformer, }) } @@ -1236,6 +1292,7 @@ export const updateNode = (options: Options) => { return (options?.client ?? client).put({ ...options, url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}", + responseTransformer: UpdateNodeResponseTransformer, }) } @@ -1264,6 +1321,7 @@ export const getAllChildren = (options: Options) => { >({ ...options, url: "/pcm/hierarchies/{hierarchyID}/children", + responseTransformer: GetAllChildrenResponseTransformer, }) } @@ -1301,6 +1359,7 @@ export const createNodeChildRelationships = ( >({ ...options, url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/children", + responseTransformer: CreateNodeChildRelationshipsResponseTransformer, }) } @@ -1317,6 +1376,7 @@ export const getAllNodeChildren = ( >({ ...options, url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/children", + responseTransformer: GetAllNodeChildrenResponseTransformer, }) } @@ -1363,6 +1423,7 @@ export const createNodeProductRelationship = ( >({ ...options, url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/products", + responseTransformer: CreateNodeProductRelationshipResponseTransformer, }) } @@ -1378,6 +1439,7 @@ export const deleteNodeProductRelationships = ( >({ ...options, url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/products", + responseTransformer: DeleteNodeProductRelationshipsResponseTransformer, }) } @@ -1393,6 +1455,7 @@ export const getNodeProducts = (options: Options) => { >({ ...options, url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/products", + responseTransformer: GetNodeProductsResponseTransformer, }) } @@ -1423,6 +1486,7 @@ export const duplicateHierarchy = ( >({ ...options, url: "/pcm/hierarchies/{hierarchyID}/duplicate_job", + responseTransformer: DuplicateHierarchyResponseTransformer, }) } @@ -1439,6 +1503,7 @@ export const getAllProductTags = (options?: Options) => { >({ ...options, url: "/pcm/tags", + responseTransformer: GetAllProductTagsResponseTransformer, }) } @@ -1453,6 +1518,7 @@ export const getProductTag = (options: Options) => { >({ ...options, url: "/pcm/tags/{tagID}", + responseTransformer: GetProductTagResponseTransformer, }) } @@ -1469,6 +1535,7 @@ export const createCustomRelationship = ( >({ ...options, url: "/pcm/custom_relationships", + responseTransformer: CreateCustomRelationshipResponseTransformer, }) } @@ -1485,5 +1552,6 @@ export const updateCustomRelationship = ( >({ ...options, url: "/pcm/custom_relationships/{customRelationshipSlug}", + responseTransformer: UpdateCustomRelationshipResponseTransformer, }) } diff --git a/packages/sdks/src/client/types.gen.ts b/packages/sdks/src/client/types.gen.ts index e536cd61..eedf9a86 100644 --- a/packages/sdks/src/client/types.gen.ts +++ b/packages/sdks/src/client/types.gen.ts @@ -13,19 +13,19 @@ export type Job = { /** * The date and time a job is started. */ - started_at?: string | null + started_at?: Date | null /** * The date and time a job is completed. */ - completed_at?: string | null + completed_at?: Date | null /** * The date and time a job is created. */ - created_at?: string + created_at?: Date /** * The date and time a job is updated. */ - updated_at?: string + updated_at?: Date /** * The status of a job. * @@ -320,11 +320,11 @@ export type ProductResponse = { /** * The date and time a product is created. */ - created_at?: string + created_at?: Date /** * The date and time a product is updated. */ - updated_at?: string + updated_at?: Date /** * The resource owner, either `organization` or `store`. */ @@ -698,11 +698,11 @@ export type Node = { /** * The date and time a node is created. */ - created_at?: string + created_at?: Date /** * The date and time a node was updated. */ - updated_at?: string + updated_at?: Date /** * The name of the parent of the node if one exists. */ @@ -842,7 +842,7 @@ export type VariationsResponse = { /** * The date and time a resource is created. */ - created_at?: string + created_at?: Date } }> } @@ -938,11 +938,11 @@ export type MultiVariations = { /** * The date and time an option is created. */ - created_at?: string + created_at?: Date /** * The date and time an option is updated. */ - updated_at?: string + updated_at?: Date /** * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. */ @@ -955,11 +955,11 @@ export type MultiVariations = { /** * The date and time a variation is created. */ - created_at?: string + created_at?: Date /** * The date and time a variation is updated. */ - updated_at?: string + updated_at?: Date } }> meta?: { @@ -1034,11 +1034,11 @@ export type CreatedVariation = { /** * The date and time a variation is created. */ - created_at?: string + created_at?: Date /** * The date and time a variation is updated. */ - updated_at?: string + updated_at?: Date } } } @@ -1083,11 +1083,11 @@ export type SingleVariation = { /** * The date and time an option is created. */ - created_at?: string + created_at?: Date /** * The date and time an option is updated. */ - updated_at?: string + updated_at?: Date /** * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. */ @@ -1171,11 +1171,11 @@ export type MultiOptions = { /** * The date and time an option is created. */ - created_at?: string + created_at?: Date /** * The date and time an option is updated. */ - updated_at?: string + updated_at?: Date } }> meta?: { @@ -1260,11 +1260,11 @@ export type CreatedOption = { /** * The date and time an option is created. */ - created_at?: string + created_at?: Date /** * The date and time an option is updated. */ - updated_at?: string + updated_at?: Date } } } @@ -1304,11 +1304,11 @@ export type SingleOption = { /** * The date and time an option is created. */ - created_at?: string + created_at?: Date /** * The date and time an option is updated. */ - updated_at?: string + updated_at?: Date } } } @@ -1853,11 +1853,11 @@ export type Hierarchy = { /** * The date and time a hierarchy is created. */ - created_at?: string + created_at?: Date /** * The date and time a hierarchy is updated. */ - updated_at?: string + updated_at?: Date /** * The owner of a resource, either `organization` or `store`. */ @@ -2101,11 +2101,11 @@ export type Tag = { /** * The date and time a tag is created. */ - created_at?: string + created_at?: Date /** * The date and time a tag is updated. */ - updated_at?: string + updated_at?: Date /** * The owner of a resource, either `organization` or `store`. */ @@ -2204,11 +2204,11 @@ export type CustomRelationship = { /** * The date and time the resource is created. */ - created_at?: string + created_at?: Date /** * The date and time the resource is updated. */ - updated_at?: string + updated_at?: Date } } } @@ -5264,3 +5264,610 @@ export type $OpenApiTs = { } } } + +export type GetAllJobsResponseTransformer = ( + data: any, +) => Promise + +export type MultiModelResponseTransformer = (data: any) => Multi + +export type JobModelResponseTransformer = (data: any) => Job + +export const JobModelResponseTransformer: JobModelResponseTransformer = ( + data, +) => { + if (data?.attributes?.started_at) { + data.attributes.started_at = new Date(data.attributes.started_at) + } + if (data?.attributes?.completed_at) { + data.attributes.completed_at = new Date(data.attributes.completed_at) + } + if (data?.attributes?.created_at) { + data.attributes.created_at = new Date(data.attributes.created_at) + } + if (data?.attributes?.updated_at) { + data.attributes.updated_at = new Date(data.attributes.updated_at) + } + return data +} + +export const MultiModelResponseTransformer: MultiModelResponseTransformer = ( + data, +) => { + if (Array.isArray(data?.data)) { + data.data.forEach(JobModelResponseTransformer) + } + return data +} + +export const GetAllJobsResponseTransformer: GetAllJobsResponseTransformer = + async (data) => { + MultiModelResponseTransformer(data) + return data + } + +export type GetJobResponseTransformer = (data: any) => Promise + +export type SingleModelResponseTransformer = (data: any) => Single + +export const SingleModelResponseTransformer: SingleModelResponseTransformer = ( + data, +) => { + if (data?.data) { + JobModelResponseTransformer(data.data) + } + return data +} + +export const GetJobResponseTransformer: GetJobResponseTransformer = async ( + data, +) => { + SingleModelResponseTransformer(data) + return data +} + +export type CancelJobResponseTransformer = ( + data: any, +) => Promise + +export const CancelJobResponseTransformer: CancelJobResponseTransformer = + async (data) => { + SingleModelResponseTransformer(data) + return data + } + +export type CreateProductResponseTransformer = ( + data: any, +) => Promise + +export type SingleProductResponseModelResponseTransformer = ( + data: any, +) => SingleProductResponse + +export type ProductResponseModelResponseTransformer = ( + data: any, +) => ProductResponse + +export const ProductResponseModelResponseTransformer: ProductResponseModelResponseTransformer = + (data) => { + if (data?.meta?.created_at) { + data.meta.created_at = new Date(data.meta.created_at) + } + if (data?.meta?.updated_at) { + data.meta.updated_at = new Date(data.meta.updated_at) + } + return data + } + +export const SingleProductResponseModelResponseTransformer: SingleProductResponseModelResponseTransformer = + (data) => { + if (data?.data) { + ProductResponseModelResponseTransformer(data.data) + } + if (Array.isArray(data?.included?.component_products)) { + data.included.component_products.forEach( + ProductResponseModelResponseTransformer, + ) + } + return data + } + +export const CreateProductResponseTransformer: CreateProductResponseTransformer = + async (data) => { + SingleProductResponseModelResponseTransformer(data) + return data + } + +export type GetAllProductsResponseTransformer = ( + data: any, +) => Promise + +export type MultiProductResponseModelResponseTransformer = ( + data: any, +) => MultiProductResponse + +export const MultiProductResponseModelResponseTransformer: MultiProductResponseModelResponseTransformer = + (data) => { + if (Array.isArray(data?.data)) { + data.data.forEach(ProductResponseModelResponseTransformer) + } + if (Array.isArray(data?.included?.component_products)) { + data.included.component_products.forEach( + ProductResponseModelResponseTransformer, + ) + } + return data + } + +export const GetAllProductsResponseTransformer: GetAllProductsResponseTransformer = + async (data) => { + MultiProductResponseModelResponseTransformer(data) + return data + } + +export type ImportProductsResponseTransformer = ( + data: any, +) => Promise + +export const ImportProductsResponseTransformer: ImportProductsResponseTransformer = + async (data) => { + SingleModelResponseTransformer(data) + return data + } + +export type ExportProductsResponseTransformer = ( + data: any, +) => Promise + +export const ExportProductsResponseTransformer: ExportProductsResponseTransformer = + async (data) => { + SingleModelResponseTransformer(data) + return data + } + +export type GetProductResponseTransformer = ( + data: any, +) => Promise + +export const GetProductResponseTransformer: GetProductResponseTransformer = + async (data) => { + SingleProductResponseModelResponseTransformer(data) + return data + } + +export type UpdateProductResponseTransformer = ( + data: any, +) => Promise + +export const UpdateProductResponseTransformer: UpdateProductResponseTransformer = + async (data) => { + SingleProductResponseModelResponseTransformer(data) + return data + } + +export type GetProductsNodesResponseTransformer = ( + data: any, +) => Promise + +export type MultiNodesModelResponseTransformer = (data: any) => MultiNodes + +export type NodeModelResponseTransformer = (data: any) => Node + +export const NodeModelResponseTransformer: NodeModelResponseTransformer = ( + data, +) => { + if (data?.meta?.created_at) { + data.meta.created_at = new Date(data.meta.created_at) + } + if (data?.meta?.updated_at) { + data.meta.updated_at = new Date(data.meta.updated_at) + } + return data +} + +export const MultiNodesModelResponseTransformer: MultiNodesModelResponseTransformer = + (data) => { + if (Array.isArray(data?.data)) { + data.data.forEach(NodeModelResponseTransformer) + } + return data + } + +export const GetProductsNodesResponseTransformer: GetProductsNodesResponseTransformer = + async (data) => { + MultiNodesModelResponseTransformer(data) + return data + } + +export type GetChildProductsResponseTransformer = ( + data: any, +) => Promise + +export const GetChildProductsResponseTransformer: GetChildProductsResponseTransformer = + async (data) => { + MultiProductResponseModelResponseTransformer(data) + return data + } + +export type CreateVariationResponseTransformer = ( + data: any, +) => Promise + +export type CreatedVariationModelResponseTransformer = ( + data: any, +) => CreatedVariation + +export const CreatedVariationModelResponseTransformer: CreatedVariationModelResponseTransformer = + (data) => { + if (data?.data?.meta?.created_at) { + data.data.meta.created_at = new Date(data.data.meta.created_at) + } + if (data?.data?.meta?.updated_at) { + data.data.meta.updated_at = new Date(data.data.meta.updated_at) + } + return data + } + +export const CreateVariationResponseTransformer: CreateVariationResponseTransformer = + async (data) => { + CreatedVariationModelResponseTransformer(data) + return data + } + +export type CreateVariationOptionResponseTransformer = ( + data: any, +) => Promise + +export type CreatedOptionModelResponseTransformer = (data: any) => CreatedOption + +export const CreatedOptionModelResponseTransformer: CreatedOptionModelResponseTransformer = + (data) => { + if (data?.data?.meta?.created_at) { + data.data.meta.created_at = new Date(data.data.meta.created_at) + } + if (data?.data?.meta?.updated_at) { + data.data.meta.updated_at = new Date(data.data.meta.updated_at) + } + return data + } + +export const CreateVariationOptionResponseTransformer: CreateVariationOptionResponseTransformer = + async (data) => { + CreatedOptionModelResponseTransformer(data) + return data + } + +export type GetVariationOptionResponseTransformer = ( + data: any, +) => Promise + +export type SingleOptionModelResponseTransformer = (data: any) => SingleOption + +export const SingleOptionModelResponseTransformer: SingleOptionModelResponseTransformer = + (data) => { + if (data?.data?.meta?.created_at) { + data.data.meta.created_at = new Date(data.data.meta.created_at) + } + if (data?.data?.meta?.updated_at) { + data.data.meta.updated_at = new Date(data.data.meta.updated_at) + } + return data + } + +export const GetVariationOptionResponseTransformer: GetVariationOptionResponseTransformer = + async (data) => { + SingleOptionModelResponseTransformer(data) + return data + } + +export type UpdateVariationOptionResponseTransformer = ( + data: any, +) => Promise + +export const UpdateVariationOptionResponseTransformer: UpdateVariationOptionResponseTransformer = + async (data) => { + SingleOptionModelResponseTransformer(data) + return data + } + +export type CreateHierarchyResponseTransformer = ( + data: any, +) => Promise + +export type SingleHierarchyModelResponseTransformer = ( + data: any, +) => SingleHierarchy + +export type HierarchyModelResponseTransformer = (data: any) => Hierarchy + +export const HierarchyModelResponseTransformer: HierarchyModelResponseTransformer = + (data) => { + if (data?.meta?.created_at) { + data.meta.created_at = new Date(data.meta.created_at) + } + if (data?.meta?.updated_at) { + data.meta.updated_at = new Date(data.meta.updated_at) + } + return data + } + +export const SingleHierarchyModelResponseTransformer: SingleHierarchyModelResponseTransformer = + (data) => { + if (data?.data) { + HierarchyModelResponseTransformer(data.data) + } + return data + } + +export const CreateHierarchyResponseTransformer: CreateHierarchyResponseTransformer = + async (data) => { + SingleHierarchyModelResponseTransformer(data) + return data + } + +export type GetHierarchyResponseTransformer = ( + data: any, +) => Promise + +export type MultiHierarchyModelResponseTransformer = ( + data: any, +) => MultiHierarchy + +export const MultiHierarchyModelResponseTransformer: MultiHierarchyModelResponseTransformer = + (data) => { + if (Array.isArray(data?.data)) { + data.data.forEach(HierarchyModelResponseTransformer) + } + return data + } + +export const GetHierarchyResponseTransformer: GetHierarchyResponseTransformer = + async (data) => { + MultiHierarchyModelResponseTransformer(data) + return data + } + +export type GetHierarchyChildResponseTransformer = ( + data: any, +) => Promise + +export const GetHierarchyChildResponseTransformer: GetHierarchyChildResponseTransformer = + async (data) => { + SingleHierarchyModelResponseTransformer(data) + return data + } + +export type UpdateHierarchyResponseTransformer = ( + data: any, +) => Promise + +export const UpdateHierarchyResponseTransformer: UpdateHierarchyResponseTransformer = + async (data) => { + SingleHierarchyModelResponseTransformer(data) + return data + } + +export type CreateNodeResponseTransformer = ( + data: any, +) => Promise + +export type SingleNodeModelResponseTransformer = (data: any) => SingleNode + +export const SingleNodeModelResponseTransformer: SingleNodeModelResponseTransformer = + (data) => { + if (data?.data) { + NodeModelResponseTransformer(data.data) + } + return data + } + +export const CreateNodeResponseTransformer: CreateNodeResponseTransformer = + async (data) => { + SingleNodeModelResponseTransformer(data) + return data + } + +export type GetAllNodesInHierarchyResponseTransformer = ( + data: any, +) => Promise + +export const GetAllNodesInHierarchyResponseTransformer: GetAllNodesInHierarchyResponseTransformer = + async (data) => { + MultiNodesModelResponseTransformer(data) + return data + } + +export type GetHierarchyNodeResponseTransformer = ( + data: any, +) => Promise + +export const GetHierarchyNodeResponseTransformer: GetHierarchyNodeResponseTransformer = + async (data) => { + SingleNodeModelResponseTransformer(data) + return data + } + +export type UpdateNodeResponseTransformer = ( + data: any, +) => Promise + +export const UpdateNodeResponseTransformer: UpdateNodeResponseTransformer = + async (data) => { + SingleNodeModelResponseTransformer(data) + return data + } + +export type GetAllChildrenResponseTransformer = ( + data: any, +) => Promise + +export const GetAllChildrenResponseTransformer: GetAllChildrenResponseTransformer = + async (data) => { + MultiNodesModelResponseTransformer(data) + return data + } + +export type CreateNodeChildRelationshipsResponseTransformer = ( + data: any, +) => Promise + +export const CreateNodeChildRelationshipsResponseTransformer: CreateNodeChildRelationshipsResponseTransformer = + async (data) => { + SingleNodeModelResponseTransformer(data) + return data + } + +export type GetAllNodeChildrenResponseTransformer = ( + data: any, +) => Promise + +export const GetAllNodeChildrenResponseTransformer: GetAllNodeChildrenResponseTransformer = + async (data) => { + MultiNodesModelResponseTransformer(data) + return data + } + +export type CreateNodeProductRelationshipResponseTransformer = ( + data: any, +) => Promise + +export const CreateNodeProductRelationshipResponseTransformer: CreateNodeProductRelationshipResponseTransformer = + async (data) => { + SingleNodeModelResponseTransformer(data) + return data + } + +export type DeleteNodeProductRelationshipsResponseTransformer = ( + data: any, +) => Promise + +export const DeleteNodeProductRelationshipsResponseTransformer: DeleteNodeProductRelationshipsResponseTransformer = + async (data) => { + SingleNodeModelResponseTransformer(data) + return data + } + +export type GetNodeProductsResponseTransformer = ( + data: any, +) => Promise + +export const GetNodeProductsResponseTransformer: GetNodeProductsResponseTransformer = + async (data) => { + MultiProductResponseModelResponseTransformer(data) + return data + } + +export type DuplicateHierarchyResponseTransformer = ( + data: any, +) => Promise + +export const DuplicateHierarchyResponseTransformer: DuplicateHierarchyResponseTransformer = + async (data) => { + SingleModelResponseTransformer(data) + return data + } + +export type GetAllProductTagsResponseTransformer = ( + data: any, +) => Promise + +export type MultiTagModelResponseTransformer = (data: any) => MultiTag + +export type TagModelResponseTransformer = (data: any) => Tag + +export const TagModelResponseTransformer: TagModelResponseTransformer = ( + data, +) => { + if (data?.meta?.created_at) { + data.meta.created_at = new Date(data.meta.created_at) + } + if (data?.meta?.updated_at) { + data.meta.updated_at = new Date(data.meta.updated_at) + } + return data +} + +export const MultiTagModelResponseTransformer: MultiTagModelResponseTransformer = + (data) => { + if (Array.isArray(data?.data)) { + data.data.forEach(TagModelResponseTransformer) + } + return data + } + +export const GetAllProductTagsResponseTransformer: GetAllProductTagsResponseTransformer = + async (data) => { + MultiTagModelResponseTransformer(data) + return data + } + +export type GetProductTagResponseTransformer = ( + data: any, +) => Promise + +export type SingleTagModelResponseTransformer = (data: any) => SingleTag + +export const SingleTagModelResponseTransformer: SingleTagModelResponseTransformer = + (data) => { + if (data?.data) { + TagModelResponseTransformer(data.data) + } + return data + } + +export const GetProductTagResponseTransformer: GetProductTagResponseTransformer = + async (data) => { + SingleTagModelResponseTransformer(data) + return data + } + +export type CreateCustomRelationshipResponseTransformer = ( + data: any, +) => Promise + +export type SingleCustomRelationshipModelResponseTransformer = ( + data: any, +) => SingleCustomRelationship + +export type CustomRelationshipModelResponseTransformer = ( + data: any, +) => CustomRelationship + +export const CustomRelationshipModelResponseTransformer: CustomRelationshipModelResponseTransformer = + (data) => { + if (data?.meta?.timestamps?.created_at) { + data.meta.timestamps.created_at = new Date( + data.meta.timestamps.created_at, + ) + } + if (data?.meta?.timestamps?.updated_at) { + data.meta.timestamps.updated_at = new Date( + data.meta.timestamps.updated_at, + ) + } + return data + } + +export const SingleCustomRelationshipModelResponseTransformer: SingleCustomRelationshipModelResponseTransformer = + (data) => { + if (data?.data) { + CustomRelationshipModelResponseTransformer(data.data) + } + return data + } + +export const CreateCustomRelationshipResponseTransformer: CreateCustomRelationshipResponseTransformer = + async (data) => { + SingleCustomRelationshipModelResponseTransformer(data) + return data + } + +export type UpdateCustomRelationshipResponseTransformer = ( + data: any, +) => Promise + +export const UpdateCustomRelationshipResponseTransformer: UpdateCustomRelationshipResponseTransformer = + async (data) => { + SingleCustomRelationshipModelResponseTransformer(data) + return data + } diff --git a/packages/sdks/src/index.ts b/packages/sdks/src/index.ts new file mode 100644 index 00000000..b583818f --- /dev/null +++ b/packages/sdks/src/index.ts @@ -0,0 +1,3 @@ +export * from "./client" +import { createClient, client } from "@hey-api/client-fetch" +export { createClient, client } diff --git a/packages/sdks/tsconfig.json b/packages/sdks/tsconfig.json index a7fc6fbf..5bf79ce5 100644 --- a/packages/sdks/tsconfig.json +++ b/packages/sdks/tsconfig.json @@ -5,6 +5,7 @@ "lib": ["ES2020", "DOM", "DOM.Iterable"], "module": "ESNext", "skipLibCheck": true, + "outDir": "dist", /* Bundler mode */ "moduleResolution": "bundler", diff --git a/packages/sdks/tsconfig.node.json b/packages/sdks/tsconfig.node.json index 97ede7ee..53f76bbb 100644 --- a/packages/sdks/tsconfig.node.json +++ b/packages/sdks/tsconfig.node.json @@ -5,7 +5,9 @@ "module": "ESNext", "moduleResolution": "bundler", "allowSyntheticDefaultImports": true, - "strict": true + "strict": true, + "outDir": "dist", + "rootDir": "src" }, - "include": ["vite.config.ts"] + "include": ["src"], } diff --git a/tsconfig.json b/tsconfig.json index a7fc6fbf..be86ea9a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,25 +1,38 @@ { "compilerOptions": { - "target": "ES2020", - "useDefineForClassFields": true, - "lib": ["ES2020", "DOM", "DOM.Iterable"], - "module": "ESNext", + "baseUrl": "tsconfig", + "lib": ["es2018", "dom"], + "module": "commonjs", + "moduleResolution": "node", + "noEmitOnError": true, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitThis": true, + "noUnusedParameters": false, + "noUnusedLocals": false, + "rootDir": ".", + "rootDirs": [ + ".", "./dist-schema"], + "skipDefaultLibCheck": true, "skipLibCheck": true, - - /* Bundler mode */ - "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true, - "jsx": "react-jsx", - - /* Linting */ - "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noFallthroughCasesInSwitch": true + "sourceMap": true, + "strictNullChecks": true, + "target": "es2019", + "types": ["node", "jest", "jest-extended"], + "esModuleInterop": true, + "jsx": "react" }, - "include": ["src"], - "references": [{ "path": "./tsconfig.node.json" }] + "files": ["node_modules/jest-extended/types/index.d.ts"], + "include": ["./**/*"], + "exclude": [ + "./*/files/**/*", + "./*/other-files/**/*", + "./*/project-files/**/*", + "./*/schematic-files/**/*", + "packages/d2c-schematics/node_modules", + "dist", + "**/node_modules/**/*", + "**/dist/**/*", + "**/*/*.test.ts" + ] } From 189c845c9bd591a2a03f12ff9cec5529c1c07397 Mon Sep 17 00:00:00 2001 From: Robert Field Date: Tue, 13 Aug 2024 19:54:33 +0100 Subject: [PATCH 04/30] refactor: move pim sdk --- packages/sdks/{ => pim}/openapi-ts.config.ts | 2 +- packages/sdks/{ => pim}/package.json | 0 packages/sdks/{ => pim}/src/client/core/ApiError.ts | 4 ++-- .../{ => pim}/src/client/core/ApiRequestOptions.ts | 0 packages/sdks/{ => pim}/src/client/core/ApiResult.ts | 0 .../{ => pim}/src/client/core/CancelablePromise.ts | 0 packages/sdks/{ => pim}/src/client/core/OpenAPI.ts | 2 +- packages/sdks/{ => pim}/src/client/core/request.ts | 12 ++++++------ packages/sdks/pim/src/client/index.ts | 4 ++++ packages/sdks/{ => pim}/src/client/schemas.gen.ts | 0 packages/sdks/{ => pim}/src/client/services.gen.ts | 2 +- packages/sdks/{ => pim}/src/client/types.gen.ts | 0 packages/sdks/{ => pim}/src/index.ts | 0 packages/sdks/{ => pim}/tsconfig.json | 6 ++++-- packages/sdks/{ => pim}/tsconfig.node.json | 4 +++- packages/sdks/src/client/index.ts | 4 ---- pnpm-workspace.yaml | 1 + 17 files changed, 23 insertions(+), 18 deletions(-) rename packages/sdks/{ => pim}/openapi-ts.config.ts (89%) rename packages/sdks/{ => pim}/package.json (100%) rename packages/sdks/{ => pim}/src/client/core/ApiError.ts (82%) rename packages/sdks/{ => pim}/src/client/core/ApiRequestOptions.ts (100%) rename packages/sdks/{ => pim}/src/client/core/ApiResult.ts (100%) rename packages/sdks/{ => pim}/src/client/core/CancelablePromise.ts (100%) rename packages/sdks/{ => pim}/src/client/core/OpenAPI.ts (95%) rename packages/sdks/{ => pim}/src/client/core/request.ts (97%) create mode 100644 packages/sdks/pim/src/client/index.ts rename packages/sdks/{ => pim}/src/client/schemas.gen.ts (100%) rename packages/sdks/{ => pim}/src/client/services.gen.ts (99%) rename packages/sdks/{ => pim}/src/client/types.gen.ts (100%) rename packages/sdks/{ => pim}/src/index.ts (100%) rename packages/sdks/{ => pim}/tsconfig.json (87%) rename packages/sdks/{ => pim}/tsconfig.node.json (87%) delete mode 100644 packages/sdks/src/client/index.ts diff --git a/packages/sdks/openapi-ts.config.ts b/packages/sdks/pim/openapi-ts.config.ts similarity index 89% rename from packages/sdks/openapi-ts.config.ts rename to packages/sdks/pim/openapi-ts.config.ts index 942e27f7..7b5affbe 100644 --- a/packages/sdks/openapi-ts.config.ts +++ b/packages/sdks/pim/openapi-ts.config.ts @@ -2,7 +2,7 @@ import { defineConfig } from "@hey-api/openapi-ts" export default defineConfig({ client: "@hey-api/client-fetch", - input: "./specs/pim.yaml", + input: "../specs/pim.yaml", output: { path: "src/client", format: "prettier" }, types: { name: "PascalCase", diff --git a/packages/sdks/package.json b/packages/sdks/pim/package.json similarity index 100% rename from packages/sdks/package.json rename to packages/sdks/pim/package.json diff --git a/packages/sdks/src/client/core/ApiError.ts b/packages/sdks/pim/src/client/core/ApiError.ts similarity index 82% rename from packages/sdks/src/client/core/ApiError.ts rename to packages/sdks/pim/src/client/core/ApiError.ts index 5499aa8f..52d5dc14 100644 --- a/packages/sdks/src/client/core/ApiError.ts +++ b/packages/sdks/pim/src/client/core/ApiError.ts @@ -1,5 +1,5 @@ -import type { ApiRequestOptions } from "./ApiRequestOptions" -import type { ApiResult } from "./ApiResult" +import type { ApiRequestOptions } from "./ApiRequestOptions.ts" +import type { ApiResult } from "./ApiResult.ts" export class ApiError extends Error { public readonly url: string diff --git a/packages/sdks/src/client/core/ApiRequestOptions.ts b/packages/sdks/pim/src/client/core/ApiRequestOptions.ts similarity index 100% rename from packages/sdks/src/client/core/ApiRequestOptions.ts rename to packages/sdks/pim/src/client/core/ApiRequestOptions.ts diff --git a/packages/sdks/src/client/core/ApiResult.ts b/packages/sdks/pim/src/client/core/ApiResult.ts similarity index 100% rename from packages/sdks/src/client/core/ApiResult.ts rename to packages/sdks/pim/src/client/core/ApiResult.ts diff --git a/packages/sdks/src/client/core/CancelablePromise.ts b/packages/sdks/pim/src/client/core/CancelablePromise.ts similarity index 100% rename from packages/sdks/src/client/core/CancelablePromise.ts rename to packages/sdks/pim/src/client/core/CancelablePromise.ts diff --git a/packages/sdks/src/client/core/OpenAPI.ts b/packages/sdks/pim/src/client/core/OpenAPI.ts similarity index 95% rename from packages/sdks/src/client/core/OpenAPI.ts rename to packages/sdks/pim/src/client/core/OpenAPI.ts index 820233a3..67761c5d 100644 --- a/packages/sdks/src/client/core/OpenAPI.ts +++ b/packages/sdks/pim/src/client/core/OpenAPI.ts @@ -1,4 +1,4 @@ -import type { ApiRequestOptions } from "./ApiRequestOptions" +import type { ApiRequestOptions } from "./ApiRequestOptions.ts" type Headers = Record type Middleware = (value: T) => T | Promise diff --git a/packages/sdks/src/client/core/request.ts b/packages/sdks/pim/src/client/core/request.ts similarity index 97% rename from packages/sdks/src/client/core/request.ts rename to packages/sdks/pim/src/client/core/request.ts index c4f42672..f465c1aa 100644 --- a/packages/sdks/src/client/core/request.ts +++ b/packages/sdks/pim/src/client/core/request.ts @@ -1,9 +1,9 @@ -import { ApiError } from "./ApiError" -import type { ApiRequestOptions } from "./ApiRequestOptions" -import type { ApiResult } from "./ApiResult" -import { CancelablePromise } from "./CancelablePromise" -import type { OnCancel } from "./CancelablePromise" -import type { OpenAPIConfig } from "./OpenAPI" +import { ApiError } from "./ApiError.ts" +import type { ApiRequestOptions } from "./ApiRequestOptions.ts" +import type { ApiResult } from "./ApiResult.ts" +import { CancelablePromise } from "./CancelablePromise.ts" +import type { OnCancel } from "./CancelablePromise.ts" +import type { OpenAPIConfig } from "./OpenAPI.ts" export const isString = (value: unknown): value is string => { return typeof value === "string" diff --git a/packages/sdks/pim/src/client/index.ts b/packages/sdks/pim/src/client/index.ts new file mode 100644 index 00000000..f8a8083f --- /dev/null +++ b/packages/sdks/pim/src/client/index.ts @@ -0,0 +1,4 @@ +// This file is auto-generated by @hey-api/openapi-ts +export * from "./schemas.gen.ts" +export * from "./services.gen.ts" +export * from "./types.gen.ts" diff --git a/packages/sdks/src/client/schemas.gen.ts b/packages/sdks/pim/src/client/schemas.gen.ts similarity index 100% rename from packages/sdks/src/client/schemas.gen.ts rename to packages/sdks/pim/src/client/schemas.gen.ts diff --git a/packages/sdks/src/client/services.gen.ts b/packages/sdks/pim/src/client/services.gen.ts similarity index 99% rename from packages/sdks/src/client/services.gen.ts rename to packages/sdks/pim/src/client/services.gen.ts index c1c40147..df7efc83 100644 --- a/packages/sdks/src/client/services.gen.ts +++ b/packages/sdks/pim/src/client/services.gen.ts @@ -248,7 +248,7 @@ import { GetProductTagResponseTransformer, CreateCustomRelationshipResponseTransformer, UpdateCustomRelationshipResponseTransformer, -} from "./types.gen" +} from "./types.gen.ts" /** * Get All Jobs diff --git a/packages/sdks/src/client/types.gen.ts b/packages/sdks/pim/src/client/types.gen.ts similarity index 100% rename from packages/sdks/src/client/types.gen.ts rename to packages/sdks/pim/src/client/types.gen.ts diff --git a/packages/sdks/src/index.ts b/packages/sdks/pim/src/index.ts similarity index 100% rename from packages/sdks/src/index.ts rename to packages/sdks/pim/src/index.ts diff --git a/packages/sdks/tsconfig.json b/packages/sdks/pim/tsconfig.json similarity index 87% rename from packages/sdks/tsconfig.json rename to packages/sdks/pim/tsconfig.json index 5bf79ce5..d27f8641 100644 --- a/packages/sdks/tsconfig.json +++ b/packages/sdks/pim/tsconfig.json @@ -21,6 +21,8 @@ "noUnusedParameters": true, "noFallthroughCasesInSwitch": true }, - "include": ["src"], - "references": [{ "path": "./tsconfig.node.json" }] + "include": [ + "src" + ], + "references": [{ "path": "./tsconfig.node.json"}] } diff --git a/packages/sdks/tsconfig.node.json b/packages/sdks/pim/tsconfig.node.json similarity index 87% rename from packages/sdks/tsconfig.node.json rename to packages/sdks/pim/tsconfig.node.json index 53f76bbb..180cab8c 100644 --- a/packages/sdks/tsconfig.node.json +++ b/packages/sdks/pim/tsconfig.node.json @@ -9,5 +9,7 @@ "outDir": "dist", "rootDir": "src" }, - "include": ["src"], + "include": [ + "src" + ], } diff --git a/packages/sdks/src/client/index.ts b/packages/sdks/src/client/index.ts deleted file mode 100644 index a8a3135a..00000000 --- a/packages/sdks/src/client/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts -export * from "./schemas.gen" -export * from "./services.gen" -export * from "./types.gen" diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index b361718d..3c76650b 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,4 +1,5 @@ packages: + - 'packages/sdks/*' - 'packages/*' - 'examples/*' - 'apps/*' \ No newline at end of file From da087adc7403b7fb68b58222f0d5c8b4fe8fbbd8 Mon Sep 17 00:00:00 2001 From: Robert Field Date: Wed, 14 Aug 2024 13:42:35 +0100 Subject: [PATCH 05/30] feat: wip using generated sdks to power storefront --- examples/simple/package.json | 2 + .../app/(store)/products/[productId]/page.tsx | 48 +- examples/simple/src/services/products.ts | 36 +- package.json | 2 +- packages/sdks/nextjs/package.json | 34 + .../sdks/nextjs/src/constants/crendentials.ts | 2 + packages/sdks/nextjs/src/index.ts | 1 + .../interceptors/auth-cookie-interceptor.ts | 64 + packages/sdks/nextjs/tsconfig.json | 28 + packages/sdks/nextjs/tsconfig.node.json | 15 + packages/sdks/pim/package.json | 3 +- packages/sdks/pim/src/client/core/ApiError.ts | 4 +- packages/sdks/pim/src/client/core/request.ts | 12 +- packages/sdks/pim/src/client/index.ts | 6 +- packages/sdks/pim/src/client/services.gen.ts | 2 +- .../openapi-ts-error-1723637319210.log | 12 + packages/sdks/shopper/openapi-ts.config.ts | 12 + packages/sdks/shopper/package.json | 32 + packages/sdks/shopper/src/client/index.ts | 4 + .../sdks/shopper/src/client/schemas.gen.ts | 3403 +++++++++++ .../sdks/shopper/src/client/services.gen.ts | 1648 ++++++ packages/sdks/shopper/src/client/types.gen.ts | 4541 +++++++++++++++ packages/sdks/shopper/src/index.ts | 3 + packages/sdks/shopper/tsconfig.json | 28 + packages/sdks/shopper/tsconfig.node.json | 15 + packages/sdks/specs/catalog_view.yaml | 5070 +++++++++++++++++ 26 files changed, 14987 insertions(+), 40 deletions(-) create mode 100644 packages/sdks/nextjs/package.json create mode 100644 packages/sdks/nextjs/src/constants/crendentials.ts create mode 100644 packages/sdks/nextjs/src/index.ts create mode 100644 packages/sdks/nextjs/src/interceptors/auth-cookie-interceptor.ts create mode 100644 packages/sdks/nextjs/tsconfig.json create mode 100644 packages/sdks/nextjs/tsconfig.node.json create mode 100644 packages/sdks/shopper/openapi-ts-error-1723637319210.log create mode 100644 packages/sdks/shopper/openapi-ts.config.ts create mode 100644 packages/sdks/shopper/package.json create mode 100644 packages/sdks/shopper/src/client/index.ts create mode 100644 packages/sdks/shopper/src/client/schemas.gen.ts create mode 100644 packages/sdks/shopper/src/client/services.gen.ts create mode 100644 packages/sdks/shopper/src/client/types.gen.ts create mode 100644 packages/sdks/shopper/src/index.ts create mode 100644 packages/sdks/shopper/tsconfig.json create mode 100644 packages/sdks/shopper/tsconfig.node.json create mode 100644 packages/sdks/specs/catalog_view.yaml diff --git a/examples/simple/package.json b/examples/simple/package.json index 65c79f0c..c7810659 100644 --- a/examples/simple/package.json +++ b/examples/simple/package.json @@ -21,6 +21,8 @@ "dependencies": { "@elasticpath/js-sdk": "5.0.0", "@elasticpath/react-shopper-hooks": "workspace:*", + "@epcc-sdk/sdks-shopper": "workspace:*", + "@epcc-sdk/sdks-nextjs": "workspace:*", "clsx": "^1.2.1", "cookies-next": "^4.0.0", "focus-visible": "^5.2.0", diff --git a/examples/simple/src/app/(store)/products/[productId]/page.tsx b/examples/simple/src/app/(store)/products/[productId]/page.tsx index baf35da3..0cb8b013 100644 --- a/examples/simple/src/app/(store)/products/[productId]/page.tsx +++ b/examples/simple/src/app/(store)/products/[productId]/page.tsx @@ -1,10 +1,13 @@ import { Metadata } from "next"; import { ProductDetailsComponent, ProductProvider } from "./product-display"; import { getServerSideImplicitClient } from "../../../../lib/epcc-server-side-implicit-client"; -import { getProductById } from "../../../../services/products"; import { notFound } from "next/navigation"; import { parseProductResponse } from "@elasticpath/react-shopper-hooks"; import React from "react"; +import { getByContextProduct, createClient } from "@epcc-sdk/sdks-shopper"; +import { applyDefaultNextMiddleware } from "@epcc-sdk/sdks-nextjs"; +import { epccEnv } from "../../../../lib/resolve-epcc-env"; +import { ProductResponse, ShopperCatalogResource } from "@elasticpath/js-sdk"; export const dynamic = "force-dynamic"; @@ -12,31 +15,58 @@ type Props = { params: { productId: string }; }; +createClient({ + baseUrl: `https://${epccEnv.host}`, +}); + +applyDefaultNextMiddleware(); + export async function generateMetadata({ params: { productId }, }: Props): Promise { - const client = getServerSideImplicitClient(); - const product = await getProductById(productId, client); + const productResponse = await getByContextProduct({ + path: { + product_id: productId, + }, + query: { + include: ["main_images", "files", "component_products"], + }, + }); - if (!product) { + if (!productResponse.data) { notFound(); } + const product = productResponse.data; + return { - title: product.data.attributes.name, - description: product.data.attributes.description, + title: product.data?.attributes?.name, + description: product.data?.attributes?.description, }; } export default async function ProductPage({ params }: Props) { const client = getServerSideImplicitClient(); - const product = await getProductById(params.productId, client); + const productResponse = await getByContextProduct({ + path: { + product_id: params.productId, + }, + query: { + include: ["main_images", "files", "component_products"], + }, + }); - if (!product) { + if (!productResponse.data) { notFound(); } - const shopperProduct = await parseProductResponse(product, client); + const product = productResponse.data; + + // TODO I want to replace the ShopperProduct concept and just use the sdk types that are provided + const shopperProduct = await parseProductResponse( + product as unknown as ShopperCatalogResource, + client, + ); return (
> { - return client.ShopperCatalog.Products.With([ - "main_image", - "files", - "component_products", - ]).Get({ - productId, +export async function getProductById(productId: string, client: ElasticPath) { + return getByContextProduct({ + path: { + product_id: productId, + }, + query: { + include: "main_images,files,component_products", + }, }); + // return client.ShopperCatalog.Products.With([ + // "main_image", + // "files", + // "component_products", + // ]).Get({ + // productId, + // }); } -export function getAllProducts(client: ElasticPath): Promise { +export function getAllProducts( + client: ElasticPath, +): Promise { return _getAllProductPages(client)(); } diff --git a/package.json b/package.json index fb3d3df9..16c92027 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "start:e2e": "turbo run start:e2e --filter='./examples/simple'", "test:e2e": "NODE_ENV=test turbo run test:e2e --filter='./examples/simple'", "build:cli": "turbo run build --filter=composable-cli...", - "build:packages": "turbo run build --filter='./packages/*'", + "build:packages": "turbo run build --filter='./packages/sdks/*' && turbo run build --filter='./packages/*'", "ci:version": "changeset version && pnpm install --no-frozen-lockfile", "ci:publish": "pnpm publish -r && changeset tag", "examples": "turbo run build --filter=composable-cli... && pnpm run scaffold:local", diff --git a/packages/sdks/nextjs/package.json b/packages/sdks/nextjs/package.json new file mode 100644 index 00000000..f8f0e671 --- /dev/null +++ b/packages/sdks/nextjs/package.json @@ -0,0 +1,34 @@ +{ + "name": "@epcc-sdk/sdks-nextjs", + "version": "0.0.1", + "description": "", + "main": "dist/index.js", + "scripts": { + "build": "tsc -p tsconfig.node.json" + }, + "exports": { + ".": { + "types": "./dist/index.d.ts", + "node": { + "import": "./dist/index.js", + "require": "./dist/index.js" + }, + "default": "./dist/index.js" + }, + "./package.json": "./package.json" + }, + "files": [ + "dist/**" + ], + "keywords": [], + "devDependencies": { + "next": "^14.0.0", + "typescript": "^5.5.3" + }, + "peerDependencies": { + "next": "^14.0.0" + }, + "dependencies": { + "@hey-api/client-fetch": "^0.1.7" + } +} diff --git a/packages/sdks/nextjs/src/constants/crendentials.ts b/packages/sdks/nextjs/src/constants/crendentials.ts new file mode 100644 index 00000000..dd1cc3fb --- /dev/null +++ b/packages/sdks/nextjs/src/constants/crendentials.ts @@ -0,0 +1,2 @@ +// TODO remove _store prefix once work has been done in examples folder +export const CREDENTIALS_COOKIE_NAME = "_store_ep_credentials" diff --git a/packages/sdks/nextjs/src/index.ts b/packages/sdks/nextjs/src/index.ts new file mode 100644 index 00000000..ba4c722a --- /dev/null +++ b/packages/sdks/nextjs/src/index.ts @@ -0,0 +1 @@ +export * from "./interceptors/auth-cookie-interceptor" diff --git a/packages/sdks/nextjs/src/interceptors/auth-cookie-interceptor.ts b/packages/sdks/nextjs/src/interceptors/auth-cookie-interceptor.ts new file mode 100644 index 00000000..5a4a37c5 --- /dev/null +++ b/packages/sdks/nextjs/src/interceptors/auth-cookie-interceptor.ts @@ -0,0 +1,64 @@ +import { client } from "@hey-api/client-fetch" +import { cookies } from "next/headers" +import { CREDENTIALS_COOKIE_NAME } from "../constants/crendentials" + +export type RequestMiddleware = Parameters< + (typeof client)["interceptors"]["request"]["use"] +>[0] + +export type ResponseMiddleware = Parameters< + (typeof client)["interceptors"]["response"]["use"] +>[0] + +export function createAuthCookieInterceptor(creatOptions?: { + cookieKey?: string +}): RequestMiddleware { + return function authCookieInterceptor(request, options) { + const authCookie = cookies().get( + creatOptions?.cookieKey ?? CREDENTIALS_COOKIE_NAME, + ) + + let bearerToken = null + if (authCookie?.value) { + bearerToken = `Bearer ${JSON.parse(authCookie.value).access_token}` + } + + if (bearerToken) { + request.headers.set("Authorization", bearerToken) + } else { + console.warn( + "Elastic Path Next.js authentication cookie interceptor: Did not set Authorization header on request, no access token found in cookie, please check the cookie name.", + ) + } + + return request + } +} + +export type MiddlewareStack = Array< + | { + type: "request" + middleware: RequestMiddleware + } + | { + type: "response" + middleware: ResponseMiddleware + } +> + +export const defaultNextMiddleware: MiddlewareStack = [ + { + type: "request", + middleware: createAuthCookieInterceptor(), + }, +] + +export function applyDefaultNextMiddleware(): void { + for (const middlewareEntry of defaultNextMiddleware) { + if (middlewareEntry.type === "request") { + client.interceptors.request.use(middlewareEntry.middleware) + } else { + client.interceptors.response.use(middlewareEntry.middleware) + } + } +} diff --git a/packages/sdks/nextjs/tsconfig.json b/packages/sdks/nextjs/tsconfig.json new file mode 100644 index 00000000..d27f8641 --- /dev/null +++ b/packages/sdks/nextjs/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "target": "ES2020", + "useDefineForClassFields": true, + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "module": "ESNext", + "skipLibCheck": true, + "outDir": "dist", + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "react-jsx", + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true + }, + "include": [ + "src" + ], + "references": [{ "path": "./tsconfig.node.json"}] +} diff --git a/packages/sdks/nextjs/tsconfig.node.json b/packages/sdks/nextjs/tsconfig.node.json new file mode 100644 index 00000000..180cab8c --- /dev/null +++ b/packages/sdks/nextjs/tsconfig.node.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "composite": true, + "skipLibCheck": true, + "module": "ESNext", + "moduleResolution": "bundler", + "allowSyntheticDefaultImports": true, + "strict": true, + "outDir": "dist", + "rootDir": "src" + }, + "include": [ + "src" + ], +} diff --git a/packages/sdks/pim/package.json b/packages/sdks/pim/package.json index 8f36cb12..aff0b792 100644 --- a/packages/sdks/pim/package.json +++ b/packages/sdks/pim/package.json @@ -1,7 +1,6 @@ { - "name": "@field123/sdks-temp", + "name": "@epcc-sdk/sdks-pxm", "version": "0.0.1", - "private": true, "description": "", "main": "dist/index.js", "scripts": { diff --git a/packages/sdks/pim/src/client/core/ApiError.ts b/packages/sdks/pim/src/client/core/ApiError.ts index 52d5dc14..5499aa8f 100644 --- a/packages/sdks/pim/src/client/core/ApiError.ts +++ b/packages/sdks/pim/src/client/core/ApiError.ts @@ -1,5 +1,5 @@ -import type { ApiRequestOptions } from "./ApiRequestOptions.ts" -import type { ApiResult } from "./ApiResult.ts" +import type { ApiRequestOptions } from "./ApiRequestOptions" +import type { ApiResult } from "./ApiResult" export class ApiError extends Error { public readonly url: string diff --git a/packages/sdks/pim/src/client/core/request.ts b/packages/sdks/pim/src/client/core/request.ts index f465c1aa..c4f42672 100644 --- a/packages/sdks/pim/src/client/core/request.ts +++ b/packages/sdks/pim/src/client/core/request.ts @@ -1,9 +1,9 @@ -import { ApiError } from "./ApiError.ts" -import type { ApiRequestOptions } from "./ApiRequestOptions.ts" -import type { ApiResult } from "./ApiResult.ts" -import { CancelablePromise } from "./CancelablePromise.ts" -import type { OnCancel } from "./CancelablePromise.ts" -import type { OpenAPIConfig } from "./OpenAPI.ts" +import { ApiError } from "./ApiError" +import type { ApiRequestOptions } from "./ApiRequestOptions" +import type { ApiResult } from "./ApiResult" +import { CancelablePromise } from "./CancelablePromise" +import type { OnCancel } from "./CancelablePromise" +import type { OpenAPIConfig } from "./OpenAPI" export const isString = (value: unknown): value is string => { return typeof value === "string" diff --git a/packages/sdks/pim/src/client/index.ts b/packages/sdks/pim/src/client/index.ts index f8a8083f..a8a3135a 100644 --- a/packages/sdks/pim/src/client/index.ts +++ b/packages/sdks/pim/src/client/index.ts @@ -1,4 +1,4 @@ // This file is auto-generated by @hey-api/openapi-ts -export * from "./schemas.gen.ts" -export * from "./services.gen.ts" -export * from "./types.gen.ts" +export * from "./schemas.gen" +export * from "./services.gen" +export * from "./types.gen" diff --git a/packages/sdks/pim/src/client/services.gen.ts b/packages/sdks/pim/src/client/services.gen.ts index df7efc83..c1c40147 100644 --- a/packages/sdks/pim/src/client/services.gen.ts +++ b/packages/sdks/pim/src/client/services.gen.ts @@ -248,7 +248,7 @@ import { GetProductTagResponseTransformer, CreateCustomRelationshipResponseTransformer, UpdateCustomRelationshipResponseTransformer, -} from "./types.gen.ts" +} from "./types.gen" /** * Get All Jobs diff --git a/packages/sdks/shopper/openapi-ts-error-1723637319210.log b/packages/sdks/shopper/openapi-ts-error-1723637319210.log new file mode 100644 index 00000000..8b63ef4a --- /dev/null +++ b/packages/sdks/shopper/openapi-ts-error-1723637319210.log @@ -0,0 +1,12 @@ +Token "UUID" does not exist. +JSONParserError: Token "UUID" does not exist. + at Pointer.resolve (/Users/robert.field/Documents/Projects/EP/muse/composable-frontend/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.6.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/pointer.js:103:23) + at $Ref.resolve (/Users/robert.field/Documents/Projects/EP/muse/composable-frontend/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.6.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/ref.js:81:28) + at $Refs._resolve (/Users/robert.field/Documents/Projects/EP/muse/composable-frontend/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.6.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/refs.js:158:21) + at inventory$Ref (/Users/robert.field/Documents/Projects/EP/muse/composable-frontend/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.6.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/bundle.js:116:27) + at crawl (/Users/robert.field/Documents/Projects/EP/muse/composable-frontend/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.6.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/bundle.js:91:21) + at crawl (/Users/robert.field/Documents/Projects/EP/muse/composable-frontend/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.6.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/bundle.js:94:21) + at inventory$Ref (/Users/robert.field/Documents/Projects/EP/muse/composable-frontend/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.6.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/bundle.js:153:9) + at crawl (/Users/robert.field/Documents/Projects/EP/muse/composable-frontend/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.6.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/bundle.js:91:21) + at crawl (/Users/robert.field/Documents/Projects/EP/muse/composable-frontend/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.6.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/bundle.js:94:21) + at crawl (/Users/robert.field/Documents/Projects/EP/muse/composable-frontend/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.6.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/bundle.js:94:21) \ No newline at end of file diff --git a/packages/sdks/shopper/openapi-ts.config.ts b/packages/sdks/shopper/openapi-ts.config.ts new file mode 100644 index 00000000..5a41f819 --- /dev/null +++ b/packages/sdks/shopper/openapi-ts.config.ts @@ -0,0 +1,12 @@ +import { defineConfig } from "@hey-api/openapi-ts" + +export default defineConfig({ + client: "@hey-api/client-fetch", + input: "../specs/catalog_view.yaml", + output: { path: "src/client", format: "prettier" }, + types: { + name: "PascalCase", + enums: false, + dates: "types+transform", + }, +}) diff --git a/packages/sdks/shopper/package.json b/packages/sdks/shopper/package.json new file mode 100644 index 00000000..49a78256 --- /dev/null +++ b/packages/sdks/shopper/package.json @@ -0,0 +1,32 @@ +{ + "name": "@epcc-sdk/sdks-shopper", + "version": "0.0.1", + "description": "", + "main": "dist/index.js", + "scripts": { + "build": "tsc -p tsconfig.node.json", + "openapi-ts": "openapi-ts" + }, + "exports": { + ".": { + "types": "./dist/index.d.ts", + "node": { + "import": "./dist/index.js", + "require": "./dist/index.js" + }, + "default": "./dist/index.js" + }, + "./package.json": "./package.json" + }, + "files": [ + "dist/**" + ], + "keywords": [], + "devDependencies": { + "@hey-api/openapi-ts": "^0.48.2", + "typescript": "^5.5.3" + }, + "dependencies": { + "@hey-api/client-fetch": "^0.1.7" + } +} diff --git a/packages/sdks/shopper/src/client/index.ts b/packages/sdks/shopper/src/client/index.ts new file mode 100644 index 00000000..a8a3135a --- /dev/null +++ b/packages/sdks/shopper/src/client/index.ts @@ -0,0 +1,4 @@ +// This file is auto-generated by @hey-api/openapi-ts +export * from "./schemas.gen" +export * from "./services.gen" +export * from "./types.gen" diff --git a/packages/sdks/shopper/src/client/schemas.gen.ts b/packages/sdks/shopper/src/client/schemas.gen.ts new file mode 100644 index 00000000..7903af50 --- /dev/null +++ b/packages/sdks/shopper/src/client/schemas.gen.ts @@ -0,0 +1,3403 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export const $amount = { + type: "object", + description: + "The three-letter ISO code for the currency associated with this price.", + title: "Amount", + properties: { + amount: { + description: + "The price in the lowest denomination for the specified currency. This is a product's list price.", + type: "integer", + example: 100, + format: "int64", + "x-omitempty": false, + "x-go-name": "Amount", + }, + includes_tax: { + description: "Whether this price includes tax.", + type: "boolean", + example: false, + default: false, + "x-go-name": "IncludesTax", + }, + }, + "x-go-name": "PriceAmount", +} as const + +export const $prioritized_pricebooks = { + description: + "If you want multiple price books for different scenarios, such as seasonal sales, business versus retail pricing, and reward programs, when creating a catalog, you can specify up to five price books. You must configure a priority for your price books. Product prices are displayed in the catalog according to the priority of the price books.", + type: "array", + maxItems: 5, + items: { + type: "object", + properties: { + id: { + description: "A unique identifier of a price book.", + type: "string", + format: "uuid", + }, + priority: { + description: + "Priority is a number and the price book with the highest number has the highest priority.", + type: "integer", + }, + }, + required: ["priority", "id"], + "x-go-name": "PrioritizedPricebook", + }, +} as const + +export const $catalog = { + type: "object", + title: "Catalog", + description: "Creates a catalog with the following attributes.", + properties: { + id: { + type: "string", + description: "A unique identifier of a catalog.", + example: "8dbb35b2-ef04-477e-974d-e5f3abe6faae", + }, + attributes: { + type: "object", + properties: { + name: { + description: "The name of a catalog.", + type: "string", + example: "catalog-123", + }, + description: { + description: + "A brief description of the catalog, such as the purpose of the catalog.", + type: "string", + example: "Catalog for Store 123", + default: "", + }, + hierarchy_ids: { + description: + "The unique identifiers of the hierarchies associated with a catalog.", + type: "array", + items: { + type: "string", + }, + }, + pricebook_id: { + description: + "The unique identifier of a price book associated with a catalog. If no price book is selected, the catalog is displayed without prices.", + type: "string", + }, + pricebook_ids: { + $ref: "#/components/schemas/prioritized-pricebooks", + }, + locales: { + description: + "Product Experience Manager supports localization of products and hierarchies. If you store supports multiple languages, you can localize product names and descriptions.", + type: "object", + additionalProperties: { + description: + "A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used.", + type: "object", + additionalProperties: { + description: + "A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used.", + type: "string", + }, + }, + }, + created_at: { + description: "The date and time a catalog is created.", + type: "string", + example: "2020-09-22T09:00:00", + format: "date-time", + }, + updated_at: { + description: "The date and time a catalog was updated.", + type: "string", + example: "2020-09-22T09:00:00", + format: "date-time", + }, + owner: { + description: + "The owner of this resource, can be either `organization` or `store`.", + type: "string", + enum: ["store", "organization"], + "x-go-name": "Owner", + default: "store", + nullable: true, + }, + }, + required: ["name", "hierarchy_ids", "created_at", "updated_at"], + }, + relationships: { + description: + "Relationships are established between different catalog entities. For example, a catalog rule and a price book are related to a catalog, as both are associated with it.", + type: "object", + title: "CatalogRelationships", + properties: { + rules: { + description: "The catalog rules related to a catalog.", + type: "object", + properties: { + links: { + $ref: "#/components/schemas/related-link", + }, + }, + }, + releases: { + description: + "When a catalog is published, a catalog release is created. This is a URL to all catalog published releases available for this catalog.", + type: "object", + properties: { + links: { + $ref: "#/components/schemas/related-link", + }, + meta: { + type: "object", + properties: { + count: { + description: "The number releases available for a catalog.", + type: "integer", + }, + }, + }, + }, + }, + }, + }, + type: { + type: "string", + example: "catalog", + enum: ["catalog"], + }, + }, + required: ["id", "type", "attributes"], +} as const + +export const $catalog_create_data = { + type: "object", + title: "CatalogCreateData", + description: "Creates a catalog with the following attributes.", + properties: { + data: { + type: "object", + properties: { + attributes: { + type: "object", + properties: { + name: { + description: "The name of the catalog.", + type: "string", + minLength: 1, + example: "catalog-123", + }, + description: { + description: "A brief description of the catalog.", + type: "string", + example: "Catalog for Store 123", + nullable: true, + }, + hierarchy_ids: { + description: + "The unique identifiers of the hierarchies to associate with a catalog.", + type: "array", + items: { + type: "string", + }, + }, + pricebook_id: { + description: `The unique identifier of the price book to associate with this catalog. You can specify either a \`pricebook_id\` or \`pricebook_ids\` but not both. If you specify both a \`pricebook_id\` and \`pricebook_ids\`, a \`422 Unprocessable Entity\` error is displayed. +`, + type: "string", + }, + pricebook_ids: { + $ref: "#/components/schemas/prioritized-pricebooks", + }, + locales: { + description: + "Product Experience Manager supports localization of products and hierarchies. If you store supports multiple languages, you can localize product names and descriptions.", + type: "object", + additionalProperties: { + description: + "A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used.", + type: "object", + additionalProperties: { + description: + "A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used.", + type: "string", + }, + }, + }, + }, + required: ["name", "hierarchy_ids"], + }, + type: { + description: + "Represents the type of object being returned. Always `Catalog`.", + type: "string", + example: "catalog", + enum: ["catalog"], + }, + }, + required: ["type", "attributes"], + }, + }, + required: ["data"], +} as const + +export const $catalog_data = { + type: "object", + title: "CatalogData", + description: "Container for a single catalog.", + properties: { + data: { + $ref: "#/components/schemas/catalog", + }, + links: { + $ref: "#/components/schemas/links", + }, + }, + required: ["data"], +} as const + +export const $catalog_list_data = { + type: "object", + title: "CatalogListData", + description: "Container for a list of catalogs.", + properties: { + data: { + type: "array", + items: { + $ref: "#/components/schemas/catalog", + }, + }, + links: { + $ref: "#/components/schemas/links", + }, + }, + required: ["data"], +} as const + +export const $catalog_update_data = { + type: "object", + title: "CatalogUpdateData", + description: + "A catalog combines price books, product lists, and hierarchies.", + properties: { + data: { + type: "object", + properties: { + attributes: { + type: "object", + properties: { + name: { + description: "The name of the catalog.", + type: "string", + minLength: 1, + example: "catalog-123", + nullable: true, + }, + description: { + description: "A brief description of the catalog.", + type: "string", + example: "Catalog for Store 123", + nullable: true, + }, + hierarchy_ids: { + description: + "The unique identifiers of the hierarchies to associate with a catalog.", + type: "array", + items: { + type: "string", + }, + nullable: true, + }, + pricebook_id: { + description: + "The unique identifier of a price book to associate with a catalog. You can specify a `pricebook_id` or a `pricebook_ids` but not both. If you specify both, a `422 unprocessable entity` error is displayed.", + type: "string", + nullable: true, + }, + pricebook_ids: { + $ref: "#/components/schemas/prioritized-pricebooks", + }, + locales: { + description: + "Product Experience Manager supports localization of products and hierarchies. If you store supports multiple languages, you can localize product names and descriptions.", + type: "object", + additionalProperties: { + description: + "A [three-letter language code](https://www.loc.gov/standards/iso639-2/) that represents the name of language you have used.", + type: "object", + additionalProperties: { + description: + "A [three-letter language code](https://www.loc.gov/standards/iso639-2/) that represents the name of language you have used.", + type: "string", + }, + }, + }, + }, + }, + id: { + description: "The unique identifier of the catalog to be updated.", + type: "string", + "x-go-name": "ID", + example: "8dbb35b2-ef04-477e-974d-e5f3abe6faae", + }, + type: { + description: + "This represents the type of object being returned. Always `catalog`.", + type: "string", + example: "catalog", + enum: ["catalog"], + }, + }, + required: ["type", "id", "attributes"], + }, + }, + required: ["data"], +} as const + +export const $component_product = { + type: "object", + title: "Component Product", + description: "The unique identifier of the component, for example, `games`.", + properties: { + name: { + description: + "The component name is the name that is displayed in your storefront.", + type: "string", + "x-go-name": "Name", + }, + min: { + description: + "The minimum number of product options a shopper can select from this component.", + type: "integer", + "x-go-name": "Min", + nullable: true, + }, + max: { + description: + "The maximum number of product options a shopper can select from this component.", + type: "integer", + "x-go-name": "Max", + nullable: true, + }, + sort_order: { + description: + "The sort order of the components. The `create a bundle` and `update a bundle` endpoints do not sort the components. You can use the `sort_order` attribute when programming your storefront to display the components in the order that you want.", + type: "integer", + "x-go-name": "Sort Order", + nullable: true, + }, + options: { + description: + "The product options included in a component. This can be the ID of another bundle.", + type: "array", + items: { + $ref: "#/components/schemas/component-product-option", + }, + "x-go-name": "Options", + }, + }, +} as const + +export const $component_product_option = { + type: "object", + title: "Component Product Option", + description: + "The product options included in a component. This can be the ID of another bundle.", + properties: { + id: { + description: + "A unique identifier of the product you want to add to a component.", + type: "string", + format: "uuid", + "x-go-name": "ID", + }, + type: { + description: + "This represents the type of object being returned. Always `product`.", + type: "string", + "x-go-name": "Type", + default: "product", + example: "product", + enum: ["product"], + }, + quantity: { + description: + "The number of this product option that a shopper must purchase.", + type: "integer", + example: 2, + "x-go-name": "Quantity", + }, + sort_order: { + description: + "The sort order of the options. The `create a bundle` and `update a bundle` endpoints do not sort the options. You can use the `sort_order` attribute when programming your storefront to display the options in the order that you want.", + type: "integer", + example: 15, + "x-go-name": "Sort Order", + nullable: true, + }, + default: { + description: + "The boolean indicates whether the current option is a default option for the component.", + type: "boolean", + example: true, + default: false, + "x-go-name": "Default", + nullable: true, + }, + }, +} as const + +export const $components = { + type: "object", + title: "Components", + description: + "A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity.", + additionalProperties: { + $ref: "#/components/schemas/component-product", + }, +} as const + +export const $custom_input_validation_rule_options = { + type: "object", + description: "The length of the custom input text field.", + "x-go-name": "CustomInputValidationRuleOptions", + properties: { + max_length: { + description: + "The number of characters the custom text field can be. You can specify a maximum length up to 255 characters, as the limit is 255 characters.", + type: "integer", + "x-go-name": "MaxLength", + example: 255, + }, + }, +} as const + +export const $custom_input_validation_rule = { + type: "object", + title: "Custom Input Validation Rule", + description: "The validation rules for the custom text.", + "x-go-name": "CustomInputValidationRule", + properties: { + type: { + description: + "This represents the type of object being returned. Must be `string`.", + type: "string", + "x-go-name": "Type", + default: "string", + example: "string", + enum: ["string"], + }, + options: { + $ref: "#/components/schemas/custom-input-validation-rule-options", + }, + }, +} as const + +export const $custom_input = { + type: "object", + title: "Custom Input", + description: + "The name of the custom input. You can rename the input to something more representative of the input that shoppers are adding, for example, `message` or `front`.", + properties: { + name: { + description: + "The name for the custom text field that is displayed in your storefront.", + type: "string", + "x-go-name": "Name", + example: "Message", + }, + validation_rules: { + description: "The validation rules for the custom text.", + type: "array", + "x-go-name": "ValidationRules", + items: { + $ref: "#/components/schemas/custom-input-validation-rule", + }, + }, + required: { + description: + "This is `true` or `false` depending on whether the custom text is required.", + type: "boolean", + "x-go-name": "Required", + example: false, + default: false, + nullable: true, + }, + }, +} as const + +export const $custom_inputs = { + type: "object", + title: "Custom Inputs", + description: `You can allow your shoppers to add custom text to a product when adding product items to their carts. This is useful, for example, if you have a product like a T-shirt that can be personalized or you sell greetings cards that can be printed with your shoppers personalized messages. You can do this using the \`custom_inputs\` attribute. + + - You can rename input to something more representative of the input that shoppers are adding, for example, \`message\` or \`front\`. + - \`name\` is the name that is displayed in your storefront. + - You can add validation rules. For example, the input field must be a string and/or up to 255 characters in length. The limit is 255 characters. +`, + additionalProperties: { + $ref: "#/components/schemas/custom-input", + }, +} as const + +export const $currencies = { + type: "object", + description: + "A collection of one or more currencies objects that consists of the [**three-letter ISO code**](https://www.iso.org/iso-3166-country-codes.html) of the currencies associated with this price and the amount. This is the product's price.", + title: "Currencies", + additionalProperties: { + $ref: "#/components/schemas/amount", + }, +} as const + +export const $shopper_attributes = { + type: "object", + description: + "The optional price extension with values in string format, viewable by shoppers.", + title: "ShopperAttributes", + additionalProperties: { + type: "string", + }, +} as const + +export const $diff_list_data = { + type: "object", + title: "DiffListData", + description: "A list of differences between two releases.", + properties: { + data: { + type: "array", + items: { + $ref: "#/components/schemas/product-diff", + }, + }, + links: { + $ref: "#/components/schemas/links", + }, + }, +} as const + +export const $display_price = { + type: "object", + description: "A price formatted for display.", + "x-omitempty": true, + properties: { + with_tax: { + $ref: "#/components/schemas/formatted-price", + }, + without_tax: { + $ref: "#/components/schemas/formatted-price", + }, + }, +} as const + +export const $error = { + type: "object", + title: "APIError", + description: "APIError is a json-api style part of an error response.", + properties: { + detail: { + type: "string", + example: "not processable", + "x-go-name": "Detail", + }, + status: { + type: "string", + example: "422", + "x-go-name": "Status", + }, + title: { + type: "string", + example: "There was a problem processing your request.", + "x-go-name": "Title", + }, + }, + "x-go-name": "APIError", +} as const + +export const $error_response = { + type: "object", + title: "ErrorResponse", + description: "ErrorResponse is a json-api style Error response.", + properties: { + errors: { + type: "array", + items: { + $ref: "#/components/schemas/error", + }, + "x-go-name": "Errors", + }, + }, + "x-go-name": "ErrorResponse", +} as const + +export const $extension = { + type: "object", + title: "Extension", + description: "The name of the product template.", + additionalProperties: { + description: "The product attributes available for this template.", + type: "object", + }, +} as const + +export const $extensions = { + type: "object", + title: "Extensions", + description: + "With extension templates, you can attach a specific set of custom fields to your products in Product Experience Manager. For example, a **Book** template might contain the attributes, such as **ISBN**, **Author**, **Number of pages**, **Year Published**, or **Condition (New/Used)**.", + additionalProperties: { + $ref: "#/components/schemas/extension", + }, +} as const + +export const $file_reference = { + description: + "In Product Experience Manager, products can have associated rich media assets, such as product images or a file containing additional product details.", + type: "object", + properties: { + type: { + description: + "This represents the type of object being returned. Always `file`.", + type: "string", + example: "file", + enum: ["file"], + }, + id: { + description: "A unique identifier for a file.", + type: "string", + format: "uuid", + }, + created_at: { + description: "The date and time a file is created.", + type: "string", + format: "date-time", + example: "1970-01-01T00:00:00.000", + "x-go-name": "CreatedAt", + }, + }, + "x-go-name": "FileRelationship", +} as const + +export const $files_relationship = { + description: + "In Product Experience Manager, products can have associated rich media assets, such as product images or a file containing additional product details.", + type: "object", + properties: { + data: { + type: "array", + items: { + $ref: "#/components/schemas/file-reference", + }, + }, + }, + "x-omitempty": true, +} as const + +export const $component_products_relationship = { + description: + "A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. You can link to the products that make up your bundle components.", + type: "object", + properties: { + data: { + $ref: "#/components/schemas/product-references", + }, + links: { + $ref: "#/components/schemas/self-link", + }, + }, + "x-omitempty": true, +} as const + +export const $formatted_price = { + type: "object", + title: "FormattedPrice", + "x-omitempty": true, + description: "A price formatted for display.", + properties: { + amount: { + description: + "The price in the lowest denomination for the specified currency. This is a product's list price.", + type: "integer", + "x-omitempty": false, + example: "47500", + }, + currency: { + description: + "The three-letter ISO code of the currencies associated with this price and the amount.", + type: "string", + example: "USD", + }, + formatted: { + description: "The format of the price for display.", + type: "string", + example: "$475.00", + }, + }, +} as const + +export const $hierarchy = { + type: "object", + title: "Hierarchy", + description: + "A category hierarchy in a catalog. Hierarchies can have parent nodes and child nodes, as well as a list of attached products.", + properties: { + attributes: { + $ref: "#/components/schemas/hierarchy-attributes", + }, + id: { + description: "A unique identifier of a hierarchy.", + type: "string", + example: "e871df93-c769-49a9-9394-a6fd555b8e8a", + "x-go-name": "ID", + }, + relationships: { + $ref: "#/components/schemas/hierarchy-relationships", + }, + type: { + description: + "This represents the type of object being returned. Always `hierarchy`.", + type: "string", + example: "hierarchy", + "x-go-name": "Type", + }, + meta: { + $ref: "#/components/schemas/hierarchy-meta", + }, + }, + "x-go-name": "Hierarchy", +} as const + +export const $hierarchy_meta = { + type: "object", + title: "HierarchyMeta", + description: "A hierarchy's metadata.", + properties: { + language: { + description: + "Product Experience Manager supports localization of hierarchies. If your store supports multiple languages, you can localize hierarchy names and descriptions. This is [**three-letter language code**](https://www.iso.org/iso-639-language-code) that represents the name of the language you have used.", + type: "string", + example: "en-GB", + }, + }, + "x-go-name": "HierarchyMeta", + "x-omitempty": true, +} as const + +export const $hierarchy_attributes = { + type: "object", + title: "HierarchyAttributes", + description: "Resource attributes of a catalog hierarchy.", + properties: { + created_at: { + description: "The date and time a hierarchy is created.", + type: "string", + format: "date-time", + example: "1970-01-01T00:00:00.000", + "x-go-name": "CreatedAt", + }, + published_at: { + description: "The date and time a hierarchy is published in a catalog.", + type: "string", + format: "date-time", + example: "1970-01-01T00:00:00.000", + nullable: true, + }, + description: { + description: "A description of a hierarchy.", + type: "string", + example: "Formal dresswear", + "x-go-name": "Description", + }, + name: { + description: "The name of a hierarchy.", + type: "string", + example: "Formal dresswear", + "x-go-name": "Name", + }, + slug: { + description: "A unique slug for a hierarchy.", + type: "string", + example: "formal", + "x-go-name": "Slug", + }, + updated_at: { + description: "The date and time a hierarchy was updated.", + type: "string", + format: "date-time", + example: "1970-01-01T00:00:00.000", + "x-go-name": "UpdatedAt", + }, + }, + "x-go-name": "HierarchyAttributes", +} as const + +export const $hierarchy_data = { + type: "object", + title: "HierarchyData", + description: "Container for hierarchies.", + properties: { + data: { + $ref: "#/components/schemas/hierarchy", + }, + links: { + $ref: "#/components/schemas/links", + }, + }, +} as const + +export const $hierarchy_list_data = { + type: "object", + title: "HierarchyListData", + description: "Container for a list of hierarchies.", + properties: { + meta: { + $ref: "#/components/schemas/page-meta", + }, + data: { + type: "array", + items: { + $ref: "#/components/schemas/hierarchy", + }, + }, + links: { + $ref: "#/components/schemas/links", + }, + }, +} as const + +export const $hierarchy_relationships = { + type: "object", + title: "HierarchyRelationships", + description: "Relationships to child nodes, and products.", + properties: { + products: { + description: "A URL to all the products associated with a hierarchy.", + type: "object", + properties: { + links: { + $ref: "#/components/schemas/related-link", + }, + }, + }, + children: { + description: + "A URL to all the child products associated with a hierarchy.", + type: "object", + properties: { + links: { + $ref: "#/components/schemas/related-link", + }, + }, + required: ["links"], + }, + nodes: { + description: "A URL to all the nodes associated with a hierarchy.", + type: "object", + properties: { + links: { + $ref: "#/components/schemas/related-link", + }, + }, + required: ["links"], + }, + }, + "x-go-name": "HierarchyRelationships", +} as const + +export const $links = { + description: "Links allow you to move between requests.", + type: "object", + properties: { + self: { + description: + "Single entities use a `self` parameter with a link the specific resource.", + type: "string", + format: "uri", + nullable: true, + }, + first: { + description: "Always the first page.", + type: "string", + format: "uri", + nullable: true, + }, + last: { + description: "This is `null` if there is only one page.", + type: "string", + format: "uri", + nullable: true, + }, + prev: { + description: "This is `null` if there is only one page.", + type: "string", + format: "uri", + nullable: true, + }, + next: { + description: "This is `null` if there is only one page.", + type: "string", + format: "uri", + nullable: true, + }, + }, +} as const + +export const $included = { + description: + "Included is an array of resources that are included in the response.", + type: "object", + properties: { + main_images: { + description: "The main images associated with a product.", + type: "array", + items: { + $ref: "#/components/schemas/file", + }, + }, + component_products: { + description: "The component products associated with a product.", + type: "array", + items: { + $ref: "#/components/schemas/product", + }, + }, + files: { + description: "The files associated with a product.", + type: "array", + items: { + $ref: "#/components/schemas/file", + }, + }, + }, +} as const + +export const $main_image_relationship = { + type: "object", + description: + "In Product Experience Manager, products can also have associated product images.", + properties: { + data: { + description: "The images associated with a product.", + type: "object", + "x-nullable": "true", + properties: { + type: { + description: + "This represents the type of object being returned. Always `main_image`.", + type: "string", + example: "main_image", + enum: ["main_image"], + }, + id: { + description: "A unique identifier for an image.", + type: "string", + format: "uuid", + }, + }, + }, + }, + "x-omitempty": true, +} as const + +export const $node = { + type: "object", + title: "Node", + description: + "A category node in a catalog. Nodes can have child nodes, as well as a list of attached products.", + properties: { + attributes: { + $ref: "#/components/schemas/node-attributes", + }, + id: { + description: "The unique identifier of a node.", + type: "string", + example: "e871df93-c769-49a9-9394-a6fd555b8e8a", + "x-go-name": "ID", + }, + relationships: { + $ref: "#/components/schemas/node-relationships", + }, + type: { + description: + "This represents the type of object being returned. Always `node`.", + type: "string", + example: "node", + "x-go-name": "Type", + }, + meta: { + $ref: "#/components/schemas/node-meta", + }, + }, + "x-go-name": "Node", +} as const + +export const $node_attributes = { + type: "object", + title: "NodeAttributes", + description: "Resource attributes of a catalog node.", + properties: { + created_at: { + description: "The date and time a node was created.", + type: "string", + format: "date-time", + example: "1970-01-01T00:00:00.000", + "x-go-name": "CreatedAt", + }, + published_at: { + description: "The date and time a node was published in a catalog.", + type: "string", + format: "date-time", + example: "1970-01-01T00:00:00.000", + nullable: true, + }, + description: { + type: "string", + description: "A description of a node.", + example: "Formal dresswear", + "x-go-name": "Description", + }, + label: { + type: "string", + example: "category", + "x-go-name": "Label", + }, + name: { + description: + "The name of a node. Names must be unique among sibling nodes in a hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies.", + type: "string", + example: "Formal dresswear", + "x-go-name": "Name", + }, + slug: { + description: + "A slug for the node. Slugs must be unique among sibling nodes in the hierarchy. Otherwise, a slug can be non-unique within the hierarchy and across multiple hierarchies.", + type: "string", + example: "formal", + "x-go-name": "Slug", + }, + curated_products: { + description: + "A list of curated products for a node. You can curate your products in your nodes product lists. Product curation allows you to promote specific products within each node in a hierarchy, enabling you to create unique product collections in your storefront.", + type: "array", + items: { + type: "string", + example: "8dbb35b2-ef04-477e-974d-e5f3abe6faae", + }, + "x-omitempty": true, + }, + status: { + type: "string", + example: "live", + "x-go-name": "Status", + }, + updated_at: { + description: "The date and time a node was updated.", + type: "string", + format: "date-time", + example: "1970-01-01T00:00:00.000", + "x-go-name": "UpdatedAt", + }, + }, + "x-go-name": "NodeAttributes", +} as const + +export const $node_create_data = { + type: "object", + title: "NodeCreateData", + description: "Container for nodes.", + properties: { + data: { + type: "object", + title: "NodeCreateArgs", + description: + "A node in a catalog (e.g. a category node). Nodes can have child nodes, as well as a list of attached products", + properties: { + attributes: { + type: "object", + title: "NodeCreateAttributes", + description: "Resource attributes of a catalog node.", + properties: { + description: { + type: "string", + example: "Formal dresswear", + "x-go-name": "Description", + }, + hierarchy_id: { + type: "string", + description: "hierarchy id of the node", + example: "ddd401ac-db06-4d9e-af60-cf5206abb9bc", + }, + label: { + type: "string", + example: "category", + "x-go-name": "Label", + }, + name: { + type: "string", + example: "Formal dresswear", + "x-go-name": "Name", + }, + slug: { + type: "string", + example: "formal", + "x-go-name": "Slug", + }, + status: { + type: "string", + example: "Live", + "x-go-name": "Status", + }, + locales: { + type: "object", + additionalProperties: { + type: "object", + additionalProperties: { + type: "string", + }, + }, + }, + }, + required: ["name"], + }, + relationships: { + $ref: "#/components/schemas/node-relationships", + }, + id: { + type: "string", + example: "8fccaa19-dba9-4621-8d11-31a222a68c7c", + "x-go-name": "ID", + }, + type: { + type: "string", + example: "node", + "x-go-name": "Type", + }, + }, + required: ["type", "attributes"], + }, + links: { + $ref: "#/components/schemas/links", + }, + }, + required: ["data"], +} as const + +export const $node_data = { + type: "object", + title: "NodeData", + description: "Container for nodes.", + properties: { + data: { + $ref: "#/components/schemas/node", + }, + links: { + $ref: "#/components/schemas/links", + }, + }, +} as const + +export const $node_list_data = { + type: "object", + title: "NodeListData", + description: "Container for a list of nodes.", + properties: { + meta: { + $ref: "#/components/schemas/page-meta", + }, + data: { + type: "array", + items: { + $ref: "#/components/schemas/node", + }, + }, + links: { + $ref: "#/components/schemas/links", + }, + }, +} as const + +export const $node_meta = { + type: "object", + title: "NodeMeta", + description: "A node's metadata.", + properties: { + language: { + description: "The node details localized in the supported languages.", + type: "string", + example: "en-GB", + }, + bread_crumb: { + description: + "Helps you understand the association of products with nodes. It explains how products are associated with parent nodes and the relationship among the array of nodes. This is useful if you want to improve how your shoppers search within you store.", + type: "array", + items: { + type: "string", + example: "8dbb35b2-ef04-477e-974d-e5f3abe6faae", + }, + "x-omitempty": true, + }, + }, + "x-go-name": "NodeMeta", + "x-omitempty": true, +} as const + +export const $node_reference = { + type: "object", + title: "NodeReference", + description: "Minimum set of information to identify a catalog node.", + properties: { + id: { + description: "The unique identifier of a hierarchy.", + type: "string", + example: "65477ce0-fcb8-436b-a120-3d57979421dd", + "x-go-name": "ID", + }, + label: { + description: "A label for a hierarchy.", + type: "string", + example: "category", + "x-go-name": "Label", + }, + name: { + description: "The name of a hierarchy.", + type: "string", + example: "Formal dresswear", + "x-go-name": "Name", + }, + }, + "x-go-name": "NodeReference", +} as const + +export const $node_relationships = { + type: "object", + title: "NodeRelationships", + description: "Relationships to parent and child nodes, and products.", + properties: { + products: { + description: "A URL to all products associated with a node.", + type: "object", + properties: { + data: { + type: "array", + "x-omitempty": true, + items: { + $ref: "#/components/schemas/product-reference", + }, + }, + links: { + $ref: "#/components/schemas/related-link", + }, + }, + }, + children: { + description: "A URL to all child nodes associated with a node.", + type: "object", + properties: { + links: { + $ref: "#/components/schemas/related-link", + }, + }, + required: ["links"], + }, + parent: { + description: "A URL to all parent nodes associated with a node.", + type: "object", + properties: { + data: { + type: "object", + properties: { + type: { + type: "string", + example: "node", + enum: ["node"], + }, + id: { + type: "string", + example: "8fccaa19-dba9-4621-8d11-31a222a68c7c", + "x-go-name": "ID", + }, + }, + required: ["id", "type"], + }, + links: { + $ref: "#/components/schemas/related-link", + }, + }, + required: ["data"], + }, + hierarchy: { + description: "A URL to the hierarchies associated with a node.", + type: "object", + properties: { + data: { + type: "object", + properties: { + type: { + type: "string", + example: "hierarchy", + enum: ["hierarchy"], + }, + id: { + type: "string", + example: "8fccaa19-dba9-4621-8d11-31a222a68c7c", + "x-go-name": "ID", + }, + }, + required: ["id", "type"], + }, + links: { + $ref: "#/components/schemas/related-link", + }, + }, + required: ["data"], + }, + }, + "x-go-name": "NodeRelationships", +} as const + +export const $node_relationships_data = { + type: "object", + title: "NodeRelationshipsData", + description: "Container for node relationships.", + properties: { + data: { + $ref: "#/components/schemas/node-relationships", + }, + links: { + $ref: "#/components/schemas/links", + }, + }, +} as const + +export const $page_meta = { + type: "object", + description: "Contains the results for the entire collection.", + title: "PageMeta", + properties: { + results: { + description: "Total number of results for the entire collection.", + type: "object", + properties: { + total: { + description: "Total number of results for the entire collection.", + type: "integer", + format: "int64", + }, + }, + }, + page: { + type: "object", + properties: { + limit: { + description: "The maximum number of records for all pages.", + type: "integer", + format: "int64", + }, + offset: { + description: "The current offset by number of pages.", + type: "integer", + format: "int64", + }, + current: { + description: "The current number of pages.", + type: "integer", + format: "int64", + }, + total: { + description: "The total number of records for the entire collection.", + type: "integer", + format: "int64", + }, + }, + }, + }, +} as const + +export const $pricebook = { + type: "object", + title: "Pricebook", + description: + "Top level entity in the pricebooks domain model. It contains a list of product prices.", + properties: { + id: { + description: "The unique identifier of a price book.", + type: "string", + example: "4c45e4ec-26e0-4043-86e4-c15b9cf985a7", + "x-go-name": "ID", + }, + type: { + description: + "This represents the type of object being returned. Always `pricebook`.", + type: "string", + "x-go-name": "Type", + default: "pricebook", + example: "pricebook", + enum: ["pricebook"], + }, + attributes: { + type: "object", + properties: { + created_at: { + type: "string", + format: "date-time", + example: "2020-09-22T09:00:00", + "x-go-name": "CreatedAt", + }, + description: { + type: "string", + example: "This is a pricebook", + "x-go-name": "Description", + nullable: true, + }, + name: { + type: "string", + example: "pricebook-store-abc", + "x-go-name": "Name", + nullable: true, + }, + updated_at: { + type: "string", + example: "2020-09-22T09:00:00", + format: "date-time", + "x-go-name": "UpdatedAt", + }, + }, + required: ["name"], + }, + }, + required: ["type", "attributes"], + additionalProperties: false, + "x-go-name": "Pricebook", +} as const + +export const $pricebook_create_data = { + type: "object", + title: "PricebookData", + description: "Container for pricebooks.", + properties: { + data: { + type: "object", + description: "New top level pricebook.", + title: "PricebookCreateArgs", + properties: { + type: { + type: "string", + "x-go-name": "Type", + default: "pricebook", + example: "pricebook", + enum: ["pricebook"], + }, + attributes: { + type: "object", + properties: { + description: { + type: "string", + example: "This is a pricebook", + "x-go-name": "Description", + nullable: true, + }, + name: { + type: "string", + example: "pricebook-store-abc", + "x-go-name": "Name", + nullable: true, + }, + }, + required: ["name"], + }, + }, + required: ["type", "attributes"], + additionalProperties: false, + }, + links: { + $ref: "#/components/schemas/links", + }, + }, + required: ["data"], +} as const + +export const $pricebook_data = { + type: "object", + title: "PricebookData", + description: "Container for pricebooks.", + properties: { + data: { + $ref: "#/components/schemas/pricebook", + }, + links: { + $ref: "#/components/schemas/links", + }, + }, + required: ["data"], +} as const + +export const $pricebook_price = { + type: "object", + title: "PricebookPrice", + description: + "ProductPrice associates a collection of locale specific prices with a product ID.", + properties: { + type: { + type: "string", + example: "product-price", + default: "product-price", + enum: ["product-price"], + }, + attributes: { + type: "object", + properties: { + currencies: { + $ref: "#/components/schemas/tiered-currencies", + }, + sales: { + $ref: "#/components/schemas/sales", + }, + sku: { + type: "string", + example: "4c45e4ec-sku", + }, + }, + required: ["currencies", "sku"], + }, + id: { + type: "string", + example: "4c45e4ec-26e0-4043-86e4-c15b9cf985a7", + "x-go-name": "ID", + }, + }, + required: ["type", "id", "attributes"], + additionalProperties: false, +} as const + +export const $pricebook_price_create_data = { + type: "object", + title: "PricebookPriceCreateData", + description: "Container for pricebook prices.", + properties: { + data: { + type: "object", + title: "PricebookPriceCreateArgs", + description: + "ProductPrice associates a collection of locale specific prices with a product ID.", + properties: { + type: { + type: "string", + example: "product-price", + default: "product-price", + enum: ["product-price"], + }, + attributes: { + type: "object", + properties: { + currencies: { + $ref: "#/components/schemas/tiered-currencies", + }, + sales: { + $ref: "#/components/schemas/sales", + }, + sku: { + type: "string", + example: "4c45e4ec-sku", + }, + }, + required: ["currencies", "sku"], + }, + }, + required: ["type", "attributes"], + }, + links: { + $ref: "#/components/schemas/links", + }, + }, + required: ["data"], +} as const + +export const $pricebook_price_data = { + type: "object", + title: "PricebookPriceData", + description: "Container for pricebook prices.", + properties: { + data: { + $ref: "#/components/schemas/pricebook-price", + }, + links: { + $ref: "#/components/schemas/links", + }, + }, + required: ["data"], +} as const + +export const $product = { + type: "object", + title: "Product", + description: "A product in a catalog with the following attributes.", + properties: { + attributes: { + $ref: "#/components/schemas/product-attributes", + }, + id: { + description: "A unique identifier for a product.", + type: "string", + example: "8fccaa19-dba9-4621-8d11-31a222a68c7c", + "x-go-name": "ID", + }, + relationships: { + $ref: "#/components/schemas/product-relationships", + }, + type: { + description: + "This represents the type of object being returned. Always `product`.", + type: "string", + example: "product", + "x-go-name": "Type", + }, + meta: { + $ref: "#/components/schemas/product-meta", + }, + }, + "x-go-name": "Product", +} as const + +export const $product_attributes = { + type: "object", + title: "ProductAttributes", + description: "A product's attributes.", + properties: { + published_at: { + description: "The date and time a product was published in a catalog.", + type: "string", + format: "date-time", + example: "1970-01-01T00:00:00.000", + nullable: true, + }, + base_product: { + description: + "If this product is a `parent` product. A `parent` product is a product that has child products that have been built using the `build child products` endpoint.", + type: "boolean", + example: false, + default: false, + "x-go-name": "BaseProduct", + }, + base_product_id: { + description: "The unique identifier of a `parent` product.", + type: "string", + example: "cdf574bc-e36e-48fc-9eac-01c87839b285", + "x-go-name": "BaseProductID", + }, + commodity_type: { + description: "The commodity type, either `physical` or `digital`.", + type: "string", + example: "physical", + "x-go-name": "CommodityType", + }, + curated_product: { + description: + "If a product is curated, then the `curated_product` attribute with a value of `true` is displayed. If a product is not curated, the `curated_product` attribute is not displayed.", + type: "boolean", + example: true, + "x-omitempty": true, + "x-go-name": "CuratedProduct", + }, + upc_ean: { + description: + "The universal product code or european article number of the product.", + type: "string", + example: "0123456", + "x-go-name": "UpcEan", + }, + manufacturer_part_num: { + description: "The manufacturer part number of the product.", + type: "string", + example: "mfn1", + "x-go-name": "ManufacturerPartNum", + }, + tags: { + type: "array", + description: + "A list of tags associated with the product. A tag must be HTML compatible characters excluding commas and will be stored in lowercase letters.", + items: { + description: "A tag associated with the product.", + type: "string", + example: "tag-a", + }, + "x-go-name": "Tags", + "x-omitempty": true, + }, + price_modifiers: { + type: "array", + description: "A list of price modifier names.", + items: { + description: "A list of price modifier names.", + type: "string", + example: "modifier-1", + }, + "x-go-name": "PriceModifiers", + "x-omitempty": true, + }, + created_at: { + description: "The date and time a product was created.", + type: "string", + format: "date-time", + example: "1970-01-01T00:00:00.000", + "x-go-name": "CreatedAt", + }, + description: { + description: "A description of the product.", + type: "string", + example: "This is a product", + "x-go-name": "Description", + }, + name: { + description: "A name of a product.", + type: "string", + example: "Blue shirt", + "x-go-name": "Name", + }, + price: { + $ref: "#/components/schemas/currencies", + }, + shopper_attributes: { + $ref: "#/components/schemas/shopper_attributes", + }, + tiers: { + $ref: "#/components/schemas/tiers", + }, + components: { + $ref: "#/components/schemas/components", + }, + custom_inputs: { + $ref: "#/components/schemas/custom_inputs", + }, + sku: { + description: "The unique stock keeping unit of the product.", + type: "string", + example: "blue-shirt", + "x-go-name": "Sku", + }, + slug: { + description: + "A label for the product that is used in the URL paths. A slug can contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. By default, the product name is used as the slug.", + type: "string", + example: "blue-shirt", + "x-go-name": "Slug", + }, + status: { + description: "The status of the product, either `live` or `draft`.", + type: "string", + example: "live", + "x-go-name": "Status", + }, + external_ref: { + description: + "The unique attribute associated with the product. This could be an external reference from a separate company system, for example.", + type: "string", + "x-go-name": "ExternalRef", + nullable: true, + }, + updated_at: { + description: "The date and time a product was updated.", + type: "string", + example: "1970-01-01T00:00:00.000", + format: "date-time", + "x-go-name": "UpdatedAt", + }, + extensions: { + $ref: "#/components/schemas/extensions", + }, + }, + "x-go-name": "ProductAttributes", +} as const + +export const $product_create_data = { + type: "object", + title: "ProductData", + description: "Container for products.", + properties: { + data: { + type: "object", + title: "ProductCreateArgs", + description: "A new product in a catalog.", + properties: { + attributes: { + type: "object", + title: "ProductCreateAttributes", + description: "A product's attributes.", + properties: { + description: { + type: "string", + example: "This is a product", + }, + name: { + type: "string", + example: "Blue shirt", + }, + sku: { + type: "string", + example: "blue-shirt", + }, + slug: { + type: "string", + example: "blue-shirt", + }, + status: { + type: "string", + example: "live", + }, + locales: { + type: "object", + additionalProperties: { + type: "object", + additionalProperties: { + type: "string", + }, + }, + }, + }, + required: ["name", "status"], + }, + id: { + type: "string", + example: "8fccaa19-dba9-4621-8d11-31a222a68c7c", + "x-go-name": "ID", + }, + type: { + type: "string", + example: "product", + "x-go-name": "Type", + }, + }, + required: ["attributes", "type"], + }, + links: { + $ref: "#/components/schemas/links", + }, + }, +} as const + +export const $product_data = { + type: "object", + title: "ProductData", + description: "Container for products.", + properties: { + data: { + $ref: "#/components/schemas/product", + }, + links: { + $ref: "#/components/schemas/links", + }, + included: { + $ref: "#/components/schemas/included", + }, + }, +} as const + +export const $product_diff = { + "x-go-name": "ProductDiff", + type: "object", + properties: { + id: { + type: "string", + example: "e871df93-c769-49a9-9394-a6fd555b8e8a", + "x-go-name": "ID", + }, + type: { + type: "string", + example: "product_diff", + "x-go-name": "Type", + }, + attributes: { + type: "object", + properties: { + sku: { + type: "string", + }, + this_release_id: { + type: "string", + }, + other_release_id: { + type: "string", + }, + diff_created_at: { + type: "string", + format: "date-time", + example: "1970-01-01T00:00:00.000", + }, + exists: { + "x-go-name": "ProductDiffExists", + type: "object", + properties: { + this: { + type: "boolean", + }, + other: { + type: "boolean", + }, + }, + required: ["this", "other"], + }, + updated_at: { + "x-go-name": "ProductDiffUpdatedAt", + type: "object", + properties: { + this: { + type: "string", + format: "date-time", + example: "1970-01-01T00:00:00.000", + "x-omitempty": true, + nullable: true, + }, + other: { + type: "string", + format: "date-time", + example: "1970-01-01T00:00:00.000", + "x-omitempty": true, + nullable: true, + }, + }, + }, + }, + }, + }, +} as const + +export const $product_list_data = { + type: "object", + title: "ProductListData", + description: "Container for a list of products.", + properties: { + meta: { + $ref: "#/components/schemas/page-meta", + }, + data: { + type: "array", + items: { + $ref: "#/components/schemas/product", + }, + "x-go-name": "Data", + }, + links: { + $ref: "#/components/schemas/links", + }, + }, +} as const + +export const $product_meta = { + type: "object", + title: "ProductMeta", + description: + "A product's metadata contains information about products, for example, the nodes a product is associated with, any child products, bundle configurations, and so on.", + properties: { + bread_crumbs: { + description: + "The relationship among the array of nodes a product is associated with, demonstrating the linking of the children nodes with the parent nodes. Up to 10 levels of parent nodes are displayed, depending on the number of levels of parent nodes you have.", + type: "object", + additionalProperties: { + type: "array", + items: { + type: "string", + example: "8dbb35b2-ef04-477e-974d-e5f3abe6faae", + }, + }, + "x-omitempty": true, + }, + bread_crumb_nodes: { + description: + "An array of parent node IDs that a product is associated with. Up to 10 levels of parent nodes are displayed, depending on the number of levels of parent nodes you have.", + type: "array", + items: { + type: "string", + example: "8dbb35b2-ef04-477e-974d-e5f3abe6faae", + }, + "x-omitempty": true, + }, + catalog_id: { + description: + "A unique identifier of the catalog a product is associated with.", + type: "string", + example: "362a16dc-f7c6-4280-83d6-4fcc152af091", + "x-go-name": "CatalogID", + }, + pricebook_id: { + description: + "The unique identifier of the price book a product is associated with.", + type: "string", + example: "f5466169-0037-460c-b181-b02682b6f4de", + "x-go-name": "PricebookID", + nullable: true, + }, + display_price: { + $ref: "#/components/schemas/display-price", + }, + catalog_source: { + description: "The source of a catalog. Always `pim`.", + type: "string", + example: "pim", + enum: ["pim"], + "x-go-name": "CatalogSource", + }, + sale_id: { + description: + "With sales pricing, a store can optionally add a sale price to a product price. For example, a store can schedule seasonal pricing on products without creating a new price book and catalog ruleset. Optionally, a store can schedule the date ranges for the sale products. This is the unique identifier of a sale.", + type: "string", + "x-go-name": "SaleID", + }, + sale_expires: { + description: "The date and time a sale expires.", + type: "string", + format: "date-time", + example: "1970-01-01T00:00:00.000", + "x-go-name": "SaleExpires", + nullable: true, + }, + original_price: { + $ref: "#/components/schemas/currencies", + }, + original_display_price: { + $ref: "#/components/schemas/display-price", + }, + bundle_configuration: { + $ref: "#/components/schemas/bundle-configuration", + }, + component_products: { + description: + "A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity.", + type: "object", + additionalProperties: { + type: "object", + properties: { + sale_id: { + description: + "With sales pricing, a store can optionally add a sale price to a product price. For example, a store can schedule seasonal pricing on products without creating a new price book and catalog ruleset. Optionally, a store can schedule the date ranges for the sale products. This is the unique identifier of a sale.", + type: "string", + "x-go-name": "SaleID", + }, + sale_expires: { + description: "The date and time a sale expires.", + type: "string", + format: "date-time", + example: "1970-01-01T00:00:00.000", + "x-go-name": "SaleExpires", + nullable: true, + }, + price: { + $ref: "#/components/schemas/currencies", + }, + display_price: { + $ref: "#/components/schemas/display-price", + }, + original_price: { + $ref: "#/components/schemas/currencies", + }, + original_display_price: { + $ref: "#/components/schemas/display-price", + }, + pricebook_id: { + type: "string", + example: "f5466169-0037-460c-b181-b02682b6f4de", + "x-go-name": "PricebookID", + nullable: true, + }, + }, + "x-go-name": "ComponentProductMeta", + }, + }, + price_modifiers: { + type: "object", + description: + "You can use price modifiers to change the price property of child products. By default, child products inherit the same price as their base products. Using price modifiers, you can enable child products to inherit a different price.", + additionalProperties: { + description: + "A name for the modifier. The name must be unique and is case-sensitive.", + type: "object", + properties: { + modifier_type: { + description: `There are three modifier types. + + - The \`price_increment\` type increases the prices of a product. + - The \`price_decrement\` type decreases the price of a product. + - The \`price_equals\` type sets the price of a product to an amount you specify. +`, + type: "string", + example: "price_equals", + }, + currencies: { + $ref: "#/components/schemas/currencies", + }, + }, + "x-go-name": "PriceModifierMeta", + }, + }, + tiers: { + description: + "You can use tiers to allow your store to offer different pricing for minimum quantities of items that your shoppers purchase.", + type: "object", + additionalProperties: { + description: "The name of the tier, such as `Pencils`.", + type: "object", + properties: { + sale_id: { + description: "The unique identifier of a sale.", + type: "string", + "x-go-name": "SaleID", + }, + sale_expires: { + description: "The date and time a sale expires.", + type: "string", + format: "date-time", + example: "1970-01-01T00:00:00.000", + "x-go-name": "SaleExpires", + nullable: true, + }, + display_price: { + $ref: "#/components/schemas/display-price", + }, + original_price: { + $ref: "#/components/schemas/currencies", + }, + original_display_price: { + $ref: "#/components/schemas/display-price", + }, + }, + "x-go-name": "ProductMetaTier", + }, + "x-go-name": "ProductMetaTiers", + }, + variation_matrix: { + description: + "The `variation_matrix` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. If no variations are available, the `variation_matrix` is empty.", + type: "object", + }, + variations: { + description: + "If you specified `build_rules` for a product, the `variations` object lists the variation option IDs that you specified to include when building your child products. If no `build_rules` are specified, all the variation and variation options available for a product are displayed. If a product does not have any variations, then the `variations` object is not displayed.", + type: "array", + items: { + $ref: "#/components/schemas/variation", + }, + "x-omitempty": true, + }, + child_option_ids: { + description: + "An array of variation options IDs that a child product has.", + type: "array", + items: { + type: "string", + example: [ + "8dbb35b2-ef04-477e-974d-e5f3abe6faae", + "6ddf2a66-d805-449c-a0e1-8e81335e31a6", + ], + }, + "x-omitempty": true, + nullable: true, + }, + child_variations: { + description: + "If this is a child product, the `child_variations` object lists the variation option IDs that define this child product.", + type: "array", + items: { + $ref: "#/components/schemas/variation", + }, + "x-omitempty": true, + nullable: true, + }, + product_types: { + description: `Commerce automatically assigns types to the products you create. In Commerce Manager, you can see at a glance the product types in a list of a products. In addition, you can filter on product types in both the API and Commerce Manager. + + Product types can also be used in catalogs. For example, in your catalog, you can filter on parent so that only your parent products are displayed in your storefront. + + Products have one of the following types: + + - **standard** - Standard products are a standalone products. + - **parent** - A parent product is a product that has child products that have been built using the \`Build Child Products\` endpoint. + - **child** - When you configure product variations and variation options for parent products, the child products derived from the parent products are automatically created in Commerce. + - **bundle** - A bundle is a purchasable product, comprising two or more standalone products (in other words, components) to be sold together. +`, + type: "array", + items: { + type: "string", + }, + "x-omitempty": true, + "x-go-name": "ProductTypes", + }, + language: { + description: + "If you storefront supports multiple languages, your storefront's preferred language and locale.", + type: "string", + example: "en-GB", + }, + }, + "x-go-name": "ProductMeta", + "x-omitempty": true, +} as const + +export const $variation_option = { + description: "The options available for a variation.", + type: "object", + properties: { + id: { + description: "A unique identifier for an option.", + type: "string", + format: "uuid", + "x-go-name": "ID", + }, + name: { + description: "The name of the option.", + type: "string", + }, + sort_order: { + description: + "If you specified a `sort_order` when creating your variations and variation options, then use the `sort_order` value to program your storefront to display the variations and variation options in the order that you want.", + type: "integer", + "x-go-name": "Sort Order", + nullable: true, + }, + description: { + description: "The option description to display to customers.", + type: "string", + }, + }, + "x-go-name": "ProductVariationOption", +} as const + +export const $variation = { + type: "object", + properties: { + id: { + description: "A unique identifier of a variation.", + type: "string", + format: "uuid", + "x-go-name": "ID", + }, + name: { + description: "The name of a variation.", + type: "string", + }, + sort_order: { + description: + "If you specified a `sort_order` when creating your variations and variation options, then use the `sort_order` value to program your storefront to display the variations and variation options in the order that you want.", + type: "integer", + "x-go-name": "Sort Order", + nullable: true, + }, + option: { + $ref: "#/components/schemas/variation_option", + }, + options: { + description: "The options available for this variation.", + type: "array", + "x-omitempty": true, + items: { + $ref: "#/components/schemas/variation_option", + }, + }, + }, + "x-go-name": "ProductVariation", +} as const + +export const $bundle_configuration_data = { + type: "object", + title: "BundleConfigurationData", + description: "Container for a bundle configuration.", + properties: { + data: { + $ref: "#/components/schemas/bundle-configuration", + }, + }, + required: ["data"], +} as const + +export const $bundle_configuration = { + type: "object", + title: "BundleConfiguration", + description: + "A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity.", + properties: { + selected_options: { + type: "object", + description: + "The product options included in a component. This can be the ID of another bundle.", + additionalProperties: { + description: + "The unique identifier of the component, for example, `games`.", + type: "object", + additionalProperties: { + description: + "The number of this product option that a shopper must purchase.", + type: "integer", + format: "int64", + }, + }, + }, + }, + required: ["selected_options"], + "x-go-name": "ProductBundleConfiguration", +} as const + +export const $product_reference = { + type: "object", + title: "ProductReference", + description: "A product identifier.", + "x-nullable": "true", + properties: { + id: { + description: "A unique identifier for a product.", + type: "string", + format: "uuid", + "x-go-name": "ID", + }, + type: { + description: + "This represents the type of object being returned. Always `product`.", + type: "string", + "x-go-name": "Type", + example: "product", + enum: ["product"], + }, + }, + "x-go-name": "ProductReference", +} as const + +export const $product_reference_list_data = { + type: "object", + title: "ProductReferenceListData", + description: "Container for a list of product references.", + properties: { + meta: { + $ref: "#/components/schemas/page-meta", + }, + data: { + $ref: "#/components/schemas/product-references", + }, + links: { + $ref: "#/components/schemas/links", + }, + }, +} as const + +export const $product_references = { + type: "array", + title: "ProductReferences", + description: "A list of product identifiers.", + items: { + $ref: "#/components/schemas/product-reference", + }, + "x-go-name": "ProductReferences", +} as const + +export const $product_relationships = { + type: "object", + title: "ProductRelationships", + description: + "Relationships allow you to move between requests. Includes links to the parent and child products, bundle component products, files, and main images associated with a product.", + properties: { + parent: { + description: + "The details of a `parent` product. A `parent` product is a product that has child products that have been built using the `Build Child Products` endpoint.", + type: "object", + properties: { + data: { + $ref: "#/components/schemas/product-reference", + }, + }, + "x-go-name": "Parent", + "x-omitempty": true, + }, + children: { + description: + "The details of a `child` product. When you configure product variations and variation options for parent products, the child products derived from the parent products are automatically created in Commerce.", + type: "object", + properties: { + data: { + $ref: "#/components/schemas/product-references", + }, + links: { + $ref: "#/components/schemas/self-link", + }, + }, + "x-go-name": "Children", + "x-omitempty": true, + }, + files: { + $ref: "#/components/schemas/files-relationship", + }, + main_image: { + $ref: "#/components/schemas/main-image-relationship", + }, + component_products: { + $ref: "#/components/schemas/component-products-relationship", + }, + }, + "x-go-name": "ProductRelationships", + "x-omitempty": true, +} as const + +export const $product_relationships_data = { + type: "object", + title: "ProductRelationshipsData", + description: "Container for product relationships.", + properties: { + data: { + $ref: "#/components/schemas/product-relationships", + }, + links: { + $ref: "#/components/schemas/links", + }, + }, +} as const + +export const $products_for_cart = { + type: "object", + title: "ProductsForCart", + description: + "A list of products to be added to cart. Can be type product-data or error-response.", + properties: { + data: { + type: "array", + items: {}, + "x-go-name": "Data", + }, + included: { + type: "object", + "x-go-name": "Included", + properties: { + component_products: { + type: "array", + items: { + $ref: "#/components/schemas/product", + }, + "x-go-name": "ComponentProducts", + }, + }, + nullable: true, + }, + }, + required: ["data"], + "x-go-name": "ProductsForCart", +} as const + +export const $products_for_cart_configuration = { + type: "object", + title: "ProductsForCartConfiguration", + description: "A list of product id or sku and bundle configuration for cart.", + properties: { + data: { + type: "array", + minItems: 1, + items: { + type: "object", + properties: { + id: { + type: "string", + format: "uuid", + "x-go-name": "ID", + nullable: true, + }, + sku: { + type: "string", + "x-go-name": "SKU", + nullable: true, + }, + bundle_configuration: { + $ref: "#/components/schemas/bundle-configuration", + }, + }, + }, + "x-go-name": "Data", + }, + }, + required: ["data"], + "x-go-name": "ProductsForCartConfiguration", +} as const + +export const $related_link = { + description: + "A URL to a related object, for example, catalog rules, hierarchies, price books, products and deltas.", + type: "object", + properties: { + related: { + description: + "A URL to a related object, for example, catalog rules, hierarchies, price books, products and deltas.", + type: "string", + }, + }, + required: ["related"], +} as const + +export const $self_link = { + description: "Links are used to allow you to move between requests.", + type: "object", + properties: { + self: { + description: + "Single entities use a self parameter with a link to that specific resource.", + type: "string", + }, + }, + required: ["self"], +} as const + +export const $release = { + type: "object", + title: "Release", + description: + "A catalog release represents a collection of hierarchical product data, price books and catalogs rules.", + properties: { + id: { + description: "A unique identifier for the catalog release.", + type: "string", + "x-go-name": "ID", + example: "8dbb35b2-ef04-477e-974d-e5f3abe6faae", + }, + attributes: { + type: "object", + properties: { + name: { + description: "The name of a release.", + type: "string", + example: "Clothing", + }, + published_at: { + description: "The date and time a release was published.", + type: "string", + format: "date-time", + example: "1970-01-01T00:00:00.000", + nullable: true, + }, + catalog_id: { + description: "A unique identifier for the catalog.", + type: "string", + example: "0194f54d-f2a1-4e33-9a6e-9ec366152490", + }, + description: { + description: "A description of the catalog release.", + type: "string", + example: "Catalog for Store 123", + default: "", + }, + hierarchies: { + description: "An array of hierarchy IDs associated with the release.", + type: "array", + items: { + $ref: "#/components/schemas/node-reference", + }, + "x-go-name": "RootNodes", + }, + }, + }, + relationships: { + $ref: "#/components/schemas/release-relationships", + }, + type: { + description: + "This represents the type of object being returned. Always `catalog-release`.", + type: "string", + "x-go-name": "Type", + }, + meta: { + $ref: "#/components/schemas/release-meta", + }, + }, + "x-go-name": "Release", +} as const + +export const $release_data = { + type: "object", + title: "Release Data", + description: "Container for a catalog release.", + properties: { + data: { + $ref: "#/components/schemas/release", + }, + links: { + $ref: "#/components/schemas/links", + }, + }, +} as const + +export const $release_list_data = { + type: "object", + title: "ReleaseListData", + description: "Container for a list of catalog releases.", + properties: { + data: { + type: "array", + items: { + $ref: "#/components/schemas/release", + }, + }, + links: { + $ref: "#/components/schemas/links", + }, + }, +} as const + +export const $release_meta = { + type: "object", + title: "ReleaseMeta", + description: "A release's metadata.", + properties: { + created_at: { + description: "The date and time a release is created.", + type: "string", + format: "date-time", + example: "1970-01-01T00:00:00.000", + }, + started_at: { + description: + "The date and time a release is available for use. In other words, the date and time the status of a catalog release changes to PUBLISHED, rather than IN PROGRESS.", + type: "string", + format: "date-time", + example: "1970-01-01T00:00:00.000", + nullable: true, + }, + updated_at: { + description: "The date and time a release is updated.", + type: "string", + format: "date-time", + example: "1970-01-01T00:00:00.000", + nullable: true, + }, + release_status: { + description: "The status of the current release.", + type: "string", + enum: ["PENDING", "IN_PROGRESS", "FAILED", "PUBLISHED"], + }, + language: { + description: "Your storefront's preferred language code and locale.", + type: "string", + example: "en-GB", + }, + is_full_publish: { + description: `Indicates that a full publish was performed (either because this is the first time a catalog has been published or because of a change that occurred, for example, adding/removing a price book or hierarchy). When determining whether delta data needs to be refreshed, ignore this attribute and always use the \`is_full_delta\` attribute. +`, + type: "boolean", + example: false, + default: false, + "x-go-name": "IsFullPublish", + }, + is_full_delta: { + description: `Indicates whether the release delta file contains the full content of a catalog release. Using a search service as an example, if the \`is_full_delta\` attribute is \`true\`, you should remove all data about that catalog release from the search service before injecting fresh data from the delta file. If the \`is_full_delta\` attribute is \`false\`, then data from the previous catalog release overlays the existing data in the delta file. The \`is_full_delta\` attribute is always \`true\` the first time a catalog is published. +`, + type: "boolean", + example: false, + default: false, + "x-go-name": "IsFullDelta", + }, + total_products: { + description: + "The total number of products displayed in a catalog release.", + type: "integer", + format: "int64", + "x-go-name": "TotalProducts", + nullable: true, + }, + total_nodes: { + description: + "The total number of hierarchy nodes displayed in a catalog release.", + type: "integer", + format: "int64", + "x-go-name": "TotalNodes", + nullable: true, + }, + percent_completed: { + description: + "An integer that represents the progress of a catalog publish. The attribute starts at `0` and reaches `100` when publishing is complete.", + type: "integer", + format: "int32", + "x-go-name": "PercentCompleted", + nullable: true, + }, + owner: { + description: + "The owner of the resource, can be either `organization` or `store`.", + type: "string", + enum: ["store", "organization"], + "x-go-name": "Owner", + nullable: true, + }, + }, + "x-go-name": "ReleaseMeta", + "x-omitempty": true, +} as const + +export const $release_relationships = { + type: "object", + title: "ReleaseRelationships", + description: + "Relationships are established between different catalog entities. For example, products, hierarchies, price books, and catalog rules are related to a catalog, as they are associated with it.", + properties: { + delta: { + description: + "A URL to a delta document that describes the changes between catalog releases.", + type: "object", + properties: { + links: { + $ref: "#/components/schemas/related-link", + }, + }, + }, + products: { + description: "A URL to all products included in a catalog release.", + type: "object", + properties: { + links: { + $ref: "#/components/schemas/related-link", + }, + }, + }, + hierarchies: { + description: "A URL to all hierarchies included in a catalog release.", + type: "object", + properties: { + links: { + $ref: "#/components/schemas/related-link", + }, + }, + required: ["links"], + }, + }, + "x-go-name": "ReleaseRelationships", +} as const + +export const $rule = { + type: "object", + title: "Catalog Rule", + description: + "A catalog rule specifies which catalog to use for a given shopper context.", + properties: { + id: { + type: "string", + description: + "The catalog rule ID. Use this to get, modify, or delete the catalog rule.", + example: "8dbb35b2-ef04-477e-974d-e5f3abe6faae", + }, + attributes: { + type: "object", + properties: { + name: { + description: + "The name of a catalog rule. The name must not contain any spaces.", + type: "string", + example: "rule-123", + }, + description: { + description: "A brief description of the purpose of a catalog rule.", + type: "string", + example: "Catalog Rule for most favored customers", + default: "", + "x-omitempty": true, + }, + account_ids: { + description: + "The list of accounts who are eligible to see this catalog. If this field is empty, the rule matches all accounts.", + type: "array", + items: { + type: "string", + }, + "x-omitempty": true, + }, + customer_ids: { + description: + "The list of customers who are eligible to see this catalog. If empty, the rule matches all customers.", + type: "array", + items: { + type: "string", + }, + "x-omitempty": true, + }, + channels: { + description: + "The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests.", + type: "array", + items: { + type: "string", + }, + "x-omitempty": true, + }, + tags: { + description: + "A list of user-defined tags that can be used to further restrict the eligibility criteria for this rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header.", + type: "array", + items: { + type: "string", + }, + "x-omitempty": true, + }, + schedules: { + description: `Specifies a time period when a catalog is displayed, such as on a specific date or during summer. Requests populate the rule tag using the \`EP-Context-Tag\` header. + +The schedules attribute must include the following. + +- \`valid_from\` matches the date and time that the catalog is displayed from. +- \`valid_to\` matches the date and time the catalog is displayed to. + +Commerce runs on UTC time. + +You can offset the timezone by adding the offset to the end of the date and time. For example, a catalog which contains a sale hierarchy that should appear for a set timeframe may be scheduled to publish on a given date and time within a given timezone. For instance, a sale that should begin on 1st of June 2022 05:00 ET and end on the 15th of June 2022 at 23:50 PT would have a valid schedule of \`"valid_from": "2022-06-01T05:00:00.000-05:00"\`, \`"valid_to": "2022-06-15T11:59:99.000-08:00"\`. +`, + type: "array", + items: { + $ref: "#/components/schemas/rule-schedule", + }, + "x-omitempty": true, + }, + catalog_id: { + type: "string", + description: "The unique identifier of a catalog.", + example: "d09b4e16-08a5-4f42-817c-6e0d98acbb63", + }, + created_at: { + description: "The date and time a catalog rule was created.", + type: "string", + example: "2020-09-22T09:00:00", + format: "date-time", + }, + updated_at: { + description: "The date and time a catalog release is updated.", + type: "string", + example: "2020-09-22T09:00:00", + format: "date-time", + }, + }, + required: ["name", "catalog_id", "created_at", "updated_at"], + }, + type: { + description: + "This represents the type of object being returned. Always `catalog_rule`.", + type: "string", + example: "catalog_rule", + enum: ["catalog_rule"], + }, + }, + required: ["id", "type", "attributes"], +} as const + +export const $rule_create_data = { + type: "object", + title: "CatalogRuleCreateData", + description: + "A catalog rule specifies which catalog to use for a given shopper context.", + properties: { + data: { + type: "object", + properties: { + attributes: { + type: "object", + properties: { + name: { + description: + "The name of a catalog rule. The name must not contain spaces.", + type: "string", + minLength: 1, + example: "rule-123", + }, + description: { + description: + "A brief description of the purpose of a catalog rule.", + type: "string", + example: "Catalog Rule for most favored customers", + default: "", + nullable: true, + }, + account_ids: { + description: + "The list of accounts who are eligible to see this catalog. If this field is empty, the rule matches all accounts.", + type: "array", + items: { + type: "string", + }, + nullable: true, + }, + customer_ids: { + description: + "The list of customers who are eligible to see this catalog. If empty, the rule matches all customers.", + type: "array", + items: { + type: "string", + }, + nullable: true, + }, + channels: { + description: + "The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests.", + type: "array", + items: { + type: "string", + }, + nullable: true, + }, + tags: { + description: + "A list of user-defined tags that can be used to further restrict the eligibility criteria for this rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header.", + type: "array", + items: { + type: "string", + }, + nullable: true, + }, + schedules: { + description: `Specifies a time period when a catalog is displayed, such as on a specific date or during summer. Requests populate the rule tag using the \`EP-Context-Tag\` header. + +The schedules attribute must include the following. + +- \`valid_from\` matches the date and time that the catalog is displayed from. +- \`valid_to\` matches the date and time the catalog is displayed to. + +Commerce runs on UTC time. + +You can offset the timezone by adding the offset to the end of the date and time. For example, a catalog which contains a sale hierarchy that should appear for a set timeframe may be scheduled to publish on a given date and time within a given timezone. For instance, a sale that should begin on 1st of June 2022 05:00 ET and end on the 15th of June 2022 at 23:50 PT would have a valid schedule of \`"valid_from": "2022-06-01T05:00:00.000-05:00"\`, \`"valid_to": "2022-06-15T11:59:99.000-08:00"\`. +`, + type: "array", + items: { + $ref: "#/components/schemas/rule-schedule", + }, + nullable: true, + }, + catalog_id: { + type: "string", + description: "The unique identifier of a catalog.", + example: "d09b4e16-08a5-4f42-817c-6e0d98acbb63", + }, + }, + required: ["name", "catalog_id"], + }, + type: { + description: + "This represents the type of object being returned. Always `catalog_rule`.", + type: "string", + example: "catalog_rule", + enum: ["catalog_rule"], + }, + }, + required: ["type", "attributes"], + }, + }, + required: ["data"], +} as const + +export const $rule_data = { + type: "object", + title: "CatalogRuleData", + description: "Container for a single catalog rule.", + properties: { + data: { + $ref: "#/components/schemas/rule", + }, + links: { + $ref: "#/components/schemas/links", + }, + }, + required: ["data"], +} as const + +export const $rule_list_data = { + type: "object", + title: "CatalogRuleListData", + description: "Container for a list of catalog rules.", + properties: { + meta: { + $ref: "#/components/schemas/page-meta", + }, + data: { + type: "array", + items: { + $ref: "#/components/schemas/rule", + }, + }, + links: { + $ref: "#/components/schemas/links", + }, + }, + required: ["data"], +} as const + +export const $rule_schedule = { + type: "object", + title: "Catalog Schedule", + description: "A period of time during which a catalog is valid", + properties: { + valid_from: { + description: + "Matches the date and time that the catalog is displayed from.", + type: "string", + example: "2020-09-22T09:00:00", + format: "date-time", + "x-go-name": "ValidFrom", + nullable: true, + }, + valid_to: { + description: "Matches the date and time the catalog is displayed to.", + type: "string", + example: "2020-09-22T09:00:00", + format: "date-time", + "x-go-name": "ValidTo", + nullable: true, + }, + }, + "x-go-name": "RuleSchedule", +} as const + +export const $rule_update_data = { + type: "object", + title: "CatalogRuleUpdateData", + description: + "A catalog rule specifies which catalog to use for a given shopper context.", + properties: { + data: { + type: "object", + properties: { + id: { + type: "string", + description: + "The catalog rule ID. Use this to get, modify, or delete the catalog rule.", + example: "8dbb35b2-ef04-477e-974d-e5f3abe6faae", + }, + attributes: { + type: "object", + properties: { + name: { + description: + "The name of a catalog rule. The name must not contain spaces.", + type: "string", + minLength: 1, + example: "rule-123", + nullable: true, + }, + description: { + description: "A description of the purpose of a catalog rule.", + type: "string", + example: "Catalog Rule for most favored customers", + default: "", + nullable: true, + }, + account_ids: { + description: + "Specifies the list of accounts who are eligible to see this catalog. If this field is empty, the rule matches all accounts.", + type: "array", + items: { + type: "string", + }, + nullable: true, + }, + customer_ids: { + description: + "The list of customers who are eligible to see this catalog. If empty, the rule matches all customers.", + type: "array", + items: { + type: "string", + }, + nullable: true, + }, + channels: { + description: + "The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests.", + type: "array", + items: { + type: "string", + }, + nullable: true, + }, + schedules: { + description: `Specifies a time period when a catalog is displayed, such as on a specific date or during summer. Requests populate the rule tag using the \`EP-Context-Tag\` header. + +The schedules attribute must include the following. + +- \`valid_from\` matches the date and time that the catalog is displayed from. +- \`valid_to\` matches the date and time the catalog is displayed to. + +Commerce runs on UTC time. + +You can offset the timezone by adding the offset to the end of the date and time. For example, a catalog which contains a sale hierarchy that should appear for a set timeframe may be scheduled to publish on a given date and time within a given timezone. For instance, a sale that should begin on 1st of June 2022 05:00 ET and end on the 15th of June 2022 at 23:50 PT would have a valid schedule of \`"valid_from": "2022-06-01T05:00:00.000-05:00"\`, \`"valid_to": "2022-06-15T11:59:99.000-08:00"\`. +`, + type: "array", + items: { + $ref: "#/components/schemas/rule-schedule", + }, + nullable: true, + }, + tags: { + description: + "A list of user-defined tags that can be used to further restrict the eligibility criteria for this rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header.", + type: "array", + items: { + type: "string", + }, + nullable: true, + }, + catalog_id: { + type: "string", + description: "The unique identifier of a catalog rule.", + example: "d09b4e16-08a5-4f42-817c-6e0d98acbb63", + nullable: true, + }, + }, + }, + type: { + description: + "This represents the type of object being returned. Always `catalog_rule`.", + type: "string", + example: "catalog_rule", + enum: ["catalog_rule"], + }, + }, + required: ["id", "type"], + }, + }, + required: ["data"], +} as const + +export const $sale = { + type: "object", + description: "A set of sale prices and a validity period.", + properties: { + schedule: { + $ref: "#/components/schemas/schedule", + }, + currencies: { + $ref: "#/components/schemas/tiered-currencies", + }, + }, +} as const + +export const $sales = { + type: "object", + title: "Sales", + description: "A set of sale specifications", + additionalProperties: { + $ref: "#/components/schemas/sale", + }, +} as const + +export const $schedule = { + type: "object", + description: "A definition of the times at which a sale is valid", + properties: { + valid_from: { + type: "string", + example: "2020-09-22T09:00:00", + format: "date-time", + "x-go-name": "ValidFrom", + nullable: true, + }, + valid_to: { + type: "string", + example: "2020-09-22T09:00:00", + format: "date-time", + "x-go-name": "ValidTo", + nullable: true, + }, + }, + "x-go-name": "Schedule", +} as const + +export const $tier = { + type: "object", + title: "Tier", + description: "The name of the tier, for example, `Pencils`.", + properties: { + minimum_quantity: { + description: + "The minimum quantity of 1 or more defined for the specified price. If a minimum quantity is not specified, an error is returned.", + type: "integer", + example: "5", + }, + price: { + $ref: "#/components/schemas/currencies", + }, + }, +} as const + +export const $tiered_amount = { + type: "object", + title: "TieredAmount", + description: + "The three-letter ISO code for the currency associated with this price.", + properties: { + amount: { + description: + "The price in the lowest denomination for the specified currency. This is a product's list price.", + type: "integer", + example: 100, + format: "int64", + "x-omitempty": false, + "x-go-name": "Amount", + }, + includes_tax: { + description: "Whether this price includes tax.", + type: "boolean", + example: false, + default: false, + "x-go-name": "IncludesTax", + }, + tiers: { + description: + "The price tier that an item is eligible for based on the quantity purchased. You cannot have conflicting tiers within the same currencies block.", + type: "object", + additionalProperties: { + description: "The name of the tier, for example, `Pencils`.", + type: "object", + properties: { + minimum_quantity: { + description: + "The minimum quantity of 1 or more defined for the specified price. If a minimum quantity is not specified, an error is returned.", + type: "integer", + example: 5, + "x-go-name": "MinimumQuantity", + }, + amount: { + description: "The price for each quantity.", + type: "integer", + example: 100, + format: "int64", + "x-omitempty": false, + "x-go-name": "Amount", + }, + }, + "x-go-name": "TierAmount", + }, + "x-go-name": "Tiers", + }, + }, + "x-go-name": "TieredAmount", +} as const + +export const $tiered_currencies = { + type: "object", + title: "TieredCurrencies", + description: "Collection of currency specific prices for a product.", + additionalProperties: { + $ref: "#/components/schemas/tiered-amount", + }, +} as const + +export const $tiers = { + type: "object", + title: "Tiers", + description: + "The price tier that an item is eligible for based on the quantity purchased. You cannot have conflicting tiers within the same currencies block.", + additionalProperties: { + $ref: "#/components/schemas/tier", + }, +} as const + +export const $catalog_release_create_data = { + type: "object", + title: "CatalogReleaseCreateData", + description: "Creates a catalog release with the following attributes.", + properties: { + data: { + type: "object", + properties: { + export_full_delta: { + type: "boolean", + description: `Set to \`true\` if you want to export all the data from a catalog release in a delta link. The \`is_full_delta\` attribute is returned from the \`get a release of a catalog\` endpoint. The \`is_full_delta\` attribute tells you if the delta file contains the full content of a catalog release. You can use the \`is_full_delta\` to determine if you need to refresh the data in your company system before publishing a catalog release with fresh data in a delta link. Using a search service as an example, if the \`is_full_delta\` attribute is true, you should remove all data about that catalog from the search service before publishing a catalog release and injecting fresh data from the delta file. If the \`is_full_delta\` attribute is false, then data from the previous catalog overlays the existing data in the delta file. The \`is_full_delta\` attribute is always \`true\` the first time a catalog is published. +`, + "x-go-name": "ExportFullDelta", + }, + include_organization_resources: { + type: "boolean", + description: + "If you are publishing a catalog in a store that contains resources from an organization, you must set this to true and you must enable the **Include Organization Resources in Catalog Publishes** checkbox in Commerce Manager. See [**Multi-Store Management Solutions**](/docs/api/pxm/catalog/publish-release).", + "x-go-name": "IncludeOrganizationResources", + nullable: true, + }, + }, + }, + }, +} as const + +export const $file = { + properties: { + id: { + type: "string", + description: "The unique identifier for this file.", + format: "uuid", + }, + type: { + description: "The type represents the object being returned.", + type: "string", + example: "file", + }, + file_name: { + description: "The name of the file.", + type: "string", + example: "file_name.jpg", + }, + mime_type: { + description: "The mime type of the file.", + type: "string", + example: "image/jpeg", + }, + file_size: { + description: "The size of the file. Required when uploading files.", + type: "integer", + example: 36000, + }, + public: { + description: + "DEPRECATED Whether the file public or not. Required when uploading files.", + type: "boolean", + example: true, + }, + meta: { + $ref: "#/components/schemas/file-meta", + }, + links: { + $ref: "#/components/schemas/links", + }, + link: { + $ref: "#/components/schemas/file-link", + }, + }, +} as const + +export const $file_meta = { + properties: { + timestamps: { + type: "object", + description: "The date and time the file was created.", + properties: { + created_at: { + description: "The date and time the file was created.", + type: "string", + example: "2023-10-11T13:02:25.293Z", + }, + }, + }, + dimensions: { + description: "The file dimensions.", + type: "object", + properties: { + width: { + description: "The width of the file.", + type: "integer", + example: 1800, + }, + height: { + description: "The height of the file.", + type: "integer", + example: 1000, + }, + }, + }, + }, +} as const + +export const $file_link = { + type: "object", + description: "The publicly available URL for this file.", + properties: { + href: { + description: "The publicly available URL for this file.", + type: "string", + example: + "https://files-eu.epusercontent.com/e8c53cb0-120d-4ea5-8941-ce74dec06038/f8cf26b3-6d38-4275-937a-624a83994702.png", + }, + }, +} as const diff --git a/packages/sdks/shopper/src/client/services.gen.ts b/packages/sdks/shopper/src/client/services.gen.ts new file mode 100644 index 00000000..d3eba25f --- /dev/null +++ b/packages/sdks/shopper/src/client/services.gen.ts @@ -0,0 +1,1648 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import { client, type Options } from "@hey-api/client-fetch" +import { + type CreateCatalogData, + type CreateCatalogError, + type CreateCatalogResponse, + type GetCatalogsError, + type GetCatalogsResponse, + type GetCatalogByIdData, + type GetCatalogByIdError, + type GetCatalogByIdResponse, + type UpdateCatalogData, + type UpdateCatalogError, + type UpdateCatalogResponse, + type DeleteCatalogByIdData, + type DeleteCatalogByIdError, + type DeleteCatalogByIdResponse, + type PublishReleaseData, + type PublishReleaseError, + type PublishReleaseResponse, + type GetReleasesData, + type GetReleasesError, + type GetReleasesResponse, + type DeleteReleasesData, + type DeleteReleasesError, + type DeleteReleasesResponse, + type GetReleaseByIdData, + type GetReleaseByIdError, + type GetReleaseByIdResponse, + type DeleteReleaseByIdData, + type DeleteReleaseByIdError, + type DeleteReleaseByIdResponse, + type CreateRuleData, + type CreateRuleError, + type CreateRuleResponse, + type GetRulesData, + type GetRulesError, + type GetRulesResponse, + type GetRuleByIdData, + type GetRuleByIdError, + type GetRuleByIdResponse, + type UpdateRuleData, + type UpdateRuleError, + type UpdateRuleResponse, + type DeleteRuleByIdData, + type DeleteRuleByIdError, + type DeleteRuleByIdResponse, + type GetAllHierarchiesData, + type GetAllHierarchiesError, + type GetAllHierarchiesResponse, + type GetHierarchyData, + type GetHierarchyError, + type GetHierarchyResponse, + type GetHierarchyNodesData, + type GetHierarchyNodesError, + type GetHierarchyNodesResponse, + type GetHierarchyChildNodesData, + type GetHierarchyChildNodesError, + type GetHierarchyChildNodesResponse, + type GetAllNodesData, + type GetAllNodesError, + type GetAllNodesResponse, + type GetNodeData, + type GetNodeError, + type GetNodeResponse, + type GetChildNodesData, + type GetChildNodesError, + type GetChildNodesResponse, + type GetAllProductsData, + type GetAllProductsError, + type GetAllProductsResponse, + type GetProductData, + type GetProductError, + type GetProductResponse, + type GetComponentProductIdsData, + type GetComponentProductIdsError, + type GetComponentProductIdsResponse, + type GetChildProductsData, + type GetChildProductsError, + type GetChildProductsResponse, + type GetProductsForHierarchyData, + type GetProductsForHierarchyError, + type GetProductsForHierarchyResponse, + type GetProductsForNodeData, + type GetProductsForNodeError, + type GetProductsForNodeResponse, + type GetByContextReleaseData, + type GetByContextReleaseError, + type GetByContextReleaseResponse, + type GetByContextAllHierarchiesData, + type GetByContextAllHierarchiesError, + type GetByContextAllHierarchiesResponse, + type GetByContextHierarchyData, + type GetByContextHierarchyError, + type GetByContextHierarchyResponse, + type GetByContextHierarchyNodesData, + type GetByContextHierarchyNodesError, + type GetByContextHierarchyNodesResponse, + type GetByContextHierarchyChildNodesData, + type GetByContextHierarchyChildNodesError, + type GetByContextHierarchyChildNodesResponse, + type GetByContextAllNodesData, + type GetByContextAllNodesError, + type GetByContextAllNodesResponse, + type GetByContextNodeData, + type GetByContextNodeError, + type GetByContextNodeResponse, + type GetByContextChildNodesData, + type GetByContextChildNodesError, + type GetByContextChildNodesResponse, + type GetByContextAllProductsData, + type GetByContextAllProductsError, + type GetByContextAllProductsResponse, + type GetByContextProductData, + type GetByContextProductError, + type GetByContextProductResponse, + type GetByContextComponentProductIdsData, + type GetByContextComponentProductIdsError, + type GetByContextComponentProductIdsResponse, + type GetByContextChildProductsData, + type GetByContextChildProductsError, + type GetByContextChildProductsResponse, + type GetByContextProductsForHierarchyData, + type GetByContextProductsForHierarchyError, + type GetByContextProductsForHierarchyResponse, + type GetByContextProductsForNodeData, + type GetByContextProductsForNodeError, + type GetByContextProductsForNodeResponse, + type ConfigureByContextProductData, + type ConfigureByContextProductError, + type ConfigureByContextProductResponse, + CreateCatalogResponseTransformer, + GetCatalogsResponseTransformer, + GetCatalogByIdResponseTransformer, + UpdateCatalogResponseTransformer, + PublishReleaseResponseTransformer, + GetReleasesResponseTransformer, + GetReleaseByIdResponseTransformer, + CreateRuleResponseTransformer, + GetRulesResponseTransformer, + GetRuleByIdResponseTransformer, + UpdateRuleResponseTransformer, + GetAllHierarchiesResponseTransformer, + GetHierarchyResponseTransformer, + GetHierarchyNodesResponseTransformer, + GetHierarchyChildNodesResponseTransformer, + GetAllNodesResponseTransformer, + GetNodeResponseTransformer, + GetChildNodesResponseTransformer, + GetAllProductsResponseTransformer, + GetProductResponseTransformer, + GetChildProductsResponseTransformer, + GetProductsForHierarchyResponseTransformer, + GetProductsForNodeResponseTransformer, + GetByContextReleaseResponseTransformer, + GetByContextAllHierarchiesResponseTransformer, + GetByContextHierarchyResponseTransformer, + GetByContextHierarchyNodesResponseTransformer, + GetByContextHierarchyChildNodesResponseTransformer, + GetByContextAllNodesResponseTransformer, + GetByContextNodeResponseTransformer, + GetByContextChildNodesResponseTransformer, + GetByContextAllProductsResponseTransformer, + GetByContextProductResponseTransformer, + GetByContextChildProductsResponseTransformer, + GetByContextProductsForHierarchyResponseTransformer, + GetByContextProductsForNodeResponseTransformer, + ConfigureByContextProductResponseTransformer, +} from "./types.gen" + +/** + * Creates a new catalog + * Before you create a catalog, you must define the following resources: + * + * - Hierarchies - hierarchies and nodes to categorize the products. + * - Products - product information, associated assets, and links to hierarchy nodes. + * - Price Books - prices for the products associated with the hierarchies. You can create multiple price books for different scenarios, such as seasonal sales, business versus retail customer pricing, and reward programs. When creating a catalog, you can specify up to five price books. You must configure a priority for your price books. Product prices are displayed in the catalog according to the priority of the price books. Priority is a number and the price book with the highest number has the highest priority. + * + */ +export const createCatalog = (options: Options) => { + return (options?.client ?? client).post< + CreateCatalogResponse, + CreateCatalogError + >({ + ...options, + url: "/pcm/catalogs", + responseTransformer: CreateCatalogResponseTransformer, + }) +} + +/** + * Gets all authorized catalogs + * Retrieves a list of all the catalogs that you are authorized to view. Currently, published catalogs are limited to the current release and two releases prior to the current release. You can see the differences between the last 2 consecutive catalog releases using the delta link returned in the response of a [publish a catalog](/docs/api/pxm/catalog/publish-release) endpoint. + * + * You can use the `is_full_delta` attribute returned from the `get a release of a catalog` endpoint to determine if you need to refresh the data in your company system before publishing a catalog release and injecting fresh data in a delta link. The `is_full_delta` attribute tells you if this is a full publish of a catalog release. Using a search service as an example, if the `is_full_delta` attribute is `true`, you should remove all data about that catalog from the search service before publishing a catalog release and injecting fresh data from the delta file. See [Publish a catalog](/docs/api/pxm/catalog/publish-release). + * + * If the `is_full_publish` attribute returned in the response is `false`, data from the previous catalog release overlaid the existing data in the delta file. The `is_full_publish` attribute is always `true` the first time a catalog is published. + * + */ +export const getCatalogs = (options?: Options) => { + return (options?.client ?? client).get( + { + ...options, + url: "/pcm/catalogs", + responseTransformer: GetCatalogsResponseTransformer, + }, + ) +} + +/** + * Get a catalog by ID + * Retrieves the specified catalog. + */ +export const getCatalogById = (options: Options) => { + return (options?.client ?? client).get< + GetCatalogByIdResponse, + GetCatalogByIdError + >({ + ...options, + url: "/pcm/catalogs/{catalog_id}", + responseTransformer: GetCatalogByIdResponseTransformer, + }) +} + +/** + * Updates a catalog + * Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the catalog is not updated. + */ +export const updateCatalog = (options: Options) => { + return (options?.client ?? client).put< + UpdateCatalogResponse, + UpdateCatalogError + >({ + ...options, + url: "/pcm/catalogs/{catalog_id}", + responseTransformer: UpdateCatalogResponseTransformer, + }) +} + +/** + * Deletes a catalog + * Deletes an unpublished catalog. Use [**Delete a Release**](/docs/api/pxm/catalog/delete-release-by-id) and [**Delete All Releases**](/docs/api/pxm/catalog/delete-releases) to delete releases of a catalog. If the catalog is associated with any catalog rules, you must first update the catalog rules to remove the catalog. + */ +export const deleteCatalogById = (options: Options) => { + return (options?.client ?? client).delete< + DeleteCatalogByIdResponse, + DeleteCatalogByIdError + >({ + ...options, + url: "/pcm/catalogs/{catalog_id}", + }) +} + +/** + * Publishes a catalog + * + * Publishes a catalog. You must publish a catalog before you can retrieve that catalog in an organization or store. The hierarchies, live products, and prices associated with a published catalog are in read-only mode. If you make a change to these resources, for example, a change to your price book or hierarchies, you need to republish the catalog. + * + * You can get [a catalog release](/docs/api/pxm/catalog/get-release-by-id) to retrieve a published catalog. Currently, published catalogs are limited to the current release and two releases prior to the current release. + * + * You can see the differences between the last 2 consecutive catalog releases. This is useful if want to understand how your products have changed in your catalog, ensuring your site search integration is kept up-to-date. + * + * Once a catalog release has completed publishing, the delta relationship links to the delta document. + * + * The `delta` links are signed and only valid for 1 hour. Re-reading a catalog release, for example, using [Getting a release of a catalog](/docs/pxm/catalogs/catalog-latest-release/get-a-release-of-a-catalog) returns a fresh a link. + * + * You can use the `is_full_delta` attribute returned from the `get a release of a catalog` endpoint to determine if you need to refresh the data in your company system before injecting fresh data in a `delta` link. The `is_full_delta` attribute tells you if this is a full publish of the catalog. Using a search service as an example, if the `is_full_delta` attribute is `true`, you should remove all data about that catalog from the search service before injecting fresh data from the `delta` file. If the `is_full_delta` attribute is `false`, then data from the previous catalog overlays the existing data in the `delta` file. To publish a catalog and inject fresh data in a `delta` link, set `export_full_delta` to `true`. + * + * If a previous catalog publish date is greater than 90 days, then a full catalog publish is automatically performed. If you publish your catalogs infrequently, Commerce may perform a full publish when you are expecting a delta publish. + * + * :::caution + * + * Generating a full delta is resource intensive and slows down the publishing process and so should only be performed in certain circumstances, for example, when initializing an integration with a service like Algolia. + * + * ::: + * + * The `is_full_delta` attribute is always `true` the first time a catalog is published. The information is stored in a collection of `json` documents in a compressed file. You can either manually check the file or, for example, use them to automatically update another company system you may have. + * + * - Delta files are only available for 30 days. + * - Delta files are removed when a catalog release is deleted. + * + * Each document has a `delta_type` with one of the following values, depending on whether a product has been deleted, updated or created in a catalog release. + * + * - `delete` describes products deleted from this release of a catalog. + * - `createupdate` describes products updated in this release of a catalog. + * + * ### Multi-Store Management Solutions + * + * In a multi-store management solution. + * + * - You can create organization catalogs. Your organization catalogs are available for your stores to use. + * - Your stores can create their own catalogs. + * - Your stores can create catalogs that have a combination of organization products and store products. + * + * If you are publishing a catalog in a store that contains resources from an organization, in Commerce Manager, you must enable the **Include Organization Resources in Catalog Publishes** checkbox. + * + * 1. Go to **SYSTEM** > **Store Settings**. + * 2. Click **General Settings**. + * 3. Select **PXM** from the list. + * 4. Select the **Include Organization Resources in Catalog Publishes** checkbox. + * + */ +export const publishRelease = (options: Options) => { + return (options?.client ?? client).post< + PublishReleaseResponse, + PublishReleaseError + >({ + ...options, + url: "/pcm/catalogs/{catalog_id}/releases", + responseTransformer: PublishReleaseResponseTransformer, + }) +} + +/** + * Gets all authorized catalog releases + * Returns a list of all published releases of the specified catalog. Currently, published catalogs are limited to the current release and two releases prior to the current release. You can see the differences between the last 2 consecutive catalog releases using the `delta` link returned in the response of a `publish a catalog` endpoint. + * + * You can use the `is_full_delta` attribute returned from the `get a release of a catalog` endpoint to determine if you need to refresh the data in your company system before publishing a catalog release and injecting fresh data in a delta link. The `is_full_delta` attribute tells you if this is a full publish of a catalog release. Using a search service as an example, if the `is_full_delta` attribute is `true`, you should remove all data about that catalog from the search service before publishing a catalog release and injecting fresh data from the delta file. + * + * If the `is_full_publish` attribute returned in the response is `false`, data from the previous catalog release overlaid the existing data in the delta file. The `is_full_publish` attribute is always `true` the first time a catalog is published. + * + */ +export const getReleases = (options: Options) => { + return (options?.client ?? client).get( + { + ...options, + url: "/pcm/catalogs/{catalog_id}/releases", + responseTransformer: GetReleasesResponseTransformer, + }, + ) +} + +/** + * Deletes all releases + * Deletes all releases of the specified published catalog. + */ +export const deleteReleases = (options: Options) => { + return (options?.client ?? client).delete< + DeleteReleasesResponse, + DeleteReleasesError + >({ + ...options, + url: "/pcm/catalogs/{catalog_id}/releases", + }) +} + +/** + * Get a catalog release by ID + * Retrieves the specified catalog release. + */ +export const getReleaseById = (options: Options) => { + return (options?.client ?? client).get< + GetReleaseByIdResponse, + GetReleaseByIdError + >({ + ...options, + url: "/pcm/catalogs/{catalog_id}/releases/{release_id}", + responseTransformer: GetReleaseByIdResponseTransformer, + }) +} + +/** + * Deletes a release + * Deletes the specified published catalog release. + */ +export const deleteReleaseById = (options: Options) => { + return (options?.client ?? client).delete< + DeleteReleaseByIdResponse, + DeleteReleaseByIdError + >({ + ...options, + url: "/pcm/catalogs/{catalog_id}/releases/{release_id}", + }) +} + +/** + * Creates a new catalog rule + * If you have multiple catalogs, create catalog rule resources. With catalog rules, you can display different catalogs to different shoppers. For example, you can display a preferred pricing catalog to a few special customers. Or you can display one catalog to shoppers using your website and a different catalog to shoppers using your mobile app. Finally, you can define custom criteria by creating tags. + * + * :::note + * + * - If you have one catalog for all customers and channels, you can omit creating this resource. + * - Due to the way catalogs are cached in Commerce, using catalog rules to display catalogs sometimes causes a 5-minute time delay before the catalogs are displayed. + * - You cannot create catalog rules for organization catalogs. + * + * ::: + * + * For ideas about the kinds of business scenarios you can achieve with catalog rules, see [Catalog Rules](/docs/api/pxm/catalog/rules). To understand how catalogs are matched to shoppers by using rules, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + * + */ +export const createRule = (options: Options) => { + return (options?.client ?? client).post({ + ...options, + url: "/pcm/catalogs/rules", + responseTransformer: CreateRuleResponseTransformer, + }) +} + +/** + * Gets all authorized catalog rules + * Retrieves all authorized catalog rules. + * + * ### Filtering + * + * This endpoint supports filtering. For general filtering syntax, see [Filtering](https://elasticpath.dev/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are supported. + * + * | Operator | Description | Supported Attributes | Example | + * |:--- |:--- |:--- |:--- | + * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | + * + */ +export const getRules = (options?: Options) => { + return (options?.client ?? client).get({ + ...options, + url: "/pcm/catalogs/rules", + responseTransformer: GetRulesResponseTransformer, + }) +} + +/** + * Get a catalog rule by ID + */ +export const getRuleById = (options: Options) => { + return (options?.client ?? client).get( + { + ...options, + url: "/pcm/catalogs/rules/{catalog_rule_id}", + responseTransformer: GetRuleByIdResponseTransformer, + }, + ) +} + +/** + * Updates a catalog rule + * Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the catalog rule is not updated. + */ +export const updateRule = (options: Options) => { + return (options?.client ?? client).put({ + ...options, + url: "/pcm/catalogs/rules/{catalog_rule_id}", + responseTransformer: UpdateRuleResponseTransformer, + }) +} + +/** + * Deletes a catalog rule + */ +export const deleteRuleById = (options: Options) => { + return (options?.client ?? client).delete< + DeleteRuleByIdResponse, + DeleteRuleByIdError + >({ + ...options, + url: "/pcm/catalogs/rules/{catalog_rule_id}", + }) +} + +/** + * Get all Hierarchies + * Returns the hierarchies from a published catalog. + * + * :::note + * + * Currently, published catalogs are limited to the current release and two releases prior to the current release. + * + * ::: + * + * ### Filtering + * + * This endpoint supports filtering. For general syntax, see [Filtering](https://beta.elasticpath.dev/docs/commerce-cloud/api-overview/filtering). + * + * | Operator | Description | Supported Attributes | Example | + * |:--- |:--- |:--- |:--- | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | + * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | + * + * ### Building breadcrumbs in a storefront + * + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + * + * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + * + * - Specify the node Ids in the filter expression. + * - You can have as many node Ids as you want. + * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + * + */ +export const getAllHierarchies = (options: Options) => { + return (options?.client ?? client).get< + GetAllHierarchiesResponse, + GetAllHierarchiesError + >({ + ...options, + url: "/pcm/catalogs/{catalog_id}/releases/{release_id}/hierarchies", + responseTransformer: GetAllHierarchiesResponseTransformer, + }) +} + +/** + * Get a Hierarchy + * Returns the specified hierarchy from a published catalog. + * + * :::note + * + * Currently, published catalogs are limited to the current release and two releases prior to the current release. + * + * ::: + * + */ +export const getHierarchy = (options: Options) => { + return (options?.client ?? client).get< + GetHierarchyResponse, + GetHierarchyError + >({ + ...options, + url: "/pcm/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}", + responseTransformer: GetHierarchyResponseTransformer, + }) +} + +/** + * Get a Hierarchy's Nodes + * Returns all nodes for the specified hierarchy from a published catalog. + * + * :::note + * + * Currently, published catalogs are limited to the current release and two releases prior to the current release. + * + * ::: + * + * In the `bread_crumb` metadata, you can identify the parent nodes that a node is associated with. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + * + * ### Filtering + * + * This endpoint supports filtering. For general syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). + * + * | Operator | Description | Supported Attributes | Example | + * |:--- |:--- |:--- |:--- | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | + * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | + * + * ### Building breadcrumbs in a storefront + * + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + * + * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + * + * - Specify the node Ids in the filter expression. + * - You can have as many node Ids as you want. + * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + * + */ +export const getHierarchyNodes = (options: Options) => { + return (options?.client ?? client).get< + GetHierarchyNodesResponse, + GetHierarchyNodesError + >({ + ...options, + url: "/pcm/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/nodes", + responseTransformer: GetHierarchyNodesResponseTransformer, + }) +} + +/** + * Get a Hierarchy's Children + * Returns the parent nodes for the specified hierarchy from a published catalog. + * + * ![Parent Nodes](/assets/rootnodes.PNG) + * + * :::note + * + * Currently, published catalogs are limited to the current release and two releases prior to the current release. + * + * ::: + * + * In the `bread_crumb` metadata, you can identify the parent nodes that a node is associated with. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + * + * ### Filtering + * + * This endpoint supports filtering. For general syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). + * + * | Operator | Description | Supported Attributes | Example | + * |:--- |:--- |:--- |:--- | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | + * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | + * + * ### Building breadcrumbs in a storefront + * + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + * + * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + * + * - Specify the node Ids in the filter expression. + * - You can have as many node Ids as you want. + * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + * + */ +export const getHierarchyChildNodes = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetHierarchyChildNodesResponse, + GetHierarchyChildNodesError + >({ + ...options, + url: "/pcm/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/children", + responseTransformer: GetHierarchyChildNodesResponseTransformer, + }) +} + +/** + * Get all Nodes + * Returns the child nodes from a published catalog. + * + * :::note + * + * Currently, published catalogs are limited to the current release and two releases prior to the current release. + * + * ::: + * + * You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + * + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. See [Building breadcrumbs in a storefront](#building-breadcrumbs-in-a-storefront). + * + * The response lists the products associated with the nodes. If products are [curated](https://beta.elasticpath.dev/guides/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront. + * + * - If you don't provide any `curated_products`, products are listed by their `updated_at` time in descending order, with the most recently updated product first. + * - If you configure `curated_products` for only a few products, the curated products are displayed first and the other products are displayed in the order of `updated_at` time. + * - You can only curate 20 products or less. You cannot have more than 20 curated products. + * - If a curated product is removed from a node, the product is also removed from the `curated_products` list. + * - A product that is curated has the `"curated_product": true` attribute displayed. + * + * ### Filtering + * + * This endpoint supports filtering. For general syntax, see (/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available. + * + * | Operator | Description | Attributes | Example | + * | --- | --- | --- | --- | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug` | `filter=eq(name,some-name)` | + * | `in` | Checks if the values are included in the specified string. If they are, the condition is true. + * | `Id` | `filter=in(id,9214719b-17fe-4ea7-896c-d61e60fc0d05,e104d541-2c52-47fa-8a9a-c4382480d97c,65daaf68-ff2e-4632-8944-370de835967d)` | + * + * ### Building breadcrumbs in a storefront + * + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + * + * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + * + * - Specify the node Ids in the filter expression. + * - You can have as many node Ids as you want. + * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + * + */ +export const getAllNodes = (options: Options) => { + return (options?.client ?? client).get( + { + ...options, + url: "/pcm/catalogs/{catalog_id}/releases/{release_id}/nodes", + responseTransformer: GetAllNodesResponseTransformer, + }, + ) +} + +/** + * Get a Node + * Returns a node from a published catalog. + * + * :::note + * + * Currently, published catalogs are limited to the current release and two releases prior to the current release. + * + * ::: + * + * You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + * + * The response lists the products associated with the nodes. If products are [curated](https://beta.elasticpath.dev/guides/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront. + * + * - If you don't provide any `curated_products`, products are listed by their `updated_at` time in descending order, with the most recently updated product first. + * - If you configure `curated_products` for only a few products, the curated products are displayed first and the other products are displayed in the order of `updated_at` time. + * - You can only curate 20 products or less. You cannot have more than 20 curated products. + * - If a curated product is removed from a node, the product is also removed from the `curated_products` list. + * - A product that is curated has the `"curated_product": true` attribute displayed. + * + */ +export const getNode = (options: Options) => { + return (options?.client ?? client).get({ + ...options, + url: "/pcm/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}", + responseTransformer: GetNodeResponseTransformer, + }) +} + +/** + * Get a Node's Children + * Returns the child nodes for a node from a published catalog. + * + * :::note + * + * Currently, published catalogs are limited to the current release and two releases prior to the current release. + * + * ::: + * + * You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + * + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. For more information, see [Building breadcrumbs in a storefront](#building-breadcrumbs-in-a-storefront). + * + * The response lists the products associated with the nodes. If products are [curated](https://beta.elasticpath.dev/guides/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront. + * + * - If you don't provide any `curated_products`, products are listed by their `updated_at` time in descending order, with the most recently updated product first. + * - If you configure `curated_products` for only a few products, the curated products are displayed first and the other products are displayed in the order of `updated_at` time. + * - You can only curate 20 products or less. You cannot have more than 20 curated products. + * - If a curated product is removed from a node, the product is also removed from the `curated_products` list. + * - A product that is curated has the `"curated_product": true` attribute displayed. + * + * ### Filtering + * + * This endpoint supports filtering. For general syntax, see (/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available. + * + * | Operator | Description | Attributes | Example | + * | --- | --- | --- | --- | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug` | `filter=eq(name,some-name)` | + * | `in` | Checks if the values are included in the specified string. If they are, the condition is true. + * | `Id` | `filter=in(id,9214719b-17fe-4ea7-896c-d61e60fc0d05,e104d541-2c52-47fa-8a9a-c4382480d97c,65daaf68-ff2e-4632-8944-370de835967d)` | + * + * ### Building breadcrumbs in a storefront + * + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + * + * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + * + * - Specify the node Ids in the filter expression. + * - You can have as many node Ids as you want. + * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + * + */ +export const getChildNodes = (options: Options) => { + return (options?.client ?? client).get< + GetChildNodesResponse, + GetChildNodesError + >({ + ...options, + url: "/pcm/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/children", + responseTransformer: GetChildNodesResponseTransformer, + }) +} + +/** + * Get all Products + * Returns the products from a published catalog. Only the products in a `live` status are retrieved. Currently, published catalogs are limited to the current release and two releases prior to the current release. + * + * You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + * + * The `variations` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. The `variations` object can then be added to your catalogs. By default, variations and variation options are sorted randomly. You can use the `sort_order` attribute to sort the order of your variation and variation options in `variations`. Once a parent product is published in a catalog, the [Get a List of products in a catalog release](/docs/api/pxm/catalog/get-all-products) response displays the sorted variations and variation options. Variations and variation options are displayed in descending order according to their `sort_order` values. + * + * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + * + * | Parameter | Required | Description | + * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + * | `main_image` | Optional | The main images associated with a product. | + * | `files` | Optional | Any files associated with a product. + * + * See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + * + * ### Filtering + * + * This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. + * + * | Operator | Description | Supported Attributes | Example | + * |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types`, you can only specify one product type. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | + * + * ### Building breadcrumbs in a storefront + * + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + * + * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + * + * - Specify the node Ids in the filter expression. + * - You can have as many node Ids as you want. + * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + * + * ### Including Resources + * + * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + * + * | Parameter | Required | Description | + * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + * | `main_image` | Optional | The main images associated with a product. | + * | `files` | Optional | Any files associated with a product. | + * + * See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + * + */ +export const getAllProducts = (options: Options) => { + return (options?.client ?? client).get< + GetAllProductsResponse, + GetAllProductsError + >({ + ...options, + url: "/pcm/catalogs/{catalog_id}/releases/{release_id}/products", + responseTransformer: GetAllProductsResponseTransformer, + }) +} + +/** + * Get a Product + * Returns a product from a published catalog. The product must be in `live` status. Currently, published catalogs are limited to the current release and two releases prior to the current release. + * + * ### Product and Node Associations in Breadcrumb Metadata + * + * You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + * + * ### Product Variations + * + * The `variations` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. The `variations` object can then be added to your catalogs. By default, variations and variation options are sorted randomly. You can use the `sort_order`attribute to sort the order of your variation and variation options in `variations`. Once a parent product is published in a catalog, the get a product in a catalog release response displays the sorted variations and variation options. Variations and variation options are displayed in descending order according to their `sort_order` values. + * + * ### Including Resources + * + * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + * + * | Parameter | Required | Description | + * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + * | `main_image` | Optional | The main images associated with a product. | + * | `files` | Optional | Any files associated with a product. + * + * See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + * + */ +export const getProduct = (options: Options) => { + return (options?.client ?? client).get({ + ...options, + url: "/pcm/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}", + responseTransformer: GetProductResponseTransformer, + }) +} + +/** + * Get a Bundle's Component Products + * With Product Experience Manager, you can [create](/docs/api/pxm/products/create-product) and manage bundles. A bundle is a purchasable product, comprising of one or more products that you want to sell together. + * + * You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. + * + * This endpoint returns a list of component product IDs for the specified bundle. + * + * ### Including Resources + * + * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + * + * | Parameter | Required | Description | + * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + * | `main_image` | Optional | The main images associated with a product. | + * | `files` | Optional | Any files associated with a product. | + * + * See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + * + */ +export const getComponentProductIds = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetComponentProductIdsResponse, + GetComponentProductIdsError + >({ + ...options, + url: "/pcm/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/component_products", + }) +} + +/** + * Get a Parent Product's Child Products + * For a specified product and catalog release, retrieves a list of child products from a parent product. Any product other than a base product results in a `422 Unprocessable Entity` response. Only the products in a `live` status are retrieved. + * + * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. If no catalog rules are configured, the first catalog found is returned. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + * + * You can see the parent nodes a product is associated within the breadcrumbs metadata for each product. For example, this is useful if you want to improve how your shoppers search your store. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + * + * ### Filtering + * + * This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. + * + * | Operator | Description | Supported Attributes | Example | + * |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types`, you can only specify one product type. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | + * + * ### Building breadcrumbs in a storefront + * + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + * + * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + * + * - Specify the node Ids in the filter expression. + * - You can have as many node Ids as you want. + * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + * + * ### Including Resources + * + * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + * + * | Parameter | Required | Description | + * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + * | `main_image` | Optional | The main images associated with a product. | + * | `files` | Optional | Any files associated with a product. | + * + * See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + * + */ +export const getChildProducts = (options: Options) => { + return (options?.client ?? client).get< + GetChildProductsResponse, + GetChildProductsError + >({ + ...options, + url: "/pcm/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/children", + responseTransformer: GetChildProductsResponseTransformer, + }) +} + +/** + * Get a Hierarchy's Products + * Returns the products associated with the specified hierarchy in the catalog. The products must be in the `live` status. + * + * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. See [Resolving catalog rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + * + * You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + * + * The `variations` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. The variations object can then be added to your catalogs. By default, variations and variation options are sorted randomly. You can use the `sort_order` attribute to sort the order of your variation and variation options in variations. Once a parent product is published in a catalog, the [Get a List of products in a catalog](/docs/api/pxm/catalog/get-all-products) release response displays the sorted variations and variation options. Variations and variation options are displayed in descending order according to their `sort_order` values. + * + * ### Filtering + * + * This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. + * + * | Operator | Description | Supported Attributes | Example | + * |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types`, you can only specify one product type. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | + * + * ### Building breadcrumbs in a storefront + * + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + * + * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + * + * - Specify the node Ids in the filter expression. + * - You can have as many node Ids as you want. + * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + * + * ### Including Resources + * + * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + * + * | Parameter | Required | Description | + * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + * | `main_image` | Optional | The main images associated with a product. | + * | `files` | Optional | Any files associated with a product. | + * + * See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + * + */ +export const getProductsForHierarchy = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetProductsForHierarchyResponse, + GetProductsForHierarchyError + >({ + ...options, + url: "/pcm/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/products", + responseTransformer: GetProductsForHierarchyResponseTransformer, + }) +} + +/** + * Get a Node's Products + * Returns the products associated with the specified hierarchy node in the catalog. The products must be in the `live` status. If the products have been curated, then the products are returned in the order specified in the `curated_products` attribute. A product that is curated has the `"curated_product": true` attribute displayed. + * + * :::note + * + * Currently, published catalogs are limited to the current release and two releases prior to the current release. + * + * ::: + * + * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. See [Resolving catalog rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + * + * You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://elasticpath.dev/guides/Catalogs/breadcrumbs). + * + * The `variations` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. The `variations` object can then be added to your catalogs. By default, variations and variation options are sorted randomly. You can use the `sort_order` attribute to sort the order of your variation and variation options in `variations`. Once a parent product is published in a catalog, the [Get a List of products in a catalog release](/docs/api/pxm/catalog/get-all-products) response displays the sorted variations and variation options. Variations and variation options are displayed in descending order according to their `sort_order` values. + * + * ### Filtering + * + * This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. + * + * | Operator | Description | Supported Attributes | Example | + * |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | + * + * ### Building breadcrumbs in a storefront + * + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + * + * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + * + * - Specify the node Ids in the filter expression. + * - You can have as many node Ids as you want. + * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + * + * ### Including Resources + * + * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + * + * | Parameter | Required | Description | + * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + * | `main_image` | Optional | The main images associated with a product. | + * | `files` | Optional | Any files associated with a product. | + * + * See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + * + */ +export const getProductsForNode = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetProductsForNodeResponse, + GetProductsForNodeError + >({ + ...options, + url: "/pcm/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/products", + responseTransformer: GetProductsForNodeResponseTransformer, + }) +} + +/** + * Get the catalog release as shoppers + * Returns a list of all published releases of the specified catalog. + */ +export const getByContextRelease = ( + options?: Options, +) => { + return (options?.client ?? client).get< + GetByContextReleaseResponse, + GetByContextReleaseError + >({ + ...options, + url: "/catalog", + responseTransformer: GetByContextReleaseResponseTransformer, + }) +} + +/** + * Get all Hierarchies + * Returns all hierarchies from a catalog. + * + * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + * + * ### Filtering + * + * This endpoint supports filtering. For general syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). + * + * | Operator | Description | Supported Attributes | Example | + * |:--- |:--- |:--- |:--- | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | + * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | + * + * ### Building breadcrumbs in a storefront + * + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + * + * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + * + * - Specify the node Ids in the filter expression. + * - You can have as many node Ids as you want. + * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + * + */ +export const getByContextAllHierarchies = ( + options?: Options, +) => { + return (options?.client ?? client).get< + GetByContextAllHierarchiesResponse, + GetByContextAllHierarchiesError + >({ + ...options, + url: "/catalog/hierarchies", + responseTransformer: GetByContextAllHierarchiesResponseTransformer, + }) +} + +/** + * Get a Hierarchy + * Returns a hierarchy from the catalog. + * + * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog to retrieve. For information about how catalog rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules). + * + */ +export const getByContextHierarchy = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetByContextHierarchyResponse, + GetByContextHierarchyError + >({ + ...options, + url: "/catalog/hierarchies/{hierarchy_id}", + responseTransformer: GetByContextHierarchyResponseTransformer, + }) +} + +/** + * Get a Hierarchy's Nodes + * Returns all the nodes for the specified hierarchy. + * + * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + * + * In the `bread_crumb` metadata, you can identify the parent nodes that a node is associated with. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + * + * ### Filtering + * + * This endpoint supports filtering. For general syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). + * + * | Operator | Description | Supported Attributes | Example | + * |:--- |:--- |:--- |:--- | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | + * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | + * + * ### Building breadcrumbs in a storefront + * + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + * + * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + * + * - Specify the node Ids in the filter expression. + * - You can have as many node Ids as you want. + * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + * + */ +export const getByContextHierarchyNodes = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetByContextHierarchyNodesResponse, + GetByContextHierarchyNodesError + >({ + ...options, + url: "/catalog/hierarchies/{hierarchy_id}/nodes", + responseTransformer: GetByContextHierarchyNodesResponseTransformer, + }) +} + +/** + * Get a Hierarchy's Children + * Returns the parent nodes for the specified hierarchy. + * + * ![Parent Nodes](/assets/rootnodes.PNG) + * + * If you have multiple catalog rules defined, the rule that best matches the shopperʼs context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + * + * In the `bread_crumb` metadata, you can identify the parent nodes that a node is associated with. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + * + * ### Filtering + * + * The following operators and attributes are available when filtering on this endpoint. + * + * | Operator | Description | Supported Attributes | Example | + * |:--- |:--- |:--- |:--- | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | + * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | + * + * For more information, see [Filtering](/docs/commerce-cloud/api-overview/filtering). + * + * ### Building breadcrumbs in a storefront + * + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + * + * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + * + * - Specify the node Ids in the filter expression. + * - You can have as many node Ids as you want. + * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + * + */ +export const getByContextHierarchyChildNodes = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetByContextHierarchyChildNodesResponse, + GetByContextHierarchyChildNodesError + >({ + ...options, + url: "/catalog/hierarchies/{hierarchy_id}/children", + responseTransformer: GetByContextHierarchyChildNodesResponseTransformer, + }) +} + +/** + * Get all Nodes + * Returns all nodes in the catalog. + * + * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + * + * You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + * + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. For more information, see [Building breadcrumbs in a storefront](#building-breadcrumbs-in-a-storefront). + * + * The response lists the products associated with the nodes. If products are [curated](https://beta.elasticpath.dev/guides/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront. + * + * - You can only curate 20 products or less. You cannot have more than 20 curated products. + * - If a curated product is removed from a node, the product is also removed from the `curated_products` list. + * + * ### Filtering + * + * This endpoint supports filtering. For general syntax, see (/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available. + * + * | Operator | Description | Attributes | Example | + * | --- | --- | --- | --- | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug` | `filter=eq(name,some-name)` | + * | `in` | Checks if the values are included in the specified string. If they are, the condition is true. + * | `Id` | `filter=in(id,9214719b-17fe-4ea7-896c-d61e60fc0d05,e104d541-2c52-47fa-8a9a-c4382480d97c,65daaf68-ff2e-4632-8944-370de835967d)` | + * + * ### Building breadcrumbs in a storefront + * + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + * + * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + * + * - Specify the node Ids in the filter expression. + * - You can have as many node Ids as you want. + * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + * + */ +export const getByContextAllNodes = ( + options?: Options, +) => { + return (options?.client ?? client).get< + GetByContextAllNodesResponse, + GetByContextAllNodesError + >({ + ...options, + url: "/catalog/nodes", + responseTransformer: GetByContextAllNodesResponseTransformer, + }) +} + +/** + * Get a Node + * Returns a node from the catalog. + * + * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + * + * You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + * + * The response lists the products associated with a node. If products are curated, they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your nodes, enabling you to create unique product collections in your storefront. + * + * - If you don't provide any `curated_products`, products are listed by their `updated_at` time in descending order, with the most recently updated product first. + * - If you configure `curated_products` for only a few products, the curated products are displayed first and the other products are displayed in the order of `updated_at` time. + * - You can only curate 20 products or less. You cannot have more than 20 curated products. + * - A product that is curated has the `"curated_product": true` attribute displayed. + * - If a curated product is removed from a node, the product is also removed from the `curated_products` list. + * + */ +export const getByContextNode = (options: Options) => { + return (options?.client ?? client).get< + GetByContextNodeResponse, + GetByContextNodeError + >({ + ...options, + url: "/catalog/nodes/{node_id}", + responseTransformer: GetByContextNodeResponseTransformer, + }) +} + +/** + * Get a Node's Children + * Returns the child nodes for a node in the catalog. + * + * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + * + * You can see which parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + * + * The response lists the products associated with the nodes. If products are [curated](https://beta.elasticpath.dev/guides/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront. + * + * - If you don't provide any curated_products, products are listed by their updated_at time in descending order, with the most recently updated product first. + * - If you configure curated_products for only a few products, the curated products are displayed first and the other products are displayed in the order of updated_at time. + * - You can only curate 20 products or less. You cannot have more than 20 curated products. + * - A product that is curated has the "curated_product": true attribute displayed. + * - If a curated product is removed from a node, the product is also removed from the curated_products list. + * + * ### Filtering + * + * This endpoint supports filtering. For general syntax, see (/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available. + * + * | Operator | Description | Attributes | Example | + * | --- | --- | --- | --- | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug` | `filter=eq(name,some-name)` | + * | `in` | Checks if the values are included in the specified string. If they are, the condition is true. + * | `Id` | `filter=in(id,9214719b-17fe-4ea7-896c-d61e60fc0d05,e104d541-2c52-47fa-8a9a-c4382480d97c,65daaf68-ff2e-4632-8944-370de835967d)` | + * + * ### Building breadcrumbs in a storefront + * + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + * + * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + * + * - Specify the node Ids in the filter expression. + * - You can have as many node Ids as you want. + * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + * + */ +export const getByContextChildNodes = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetByContextChildNodesResponse, + GetByContextChildNodesError + >({ + ...options, + url: "/catalog/nodes/{node_id}/relationships/children", + responseTransformer: GetByContextChildNodesResponseTransformer, + }) +} + +/** + * Get all Products + * Retrieves the list of products from the catalog. Only the products in a live status are retrieved. + * + * ### Catalog Rules + * + * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. If no catalog rules are configured, the first catalog found is returned. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + * + * ### Product and Node Associations + * + * You can see the parent nodes a product is associated within the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. For example, this is useful if you want to improve how your shoppers search your store. See [Product and Node Associations in Breadcrumb Metadata](https://elasticpath.dev/guides/Catalogs/breadcrumbs). + * + * + * ### Including Resources + * + * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + * + * | Parameter | Required | Description | + * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + * | `main_image` | Optional | The main images associated with a product. | + * | `files` | Optional | Any files associated with a product. | + * + * See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + * + * ### Filtering + * + * This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. + * + * | Operator | Description | Supported Attributes | Example | + * |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | + * + * ### Building breadcrumbs in a storefront + * + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + * + * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + * + * - Specify the node Ids in the filter expression. + * - You can have as many node Ids as you want. + * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + * + * ### Including Resources + * + * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + * + * | Parameter | Required | Description | + * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + * | `main_image` | Optional | The main images associated with a product. | + * | `files` | Optional | Any files associated with a product. | + * + * See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + * + */ +export const getByContextAllProducts = ( + options?: Options, +) => { + return (options?.client ?? client).get< + GetByContextAllProductsResponse, + GetByContextAllProductsError + >({ + ...options, + url: "/catalog/products", + responseTransformer: GetByContextAllProductsResponseTransformer, + }) +} + +/** + * Get a Product + * Returns the specified product from the catalog. The product must be in the `live` status. + * + * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + * + * You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://elasticpath.dev/guides/Catalogs/breadcrumbs). + * + * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + * + * | Parameter | Required | Description | + * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + * | `main_image` | Optional | The main images associated with a product. | + * | `files` | Optional | Any files associated with a product. | + * + * See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + * + */ +export const getByContextProduct = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetByContextProductResponse, + GetByContextProductError + >({ + ...options, + url: "/catalog/products/{product_id}", + responseTransformer: GetByContextProductResponseTransformer, + }) +} + +/** + * Get a Bundle's Component Products + * With Product Experience Manager, you can [create](/docs/api/pxm/products/create-product) and manage bundles. A bundle is a purchasable product, comprising of one or more products that you want to sell together. + * + * You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. + * + * This endpoint returns a list of component product IDs for the specified bundle. + * + */ +export const getByContextComponentProductIds = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetByContextComponentProductIdsResponse, + GetByContextComponentProductIdsError + >({ + ...options, + url: "/catalog/products/{product_id}/relationships/component_products", + }) +} + +/** + * Get a Parent Product's Child Products + * For a specified product and catalog release, retrieves a list of child products from a parent product. Any product other than a base product results in a `422 Unprocessable Entity` response. Only the products in a `live` status are retrieved. + * + * If you have multiple catalog rules defined, the rule that best matches the shopperʼs context is used to determine which catalog is retrieved. If no catalog rules are configured, the first catalog found is returned. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + * + * You can see the parent nodes a product is associated within the `breadcrumbs` metadata for each product. For example, this is useful if you want to improve how your shoppers search your store. See [Product and Node Associations in Breadcrumb Metadata](https://elasticpath.dev/guides/Catalogs/breadcrumbs). + * + * ### Filtering + * + * This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. + * + * | Operator | Description | Supported Attributes | Example | + * |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | + * + * ### Building breadcrumbs in a storefront + * + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + * + * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + * + * - Specify the node Ids in the filter expression. + * - You can have as many node Ids as you want. + * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + * + * ### Including Resources + * + * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + * + * | Parameter | Required | Description | + * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + * | `main_image` | Optional | The main images associated with a product. | + * | `files` | Optional | Any files associated with a product. | + * + * See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + * + */ +export const getByContextChildProducts = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetByContextChildProductsResponse, + GetByContextChildProductsError + >({ + ...options, + url: "/catalog/products/{product_id}/relationships/children", + responseTransformer: GetByContextChildProductsResponseTransformer, + }) +} + +/** + * Get a Hierarchy's Products + * Returns the products associated with the specified hierarchy in the catalog. The products must be in the live status. + * + * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. See [Resolving catalog rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + * + * You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://elasticpath.dev/guides/Catalogs/breadcrumbs). + * + * ### Filtering + * + * This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. + * + * | Operator | Description | Supported Attributes | Example | + * |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | + * + * ### Building breadcrumbs in a storefront + * + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + * + * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + * + * - Specify the node Ids in the filter expression. + * - You can have as many node Ids as you want. + * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + * + * ### Including Resources + * + * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + * + * | Parameter | Required | Description | + * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + * | `main_image` | Optional | The main images associated with a product. | + * `files` | Optional | Any files associated with a product. | + * + * See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + * + */ +export const getByContextProductsForHierarchy = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetByContextProductsForHierarchyResponse, + GetByContextProductsForHierarchyError + >({ + ...options, + url: "/catalog/hierarchies/{hierarchy_id}/products", + responseTransformer: GetByContextProductsForHierarchyResponseTransformer, + }) +} + +/** + * Get a Node's Products + * Returns the products associated with the specified hierarchy node in the catalog. The products must be in the `live` status. If the products have been curated then the products are returned in the order specified in the `curated_products` attribute. A product that is curated has the `"curated_product": true` attribute displayed. + * + * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. See [Resolving catalog rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + * + * You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://elasticpath.dev/guides/Catalogs/breadcrumbs). + * + * ### Filtering + * + * This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. + * + * | Operator | Description | Supported Attributes | Example | + * |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | + * + * ### Building breadcrumbs in a storefront + * + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + * + * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + * + * - Specify the node Ids in the filter expression. + * - You can have as many node Ids as you want. + * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + * + * ### Including Resources + * + * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + * + * | Parameter | Required | Description | + * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + * | `main_image` | Optional | The main images associated with a product. | + * | `files` | Optional | Any files associated with a product. | + * + * See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + * + */ +export const getByContextProductsForNode = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetByContextProductsForNodeResponse, + GetByContextProductsForNodeError + >({ + ...options, + url: "/catalog/nodes/{node_id}/relationships/products", + responseTransformer: GetByContextProductsForNodeResponseTransformer, + }) +} + +/** + * Configure a Shopper Bundle + * Once you have configured your product bundles, you can display them in your storefront in your published catalog. Depending on how you have configured the minimum and maximum values for the product options in your components, you can allow your shoppers to choose which products they want to select. For example, you can enable a shopper to select 1 or more product options from a list of 10, giving your shoppers greater flexibility when selecting products in your store front. + * + * - Products must be in a `live` status. + * - If you have not specified any minimum or maximum values for the product options in your components, your shoppers can select any combination of product options. + * + * If you have configured minimum and maximum values using [Create a Bundle](/docs/api/pxm/products/create-product), this becomes part of the `bundle_configuration`. You can check how your bundle is configured using [Get a product in a catalog release](/docs/api/pxm/catalog/get-product) in `bundle_configuration` under `meta`. The `bundle_configuration` forms the body of the request. + * + * The response updates the `bundle_configuration` with the product options the shopper selects. The `meta` data is updated with the `meta` data of the selected product options. In your storefront, you could display this as a summary of the product options a shopper has selected. + * + * ### Including Resources + * + * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + * + * | Parameter | Required | Description | + * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + * | `main_image` | Optional | The main images associated with a product. | + * | `files` | Optional | Any files associated with a product. | + * + * See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + * + */ +export const configureByContextProduct = ( + options: Options, +) => { + return (options?.client ?? client).post< + ConfigureByContextProductResponse, + ConfigureByContextProductError + >({ + ...options, + url: "/catalog/products/{product_id}/configure", + responseTransformer: ConfigureByContextProductResponseTransformer, + }) +} diff --git a/packages/sdks/shopper/src/client/types.gen.ts b/packages/sdks/shopper/src/client/types.gen.ts new file mode 100644 index 00000000..227b7ddf --- /dev/null +++ b/packages/sdks/shopper/src/client/types.gen.ts @@ -0,0 +1,4541 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * The three-letter ISO code for the currency associated with this price. + */ +export type Amount = { + /** + * The price in the lowest denomination for the specified currency. This is a product's list price. + */ + amount?: number + /** + * Whether this price includes tax. + */ + includes_tax?: boolean +} + +/** + * If you want multiple price books for different scenarios, such as seasonal sales, business versus retail pricing, and reward programs, when creating a catalog, you can specify up to five price books. You must configure a priority for your price books. Product prices are displayed in the catalog according to the priority of the price books. + */ +export type PrioritizedPricebooks = Array<{ + /** + * A unique identifier of a price book. + */ + id: string + /** + * Priority is a number and the price book with the highest number has the highest priority. + */ + priority: number +}> + +/** + * Creates a catalog with the following attributes. + */ +export type Catalog = { + /** + * A unique identifier of a catalog. + */ + id: string + attributes: { + /** + * The name of a catalog. + */ + name: string + /** + * A brief description of the catalog, such as the purpose of the catalog. + */ + description?: string + /** + * The unique identifiers of the hierarchies associated with a catalog. + */ + hierarchy_ids: Array + /** + * The unique identifier of a price book associated with a catalog. If no price book is selected, the catalog is displayed without prices. + */ + pricebook_id?: string + pricebook_ids?: PrioritizedPricebooks + /** + * Product Experience Manager supports localization of products and hierarchies. If you store supports multiple languages, you can localize product names and descriptions. + */ + locales?: { + [key: string]: { + [key: string]: string + } + } + /** + * The date and time a catalog is created. + */ + created_at: Date + /** + * The date and time a catalog was updated. + */ + updated_at: Date + /** + * The owner of this resource, can be either `organization` or `store`. + */ + owner?: "store" | "organization" | null + } + /** + * Relationships are established between different catalog entities. For example, a catalog rule and a price book are related to a catalog, as both are associated with it. + */ + relationships?: { + /** + * The catalog rules related to a catalog. + */ + rules?: { + links?: RelatedLink + } + /** + * When a catalog is published, a catalog release is created. This is a URL to all catalog published releases available for this catalog. + */ + releases?: { + links?: RelatedLink + meta?: { + /** + * The number releases available for a catalog. + */ + count?: number + } + } + } + type: "catalog" +} + +/** + * The owner of this resource, can be either `organization` or `store`. + */ +export type owner = "store" | "organization" + +export type type = "catalog" + +/** + * Creates a catalog with the following attributes. + */ +export type CatalogCreateData = { + data: { + attributes: { + /** + * The name of the catalog. + */ + name: string + /** + * A brief description of the catalog. + */ + description?: string | null + /** + * The unique identifiers of the hierarchies to associate with a catalog. + */ + hierarchy_ids: Array + /** + * The unique identifier of the price book to associate with this catalog. You can specify either a `pricebook_id` or `pricebook_ids` but not both. If you specify both a `pricebook_id` and `pricebook_ids`, a `422 Unprocessable Entity` error is displayed. + * + */ + pricebook_id?: string + pricebook_ids?: PrioritizedPricebooks + /** + * Product Experience Manager supports localization of products and hierarchies. If you store supports multiple languages, you can localize product names and descriptions. + */ + locales?: { + [key: string]: { + [key: string]: string + } + } + } + /** + * Represents the type of object being returned. Always `Catalog`. + */ + type: "catalog" + } +} + +/** + * Container for a single catalog. + */ +export type CatalogData = { + data: Catalog + links?: Links +} + +/** + * Container for a list of catalogs. + */ +export type CatalogListData = { + data: Array + links?: Links +} + +/** + * A catalog combines price books, product lists, and hierarchies. + */ +export type CatalogUpdateData = { + data: { + attributes: { + /** + * The name of the catalog. + */ + name?: string | null + /** + * A brief description of the catalog. + */ + description?: string | null + /** + * The unique identifiers of the hierarchies to associate with a catalog. + */ + hierarchy_ids?: Array | null + /** + * The unique identifier of a price book to associate with a catalog. You can specify a `pricebook_id` or a `pricebook_ids` but not both. If you specify both, a `422 unprocessable entity` error is displayed. + */ + pricebook_id?: string | null + pricebook_ids?: PrioritizedPricebooks + /** + * Product Experience Manager supports localization of products and hierarchies. If you store supports multiple languages, you can localize product names and descriptions. + */ + locales?: { + [key: string]: { + [key: string]: string + } + } + } + /** + * The unique identifier of the catalog to be updated. + */ + id: string + /** + * This represents the type of object being returned. Always `catalog`. + */ + type: "catalog" + } +} + +/** + * The unique identifier of the component, for example, `games`. + */ +export type ComponentProduct = { + /** + * The component name is the name that is displayed in your storefront. + */ + name?: string + /** + * The minimum number of product options a shopper can select from this component. + */ + min?: number | null + /** + * The maximum number of product options a shopper can select from this component. + */ + max?: number | null + /** + * The sort order of the components. The `create a bundle` and `update a bundle` endpoints do not sort the components. You can use the `sort_order` attribute when programming your storefront to display the components in the order that you want. + */ + sort_order?: number | null + /** + * The product options included in a component. This can be the ID of another bundle. + */ + options?: Array +} + +/** + * The product options included in a component. This can be the ID of another bundle. + */ +export type ComponentProductOption = { + /** + * A unique identifier of the product you want to add to a component. + */ + id?: string + /** + * This represents the type of object being returned. Always `product`. + */ + type?: "product" + /** + * The number of this product option that a shopper must purchase. + */ + quantity?: number + /** + * The sort order of the options. The `create a bundle` and `update a bundle` endpoints do not sort the options. You can use the `sort_order` attribute when programming your storefront to display the options in the order that you want. + */ + sort_order?: number | null + /** + * The boolean indicates whether the current option is a default option for the component. + */ + default?: boolean | null +} + +/** + * This represents the type of object being returned. Always `product`. + */ +export type type2 = "product" + +/** + * A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. + */ +export type Components = { + [key: string]: ComponentProduct +} + +/** + * The length of the custom input text field. + */ +export type CustomInputValidationRuleOptions = { + /** + * The number of characters the custom text field can be. You can specify a maximum length up to 255 characters, as the limit is 255 characters. + */ + max_length?: number +} + +/** + * The validation rules for the custom text. + */ +export type CustomInputValidationRule = { + /** + * This represents the type of object being returned. Must be `string`. + */ + type?: "string" + options?: CustomInputValidationRuleOptions +} + +/** + * This represents the type of object being returned. Must be `string`. + */ +export type type3 = "string" + +/** + * The name of the custom input. You can rename the input to something more representative of the input that shoppers are adding, for example, `message` or `front`. + */ +export type CustomInput = { + /** + * The name for the custom text field that is displayed in your storefront. + */ + name?: string + /** + * The validation rules for the custom text. + */ + validation_rules?: Array + /** + * This is `true` or `false` depending on whether the custom text is required. + */ + required?: boolean | null +} + +/** + * You can allow your shoppers to add custom text to a product when adding product items to their carts. This is useful, for example, if you have a product like a T-shirt that can be personalized or you sell greetings cards that can be printed with your shoppers personalized messages. You can do this using the `custom_inputs` attribute. + * + * - You can rename input to something more representative of the input that shoppers are adding, for example, `message` or `front`. + * - `name` is the name that is displayed in your storefront. + * - You can add validation rules. For example, the input field must be a string and/or up to 255 characters in length. The limit is 255 characters. + * + */ +export type CustomInputs = { + [key: string]: CustomInput +} + +/** + * A collection of one or more currencies objects that consists of the [**three-letter ISO code**](https://www.iso.org/iso-3166-country-codes.html) of the currencies associated with this price and the amount. This is the product's price. + */ +export type Currencies = { + [key: string]: Amount +} + +/** + * The optional price extension with values in string format, viewable by shoppers. + */ +export type ShopperAttributes = { + [key: string]: string +} + +/** + * A list of differences between two releases. + */ +export type DiffListData = { + data?: Array + links?: Links +} + +/** + * A price formatted for display. + */ +export type DisplayPrice = { + with_tax?: FormattedPrice + without_tax?: FormattedPrice +} + +/** + * APIError is a json-api style part of an error response. + */ +export type Error = { + detail?: string + status?: string + title?: string +} + +/** + * ErrorResponse is a json-api style Error response. + */ +export type ErrorResponse = { + errors?: Array +} + +/** + * The name of the product template. + */ +export type Extension = { + [key: string]: { + [key: string]: unknown + } +} + +/** + * With extension templates, you can attach a specific set of custom fields to your products in Product Experience Manager. For example, a **Book** template might contain the attributes, such as **ISBN**, **Author**, **Number of pages**, **Year Published**, or **Condition (New/Used)**. + */ +export type Extensions = { + [key: string]: Extension +} + +/** + * In Product Experience Manager, products can have associated rich media assets, such as product images or a file containing additional product details. + */ +export type FileReference = { + /** + * This represents the type of object being returned. Always `file`. + */ + type?: "file" + /** + * A unique identifier for a file. + */ + id?: string + /** + * The date and time a file is created. + */ + created_at?: Date +} + +/** + * This represents the type of object being returned. Always `file`. + */ +export type type4 = "file" + +/** + * In Product Experience Manager, products can have associated rich media assets, such as product images or a file containing additional product details. + */ +export type FilesRelationship = { + data?: Array +} + +/** + * A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. You can link to the products that make up your bundle components. + */ +export type ComponentProductsRelationship = { + data?: ProductReferences + links?: SelfLink +} + +/** + * A price formatted for display. + */ +export type FormattedPrice = { + /** + * The price in the lowest denomination for the specified currency. This is a product's list price. + */ + amount?: number + /** + * The three-letter ISO code of the currencies associated with this price and the amount. + */ + currency?: string + /** + * The format of the price for display. + */ + formatted?: string +} + +/** + * A category hierarchy in a catalog. Hierarchies can have parent nodes and child nodes, as well as a list of attached products. + */ +export type Hierarchy = { + attributes?: HierarchyAttributes + /** + * A unique identifier of a hierarchy. + */ + id?: string + relationships?: HierarchyRelationships + /** + * This represents the type of object being returned. Always `hierarchy`. + */ + type?: string + meta?: HierarchyMeta +} + +/** + * A hierarchy's metadata. + */ +export type HierarchyMeta = { + /** + * Product Experience Manager supports localization of hierarchies. If your store supports multiple languages, you can localize hierarchy names and descriptions. This is [**three-letter language code**](https://www.iso.org/iso-639-language-code) that represents the name of the language you have used. + */ + language?: string +} + +/** + * Resource attributes of a catalog hierarchy. + */ +export type HierarchyAttributes = { + /** + * The date and time a hierarchy is created. + */ + created_at?: Date + /** + * The date and time a hierarchy is published in a catalog. + */ + published_at?: Date | null + /** + * A description of a hierarchy. + */ + description?: string + /** + * The name of a hierarchy. + */ + name?: string + /** + * A unique slug for a hierarchy. + */ + slug?: string + /** + * The date and time a hierarchy was updated. + */ + updated_at?: Date +} + +/** + * Container for hierarchies. + */ +export type HierarchyData = { + data?: Hierarchy + links?: Links +} + +/** + * Container for a list of hierarchies. + */ +export type HierarchyListData = { + meta?: PageMeta + data?: Array + links?: Links +} + +/** + * Relationships to child nodes, and products. + */ +export type HierarchyRelationships = { + /** + * A URL to all the products associated with a hierarchy. + */ + products?: { + links?: RelatedLink + } + /** + * A URL to all the child products associated with a hierarchy. + */ + children?: { + links: RelatedLink + } + /** + * A URL to all the nodes associated with a hierarchy. + */ + nodes?: { + links: RelatedLink + } +} + +/** + * Links allow you to move between requests. + */ +export type Links = { + /** + * Single entities use a `self` parameter with a link the specific resource. + */ + self?: string | null + /** + * Always the first page. + */ + first?: string | null + /** + * This is `null` if there is only one page. + */ + last?: string | null + /** + * This is `null` if there is only one page. + */ + prev?: string | null + /** + * This is `null` if there is only one page. + */ + next?: string | null +} + +/** + * Included is an array of resources that are included in the response. + */ +export type Included = { + /** + * The main images associated with a product. + */ + main_images?: Array + /** + * The component products associated with a product. + */ + component_products?: Array + /** + * The files associated with a product. + */ + files?: Array +} + +/** + * In Product Experience Manager, products can also have associated product images. + */ +export type MainImageRelationship = { + /** + * The images associated with a product. + */ + data?: { + /** + * This represents the type of object being returned. Always `main_image`. + */ + type?: "main_image" + /** + * A unique identifier for an image. + */ + id?: string + } +} + +/** + * This represents the type of object being returned. Always `main_image`. + */ +export type type5 = "main_image" + +/** + * A category node in a catalog. Nodes can have child nodes, as well as a list of attached products. + */ +export type Node = { + attributes?: NodeAttributes + /** + * The unique identifier of a node. + */ + id?: string + relationships?: NodeRelationships + /** + * This represents the type of object being returned. Always `node`. + */ + type?: string + meta?: NodeMeta +} + +/** + * Resource attributes of a catalog node. + */ +export type NodeAttributes = { + /** + * The date and time a node was created. + */ + created_at?: Date + /** + * The date and time a node was published in a catalog. + */ + published_at?: Date | null + /** + * A description of a node. + */ + description?: string + label?: string + /** + * The name of a node. Names must be unique among sibling nodes in a hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies. + */ + name?: string + /** + * A slug for the node. Slugs must be unique among sibling nodes in the hierarchy. Otherwise, a slug can be non-unique within the hierarchy and across multiple hierarchies. + */ + slug?: string + /** + * A list of curated products for a node. You can curate your products in your nodes product lists. Product curation allows you to promote specific products within each node in a hierarchy, enabling you to create unique product collections in your storefront. + */ + curated_products?: Array + status?: string + /** + * The date and time a node was updated. + */ + updated_at?: Date +} + +/** + * Container for nodes. + */ +export type NodeCreateData = { + /** + * A node in a catalog (e.g. a category node). Nodes can have child nodes, as well as a list of attached products + */ + data: { + /** + * Resource attributes of a catalog node. + */ + attributes: { + description?: string + /** + * hierarchy id of the node + */ + hierarchy_id?: string + label?: string + name: string + slug?: string + status?: string + locales?: { + [key: string]: { + [key: string]: string + } + } + } + relationships?: NodeRelationships + id?: string + type: string + } + links?: Links +} + +/** + * Container for nodes. + */ +export type NodeData = { + data?: Node + links?: Links +} + +/** + * Container for a list of nodes. + */ +export type NodeListData = { + meta?: PageMeta + data?: Array + links?: Links +} + +/** + * A node's metadata. + */ +export type NodeMeta = { + /** + * The node details localized in the supported languages. + */ + language?: string + /** + * Helps you understand the association of products with nodes. It explains how products are associated with parent nodes and the relationship among the array of nodes. This is useful if you want to improve how your shoppers search within you store. + */ + bread_crumb?: Array +} + +/** + * Minimum set of information to identify a catalog node. + */ +export type NodeReference = { + /** + * The unique identifier of a hierarchy. + */ + id?: string + /** + * A label for a hierarchy. + */ + label?: string + /** + * The name of a hierarchy. + */ + name?: string +} + +/** + * Relationships to parent and child nodes, and products. + */ +export type NodeRelationships = { + /** + * A URL to all products associated with a node. + */ + products?: { + data?: Array + links?: RelatedLink + } + /** + * A URL to all child nodes associated with a node. + */ + children?: { + links: RelatedLink + } + /** + * A URL to all parent nodes associated with a node. + */ + parent?: { + data: { + type: "node" + id: string + } + links?: RelatedLink + } + /** + * A URL to the hierarchies associated with a node. + */ + hierarchy?: { + data: { + type: "hierarchy" + id: string + } + links?: RelatedLink + } +} + +export type type6 = "node" + +/** + * Container for node relationships. + */ +export type NodeRelationshipsData = { + data?: NodeRelationships + links?: Links +} + +/** + * Contains the results for the entire collection. + */ +export type PageMeta = { + /** + * Total number of results for the entire collection. + */ + results?: { + /** + * Total number of results for the entire collection. + */ + total?: number + } + page?: { + /** + * The maximum number of records for all pages. + */ + limit?: number + /** + * The current offset by number of pages. + */ + offset?: number + /** + * The current number of pages. + */ + current?: number + /** + * The total number of records for the entire collection. + */ + total?: number + } +} + +/** + * Top level entity in the pricebooks domain model. It contains a list of product prices. + */ +export type Pricebook = { + /** + * The unique identifier of a price book. + */ + id?: string + /** + * This represents the type of object being returned. Always `pricebook`. + */ + type: "pricebook" + attributes: { + created_at?: Date + description?: string | null + name: string | null + updated_at?: Date + } +} + +/** + * This represents the type of object being returned. Always `pricebook`. + */ +export type type7 = "pricebook" + +/** + * Container for pricebooks. + */ +export type PricebookCreateData = { + /** + * New top level pricebook. + */ + data: { + type: "pricebook" + attributes: { + description?: string | null + name: string | null + } + } + links?: Links +} + +/** + * Container for pricebooks. + */ +export type PricebookData = { + data: Pricebook + links?: Links +} + +/** + * ProductPrice associates a collection of locale specific prices with a product ID. + */ +export type PricebookPrice = { + type: "product-price" + attributes: { + currencies: TieredCurrencies + sales?: Sales + sku: string + } + id: string +} + +export type type8 = "product-price" + +/** + * Container for pricebook prices. + */ +export type PricebookPriceCreateData = { + /** + * ProductPrice associates a collection of locale specific prices with a product ID. + */ + data: { + type: "product-price" + attributes: { + currencies: TieredCurrencies + sales?: Sales + sku: string + } + } + links?: Links +} + +/** + * Container for pricebook prices. + */ +export type PricebookPriceData = { + data: PricebookPrice + links?: Links +} + +/** + * A product in a catalog with the following attributes. + */ +export type Product = { + attributes?: ProductAttributes + /** + * A unique identifier for a product. + */ + id?: string + relationships?: ProductRelationships + /** + * This represents the type of object being returned. Always `product`. + */ + type?: string + meta?: ProductMeta +} + +/** + * A product's attributes. + */ +export type ProductAttributes = { + /** + * The date and time a product was published in a catalog. + */ + published_at?: Date | null + /** + * If this product is a `parent` product. A `parent` product is a product that has child products that have been built using the `build child products` endpoint. + */ + base_product?: boolean + /** + * The unique identifier of a `parent` product. + */ + base_product_id?: string + /** + * The commodity type, either `physical` or `digital`. + */ + commodity_type?: string + /** + * If a product is curated, then the `curated_product` attribute with a value of `true` is displayed. If a product is not curated, the `curated_product` attribute is not displayed. + */ + curated_product?: boolean + /** + * The universal product code or european article number of the product. + */ + upc_ean?: string + /** + * The manufacturer part number of the product. + */ + manufacturer_part_num?: string + /** + * A list of tags associated with the product. A tag must be HTML compatible characters excluding commas and will be stored in lowercase letters. + */ + tags?: Array + /** + * A list of price modifier names. + */ + price_modifiers?: Array + /** + * The date and time a product was created. + */ + created_at?: Date + /** + * A description of the product. + */ + description?: string + /** + * A name of a product. + */ + name?: string + price?: Currencies + shopper_attributes?: ShopperAttributes + tiers?: Tiers + components?: Components + custom_inputs?: CustomInputs + /** + * The unique stock keeping unit of the product. + */ + sku?: string + /** + * A label for the product that is used in the URL paths. A slug can contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. By default, the product name is used as the slug. + */ + slug?: string + /** + * The status of the product, either `live` or `draft`. + */ + status?: string + /** + * The unique attribute associated with the product. This could be an external reference from a separate company system, for example. + */ + external_ref?: string | null + /** + * The date and time a product was updated. + */ + updated_at?: Date + extensions?: Extensions +} + +/** + * Container for products. + */ +export type ProductCreateData = { + /** + * A new product in a catalog. + */ + data?: { + /** + * A product's attributes. + */ + attributes: { + description?: string + name: string + sku?: string + slug?: string + status: string + locales?: { + [key: string]: { + [key: string]: string + } + } + } + id?: string + type: string + } + links?: Links +} + +/** + * Container for products. + */ +export type ProductData = { + data?: Product + links?: Links + included?: Included +} + +export type ProductDiff = { + id?: string + type?: string + attributes?: { + sku?: string + this_release_id?: string + other_release_id?: string + diff_created_at?: Date + exists?: { + this: boolean + other: boolean + } + updated_at?: { + this?: Date | null + other?: Date | null + } + } +} + +/** + * Container for a list of products. + */ +export type ProductListData = { + meta?: PageMeta + data?: Array + links?: Links +} + +/** + * A product's metadata contains information about products, for example, the nodes a product is associated with, any child products, bundle configurations, and so on. + */ +export type ProductMeta = { + /** + * The relationship among the array of nodes a product is associated with, demonstrating the linking of the children nodes with the parent nodes. Up to 10 levels of parent nodes are displayed, depending on the number of levels of parent nodes you have. + */ + bread_crumbs?: { + [key: string]: Array + } + /** + * An array of parent node IDs that a product is associated with. Up to 10 levels of parent nodes are displayed, depending on the number of levels of parent nodes you have. + */ + bread_crumb_nodes?: Array + /** + * A unique identifier of the catalog a product is associated with. + */ + catalog_id?: string + /** + * The unique identifier of the price book a product is associated with. + */ + pricebook_id?: string | null + display_price?: DisplayPrice + /** + * The source of a catalog. Always `pim`. + */ + catalog_source?: "pim" + /** + * With sales pricing, a store can optionally add a sale price to a product price. For example, a store can schedule seasonal pricing on products without creating a new price book and catalog ruleset. Optionally, a store can schedule the date ranges for the sale products. This is the unique identifier of a sale. + */ + sale_id?: string + /** + * The date and time a sale expires. + */ + sale_expires?: Date | null + original_price?: Currencies + original_display_price?: DisplayPrice + bundle_configuration?: BundleConfiguration + /** + * A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. + */ + component_products?: { + [key: string]: { + /** + * With sales pricing, a store can optionally add a sale price to a product price. For example, a store can schedule seasonal pricing on products without creating a new price book and catalog ruleset. Optionally, a store can schedule the date ranges for the sale products. This is the unique identifier of a sale. + */ + sale_id?: string + /** + * The date and time a sale expires. + */ + sale_expires?: Date | null + price?: Currencies + display_price?: DisplayPrice + original_price?: Currencies + original_display_price?: DisplayPrice + pricebook_id?: string | null + } + } + /** + * You can use price modifiers to change the price property of child products. By default, child products inherit the same price as their base products. Using price modifiers, you can enable child products to inherit a different price. + */ + price_modifiers?: { + [key: string]: { + /** + * There are three modifier types. + * + * - The `price_increment` type increases the prices of a product. + * - The `price_decrement` type decreases the price of a product. + * - The `price_equals` type sets the price of a product to an amount you specify. + * + */ + modifier_type?: string + currencies?: Currencies + } + } + /** + * You can use tiers to allow your store to offer different pricing for minimum quantities of items that your shoppers purchase. + */ + tiers?: { + [key: string]: { + /** + * The unique identifier of a sale. + */ + sale_id?: string + /** + * The date and time a sale expires. + */ + sale_expires?: Date | null + display_price?: DisplayPrice + original_price?: Currencies + original_display_price?: DisplayPrice + } + } + /** + * The `variation_matrix` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. If no variations are available, the `variation_matrix` is empty. + */ + variation_matrix?: { + [key: string]: unknown + } + /** + * If you specified `build_rules` for a product, the `variations` object lists the variation option IDs that you specified to include when building your child products. If no `build_rules` are specified, all the variation and variation options available for a product are displayed. If a product does not have any variations, then the `variations` object is not displayed. + */ + variations?: Array + /** + * An array of variation options IDs that a child product has. + */ + child_option_ids?: Array | null + /** + * If this is a child product, the `child_variations` object lists the variation option IDs that define this child product. + */ + child_variations?: Array | null + /** + * Commerce automatically assigns types to the products you create. In Commerce Manager, you can see at a glance the product types in a list of a products. In addition, you can filter on product types in both the API and Commerce Manager. + * + * Product types can also be used in catalogs. For example, in your catalog, you can filter on parent so that only your parent products are displayed in your storefront. + * + * Products have one of the following types: + * + * - **standard** - Standard products are a standalone products. + * - **parent** - A parent product is a product that has child products that have been built using the `Build Child Products` endpoint. + * - **child** - When you configure product variations and variation options for parent products, the child products derived from the parent products are automatically created in Commerce. + * - **bundle** - A bundle is a purchasable product, comprising two or more standalone products (in other words, components) to be sold together. + * + */ + product_types?: Array + /** + * If you storefront supports multiple languages, your storefront's preferred language and locale. + */ + language?: string +} + +/** + * The source of a catalog. Always `pim`. + */ +export type catalog_source = "pim" + +/** + * The options available for a variation. + */ +export type VariationOption = { + /** + * A unique identifier for an option. + */ + id?: string + /** + * The name of the option. + */ + name?: string + /** + * If you specified a `sort_order` when creating your variations and variation options, then use the `sort_order` value to program your storefront to display the variations and variation options in the order that you want. + */ + sort_order?: number | null + /** + * The option description to display to customers. + */ + description?: string +} + +export type Variation = { + /** + * A unique identifier of a variation. + */ + id?: string + /** + * The name of a variation. + */ + name?: string + /** + * If you specified a `sort_order` when creating your variations and variation options, then use the `sort_order` value to program your storefront to display the variations and variation options in the order that you want. + */ + sort_order?: number | null + option?: VariationOption + /** + * The options available for this variation. + */ + options?: Array +} + +/** + * Container for a bundle configuration. + */ +export type BundleConfigurationData = { + data: BundleConfiguration +} + +/** + * A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. + */ +export type BundleConfiguration = { + /** + * The product options included in a component. This can be the ID of another bundle. + */ + selected_options: { + [key: string]: { + [key: string]: number + } + } +} + +/** + * A product identifier. + */ +export type ProductReference = { + /** + * A unique identifier for a product. + */ + id?: string + /** + * This represents the type of object being returned. Always `product`. + */ + type?: "product" +} + +/** + * Container for a list of product references. + */ +export type ProductReferenceListData = { + meta?: PageMeta + data?: ProductReferences + links?: Links +} + +/** + * A list of product identifiers. + */ +export type ProductReferences = Array + +/** + * Relationships allow you to move between requests. Includes links to the parent and child products, bundle component products, files, and main images associated with a product. + */ +export type ProductRelationships = { + /** + * The details of a `parent` product. A `parent` product is a product that has child products that have been built using the `Build Child Products` endpoint. + */ + parent?: { + data?: ProductReference + } + /** + * The details of a `child` product. When you configure product variations and variation options for parent products, the child products derived from the parent products are automatically created in Commerce. + */ + children?: { + data?: ProductReferences + links?: SelfLink + } + files?: FilesRelationship + main_image?: MainImageRelationship + component_products?: ComponentProductsRelationship +} + +/** + * Container for product relationships. + */ +export type ProductRelationshipsData = { + data?: ProductRelationships + links?: Links +} + +/** + * A list of products to be added to cart. Can be type product-data or error-response. + */ +export type ProductsForCart = { + data: Array + included?: { + component_products?: Array + } | null +} + +/** + * A list of product id or sku and bundle configuration for cart. + */ +export type ProductsForCartConfiguration = { + data: Array<{ + id?: string | null + sku?: string | null + bundle_configuration?: BundleConfiguration + }> +} + +/** + * A URL to a related object, for example, catalog rules, hierarchies, price books, products and deltas. + */ +export type RelatedLink = { + /** + * A URL to a related object, for example, catalog rules, hierarchies, price books, products and deltas. + */ + related: string +} + +/** + * Links are used to allow you to move between requests. + */ +export type SelfLink = { + /** + * Single entities use a self parameter with a link to that specific resource. + */ + self: string +} + +/** + * A catalog release represents a collection of hierarchical product data, price books and catalogs rules. + */ +export type Release = { + /** + * A unique identifier for the catalog release. + */ + id?: string + attributes?: { + /** + * The name of a release. + */ + name?: string + /** + * The date and time a release was published. + */ + published_at?: Date | null + /** + * A unique identifier for the catalog. + */ + catalog_id?: string + /** + * A description of the catalog release. + */ + description?: string + /** + * An array of hierarchy IDs associated with the release. + */ + hierarchies?: Array + } + relationships?: ReleaseRelationships + /** + * This represents the type of object being returned. Always `catalog-release`. + */ + type?: string + meta?: ReleaseMeta +} + +/** + * Container for a catalog release. + */ +export type ReleaseData = { + data?: Release + links?: Links +} + +/** + * Container for a list of catalog releases. + */ +export type ReleaseListData = { + data?: Array + links?: Links +} + +/** + * A release's metadata. + */ +export type ReleaseMeta = { + /** + * The date and time a release is created. + */ + created_at?: Date + /** + * The date and time a release is available for use. In other words, the date and time the status of a catalog release changes to PUBLISHED, rather than IN PROGRESS. + */ + started_at?: Date | null + /** + * The date and time a release is updated. + */ + updated_at?: Date | null + /** + * The status of the current release. + */ + release_status?: "PENDING" | "IN_PROGRESS" | "FAILED" | "PUBLISHED" + /** + * Your storefront's preferred language code and locale. + */ + language?: string + /** + * Indicates that a full publish was performed (either because this is the first time a catalog has been published or because of a change that occurred, for example, adding/removing a price book or hierarchy). When determining whether delta data needs to be refreshed, ignore this attribute and always use the `is_full_delta` attribute. + * + */ + is_full_publish?: boolean + /** + * Indicates whether the release delta file contains the full content of a catalog release. Using a search service as an example, if the `is_full_delta` attribute is `true`, you should remove all data about that catalog release from the search service before injecting fresh data from the delta file. If the `is_full_delta` attribute is `false`, then data from the previous catalog release overlays the existing data in the delta file. The `is_full_delta` attribute is always `true` the first time a catalog is published. + * + */ + is_full_delta?: boolean + /** + * The total number of products displayed in a catalog release. + */ + total_products?: number | null + /** + * The total number of hierarchy nodes displayed in a catalog release. + */ + total_nodes?: number | null + /** + * An integer that represents the progress of a catalog publish. The attribute starts at `0` and reaches `100` when publishing is complete. + */ + percent_completed?: number | null + /** + * The owner of the resource, can be either `organization` or `store`. + */ + owner?: "store" | "organization" | null +} + +/** + * The status of the current release. + */ +export type release_status = "PENDING" | "IN_PROGRESS" | "FAILED" | "PUBLISHED" + +/** + * Relationships are established between different catalog entities. For example, products, hierarchies, price books, and catalog rules are related to a catalog, as they are associated with it. + */ +export type ReleaseRelationships = { + /** + * A URL to a delta document that describes the changes between catalog releases. + */ + delta?: { + links?: RelatedLink + } + /** + * A URL to all products included in a catalog release. + */ + products?: { + links?: RelatedLink + } + /** + * A URL to all hierarchies included in a catalog release. + */ + hierarchies?: { + links: RelatedLink + } +} + +/** + * A catalog rule specifies which catalog to use for a given shopper context. + */ +export type Rule = { + /** + * The catalog rule ID. Use this to get, modify, or delete the catalog rule. + */ + id: string + attributes: { + /** + * The name of a catalog rule. The name must not contain any spaces. + */ + name: string + /** + * A brief description of the purpose of a catalog rule. + */ + description?: string + /** + * The list of accounts who are eligible to see this catalog. If this field is empty, the rule matches all accounts. + */ + account_ids?: Array + /** + * The list of customers who are eligible to see this catalog. If empty, the rule matches all customers. + */ + customer_ids?: Array + /** + * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. + */ + channels?: Array + /** + * A list of user-defined tags that can be used to further restrict the eligibility criteria for this rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. + */ + tags?: Array + /** + * Specifies a time period when a catalog is displayed, such as on a specific date or during summer. Requests populate the rule tag using the `EP-Context-Tag` header. + * + * The schedules attribute must include the following. + * + * - `valid_from` matches the date and time that the catalog is displayed from. + * - `valid_to` matches the date and time the catalog is displayed to. + * + * Commerce runs on UTC time. + * + * You can offset the timezone by adding the offset to the end of the date and time. For example, a catalog which contains a sale hierarchy that should appear for a set timeframe may be scheduled to publish on a given date and time within a given timezone. For instance, a sale that should begin on 1st of June 2022 05:00 ET and end on the 15th of June 2022 at 23:50 PT would have a valid schedule of `"valid_from": "2022-06-01T05:00:00.000-05:00"`, `"valid_to": "2022-06-15T11:59:99.000-08:00"`. + * + */ + schedules?: Array + /** + * The unique identifier of a catalog. + */ + catalog_id: string + /** + * The date and time a catalog rule was created. + */ + created_at: Date + /** + * The date and time a catalog release is updated. + */ + updated_at: Date + } + /** + * This represents the type of object being returned. Always `catalog_rule`. + */ + type: "catalog_rule" +} + +/** + * This represents the type of object being returned. Always `catalog_rule`. + */ +export type type9 = "catalog_rule" + +/** + * A catalog rule specifies which catalog to use for a given shopper context. + */ +export type RuleCreateData = { + data: { + attributes: { + /** + * The name of a catalog rule. The name must not contain spaces. + */ + name: string + /** + * A brief description of the purpose of a catalog rule. + */ + description?: string | null + /** + * The list of accounts who are eligible to see this catalog. If this field is empty, the rule matches all accounts. + */ + account_ids?: Array | null + /** + * The list of customers who are eligible to see this catalog. If empty, the rule matches all customers. + */ + customer_ids?: Array | null + /** + * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. + */ + channels?: Array | null + /** + * A list of user-defined tags that can be used to further restrict the eligibility criteria for this rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. + */ + tags?: Array | null + /** + * Specifies a time period when a catalog is displayed, such as on a specific date or during summer. Requests populate the rule tag using the `EP-Context-Tag` header. + * + * The schedules attribute must include the following. + * + * - `valid_from` matches the date and time that the catalog is displayed from. + * - `valid_to` matches the date and time the catalog is displayed to. + * + * Commerce runs on UTC time. + * + * You can offset the timezone by adding the offset to the end of the date and time. For example, a catalog which contains a sale hierarchy that should appear for a set timeframe may be scheduled to publish on a given date and time within a given timezone. For instance, a sale that should begin on 1st of June 2022 05:00 ET and end on the 15th of June 2022 at 23:50 PT would have a valid schedule of `"valid_from": "2022-06-01T05:00:00.000-05:00"`, `"valid_to": "2022-06-15T11:59:99.000-08:00"`. + * + */ + schedules?: Array | null + /** + * The unique identifier of a catalog. + */ + catalog_id: string + } + /** + * This represents the type of object being returned. Always `catalog_rule`. + */ + type: "catalog_rule" + } +} + +/** + * Container for a single catalog rule. + */ +export type RuleData = { + data: Rule + links?: Links +} + +/** + * Container for a list of catalog rules. + */ +export type RuleListData = { + meta?: PageMeta + data: Array + links?: Links +} + +/** + * A period of time during which a catalog is valid + */ +export type RuleSchedule = { + /** + * Matches the date and time that the catalog is displayed from. + */ + valid_from?: Date | null + /** + * Matches the date and time the catalog is displayed to. + */ + valid_to?: Date | null +} + +/** + * A catalog rule specifies which catalog to use for a given shopper context. + */ +export type RuleUpdateData = { + data: { + /** + * The catalog rule ID. Use this to get, modify, or delete the catalog rule. + */ + id: string + attributes?: { + /** + * The name of a catalog rule. The name must not contain spaces. + */ + name?: string | null + /** + * A description of the purpose of a catalog rule. + */ + description?: string | null + /** + * Specifies the list of accounts who are eligible to see this catalog. If this field is empty, the rule matches all accounts. + */ + account_ids?: Array | null + /** + * The list of customers who are eligible to see this catalog. If empty, the rule matches all customers. + */ + customer_ids?: Array | null + /** + * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. + */ + channels?: Array | null + /** + * Specifies a time period when a catalog is displayed, such as on a specific date or during summer. Requests populate the rule tag using the `EP-Context-Tag` header. + * + * The schedules attribute must include the following. + * + * - `valid_from` matches the date and time that the catalog is displayed from. + * - `valid_to` matches the date and time the catalog is displayed to. + * + * Commerce runs on UTC time. + * + * You can offset the timezone by adding the offset to the end of the date and time. For example, a catalog which contains a sale hierarchy that should appear for a set timeframe may be scheduled to publish on a given date and time within a given timezone. For instance, a sale that should begin on 1st of June 2022 05:00 ET and end on the 15th of June 2022 at 23:50 PT would have a valid schedule of `"valid_from": "2022-06-01T05:00:00.000-05:00"`, `"valid_to": "2022-06-15T11:59:99.000-08:00"`. + * + */ + schedules?: Array | null + /** + * A list of user-defined tags that can be used to further restrict the eligibility criteria for this rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. + */ + tags?: Array | null + /** + * The unique identifier of a catalog rule. + */ + catalog_id?: string | null + } + /** + * This represents the type of object being returned. Always `catalog_rule`. + */ + type: "catalog_rule" + } +} + +/** + * A set of sale prices and a validity period. + */ +export type Sale = { + schedule?: Schedule + currencies?: TieredCurrencies +} + +/** + * A set of sale specifications + */ +export type Sales = { + [key: string]: Sale +} + +/** + * A definition of the times at which a sale is valid + */ +export type Schedule = { + valid_from?: Date | null + valid_to?: Date | null +} + +/** + * The name of the tier, for example, `Pencils`. + */ +export type Tier = { + /** + * The minimum quantity of 1 or more defined for the specified price. If a minimum quantity is not specified, an error is returned. + */ + minimum_quantity?: number + price?: Currencies +} + +/** + * The three-letter ISO code for the currency associated with this price. + */ +export type TieredAmount = { + /** + * The price in the lowest denomination for the specified currency. This is a product's list price. + */ + amount?: number + /** + * Whether this price includes tax. + */ + includes_tax?: boolean + /** + * The price tier that an item is eligible for based on the quantity purchased. You cannot have conflicting tiers within the same currencies block. + */ + tiers?: { + [key: string]: { + /** + * The minimum quantity of 1 or more defined for the specified price. If a minimum quantity is not specified, an error is returned. + */ + minimum_quantity?: number + /** + * The price for each quantity. + */ + amount?: number + } + } +} + +/** + * Collection of currency specific prices for a product. + */ +export type TieredCurrencies = { + [key: string]: TieredAmount +} + +/** + * The price tier that an item is eligible for based on the quantity purchased. You cannot have conflicting tiers within the same currencies block. + */ +export type Tiers = { + [key: string]: Tier +} + +/** + * Creates a catalog release with the following attributes. + */ +export type CatalogReleaseCreateData = { + data?: { + /** + * Set to `true` if you want to export all the data from a catalog release in a delta link. The `is_full_delta` attribute is returned from the `get a release of a catalog` endpoint. The `is_full_delta` attribute tells you if the delta file contains the full content of a catalog release. You can use the `is_full_delta` to determine if you need to refresh the data in your company system before publishing a catalog release with fresh data in a delta link. Using a search service as an example, if the `is_full_delta` attribute is true, you should remove all data about that catalog from the search service before publishing a catalog release and injecting fresh data from the delta file. If the `is_full_delta` attribute is false, then data from the previous catalog overlays the existing data in the delta file. The `is_full_delta` attribute is always `true` the first time a catalog is published. + * + */ + export_full_delta?: boolean + /** + * If you are publishing a catalog in a store that contains resources from an organization, you must set this to true and you must enable the **Include Organization Resources in Catalog Publishes** checkbox in Commerce Manager. See [**Multi-Store Management Solutions**](/docs/api/pxm/catalog/publish-release). + */ + include_organization_resources?: boolean | null + } +} + +export type binary = { + /** + * The unique identifier for this file. + */ + id?: string + /** + * The type represents the object being returned. + */ + type?: string + /** + * The name of the file. + */ + file_name?: string + /** + * The mime type of the file. + */ + mime_type?: string + /** + * The size of the file. Required when uploading files. + */ + file_size?: number + /** + * DEPRECATED Whether the file public or not. Required when uploading files. + */ + public?: boolean + meta?: FileMeta + links?: Links + link?: FileLink +} + +export type FileMeta = { + /** + * The date and time the file was created. + */ + timestamps?: { + /** + * The date and time the file was created. + */ + created_at?: string + } + /** + * The file dimensions. + */ + dimensions?: { + /** + * The width of the file. + */ + width?: number + /** + * The height of the file. + */ + height?: number + } +} + +/** + * The publicly available URL for this file. + */ +export type FileLink = { + /** + * The publicly available URL for this file. + */ + href?: string +} + +/** + * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. + */ +export type ParameterChannel = string + +/** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ +export type ParameterAcceptLanguage = string + +/** + * Product tags are used to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. You can enhance your product list using tags, enabling you to refine your product list and run targeted promotions. Tags are used to refine the eligibility criteria for a rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. + */ +export type ParameterTag = string + +/** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ +export type ParameterLimit = number + +/** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ +export type ParameterOffset = number + +/** + * This endpoint supports filtering. See [Filtering](#filtering). + * + */ +export type ParameterFilterRule = string + +/** + * + * This endpoints supports filtering. See [Filtering](#filtering). + * + */ +export type ParameterFilterHierarchy = string + +/** + * This endpoint supports filtering, see [Filtering](#filtering). + * + */ +export type ParameterFilterNode = string + +/** + * This endpoints support filtering. See [Filtering](#filtering). + * + */ +export type ParameterFilterProduct = string + +/** + * Using the `include=component_products` parameter, you can retrieve key attribute data for the bundle component products in the product bundle, such as SKU or slug . + * + */ +export type ParameterIncludeComponentProducts = string + +/** + * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products. + * + */ +export type ParameterInclude = Array< + "main_images" | "files" | "component_products" +> + +export type CreateCatalogData = { + /** + * Creates a catalog with the following attributes. + */ + body: CatalogCreateData +} + +export type CreateCatalogResponse = CatalogData + +export type CreateCatalogError = ErrorResponse + +export type GetCatalogsResponse = CatalogListData + +export type GetCatalogsError = ErrorResponse + +export type GetCatalogByIdData = { + path: { + /** + * The catalog ID. + */ + catalog_id: string + } +} + +export type GetCatalogByIdResponse = CatalogData + +export type GetCatalogByIdError = ErrorResponse + +export type UpdateCatalogData = { + /** + * Updated catalog. + */ + body: CatalogUpdateData + path: { + /** + * The catalog ID. + */ + catalog_id: string + } +} + +export type UpdateCatalogResponse = CatalogData + +export type UpdateCatalogError = ErrorResponse + +export type DeleteCatalogByIdData = { + path: { + /** + * The catalog ID. + */ + catalog_id: string + } +} + +export type DeleteCatalogByIdResponse = void + +export type DeleteCatalogByIdError = ErrorResponse + +export type PublishReleaseData = { + /** + * Options for catalog release publishing + */ + body?: CatalogReleaseCreateData + path: { + /** + * The catalog ID. + */ + catalog_id: string + } +} + +export type PublishReleaseResponse = ReleaseData + +export type PublishReleaseError = ErrorResponse + +export type GetReleasesData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + } + path: { + /** + * The catalog ID. + */ + catalog_id: string + } +} + +export type GetReleasesResponse = ReleaseListData + +export type GetReleasesError = ErrorResponse + +export type DeleteReleasesData = { + path: { + /** + * The catalog ID. + */ + catalog_id: string + } +} + +export type DeleteReleasesResponse = void + +export type DeleteReleasesError = ErrorResponse + +export type GetReleaseByIdData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + } + path: { + /** + * The catalog ID. + */ + catalog_id: string + /** + * The catalog release ID. + */ + release_id: string + } +} + +export type GetReleaseByIdResponse = ReleaseData + +export type GetReleaseByIdError = ErrorResponse + +export type DeleteReleaseByIdData = { + path: { + /** + * The catalog ID. + */ + catalog_id: string + /** + * The catalog release ID. + */ + release_id: string + } +} + +export type DeleteReleaseByIdResponse = void + +export type DeleteReleaseByIdError = ErrorResponse + +export type CreateRuleData = { + /** + * Creates a catalog rule with the following attributes. + */ + body: RuleCreateData +} + +export type CreateRuleResponse = RuleData + +export type CreateRuleError = ErrorResponse + +export type GetRulesData = { + query?: { + /** + * This endpoint supports filtering. See [Filtering](#filtering). + * + */ + filter?: string + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetRulesResponse = RuleListData + +export type GetRulesError = ErrorResponse + +export type GetRuleByIdData = { + path: { + /** + * The catalog rule ID. + */ + catalog_rule_id: string + } +} + +export type GetRuleByIdResponse = RuleData + +export type GetRuleByIdError = ErrorResponse + +export type UpdateRuleData = { + /** + * An updated catalog rule with the following attributes. + */ + body: RuleUpdateData + path: { + /** + * The catalog rule ID. + */ + catalog_rule_id: string + } +} + +export type UpdateRuleResponse = RuleData + +export type UpdateRuleError = ErrorResponse + +export type DeleteRuleByIdData = { + path: { + /** + * The catalog rule ID. + */ + catalog_rule_id: string + } +} + +export type DeleteRuleByIdResponse = void + +export type DeleteRuleByIdError = ErrorResponse + +export type GetAllHierarchiesData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + } + path: { + /** + * The catalog ID. + */ + catalog_id: string + /** + * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + */ + release_id: string + } + query?: { + /** + * + * This endpoints supports filtering. See [Filtering](#filtering). + * + */ + filter?: string + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetAllHierarchiesResponse = HierarchyListData + +export type GetAllHierarchiesError = ErrorResponse + +export type GetHierarchyData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + } + path: { + /** + * The catalog ID. + */ + catalog_id: string + /** + * The catalog hierarchy ID. + */ + hierarchy_id: string + /** + * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + */ + release_id: string + } +} + +export type GetHierarchyResponse = HierarchyData + +export type GetHierarchyError = ErrorResponse + +export type GetHierarchyNodesData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + } + path: { + /** + * The catalog ID. + */ + catalog_id: string + /** + * The catalog hierarchy ID. + */ + hierarchy_id: string + /** + * The catalog release ID. + */ + release_id: string + } + query?: { + /** + * This endpoint supports filtering, see [Filtering](#filtering). + * + */ + filter?: string + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetHierarchyNodesResponse = NodeListData + +export type GetHierarchyNodesError = ErrorResponse + +export type GetHierarchyChildNodesData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + } + path: { + /** + * The catalog ID. + */ + catalog_id: string + /** + * The catalog hierarchy ID. + */ + hierarchy_id: string + /** + * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + */ + release_id: string + } + query?: { + /** + * This endpoint supports filtering, see [Filtering](#filtering). + * + */ + filter?: string + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetHierarchyChildNodesResponse = NodeListData + +export type GetHierarchyChildNodesError = ErrorResponse + +export type GetAllNodesData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + } + path: { + /** + * The catalog ID. + */ + catalog_id: string + /** + * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + */ + release_id: string + } + query?: { + /** + * This endpoint supports filtering, see [Filtering](#filtering). + * + */ + filter?: string + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetAllNodesResponse = NodeListData + +export type GetAllNodesError = ErrorResponse + +export type GetNodeData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + } + path: { + /** + * The catalog ID. + */ + catalog_id: string + /** + * The catalog node ID. + */ + node_id: string + /** + * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + */ + release_id: string + } +} + +export type GetNodeResponse = NodeData + +export type GetNodeError = ErrorResponse + +export type GetChildNodesData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + } + path: { + /** + * The catalog ID. + */ + catalog_id: string + /** + * The catalog node ID. + */ + node_id: string + /** + * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + */ + release_id: string + } + query?: { + /** + * This endpoint supports filtering, see [Filtering](#filtering). + * + */ + filter?: string + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetChildNodesResponse = NodeListData + +export type GetChildNodesError = ErrorResponse + +export type GetAllProductsData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + } + path: { + /** + * The catalog ID. + */ + catalog_id: string + /** + * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + */ + release_id: string + } + query?: { + /** + * This endpoints support filtering. See [Filtering](#filtering). + * + */ + filter?: string + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetAllProductsResponse = ProductListData + +export type GetAllProductsError = ErrorResponse + +export type GetProductData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + } + path: { + /** + * The catalog ID. + */ + catalog_id: string + /** + * The product ID. + */ + product_id: string + /** + * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + */ + release_id: string + } +} + +export type GetProductResponse = ProductData + +export type GetProductError = ErrorResponse + +export type GetComponentProductIdsData = { + path: { + /** + * The catalog ID. + */ + catalog_id: string + /** + * The product ID. + */ + product_id: string + /** + * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + */ + release_id: string + } + query?: { + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetComponentProductIdsResponse = ProductReferenceListData + +export type GetComponentProductIdsError = ErrorResponse + +export type GetChildProductsData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + } + path: { + /** + * The catalog ID. + */ + catalog_id: string + /** + * The product ID. + */ + product_id: string + /** + * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + */ + release_id: string + } + query?: { + /** + * This endpoints support filtering. See [Filtering](#filtering). + * + */ + filter?: string + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetChildProductsResponse = ProductListData + +export type GetChildProductsError = ErrorResponse + +export type GetProductsForHierarchyData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + } + path: { + /** + * The catalog ID. + */ + catalog_id: string + /** + * The catalog hierarchy ID. + */ + hierarchy_id: string + /** + * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + */ + release_id: string + } + query?: { + /** + * This endpoints support filtering. See [Filtering](#filtering). + * + */ + filter?: string + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetProductsForHierarchyResponse = ProductListData + +export type GetProductsForHierarchyError = ErrorResponse + +export type GetProductsForNodeData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + } + path: { + /** + * The catalog ID. + */ + catalog_id: string + /** + * The catalog node ID. + */ + node_id: string + /** + * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + */ + release_id: string + } + query?: { + /** + * This endpoints support filtering. See [Filtering](#filtering). + * + */ + filter?: string + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetProductsForNodeResponse = ProductListData + +export type GetProductsForNodeError = ErrorResponse + +export type GetByContextReleaseData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + /** + * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. + */ + "EP-Channel"?: string + /** + * Product tags are used to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. You can enhance your product list using tags, enabling you to refine your product list and run targeted promotions. Tags are used to refine the eligibility criteria for a rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. + */ + "EP-Context-Tag"?: string + } +} + +export type GetByContextReleaseResponse = ReleaseData + +export type GetByContextReleaseError = ErrorResponse + +export type GetByContextAllHierarchiesData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + /** + * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. + */ + "EP-Channel"?: string + /** + * Product tags are used to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. You can enhance your product list using tags, enabling you to refine your product list and run targeted promotions. Tags are used to refine the eligibility criteria for a rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. + */ + "EP-Context-Tag"?: string + } + query?: { + /** + * + * This endpoints supports filtering. See [Filtering](#filtering). + * + */ + filter?: string + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetByContextAllHierarchiesResponse = HierarchyListData + +export type GetByContextAllHierarchiesError = ErrorResponse + +export type GetByContextHierarchyData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + /** + * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. + */ + "EP-Channel"?: string + /** + * Product tags are used to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. You can enhance your product list using tags, enabling you to refine your product list and run targeted promotions. Tags are used to refine the eligibility criteria for a rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. + */ + "EP-Context-Tag"?: string + } + path: { + /** + * The catalog hierarchy ID. + */ + hierarchy_id: string + } +} + +export type GetByContextHierarchyResponse = HierarchyData + +export type GetByContextHierarchyError = ErrorResponse + +export type GetByContextHierarchyNodesData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + /** + * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. + */ + "EP-Channel"?: string + /** + * Product tags are used to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. You can enhance your product list using tags, enabling you to refine your product list and run targeted promotions. Tags are used to refine the eligibility criteria for a rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. + */ + "EP-Context-Tag"?: string + } + path: { + /** + * The catalog hierarchy ID. + */ + hierarchy_id: string + } + query?: { + /** + * This endpoint supports filtering, see [Filtering](#filtering). + * + */ + filter?: string + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetByContextHierarchyNodesResponse = NodeListData + +export type GetByContextHierarchyNodesError = ErrorResponse + +export type GetByContextHierarchyChildNodesData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + /** + * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. + */ + "EP-Channel"?: string + /** + * Product tags are used to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. You can enhance your product list using tags, enabling you to refine your product list and run targeted promotions. Tags are used to refine the eligibility criteria for a rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. + */ + "EP-Context-Tag"?: string + } + path: { + /** + * The catalog hierarchy ID. + */ + hierarchy_id: string + } + query?: { + /** + * This endpoint supports filtering, see [Filtering](#filtering). + * + */ + filter?: string + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetByContextHierarchyChildNodesResponse = NodeListData + +export type GetByContextHierarchyChildNodesError = ErrorResponse + +export type GetByContextAllNodesData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + /** + * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. + */ + "EP-Channel"?: string + /** + * Product tags are used to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. You can enhance your product list using tags, enabling you to refine your product list and run targeted promotions. Tags are used to refine the eligibility criteria for a rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. + */ + "EP-Context-Tag"?: string + } + query?: { + /** + * This endpoint supports filtering, see [Filtering](#filtering). + * + */ + filter?: string + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetByContextAllNodesResponse = NodeListData + +export type GetByContextAllNodesError = ErrorResponse + +export type GetByContextNodeData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + /** + * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. + */ + "EP-Channel"?: string + /** + * Product tags are used to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. You can enhance your product list using tags, enabling you to refine your product list and run targeted promotions. Tags are used to refine the eligibility criteria for a rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. + */ + "EP-Context-Tag"?: string + } + path: { + /** + * The catalog node ID. + */ + node_id: string + } +} + +export type GetByContextNodeResponse = NodeData + +export type GetByContextNodeError = ErrorResponse + +export type GetByContextChildNodesData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + /** + * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. + */ + "EP-Channel"?: string + /** + * Product tags are used to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. You can enhance your product list using tags, enabling you to refine your product list and run targeted promotions. Tags are used to refine the eligibility criteria for a rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. + */ + "EP-Context-Tag"?: string + } + path: { + /** + * The catalog node ID. + */ + node_id: string + } + query?: { + /** + * This endpoint supports filtering, see [Filtering](#filtering). + * + */ + filter?: string + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetByContextChildNodesResponse = NodeListData + +export type GetByContextChildNodesError = ErrorResponse + +export type GetByContextAllProductsData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + /** + * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. + */ + "EP-Channel"?: string + /** + * Product tags are used to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. You can enhance your product list using tags, enabling you to refine your product list and run targeted promotions. Tags are used to refine the eligibility criteria for a rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. + */ + "EP-Context-Tag"?: string + } + query?: { + /** + * This endpoints support filtering. See [Filtering](#filtering). + * + */ + filter?: string + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetByContextAllProductsResponse = ProductListData + +export type GetByContextAllProductsError = ErrorResponse + +export type GetByContextProductData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + /** + * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. + */ + "EP-Channel"?: string + /** + * Product tags are used to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. You can enhance your product list using tags, enabling you to refine your product list and run targeted promotions. Tags are used to refine the eligibility criteria for a rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. + */ + "EP-Context-Tag"?: string + } + path: { + /** + * The product ID. + */ + product_id: string + } + query?: { + /** + * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products. + * + */ + include?: Array<"main_images" | "files" | "component_products"> + } +} + +export type GetByContextProductResponse = ProductData + +export type GetByContextProductError = ErrorResponse + +export type GetByContextComponentProductIdsData = { + headers?: { + /** + * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. + */ + "EP-Channel"?: string + /** + * Product tags are used to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. You can enhance your product list using tags, enabling you to refine your product list and run targeted promotions. Tags are used to refine the eligibility criteria for a rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. + */ + "EP-Context-Tag"?: string + } + path: { + /** + * The product ID. + */ + product_id: string + } + query?: { + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetByContextComponentProductIdsResponse = ProductReferenceListData + +export type GetByContextComponentProductIdsError = ErrorResponse + +export type GetByContextChildProductsData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + /** + * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. + */ + "EP-Channel"?: string + /** + * Product tags are used to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. You can enhance your product list using tags, enabling you to refine your product list and run targeted promotions. Tags are used to refine the eligibility criteria for a rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. + */ + "EP-Context-Tag"?: string + } + path: { + /** + * The product ID. + */ + product_id: string + } + query?: { + /** + * This endpoints support filtering. See [Filtering](#filtering). + * + */ + filter?: string + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetByContextChildProductsResponse = ProductListData + +export type GetByContextChildProductsError = ErrorResponse + +export type GetByContextProductsForHierarchyData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + /** + * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. + */ + "EP-Channel"?: string + /** + * Product tags are used to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. You can enhance your product list using tags, enabling you to refine your product list and run targeted promotions. Tags are used to refine the eligibility criteria for a rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. + */ + "EP-Context-Tag"?: string + } + path: { + /** + * The catalog hierarchy ID. + */ + hierarchy_id: string + } + query?: { + /** + * This endpoints support filtering. See [Filtering](#filtering). + * + */ + filter?: string + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetByContextProductsForHierarchyResponse = ProductListData + +export type GetByContextProductsForHierarchyError = ErrorResponse + +export type GetByContextProductsForNodeData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + /** + * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. + */ + "EP-Channel"?: string + /** + * Product tags are used to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. You can enhance your product list using tags, enabling you to refine your product list and run targeted promotions. Tags are used to refine the eligibility criteria for a rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. + */ + "EP-Context-Tag"?: string + } + path: { + /** + * The catalog node ID. + */ + node_id: string + } + query?: { + /** + * This endpoints support filtering. See [Filtering](#filtering). + * + */ + filter?: string + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetByContextProductsForNodeResponse = ProductListData + +export type GetByContextProductsForNodeError = ErrorResponse + +export type ConfigureByContextProductData = { + /** + * The bundle configuration. + */ + body: BundleConfigurationData + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + /** + * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. + */ + "EP-Channel"?: string + /** + * Product tags are used to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. You can enhance your product list using tags, enabling you to refine your product list and run targeted promotions. Tags are used to refine the eligibility criteria for a rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. + */ + "EP-Context-Tag"?: string + } + path: { + /** + * The product ID. + */ + product_id: string + } +} + +export type ConfigureByContextProductResponse = ProductData + +export type ConfigureByContextProductError = ErrorResponse + +export type $OpenApiTs = { + "/pcm/catalogs": { + post: { + req: CreateCatalogData + res: { + /** + * The created catalog + */ + "201": CatalogData + /** + * Unexpected error. + */ + default: ErrorResponse + } + } + get: { + res: { + /** + * The list of catalogs. + */ + "200": CatalogListData + /** + * An unexpected error. + */ + default: ErrorResponse + } + } + } + "/pcm/catalogs/{catalog_id}": { + get: { + req: GetCatalogByIdData + res: { + /** + * The catalog. + */ + "200": CatalogData + /** + * An unexpected error. + */ + default: ErrorResponse + } + } + put: { + req: UpdateCatalogData + res: { + /** + * An updated catalog with the following attributes. + */ + "200": CatalogData + /** + * Unexpected error. + */ + default: ErrorResponse + } + } + delete: { + req: DeleteCatalogByIdData + res: { + /** + * A 204 response indicates that the catalog has been deleted. + */ + "204": void + /** + * Unexpected error. + */ + default: ErrorResponse + } + } + } + "/pcm/catalogs/{catalog_id}/releases": { + post: { + req: PublishReleaseData + res: { + /** + * Publishes a catalog release with the following attributes. + */ + "201": ReleaseData + /** + * Unexpected error. + */ + default: ErrorResponse + } + } + get: { + req: GetReleasesData + res: { + /** + * The list of catalogs. + */ + "200": ReleaseListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + delete: { + req: DeleteReleasesData + res: { + /** + * A 204 response indicates that the releases have been deleted. + */ + "204": void + /** + * Unexpected error. + */ + default: ErrorResponse + } + } + } + "/pcm/catalogs/{catalog_id}/releases/{release_id}": { + get: { + req: GetReleaseByIdData + res: { + /** + * The catalog. + */ + "200": ReleaseData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + delete: { + req: DeleteReleaseByIdData + res: { + /** + * A 204 response indicates that the release has been deleted. + */ + "204": void + /** + * Unexpected error. + */ + default: ErrorResponse + } + } + } + "/pcm/catalogs/rules": { + post: { + req: CreateRuleData + res: { + /** + * The created catalog rule + */ + "201": RuleData + /** + * Unexpected error. + */ + default: ErrorResponse + } + } + get: { + req: GetRulesData + res: { + /** + * The list of catalog rules. + */ + "200": RuleListData + /** + * An unexpected error. + */ + default: ErrorResponse + } + } + } + "/pcm/catalogs/rules/{catalog_rule_id}": { + get: { + req: GetRuleByIdData + res: { + /** + * The catalog rile. + */ + "200": RuleData + /** + * An unexpected error. + */ + default: ErrorResponse + } + } + put: { + req: UpdateRuleData + res: { + /** + * An Updated catalog rule with the following attributes. + */ + "200": RuleData + /** + * Unexpected error. + */ + default: ErrorResponse + } + } + delete: { + req: DeleteRuleByIdData + res: { + /** + * A 204 response indicates that the catalog rule has been deleted. + */ + "204": void + /** + * Unexpected error. + */ + default: ErrorResponse + } + } + } + "/pcm/catalogs/{catalog_id}/releases/{release_id}/hierarchies": { + get: { + req: GetAllHierarchiesData + res: { + /** + * The hierarchies of a catalog. + */ + "200": HierarchyListData + /** + * An unexpected error. + */ + default: ErrorResponse + } + } + } + "/pcm/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}": { + get: { + req: GetHierarchyData + res: { + /** + * The catalog hierarchy. + */ + "200": HierarchyData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/pcm/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/nodes": { + get: { + req: GetHierarchyNodesData + res: { + /** + * The child nodes of a catalog hierarchy. + */ + "200": NodeListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/pcm/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/children": { + get: { + req: GetHierarchyChildNodesData + res: { + /** + * The child nodes of a catalog hierarchy. + */ + "200": NodeListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/pcm/catalogs/{catalog_id}/releases/{release_id}/nodes": { + get: { + req: GetAllNodesData + res: { + /** + * The nodes of a catalog. + */ + "200": NodeListData + /** + * An unexpected error. + */ + default: ErrorResponse + } + } + } + "/pcm/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}": { + get: { + req: GetNodeData + res: { + /** + * The catalog node. + */ + "200": NodeData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/pcm/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/children": { + get: { + req: GetChildNodesData + res: { + /** + * The child nodes of a catalog node. + */ + "200": NodeListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/pcm/catalogs/{catalog_id}/releases/{release_id}/products": { + get: { + req: GetAllProductsData + res: { + /** + * The products of a catalog. + */ + "200": ProductListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/pcm/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}": { + get: { + req: GetProductData + res: { + /** + * The product of a catalog. + */ + "200": ProductData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/pcm/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/component_products": { + get: { + req: GetComponentProductIdsData + res: { + /** + * The list of component product IDs of a specific bundle product from a catalog. + */ + "200": ProductReferenceListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/pcm/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/children": { + get: { + req: GetChildProductsData + res: { + /** + * The list of child products of a specific base product from a catalog. + */ + "200": ProductListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/pcm/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/products": { + get: { + req: GetProductsForHierarchyData + res: { + /** + * The products of a catalog hierarchy. + */ + "200": ProductListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/pcm/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/products": { + get: { + req: GetProductsForNodeData + res: { + /** + * The products of a catalog node. + */ + "200": ProductListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalog": { + get: { + req: GetByContextReleaseData + res: { + /** + * The catalog. + */ + "200": ReleaseData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalog/hierarchies": { + get: { + req: GetByContextAllHierarchiesData + res: { + /** + * The hierarchies of the catalog. + */ + "200": HierarchyListData + /** + * An unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalog/hierarchies/{hierarchy_id}": { + get: { + req: GetByContextHierarchyData + res: { + /** + * The catalog hierarchy. + */ + "200": HierarchyData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalog/hierarchies/{hierarchy_id}/nodes": { + get: { + req: GetByContextHierarchyNodesData + res: { + /** + * The child nodes of a catalog hierarchy. + */ + "200": NodeListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalog/hierarchies/{hierarchy_id}/children": { + get: { + req: GetByContextHierarchyChildNodesData + res: { + /** + * The child nodes of a catalog hierarchy. + */ + "200": NodeListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalog/nodes": { + get: { + req: GetByContextAllNodesData + res: { + /** + * The nodes of the catalog. + */ + "200": NodeListData + /** + * An unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalog/nodes/{node_id}": { + get: { + req: GetByContextNodeData + res: { + /** + * The catalog node. + */ + "200": NodeData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalog/nodes/{node_id}/relationships/children": { + get: { + req: GetByContextChildNodesData + res: { + /** + * The child nodes of a catalog node. + */ + "200": NodeListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalog/products": { + get: { + req: GetByContextAllProductsData + res: { + /** + * The products of a catalog. + */ + "200": ProductListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalog/products/{product_id}": { + get: { + req: GetByContextProductData + res: { + /** + * The product of a catalog. + */ + "200": ProductData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalog/products/{product_id}/relationships/component_products": { + get: { + req: GetByContextComponentProductIdsData + res: { + /** + * The list of component product IDs of a bundle product from a catalog. + */ + "200": ProductReferenceListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalog/products/{product_id}/relationships/children": { + get: { + req: GetByContextChildProductsData + res: { + /** + * The list of child products of a parent product from a catalog. + */ + "200": ProductListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalog/hierarchies/{hierarchy_id}/products": { + get: { + req: GetByContextProductsForHierarchyData + res: { + /** + * The products of a catalog hierarchy. + */ + "200": ProductListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalog/nodes/{node_id}/relationships/products": { + get: { + req: GetByContextProductsForNodeData + res: { + /** + * The products of a catalog node. + */ + "200": ProductListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalog/products/{product_id}/configure": { + post: { + req: ConfigureByContextProductData + res: { + /** + * The configured product of a catalog. + */ + "200": ProductData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } +} + +export type CreateCatalogResponseTransformer = ( + data: any, +) => Promise + +export type CatalogDataModelResponseTransformer = (data: any) => CatalogData + +export type CatalogModelResponseTransformer = (data: any) => Catalog + +export const CatalogModelResponseTransformer: CatalogModelResponseTransformer = + (data) => { + if (data?.attributes?.created_at) { + data.attributes.created_at = new Date(data.attributes.created_at) + } + if (data?.attributes?.updated_at) { + data.attributes.updated_at = new Date(data.attributes.updated_at) + } + return data + } + +export const CatalogDataModelResponseTransformer: CatalogDataModelResponseTransformer = + (data) => { + if (data?.data) { + CatalogModelResponseTransformer(data.data) + } + return data + } + +export const CreateCatalogResponseTransformer: CreateCatalogResponseTransformer = + async (data) => { + CatalogDataModelResponseTransformer(data) + return data + } + +export type GetCatalogsResponseTransformer = ( + data: any, +) => Promise + +export type CatalogListDataModelResponseTransformer = ( + data: any, +) => CatalogListData + +export const CatalogListDataModelResponseTransformer: CatalogListDataModelResponseTransformer = + (data) => { + if (Array.isArray(data?.data)) { + data.data.forEach(CatalogModelResponseTransformer) + } + return data + } + +export const GetCatalogsResponseTransformer: GetCatalogsResponseTransformer = + async (data) => { + CatalogListDataModelResponseTransformer(data) + return data + } + +export type GetCatalogByIdResponseTransformer = ( + data: any, +) => Promise + +export const GetCatalogByIdResponseTransformer: GetCatalogByIdResponseTransformer = + async (data) => { + CatalogDataModelResponseTransformer(data) + return data + } + +export type UpdateCatalogResponseTransformer = ( + data: any, +) => Promise + +export const UpdateCatalogResponseTransformer: UpdateCatalogResponseTransformer = + async (data) => { + CatalogDataModelResponseTransformer(data) + return data + } + +export type PublishReleaseResponseTransformer = ( + data: any, +) => Promise + +export type ReleaseDataModelResponseTransformer = (data: any) => ReleaseData + +export type ReleaseModelResponseTransformer = (data: any) => Release + +export type ReleaseMetaModelResponseTransformer = (data: any) => ReleaseMeta + +export const ReleaseMetaModelResponseTransformer: ReleaseMetaModelResponseTransformer = + (data) => { + if (data?.created_at) { + data.created_at = new Date(data.created_at) + } + if (data?.started_at) { + data.started_at = new Date(data.started_at) + } + if (data?.updated_at) { + data.updated_at = new Date(data.updated_at) + } + return data + } + +export const ReleaseModelResponseTransformer: ReleaseModelResponseTransformer = + (data) => { + if (data?.attributes?.published_at) { + data.attributes.published_at = new Date(data.attributes.published_at) + } + if (data?.meta) { + ReleaseMetaModelResponseTransformer(data.meta) + } + return data + } + +export const ReleaseDataModelResponseTransformer: ReleaseDataModelResponseTransformer = + (data) => { + if (data?.data) { + ReleaseModelResponseTransformer(data.data) + } + return data + } + +export const PublishReleaseResponseTransformer: PublishReleaseResponseTransformer = + async (data) => { + ReleaseDataModelResponseTransformer(data) + return data + } + +export type GetReleasesResponseTransformer = ( + data: any, +) => Promise + +export type ReleaseListDataModelResponseTransformer = ( + data: any, +) => ReleaseListData + +export const ReleaseListDataModelResponseTransformer: ReleaseListDataModelResponseTransformer = + (data) => { + if (Array.isArray(data?.data)) { + data.data.forEach(ReleaseModelResponseTransformer) + } + return data + } + +export const GetReleasesResponseTransformer: GetReleasesResponseTransformer = + async (data) => { + ReleaseListDataModelResponseTransformer(data) + return data + } + +export type GetReleaseByIdResponseTransformer = ( + data: any, +) => Promise + +export const GetReleaseByIdResponseTransformer: GetReleaseByIdResponseTransformer = + async (data) => { + ReleaseDataModelResponseTransformer(data) + return data + } + +export type CreateRuleResponseTransformer = ( + data: any, +) => Promise + +export type RuleDataModelResponseTransformer = (data: any) => RuleData + +export type RuleModelResponseTransformer = (data: any) => Rule + +export type RuleScheduleModelResponseTransformer = (data: any) => RuleSchedule + +export const RuleScheduleModelResponseTransformer: RuleScheduleModelResponseTransformer = + (data) => { + if (data?.valid_from) { + data.valid_from = new Date(data.valid_from) + } + if (data?.valid_to) { + data.valid_to = new Date(data.valid_to) + } + return data + } + +export const RuleModelResponseTransformer: RuleModelResponseTransformer = ( + data, +) => { + if (Array.isArray(data?.attributes?.schedules)) { + data.attributes.schedules.forEach(RuleScheduleModelResponseTransformer) + } + if (data?.attributes?.created_at) { + data.attributes.created_at = new Date(data.attributes.created_at) + } + if (data?.attributes?.updated_at) { + data.attributes.updated_at = new Date(data.attributes.updated_at) + } + return data +} + +export const RuleDataModelResponseTransformer: RuleDataModelResponseTransformer = + (data) => { + if (data?.data) { + RuleModelResponseTransformer(data.data) + } + return data + } + +export const CreateRuleResponseTransformer: CreateRuleResponseTransformer = + async (data) => { + RuleDataModelResponseTransformer(data) + return data + } + +export type GetRulesResponseTransformer = ( + data: any, +) => Promise + +export type RuleListDataModelResponseTransformer = (data: any) => RuleListData + +export const RuleListDataModelResponseTransformer: RuleListDataModelResponseTransformer = + (data) => { + if (Array.isArray(data?.data)) { + data.data.forEach(RuleModelResponseTransformer) + } + return data + } + +export const GetRulesResponseTransformer: GetRulesResponseTransformer = async ( + data, +) => { + RuleListDataModelResponseTransformer(data) + return data +} + +export type GetRuleByIdResponseTransformer = ( + data: any, +) => Promise + +export const GetRuleByIdResponseTransformer: GetRuleByIdResponseTransformer = + async (data) => { + RuleDataModelResponseTransformer(data) + return data + } + +export type UpdateRuleResponseTransformer = ( + data: any, +) => Promise + +export const UpdateRuleResponseTransformer: UpdateRuleResponseTransformer = + async (data) => { + RuleDataModelResponseTransformer(data) + return data + } + +export type GetAllHierarchiesResponseTransformer = ( + data: any, +) => Promise + +export type HierarchyListDataModelResponseTransformer = ( + data: any, +) => HierarchyListData + +export type HierarchyModelResponseTransformer = (data: any) => Hierarchy + +export type HierarchyAttributesModelResponseTransformer = ( + data: any, +) => HierarchyAttributes + +export const HierarchyAttributesModelResponseTransformer: HierarchyAttributesModelResponseTransformer = + (data) => { + if (data?.created_at) { + data.created_at = new Date(data.created_at) + } + if (data?.published_at) { + data.published_at = new Date(data.published_at) + } + if (data?.updated_at) { + data.updated_at = new Date(data.updated_at) + } + return data + } + +export const HierarchyModelResponseTransformer: HierarchyModelResponseTransformer = + (data) => { + if (data?.attributes) { + HierarchyAttributesModelResponseTransformer(data.attributes) + } + return data + } + +export const HierarchyListDataModelResponseTransformer: HierarchyListDataModelResponseTransformer = + (data) => { + if (Array.isArray(data?.data)) { + data.data.forEach(HierarchyModelResponseTransformer) + } + return data + } + +export const GetAllHierarchiesResponseTransformer: GetAllHierarchiesResponseTransformer = + async (data) => { + HierarchyListDataModelResponseTransformer(data) + return data + } + +export type GetHierarchyResponseTransformer = ( + data: any, +) => Promise + +export type HierarchyDataModelResponseTransformer = (data: any) => HierarchyData + +export const HierarchyDataModelResponseTransformer: HierarchyDataModelResponseTransformer = + (data) => { + if (data?.data) { + HierarchyModelResponseTransformer(data.data) + } + return data + } + +export const GetHierarchyResponseTransformer: GetHierarchyResponseTransformer = + async (data) => { + HierarchyDataModelResponseTransformer(data) + return data + } + +export type GetHierarchyNodesResponseTransformer = ( + data: any, +) => Promise + +export type NodeListDataModelResponseTransformer = (data: any) => NodeListData + +export type NodeModelResponseTransformer = (data: any) => Node + +export type NodeAttributesModelResponseTransformer = ( + data: any, +) => NodeAttributes + +export const NodeAttributesModelResponseTransformer: NodeAttributesModelResponseTransformer = + (data) => { + if (data?.created_at) { + data.created_at = new Date(data.created_at) + } + if (data?.published_at) { + data.published_at = new Date(data.published_at) + } + if (data?.updated_at) { + data.updated_at = new Date(data.updated_at) + } + return data + } + +export const NodeModelResponseTransformer: NodeModelResponseTransformer = ( + data, +) => { + if (data?.attributes) { + NodeAttributesModelResponseTransformer(data.attributes) + } + return data +} + +export const NodeListDataModelResponseTransformer: NodeListDataModelResponseTransformer = + (data) => { + if (Array.isArray(data?.data)) { + data.data.forEach(NodeModelResponseTransformer) + } + return data + } + +export const GetHierarchyNodesResponseTransformer: GetHierarchyNodesResponseTransformer = + async (data) => { + NodeListDataModelResponseTransformer(data) + return data + } + +export type GetHierarchyChildNodesResponseTransformer = ( + data: any, +) => Promise + +export const GetHierarchyChildNodesResponseTransformer: GetHierarchyChildNodesResponseTransformer = + async (data) => { + NodeListDataModelResponseTransformer(data) + return data + } + +export type GetAllNodesResponseTransformer = ( + data: any, +) => Promise + +export const GetAllNodesResponseTransformer: GetAllNodesResponseTransformer = + async (data) => { + NodeListDataModelResponseTransformer(data) + return data + } + +export type GetNodeResponseTransformer = (data: any) => Promise + +export type NodeDataModelResponseTransformer = (data: any) => NodeData + +export const NodeDataModelResponseTransformer: NodeDataModelResponseTransformer = + (data) => { + if (data?.data) { + NodeModelResponseTransformer(data.data) + } + return data + } + +export const GetNodeResponseTransformer: GetNodeResponseTransformer = async ( + data, +) => { + NodeDataModelResponseTransformer(data) + return data +} + +export type GetChildNodesResponseTransformer = ( + data: any, +) => Promise + +export const GetChildNodesResponseTransformer: GetChildNodesResponseTransformer = + async (data) => { + NodeListDataModelResponseTransformer(data) + return data + } + +export type GetAllProductsResponseTransformer = ( + data: any, +) => Promise + +export type ProductListDataModelResponseTransformer = ( + data: any, +) => ProductListData + +export type ProductModelResponseTransformer = (data: any) => Product + +export type ProductAttributesModelResponseTransformer = ( + data: any, +) => ProductAttributes + +export const ProductAttributesModelResponseTransformer: ProductAttributesModelResponseTransformer = + (data) => { + if (data?.published_at) { + data.published_at = new Date(data.published_at) + } + if (data?.created_at) { + data.created_at = new Date(data.created_at) + } + if (data?.updated_at) { + data.updated_at = new Date(data.updated_at) + } + return data + } + +export type ProductRelationshipsModelResponseTransformer = ( + data: any, +) => ProductRelationships + +export type FilesRelationshipModelResponseTransformer = ( + data: any, +) => FilesRelationship + +export type FileReferenceModelResponseTransformer = (data: any) => FileReference + +export const FileReferenceModelResponseTransformer: FileReferenceModelResponseTransformer = + (data) => { + if (data?.created_at) { + data.created_at = new Date(data.created_at) + } + return data + } + +export const FilesRelationshipModelResponseTransformer: FilesRelationshipModelResponseTransformer = + (data) => { + if (Array.isArray(data?.data)) { + data.data.forEach(FileReferenceModelResponseTransformer) + } + return data + } + +export const ProductRelationshipsModelResponseTransformer: ProductRelationshipsModelResponseTransformer = + (data) => { + if (data?.files) { + FilesRelationshipModelResponseTransformer(data.files) + } + return data + } + +export type ProductMetaModelResponseTransformer = (data: any) => ProductMeta + +export const ProductMetaModelResponseTransformer: ProductMetaModelResponseTransformer = + (data) => { + if (data?.sale_expires) { + data.sale_expires = new Date(data.sale_expires) + } + return data + } + +export const ProductModelResponseTransformer: ProductModelResponseTransformer = + (data) => { + if (data?.attributes) { + ProductAttributesModelResponseTransformer(data.attributes) + } + if (data?.relationships) { + ProductRelationshipsModelResponseTransformer(data.relationships) + } + if (data?.meta) { + ProductMetaModelResponseTransformer(data.meta) + } + return data + } + +export const ProductListDataModelResponseTransformer: ProductListDataModelResponseTransformer = + (data) => { + if (Array.isArray(data?.data)) { + data.data.forEach(ProductModelResponseTransformer) + } + return data + } + +export const GetAllProductsResponseTransformer: GetAllProductsResponseTransformer = + async (data) => { + ProductListDataModelResponseTransformer(data) + return data + } + +export type GetProductResponseTransformer = ( + data: any, +) => Promise + +export type ProductDataModelResponseTransformer = (data: any) => ProductData + +export type IncludedModelResponseTransformer = (data: any) => Included + +export const IncludedModelResponseTransformer: IncludedModelResponseTransformer = + (data) => { + if (Array.isArray(data?.component_products)) { + data.component_products.forEach(ProductModelResponseTransformer) + } + return data + } + +export const ProductDataModelResponseTransformer: ProductDataModelResponseTransformer = + (data) => { + if (data?.data) { + ProductModelResponseTransformer(data.data) + } + if (data?.included) { + IncludedModelResponseTransformer(data.included) + } + return data + } + +export const GetProductResponseTransformer: GetProductResponseTransformer = + async (data) => { + ProductDataModelResponseTransformer(data) + return data + } + +export type GetChildProductsResponseTransformer = ( + data: any, +) => Promise + +export const GetChildProductsResponseTransformer: GetChildProductsResponseTransformer = + async (data) => { + ProductListDataModelResponseTransformer(data) + return data + } + +export type GetProductsForHierarchyResponseTransformer = ( + data: any, +) => Promise + +export const GetProductsForHierarchyResponseTransformer: GetProductsForHierarchyResponseTransformer = + async (data) => { + ProductListDataModelResponseTransformer(data) + return data + } + +export type GetProductsForNodeResponseTransformer = ( + data: any, +) => Promise + +export const GetProductsForNodeResponseTransformer: GetProductsForNodeResponseTransformer = + async (data) => { + ProductListDataModelResponseTransformer(data) + return data + } + +export type GetByContextReleaseResponseTransformer = ( + data: any, +) => Promise + +export const GetByContextReleaseResponseTransformer: GetByContextReleaseResponseTransformer = + async (data) => { + ReleaseDataModelResponseTransformer(data) + return data + } + +export type GetByContextAllHierarchiesResponseTransformer = ( + data: any, +) => Promise + +export const GetByContextAllHierarchiesResponseTransformer: GetByContextAllHierarchiesResponseTransformer = + async (data) => { + HierarchyListDataModelResponseTransformer(data) + return data + } + +export type GetByContextHierarchyResponseTransformer = ( + data: any, +) => Promise + +export const GetByContextHierarchyResponseTransformer: GetByContextHierarchyResponseTransformer = + async (data) => { + HierarchyDataModelResponseTransformer(data) + return data + } + +export type GetByContextHierarchyNodesResponseTransformer = ( + data: any, +) => Promise + +export const GetByContextHierarchyNodesResponseTransformer: GetByContextHierarchyNodesResponseTransformer = + async (data) => { + NodeListDataModelResponseTransformer(data) + return data + } + +export type GetByContextHierarchyChildNodesResponseTransformer = ( + data: any, +) => Promise + +export const GetByContextHierarchyChildNodesResponseTransformer: GetByContextHierarchyChildNodesResponseTransformer = + async (data) => { + NodeListDataModelResponseTransformer(data) + return data + } + +export type GetByContextAllNodesResponseTransformer = ( + data: any, +) => Promise + +export const GetByContextAllNodesResponseTransformer: GetByContextAllNodesResponseTransformer = + async (data) => { + NodeListDataModelResponseTransformer(data) + return data + } + +export type GetByContextNodeResponseTransformer = ( + data: any, +) => Promise + +export const GetByContextNodeResponseTransformer: GetByContextNodeResponseTransformer = + async (data) => { + NodeDataModelResponseTransformer(data) + return data + } + +export type GetByContextChildNodesResponseTransformer = ( + data: any, +) => Promise + +export const GetByContextChildNodesResponseTransformer: GetByContextChildNodesResponseTransformer = + async (data) => { + NodeListDataModelResponseTransformer(data) + return data + } + +export type GetByContextAllProductsResponseTransformer = ( + data: any, +) => Promise + +export const GetByContextAllProductsResponseTransformer: GetByContextAllProductsResponseTransformer = + async (data) => { + ProductListDataModelResponseTransformer(data) + return data + } + +export type GetByContextProductResponseTransformer = ( + data: any, +) => Promise + +export const GetByContextProductResponseTransformer: GetByContextProductResponseTransformer = + async (data) => { + ProductDataModelResponseTransformer(data) + return data + } + +export type GetByContextChildProductsResponseTransformer = ( + data: any, +) => Promise + +export const GetByContextChildProductsResponseTransformer: GetByContextChildProductsResponseTransformer = + async (data) => { + ProductListDataModelResponseTransformer(data) + return data + } + +export type GetByContextProductsForHierarchyResponseTransformer = ( + data: any, +) => Promise + +export const GetByContextProductsForHierarchyResponseTransformer: GetByContextProductsForHierarchyResponseTransformer = + async (data) => { + ProductListDataModelResponseTransformer(data) + return data + } + +export type GetByContextProductsForNodeResponseTransformer = ( + data: any, +) => Promise + +export const GetByContextProductsForNodeResponseTransformer: GetByContextProductsForNodeResponseTransformer = + async (data) => { + ProductListDataModelResponseTransformer(data) + return data + } + +export type ConfigureByContextProductResponseTransformer = ( + data: any, +) => Promise + +export const ConfigureByContextProductResponseTransformer: ConfigureByContextProductResponseTransformer = + async (data) => { + ProductDataModelResponseTransformer(data) + return data + } diff --git a/packages/sdks/shopper/src/index.ts b/packages/sdks/shopper/src/index.ts new file mode 100644 index 00000000..b583818f --- /dev/null +++ b/packages/sdks/shopper/src/index.ts @@ -0,0 +1,3 @@ +export * from "./client" +import { createClient, client } from "@hey-api/client-fetch" +export { createClient, client } diff --git a/packages/sdks/shopper/tsconfig.json b/packages/sdks/shopper/tsconfig.json new file mode 100644 index 00000000..d27f8641 --- /dev/null +++ b/packages/sdks/shopper/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "target": "ES2020", + "useDefineForClassFields": true, + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "module": "ESNext", + "skipLibCheck": true, + "outDir": "dist", + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "react-jsx", + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true + }, + "include": [ + "src" + ], + "references": [{ "path": "./tsconfig.node.json"}] +} diff --git a/packages/sdks/shopper/tsconfig.node.json b/packages/sdks/shopper/tsconfig.node.json new file mode 100644 index 00000000..180cab8c --- /dev/null +++ b/packages/sdks/shopper/tsconfig.node.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "composite": true, + "skipLibCheck": true, + "module": "ESNext", + "moduleResolution": "bundler", + "allowSyntheticDefaultImports": true, + "strict": true, + "outDir": "dist", + "rootDir": "src" + }, + "include": [ + "src" + ], +} diff --git a/packages/sdks/specs/catalog_view.yaml b/packages/sdks/specs/catalog_view.yaml new file mode 100644 index 00000000..d764c586 --- /dev/null +++ b/packages/sdks/specs/catalog_view.yaml @@ -0,0 +1,5070 @@ +# GENERATED FILE - DO NOT EDIT +openapi: 3.0.0 +info: + title: Catalogs Introduction + description: | + Use the catalog-view Service API to create your catalogs. + + You also have the flexibility to create catalogs for different scenarios by combining hierarchies of products with a price book. Scenarios might include: + + - Multiple geographical regions. Display different catalogs in different regions with suitable pricing or combine product hierarchies from two different regions to display in a third region. + - Multiple channels. Display different catalogs based on how a shopper accesses your store, such as through a mobile app or a web storefront. + - Direct to business versus direct to customers. Offer different products and prices for business customers versus retail customers. + - Preferred customers. Offer special pricing to preferred customers while displaying a standard price catalog to all other shoppers. + - Reward programs. Enable reward programs where catalog prices drop after a certain spending level is reached. + - Product sales. Offer sale items for a limited time. + + Scenarios are created by defining the context within which a catalog is displays. Contexts can be a customer ID, a channel, or any other user-defined tag that can be passed to the APIs from the front-end shopper experiences. + version: 1.0.0 +servers: + - url: https://euwest.api.elasticpath.com + description: EU West Production Server + - url: https://useast.api.elasticpath.com + description: US East Production Server +security: + - bearerAuth: [] +tags: + - name: Catalogs + description: | + A catalog contains the products available for sale either in your organization or store. A catalog also contains information about how to organize those products for navigation menus and search facets in a shopper experience. + + Before you create a catalog you must define the following resources: + + - Hierarchies: hierarchies and nodes to categorize the products. See [**Hierarchies**](/docs/api/pxm/products/hierarchies). + - Products: product information, associated assets, and links to hierarchy nodes. See [**Products**](/docs/api/pxm/products/products). + - Price Books: prices for the products associated with the hierarchies. See [**Price Books**](/docs/api/pxm/pricebooks). + + A catalog is a combination of hierarchies and a price book. + + ### Products + + Commerce automatically assigns types to the products you create. Product types can be used in catalogs. For example, in your catalog, you can filter on `parent` so that only your parent products are displayed in your storefront. + + You can use product tags to store or assign a key word against a product or service that you sell in your store. The product tag can then be used to describe or label that product. Product tags represent similarities between products who do not share the same attributes. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. Product tags can be used in catalogs. For example, you can categorize your products based on color. Your shoppers can then search your products by color, enabling shoppers to quickly find what they are looking for, increasing the likelihood of a purchase, and boosting conversion rates. + + ### Hierarchies + + The hierarchies determine which products appear in the catalog, that is, only the products that are associated with the selected hierarchies are included in the catalog. You can also specify the order you want your hierarchies to display in a published catalog. You can order your hierarchies on a catalog-by-catalog basis. + + ![Hierarchy_sorting](/assets/hierarchy_sorting.png) + + For more information, see [**create a Catalog**](/docs/api/pxm/catalog/create-catalog). + + #### Understanding How Products And Nodes Are Associated + + You can use `breadcrumb` metadata to understand how products and nodes are associated. it explains how products are associated with parent nodes and the relationship among the array of nodes. This is useful if you want to improve how your shoppers search within your store. + + The `breadcrumb` information that you get in an endpoint response depends on whether the endpoint is retrieving product or node details. + + | Object | Product/Node | Description | + | --- | --- | --- | + | `breadcrumb` | Node | A list of nodes that a product is associated with. Up to 10 levels of nodes are displayed, depending on the number of levels of nodes you have. | + | `bread_crumbs` | Product | The relationship among the array of nodes a product is associated with, demonstrating the linking of the children nodes with the parent nodes. Up to 10 levels of nodes are displayed, depending on the number of levels of nodes you have. | + | `bread_crumb_nodes` | Product | An array of parent node IDs that a product is associated with. The `bread_crumb_node` metadata lists up to 10 levels of parent nodes, depending on the number of levels of parent nodes you have. | + + #### Understanding `bread_crumbs` Metadata + + The following diagram illustrates a parent and child nodes. + + ![Breadcrumbs](/assets/breadcrumbs.PNG) + + 1. The product is in **Node 2**. The ID for **Node 2** is shown first in the first set of breadcrumbs. + 1. **Node 2** is part of **Hierarchy 1**. The ID for **Hierarchy 1** is shown second. + 1. **Node 1** is the parent node of **Node 2**. The ID for **Node 1** is shown last. + 1. The product is also in **Node 3**. The ID for **Node 3** is shown first in the second set of breadcrumbs. + 1. **Node 3** is in the root of **Hierarchy 1**. The ID for **Hierarchy 1** is shown last. + + In the `bread_crumb_nodes` metadata, you can see a list of parent nodes a product is associated with. + + If you subsequently add a product to a new node, then the `bread_crumb_nodes` metadata appends the new node to the top of the list. Using the example above, if we add the product to **Node 1**: + + 1. The `bread_crumb_nodes` metadata is generated to show the new node appended to the top of the list. + 1. The `bread_crumbs` metadata is updated with the new node. + + #### Understanding Breadcrumb Metadata for Child Products + + When a catalog is published, the breadcrumb information for a child product includes the metadata mentioned for the parent product, in addition to the information specific to the child product. For example, **Product A** is the parent product, associated with **Node 1** and **Node 2**. The metadata for child **Product B** includes **Node 1** and **Node 2**, in addition to its own metadata information. + + ### Nodes + + The nodes determine which products appear under this in the catalog, that is, only the products that are associated with the selected node are shown under this node. + + ### Price books + + A price book contains the prices for each of the products in the catalog. You can create multiple price books for different scenarios, such as seasonal sales, business versus retail customer pricing, and reward programs. When creating a catalog, you can specify up to five price books. You must set a priority for your price books. Product prices are displayed in the catalog according to the priority of the price books. See [Create a catalog](/docs/api/pxm/catalog/create-catalog). + - name: Releases + description: | + When a catalog is published, a catalog release is created. A catalog release provides a snapshot of the product information taken at the time of publication. You can have one or more catalog releases available in your organization or in your store. If you publish a catalog for your organization, the catalog is available when the store is launched. + + If you have more than one catalog published for your store, use catalog rules to specify when to display each catalog. For example, you can use [**catalog rules**](/docs/api/pxm/catalog/rules) to schedule a catalog to appear during a particular date and time, such as a seasonal catalog. The catalog may have different pricing than the other catalogs. + + When a catalog is ready to be used in a store, you publish it. You can create and publish catalogs for different contexts and channels. + + Here are some pointers to understand a catalogs' lifecycle. + + - The default catalog is always the oldest published catalog and must have have at least one release. + - At any time, the most recent three catalog releases are maintained. Hence, if there is a fourth catalog release, the first catalog release is automatically removed. + - Until the catalog is published again, the previously created three catalog releases stay permanently. + - If you want any other catalog to become the default catalog, you must create a catalog rule. + - If you want the oldest published catalog to become the default catalog, you must remove the catalog rule. + - Use the `sort_order` value in the `variations` to program your storefront to display the variation options in the order that you want. + + Here is a diagram that describes a catalogs' lifecycle: + + ![Catalogs' Lifecycle](/assets/catalog-lifecycle.png) + + ### Publishing catalogs + + When you publish a catalog, the `live` products in the hierarchies appear in a catalog release. A catalog release provides a snapshot of product information taken at the time of publication. You can have one or more catalog releases available in your organization or in your store. If you publish a catalog for your organization, the catalog is available when the store is launched. + + If you have more than one catalog published for your store, use catalog rules to specify when to display each catalog. For example, you can use [catalog rules](/docs/api/pxm/catalog/rules) to schedule a catalog to appear during a particular date and time, such as a seasonal catalog. The catalog may have different pricing than the other catalogs. You can have multiple published catalogs. + + When a catalog is ready to be used in a store, you publish it. You can create and publish catalogs for different contexts and channels. You can see the differences between the last two consecutive catalog releases. See [Publish a catalog](/docs/api/pxm/catalog/publish-release). + + You retrieve catalogs for your shopper experience by using the [Catalog View API](/docs/api/pxm/catalog/releases). + - name: Rules + description: | + If your store requires multiple catalogs, add catalog rules to control when a catalog is displayed. A catalog rule contains a catalog plus the criteria under which to display the catalog. + + :::caution + + You cannot create catalog rules for organization catalogs. + + ::: + + You can use catalog rules to schedule a catalog to appear during a particular period, such as on a specific date or during summer. The catalog might offer different pricing during this period. The pricing depends on the associated price book. + + The following scenarios provides a few examples for using catalog rules. + + - **Multiple geographical regions**. Display different catalogs in different regions with suitable pricing or combine product hierarchies from two different regions to display in a third region. + - **Multiple channels**. Display different catalogs based on how a shopper accesses your store, such as through a mobile app or a web storefront. + - **Direct to business versus direct to customers**. Offer different products and prices for business customers versus retail customers. + - **Preferred accounts**. Offer special pricing to a group of users while displaying a standard price catalog to other users. + - **Preferred customers**. Offer special pricing to preferred customers while displaying a standard price catalog to all other shoppers. + - **Reward programs**. Enable reward programs where catalog prices drop after a certain spending level is reached. + - **Product sales**. Offer sale items for a limited time. + - **Standard pricing**. Display a default catalog to the shoppers who do not meet the criteria of the other catalog rules. + + You can define a catalog rule with any of the following criteria. + + - **Accounts**. List the accounts that should see a catalog. When a user has logged in with the account, they see the configured catalog. + - **Customers**. List the customers that should see a catalog. When the customer is logged in, they see the configured catalog. + - **Channel**. Specify a shopper experience, such as web storefront or mobile app. Set up the channel to retrieve the catalog from the catalog rule that matches that channel. + - **Other tags**. Create your own user-defined tags. For example, you might want to tag by regions or you might want to distinguish between business and consumer customers. + + If a catalog rule has no criteria defined, it is the default catalog rule. + + ### Resolving catalog rules + + When there is a request for a catalog, the store displays the catalog with the rule that matches the most attributes of the shoppers context. + + The request triggers the following steps: + + 1. Compares the shoppers context against the defined catalog rules. + 1. Determines the best match. + 1. Retrieves the catalog associated with the matching catalog rule. + + The follow examples show how the best match might be resolved: + + - A shopper matches one of the `customer_ids` in one catalog rule only. The catalog for that catalog rule is displayed. + - A shopper matches one of the `customer_ids` in one catalog rule only, but doesnʼt match any of the `tags` specified in that catalog rule. Because there are no other catalog rules for this `customer_id`, the catalog for the catalog rule is displayed because it is the best match. + - A shopper is browsing a store using the stores mobile app, which matches `channel=mobile` in two catalog rules. The catalog displayed depends on matches with the `tags` or `customer_ids` attributes. If there is no other matching attribute, the first catalog rule found by the store is used. The best practice is to create catalog rules that cover all cases so that you avoid this situation. + - An unknown shopper is browsing the only channel offered by the seller. The store displays the base catalog. + - name: Administrator Latest Releases Catalog API + description: | + Use the Administrator Latest Releases Catalog View API to retrieve product, hierarchy and node information. + + :::danger + + The Administrator Latest Releases Catalog View API is for Administrator use only. Do not use these endpoints on your customer-facing frontends. + + ::: + + Publishing a catalog creates a release of that catalog that you can use in an organization or in a specific store or other shopper experience. You can retrieve the hierarchies, nodes, and the `live` products associated with a catalog release. You can see which parent nodes a product is associated with. This is useful if want to improve how your shoppers search your store, for example. + + Currently, published catalogs are limited to the current release and two releases prior to the current release. + - name: Shopper Catalog API + description: | + Use the Shopper Catalog View API to retrieve hierarchy, node and product information for a catalog release. When you publish a catalog for a store, you can define catalog rules so that you can show catalogs with different pricing or different products to preferred customers or channels. These endpoints can be used in your customer-facing frontends. + + A catalog is a combination of one or more hierarchies, products, and a price book. Use the Products API and Hierarchies API to create a hierarchy of products that can be included in a catalog. Use the Price Book API to associate prices with products. + + ### Characteristics of Shopper Catalogs + + Shopper catalogs can have the following characteristics. + + - Use catalog rules to schedule a catalog to appear during a particular date and time, such as a seasonal catalog. The catalog may have different pricing than the other catalogs. You can have multiple published catalogs. + - If you have defined catalog rules and you want to retrieve a published catalog for a particular channel or a user-defined tag, you must set the appropriate headers in the request: + - `EP-Channel` - The channel, such as website or mobile app. See [**Create a Catalog Rule**](/docs/api/pxm/catalog/create-rule). + - `EP-Context-Tag` - A tag defined in the store, such as `clearance`. See [**Create a Catalog Rule**](/docs/api/pxm/catalog/create-rule). + * When a catalog is ready to be used in a store, you publish it. See [**Publish a Catalog**](/docs/api/pxm/catalog/publish-release). + * You can create and publish catalogs for different contexts and channels. You can see the differences between the last 2 consecutive catalog releases. See [**Publish a Catalog**](/docs/api/pxm/catalog/publish-release). + * You retrieve catalogs for your shopper experience by using the Shopper Catalog View API. For more information on how you can retrieve a catalog as a shopper using the Catalog API. + * When a catalog is published for a store, the corresponding events contain `store_id` and `org_id`. + * When a catalog is published for an organization, the corresponding events contain `org_id`. + * Use the `sort_order` value in `variations` to program your storefront to display the variation options in the order that you want. + + ### Shopper Catalog Caching + + When conducting a `GET` on `catalog` endpoints, all data returned, including catalog releases, products, nodes and hierarchies, are cached for 5 minutes. This means, if you call the same endpoint again, the catalog data is retrieved from the cached objects pool, optimizing the performance and efficiency of your store front. + + If you use any of the `catalog` endpoints with a `filter` or `include` query parameter, these are cached separately. + + The cached entries disappear from the cached objects pool after 5 minutes. +paths: + /pcm/catalogs: + post: + tags: + - Catalogs + summary: Creates a new catalog + description: | + Before you create a catalog, you must define the following resources: + + - Hierarchies - hierarchies and nodes to categorize the products. + - Products - product information, associated assets, and links to hierarchy nodes. + - Price Books - prices for the products associated with the hierarchies. You can create multiple price books for different scenarios, such as seasonal sales, business versus retail customer pricing, and reward programs. When creating a catalog, you can specify up to five price books. You must configure a priority for your price books. Product prices are displayed in the catalog according to the priority of the price books. Priority is a number and the price book with the highest number has the highest priority. + operationId: createCatalog + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/catalog-create-data' + description: Creates a catalog with the following attributes. + required: true + responses: + '201': + description: The created catalog + content: + application/json: + schema: + $ref: '#/components/schemas/catalog-data' + default: + description: Unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + get: + tags: + - Catalogs + summary: Gets all authorized catalogs + description: | + Retrieves a list of all the catalogs that you are authorized to view. Currently, published catalogs are limited to the current release and two releases prior to the current release. You can see the differences between the last 2 consecutive catalog releases using the delta link returned in the response of a [publish a catalog](/docs/api/pxm/catalog/publish-release) endpoint. + + You can use the `is_full_delta` attribute returned from the `get a release of a catalog` endpoint to determine if you need to refresh the data in your company system before publishing a catalog release and injecting fresh data in a delta link. The `is_full_delta` attribute tells you if this is a full publish of a catalog release. Using a search service as an example, if the `is_full_delta` attribute is `true`, you should remove all data about that catalog from the search service before publishing a catalog release and injecting fresh data from the delta file. See [Publish a catalog](/docs/api/pxm/catalog/publish-release). + + If the `is_full_publish` attribute returned in the response is `false`, data from the previous catalog release overlaid the existing data in the delta file. The `is_full_publish` attribute is always `true` the first time a catalog is published. + operationId: getCatalogs + responses: + '200': + description: The list of catalogs. + content: + application/json: + schema: + $ref: '#/components/schemas/catalog-list-data' + default: + description: An unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /pcm/catalogs/{catalog_id}: + get: + tags: + - Catalogs + summary: Get a catalog by ID + description: Retrieves the specified catalog. + operationId: getCatalogByID + parameters: + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + responses: + '200': + description: The catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/catalog-data' + default: + description: An unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + put: + tags: + - Catalogs + summary: Updates a catalog + description: Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the catalog is not updated. + operationId: updateCatalog + parameters: + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/catalog-update-data' + description: Updated catalog. + required: true + responses: + '200': + description: An updated catalog with the following attributes. + content: + application/json: + schema: + $ref: '#/components/schemas/catalog-data' + default: + description: Unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + delete: + tags: + - Catalogs + summary: Deletes a catalog + description: Deletes an unpublished catalog. Use [**Delete a Release**](/docs/api/pxm/catalog/delete-release-by-id) and [**Delete All Releases**](/docs/api/pxm/catalog/delete-releases) to delete releases of a catalog. If the catalog is associated with any catalog rules, you must first update the catalog rules to remove the catalog. + operationId: deleteCatalogByID + parameters: + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + responses: + '204': + description: A 204 response indicates that the catalog has been deleted. + default: + description: Unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /pcm/catalogs/{catalog_id}/releases: + post: + tags: + - Releases + summary: Publishes a catalog + description: | + + Publishes a catalog. You must publish a catalog before you can retrieve that catalog in an organization or store. The hierarchies, live products, and prices associated with a published catalog are in read-only mode. If you make a change to these resources, for example, a change to your price book or hierarchies, you need to republish the catalog. + + You can get [a catalog release](/docs/api/pxm/catalog/get-release-by-id) to retrieve a published catalog. Currently, published catalogs are limited to the current release and two releases prior to the current release. + + You can see the differences between the last 2 consecutive catalog releases. This is useful if want to understand how your products have changed in your catalog, ensuring your site search integration is kept up-to-date. + + Once a catalog release has completed publishing, the delta relationship links to the delta document. + + The `delta` links are signed and only valid for 1 hour. Re-reading a catalog release, for example, using [Getting a release of a catalog](/docs/pxm/catalogs/catalog-latest-release/get-a-release-of-a-catalog) returns a fresh a link. + + You can use the `is_full_delta` attribute returned from the `get a release of a catalog` endpoint to determine if you need to refresh the data in your company system before injecting fresh data in a `delta` link. The `is_full_delta` attribute tells you if this is a full publish of the catalog. Using a search service as an example, if the `is_full_delta` attribute is `true`, you should remove all data about that catalog from the search service before injecting fresh data from the `delta` file. If the `is_full_delta` attribute is `false`, then data from the previous catalog overlays the existing data in the `delta` file. To publish a catalog and inject fresh data in a `delta` link, set `export_full_delta` to `true`. + + If a previous catalog publish date is greater than 90 days, then a full catalog publish is automatically performed. If you publish your catalogs infrequently, Commerce may perform a full publish when you are expecting a delta publish. + + :::caution + + Generating a full delta is resource intensive and slows down the publishing process and so should only be performed in certain circumstances, for example, when initializing an integration with a service like Algolia. + + ::: + + The `is_full_delta` attribute is always `true` the first time a catalog is published. The information is stored in a collection of `json` documents in a compressed file. You can either manually check the file or, for example, use them to automatically update another company system you may have. + + - Delta files are only available for 30 days. + - Delta files are removed when a catalog release is deleted. + + Each document has a `delta_type` with one of the following values, depending on whether a product has been deleted, updated or created in a catalog release. + + - `delete` describes products deleted from this release of a catalog. + - `createupdate` describes products updated in this release of a catalog. + + ### Multi-Store Management Solutions + + In a multi-store management solution. + + - You can create organization catalogs. Your organization catalogs are available for your stores to use. + - Your stores can create their own catalogs. + - Your stores can create catalogs that have a combination of organization products and store products. + + If you are publishing a catalog in a store that contains resources from an organization, in Commerce Manager, you must enable the **Include Organization Resources in Catalog Publishes** checkbox. + + 1. Go to **SYSTEM** > **Store Settings**. + 2. Click **General Settings**. + 3. Select **PXM** from the list. + 4. Select the **Include Organization Resources in Catalog Publishes** checkbox. + operationId: publishRelease + parameters: + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/catalog-release-create-data' + description: Options for catalog release publishing + responses: + '201': + description: Publishes a catalog release with the following attributes. + content: + application/json: + schema: + $ref: '#/components/schemas/release-data' + default: + description: Unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + get: + tags: + - Releases + summary: Gets all authorized catalog releases + description: | + Returns a list of all published releases of the specified catalog. Currently, published catalogs are limited to the current release and two releases prior to the current release. You can see the differences between the last 2 consecutive catalog releases using the `delta` link returned in the response of a `publish a catalog` endpoint. + + You can use the `is_full_delta` attribute returned from the `get a release of a catalog` endpoint to determine if you need to refresh the data in your company system before publishing a catalog release and injecting fresh data in a delta link. The `is_full_delta` attribute tells you if this is a full publish of a catalog release. Using a search service as an example, if the `is_full_delta` attribute is `true`, you should remove all data about that catalog from the search service before publishing a catalog release and injecting fresh data from the delta file. + + If the `is_full_publish` attribute returned in the response is `false`, data from the previous catalog release overlaid the existing data in the delta file. The `is_full_publish` attribute is always `true` the first time a catalog is published. + operationId: getReleases + parameters: + - $ref: '#/components/parameters/accept-language' + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + responses: + '200': + description: The list of catalogs. + content: + application/json: + schema: + $ref: '#/components/schemas/release-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + delete: + tags: + - Releases + summary: Deletes all releases + description: Deletes all releases of the specified published catalog. + operationId: deleteReleases + parameters: + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + responses: + '204': + description: A 204 response indicates that the releases have been deleted. + default: + description: Unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /pcm/catalogs/{catalog_id}/releases/{release_id}: + get: + tags: + - Releases + summary: Get a catalog release by ID + description: Retrieves the specified catalog release. + operationId: getReleaseByID + parameters: + - $ref: '#/components/parameters/accept-language' + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + - description: The catalog release ID. + name: release_id + in: path + required: true + schema: + type: string + responses: + '200': + description: The catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/release-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + delete: + tags: + - Releases + summary: Deletes a release + description: Deletes the specified published catalog release. + operationId: deleteReleaseByID + parameters: + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + - description: The catalog release ID. + name: release_id + in: path + required: true + schema: + type: string + responses: + '204': + description: A 204 response indicates that the release has been deleted. + default: + description: Unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /pcm/catalogs/rules: + post: + tags: + - Rules + summary: Creates a new catalog rule + description: | + If you have multiple catalogs, create catalog rule resources. With catalog rules, you can display different catalogs to different shoppers. For example, you can display a preferred pricing catalog to a few special customers. Or you can display one catalog to shoppers using your website and a different catalog to shoppers using your mobile app. Finally, you can define custom criteria by creating tags. + + :::note + + - If you have one catalog for all customers and channels, you can omit creating this resource. + - Due to the way catalogs are cached in Commerce, using catalog rules to display catalogs sometimes causes a 5-minute time delay before the catalogs are displayed. + - You cannot create catalog rules for organization catalogs. + + ::: + + For ideas about the kinds of business scenarios you can achieve with catalog rules, see [Catalog Rules](/docs/api/pxm/catalog/rules). To understand how catalogs are matched to shoppers by using rules, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + operationId: createRule + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/rule-create-data' + description: Creates a catalog rule with the following attributes. + required: true + responses: + '201': + description: The created catalog rule + content: + application/json: + schema: + $ref: '#/components/schemas/rule-data' + default: + description: Unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + get: + tags: + - Rules + summary: Gets all authorized catalog rules + description: | + Retrieves all authorized catalog rules. + + ### Filtering + + This endpoint supports filtering. For general filtering syntax, see [Filtering](https://elasticpath.dev/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are supported. + + | Operator | Description | Supported Attributes | Example | + |:--- |:--- |:--- |:--- | + | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | + operationId: getRules + parameters: + - $ref: '#/components/parameters/filter-rule' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The list of catalog rules. + content: + application/json: + schema: + $ref: '#/components/schemas/rule-list-data' + default: + description: An unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /pcm/catalogs/rules/{catalog_rule_id}: + get: + tags: + - Rules + summary: Get a catalog rule by ID + operationId: getRuleByID + parameters: + - description: The catalog rule ID. + name: catalog_rule_id + in: path + required: true + schema: + type: string + responses: + '200': + description: The catalog rile. + content: + application/json: + schema: + $ref: '#/components/schemas/rule-data' + default: + description: An unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + put: + tags: + - Rules + summary: Updates a catalog rule + description: Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the catalog rule is not updated. + operationId: updateRule + parameters: + - description: The catalog rule ID. + name: catalog_rule_id + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/rule-update-data' + description: An updated catalog rule with the following attributes. + required: true + responses: + '200': + description: An Updated catalog rule with the following attributes. + content: + application/json: + schema: + $ref: '#/components/schemas/rule-data' + default: + description: Unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + delete: + tags: + - Rules + summary: Deletes a catalog rule + operationId: deleteRuleByID + parameters: + - description: The catalog rule ID. + name: catalog_rule_id + in: path + required: true + schema: + type: string + responses: + '204': + description: A 204 response indicates that the catalog rule has been deleted. + default: + description: Unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /pcm/catalogs/{catalog_id}/releases/{release_id}/hierarchies: + get: + tags: + - Administrator Latest Releases Catalog API + summary: Get all Hierarchies + description: | + Returns the hierarchies from a published catalog. + + :::note + + Currently, published catalogs are limited to the current release and two releases prior to the current release. + + ::: + + ### Filtering + + This endpoint supports filtering. For general syntax, see [Filtering](https://beta.elasticpath.dev/docs/commerce-cloud/api-overview/filtering). + + | Operator | Description | Supported Attributes | Example | + |:--- |:--- |:--- |:--- | + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | + | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | + + ### Building breadcrumbs in a storefront + + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + - Specify the node Ids in the filter expression. + - You can have as many node Ids as you want. + - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + operationId: getAllHierarchies + parameters: + - $ref: '#/components/parameters/accept-language' + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. + name: release_id + in: path + required: true + schema: + type: string + - $ref: '#/components/parameters/filter-hierarchy' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The hierarchies of a catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/hierarchy-list-data' + default: + description: An unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /pcm/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}: + get: + tags: + - Administrator Latest Releases Catalog API + summary: Get a Hierarchy + description: | + Returns the specified hierarchy from a published catalog. + + :::note + + Currently, published catalogs are limited to the current release and two releases prior to the current release. + + ::: + operationId: getHierarchy + parameters: + - $ref: '#/components/parameters/accept-language' + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. + name: release_id + in: path + required: true + schema: + type: string + - description: The catalog hierarchy ID. + name: hierarchy_id + in: path + required: true + schema: + type: string + responses: + '200': + description: The catalog hierarchy. + content: + application/json: + schema: + $ref: '#/components/schemas/hierarchy-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /pcm/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/nodes: + get: + tags: + - Administrator Latest Releases Catalog API + summary: Get a Hierarchy's Nodes + description: | + Returns all nodes for the specified hierarchy from a published catalog. + + :::note + + Currently, published catalogs are limited to the current release and two releases prior to the current release. + + ::: + + In the `bread_crumb` metadata, you can identify the parent nodes that a node is associated with. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + + ### Filtering + + This endpoint supports filtering. For general syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). + + | Operator | Description | Supported Attributes | Example | + |:--- |:--- |:--- |:--- | + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | + | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | + + ### Building breadcrumbs in a storefront + + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + - Specify the node Ids in the filter expression. + - You can have as many node Ids as you want. + - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + operationId: getHierarchyNodes + parameters: + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + - description: The catalog release ID. + name: release_id + in: path + required: true + schema: + type: string + - description: The catalog hierarchy ID. + name: hierarchy_id + in: path + required: true + schema: + type: string + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-node' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The child nodes of a catalog hierarchy. + content: + application/json: + schema: + $ref: '#/components/schemas/node-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /pcm/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/children: + get: + tags: + - Administrator Latest Releases Catalog API + summary: Get a Hierarchy's Children + description: | + Returns the parent nodes for the specified hierarchy from a published catalog. + + ![Parent Nodes](/assets/rootnodes.PNG) + + :::note + + Currently, published catalogs are limited to the current release and two releases prior to the current release. + + ::: + + In the `bread_crumb` metadata, you can identify the parent nodes that a node is associated with. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + + ### Filtering + + This endpoint supports filtering. For general syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). + + | Operator | Description | Supported Attributes | Example | + |:--- |:--- |:--- |:--- | + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | + | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | + + ### Building breadcrumbs in a storefront + + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + - Specify the node Ids in the filter expression. + - You can have as many node Ids as you want. + - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + operationId: getHierarchyChildNodes + parameters: + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. + name: release_id + in: path + required: true + schema: + type: string + - description: The catalog hierarchy ID. + name: hierarchy_id + in: path + required: true + schema: + type: string + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-node' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The child nodes of a catalog hierarchy. + content: + application/json: + schema: + $ref: '#/components/schemas/node-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /pcm/catalogs/{catalog_id}/releases/{release_id}/nodes: + get: + tags: + - Administrator Latest Releases Catalog API + summary: Get all Nodes + description: | + Returns the child nodes from a published catalog. + + :::note + + Currently, published catalogs are limited to the current release and two releases prior to the current release. + + ::: + + You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. See [Building breadcrumbs in a storefront](#building-breadcrumbs-in-a-storefront). + + The response lists the products associated with the nodes. If products are [curated](https://beta.elasticpath.dev/guides/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront. + + - If you don't provide any `curated_products`, products are listed by their `updated_at` time in descending order, with the most recently updated product first. + - If you configure `curated_products` for only a few products, the curated products are displayed first and the other products are displayed in the order of `updated_at` time. + - You can only curate 20 products or less. You cannot have more than 20 curated products. + - If a curated product is removed from a node, the product is also removed from the `curated_products` list. + - A product that is curated has the `"curated_product": true` attribute displayed. + + ### Filtering + + This endpoint supports filtering. For general syntax, see (/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available. + + | Operator | Description | Attributes | Example | + | --- | --- | --- | --- | + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug` | `filter=eq(name,some-name)` | + | `in` | Checks if the values are included in the specified string. If they are, the condition is true. + | `Id` | `filter=in(id,9214719b-17fe-4ea7-896c-d61e60fc0d05,e104d541-2c52-47fa-8a9a-c4382480d97c,65daaf68-ff2e-4632-8944-370de835967d)` | + + ### Building breadcrumbs in a storefront + + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + - Specify the node Ids in the filter expression. + - You can have as many node Ids as you want. + - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + operationId: getAllNodes + parameters: + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. + name: release_id + in: path + required: true + schema: + type: string + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-node' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The nodes of a catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/node-list-data' + default: + description: An unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /pcm/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}: + get: + tags: + - Administrator Latest Releases Catalog API + summary: Get a Node + description: | + Returns a node from a published catalog. + + :::note + + Currently, published catalogs are limited to the current release and two releases prior to the current release. + + ::: + + You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + + The response lists the products associated with the nodes. If products are [curated](https://beta.elasticpath.dev/guides/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront. + + - If you don't provide any `curated_products`, products are listed by their `updated_at` time in descending order, with the most recently updated product first. + - If you configure `curated_products` for only a few products, the curated products are displayed first and the other products are displayed in the order of `updated_at` time. + - You can only curate 20 products or less. You cannot have more than 20 curated products. + - If a curated product is removed from a node, the product is also removed from the `curated_products` list. + - A product that is curated has the `"curated_product": true` attribute displayed. + operationId: getNode + parameters: + - $ref: '#/components/parameters/accept-language' + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. + name: release_id + in: path + required: true + schema: + type: string + - description: The catalog node ID. + name: node_id + in: path + required: true + schema: + type: string + responses: + '200': + description: The catalog node. + content: + application/json: + schema: + $ref: '#/components/schemas/node-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /pcm/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/children: + get: + tags: + - Administrator Latest Releases Catalog API + summary: Get a Node's Children + description: | + Returns the child nodes for a node from a published catalog. + + :::note + + Currently, published catalogs are limited to the current release and two releases prior to the current release. + + ::: + + You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. For more information, see [Building breadcrumbs in a storefront](#building-breadcrumbs-in-a-storefront). + + The response lists the products associated with the nodes. If products are [curated](https://beta.elasticpath.dev/guides/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront. + + - If you don't provide any `curated_products`, products are listed by their `updated_at` time in descending order, with the most recently updated product first. + - If you configure `curated_products` for only a few products, the curated products are displayed first and the other products are displayed in the order of `updated_at` time. + - You can only curate 20 products or less. You cannot have more than 20 curated products. + - If a curated product is removed from a node, the product is also removed from the `curated_products` list. + - A product that is curated has the `"curated_product": true` attribute displayed. + + ### Filtering + + This endpoint supports filtering. For general syntax, see (/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available. + + | Operator | Description | Attributes | Example | + | --- | --- | --- | --- | + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug` | `filter=eq(name,some-name)` | + | `in` | Checks if the values are included in the specified string. If they are, the condition is true. + | `Id` | `filter=in(id,9214719b-17fe-4ea7-896c-d61e60fc0d05,e104d541-2c52-47fa-8a9a-c4382480d97c,65daaf68-ff2e-4632-8944-370de835967d)` | + + ### Building breadcrumbs in a storefront + + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + - Specify the node Ids in the filter expression. + - You can have as many node Ids as you want. + - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + operationId: getChildNodes + parameters: + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. + name: release_id + in: path + required: true + schema: + type: string + - description: The catalog node ID. + name: node_id + in: path + required: true + schema: + type: string + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-node' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The child nodes of a catalog node. + content: + application/json: + schema: + $ref: '#/components/schemas/node-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /pcm/catalogs/{catalog_id}/releases/{release_id}/products: + get: + tags: + - Administrator Latest Releases Catalog API + summary: Get all Products + description: | + Returns the products from a published catalog. Only the products in a `live` status are retrieved. Currently, published catalogs are limited to the current release and two releases prior to the current release. + + You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + + The `variations` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. The `variations` object can then be added to your catalogs. By default, variations and variation options are sorted randomly. You can use the `sort_order` attribute to sort the order of your variation and variation options in `variations`. Once a parent product is published in a catalog, the [Get a List of products in a catalog release](/docs/api/pxm/catalog/get-all-products) response displays the sorted variations and variation options. Variations and variation options are displayed in descending order according to their `sort_order` values. + + Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + + | Parameter | Required | Description | + | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + | `main_image` | Optional | The main images associated with a product. | + | `files` | Optional | Any files associated with a product. + + See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + + ### Filtering + + This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. + + | Operator | Description | Supported Attributes | Example | + |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types`, you can only specify one product type. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | + + ### Building breadcrumbs in a storefront + + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + - Specify the node Ids in the filter expression. + - You can have as many node Ids as you want. + - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + + ### Including Resources + + Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + + | Parameter | Required | Description | + | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + | `main_image` | Optional | The main images associated with a product. | + | `files` | Optional | Any files associated with a product. | + + See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + operationId: getAllProducts + parameters: + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-product' + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. + name: release_id + in: path + required: true + schema: + type: string + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The products of a catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/product-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /pcm/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}: + get: + tags: + - Administrator Latest Releases Catalog API + summary: Get a Product + description: | + Returns a product from a published catalog. The product must be in `live` status. Currently, published catalogs are limited to the current release and two releases prior to the current release. + + ### Product and Node Associations in Breadcrumb Metadata + + You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + + ### Product Variations + + The `variations` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. The `variations` object can then be added to your catalogs. By default, variations and variation options are sorted randomly. You can use the `sort_order`attribute to sort the order of your variation and variation options in `variations`. Once a parent product is published in a catalog, the get a product in a catalog release response displays the sorted variations and variation options. Variations and variation options are displayed in descending order according to their `sort_order` values. + + ### Including Resources + + Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + + | Parameter | Required | Description | + | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + | `main_image` | Optional | The main images associated with a product. | + | `files` | Optional | Any files associated with a product. + + See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + operationId: getProduct + parameters: + - $ref: '#/components/parameters/accept-language' + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. + name: release_id + in: path + required: true + schema: + type: string + - description: The product ID. + name: product_id + in: path + required: true + schema: + type: string + responses: + '200': + description: The product of a catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/product-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /pcm/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/component_products: + get: + tags: + - Administrator Latest Releases Catalog API + summary: Get a Bundle's Component Products + description: | + With Product Experience Manager, you can [create](/docs/api/pxm/products/create-product) and manage bundles. A bundle is a purchasable product, comprising of one or more products that you want to sell together. + + You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. + + This endpoint returns a list of component product IDs for the specified bundle. + + ### Including Resources + + Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + + | Parameter | Required | Description | + | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + | `main_image` | Optional | The main images associated with a product. | + | `files` | Optional | Any files associated with a product. | + + See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + operationId: getComponentProductIDs + parameters: + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. + name: release_id + in: path + required: true + schema: + type: string + - description: The product ID. + name: product_id + in: path + required: true + schema: + type: string + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The list of component product IDs of a specific bundle product from a catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/product-reference-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /pcm/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/children: + get: + tags: + - Administrator Latest Releases Catalog API + summary: Get a Parent Product's Child Products + description: | + For a specified product and catalog release, retrieves a list of child products from a parent product. Any product other than a base product results in a `422 Unprocessable Entity` response. Only the products in a `live` status are retrieved. + + If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. If no catalog rules are configured, the first catalog found is returned. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + You can see the parent nodes a product is associated within the breadcrumbs metadata for each product. For example, this is useful if you want to improve how your shoppers search your store. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + + ### Filtering + + This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. + + | Operator | Description | Supported Attributes | Example | + |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types`, you can only specify one product type. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | + + ### Building breadcrumbs in a storefront + + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + - Specify the node Ids in the filter expression. + - You can have as many node Ids as you want. + - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + + ### Including Resources + + Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + + | Parameter | Required | Description | + | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + | `main_image` | Optional | The main images associated with a product. | + | `files` | Optional | Any files associated with a product. | + + See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + operationId: getChildProducts + parameters: + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. + name: release_id + in: path + required: true + schema: + type: string + - description: The product ID. + name: product_id + in: path + required: true + schema: + type: string + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-product' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The list of child products of a specific base product from a catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/product-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /pcm/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/products: + get: + tags: + - Administrator Latest Releases Catalog API + summary: Get a Hierarchy's Products + description: | + Returns the products associated with the specified hierarchy in the catalog. The products must be in the `live` status. + + If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. See [Resolving catalog rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + + The `variations` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. The variations object can then be added to your catalogs. By default, variations and variation options are sorted randomly. You can use the `sort_order` attribute to sort the order of your variation and variation options in variations. Once a parent product is published in a catalog, the [Get a List of products in a catalog](/docs/api/pxm/catalog/get-all-products) release response displays the sorted variations and variation options. Variations and variation options are displayed in descending order according to their `sort_order` values. + + ### Filtering + + This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. + + | Operator | Description | Supported Attributes | Example | + |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types`, you can only specify one product type. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | + + ### Building breadcrumbs in a storefront + + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + - Specify the node Ids in the filter expression. + - You can have as many node Ids as you want. + - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + + ### Including Resources + + Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + + | Parameter | Required | Description | + | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + | `main_image` | Optional | The main images associated with a product. | + | `files` | Optional | Any files associated with a product. | + + See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + operationId: getProductsForHierarchy + parameters: + - $ref: '#/components/parameters/accept-language' + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. + name: release_id + in: path + required: true + schema: + type: string + - description: The catalog hierarchy ID. + name: hierarchy_id + in: path + required: true + schema: + type: string + - $ref: '#/components/parameters/filter-product' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The products of a catalog hierarchy. + content: + application/json: + schema: + $ref: '#/components/schemas/product-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /pcm/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/products: + get: + tags: + - Administrator Latest Releases Catalog API + summary: Get a Node's Products + description: | + Returns the products associated with the specified hierarchy node in the catalog. The products must be in the `live` status. If the products have been curated, then the products are returned in the order specified in the `curated_products` attribute. A product that is curated has the `"curated_product": true` attribute displayed. + + :::note + + Currently, published catalogs are limited to the current release and two releases prior to the current release. + + ::: + + If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. See [Resolving catalog rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://elasticpath.dev/guides/Catalogs/breadcrumbs). + + The `variations` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. The `variations` object can then be added to your catalogs. By default, variations and variation options are sorted randomly. You can use the `sort_order` attribute to sort the order of your variation and variation options in `variations`. Once a parent product is published in a catalog, the [Get a List of products in a catalog release](/docs/api/pxm/catalog/get-all-products) response displays the sorted variations and variation options. Variations and variation options are displayed in descending order according to their `sort_order` values. + + ### Filtering + + This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. + + | Operator | Description | Supported Attributes | Example | + |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | + + ### Building breadcrumbs in a storefront + + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + - Specify the node Ids in the filter expression. + - You can have as many node Ids as you want. + - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + + ### Including Resources + + Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + + | Parameter | Required | Description | + | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + | `main_image` | Optional | The main images associated with a product. | + | `files` | Optional | Any files associated with a product. | + + See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + operationId: getProductsForNode + parameters: + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-product' + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. + name: release_id + in: path + required: true + schema: + type: string + - description: The catalog node ID. + name: node_id + in: path + required: true + schema: + type: string + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The products of a catalog node. + content: + application/json: + schema: + $ref: '#/components/schemas/product-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /catalog: + get: + tags: + - Releases + summary: Get the catalog release as shoppers + description: Returns a list of all published releases of the specified catalog. + operationId: getByContextRelease + parameters: + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + responses: + '200': + description: The catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/release-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /catalog/hierarchies: + get: + tags: + - Shopper Catalog API + summary: Get all Hierarchies + description: | + Returns all hierarchies from a catalog. + + If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + ### Filtering + + This endpoint supports filtering. For general syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). + + | Operator | Description | Supported Attributes | Example | + |:--- |:--- |:--- |:--- | + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | + | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | + + ### Building breadcrumbs in a storefront + + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + - Specify the node Ids in the filter expression. + - You can have as many node Ids as you want. + - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + operationId: getByContextAllHierarchies + parameters: + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - $ref: '#/components/parameters/filter-hierarchy' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The hierarchies of the catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/hierarchy-list-data' + default: + description: An unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /catalog/hierarchies/{hierarchy_id}: + get: + tags: + - Shopper Catalog API + summary: Get a Hierarchy + description: | + Returns a hierarchy from the catalog. + + If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog to retrieve. For information about how catalog rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules). + operationId: getByContextHierarchy + parameters: + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - description: The catalog hierarchy ID. + name: hierarchy_id + in: path + required: true + schema: + type: string + responses: + '200': + description: The catalog hierarchy. + content: + application/json: + schema: + $ref: '#/components/schemas/hierarchy-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /catalog/hierarchies/{hierarchy_id}/nodes: + get: + tags: + - Shopper Catalog API + summary: Get a Hierarchy's Nodes + description: | + Returns all the nodes for the specified hierarchy. + + If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + In the `bread_crumb` metadata, you can identify the parent nodes that a node is associated with. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + + ### Filtering + + This endpoint supports filtering. For general syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). + + | Operator | Description | Supported Attributes | Example | + |:--- |:--- |:--- |:--- | + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | + | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | + + ### Building breadcrumbs in a storefront + + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + - Specify the node Ids in the filter expression. + - You can have as many node Ids as you want. + - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + operationId: getByContextHierarchyNodes + parameters: + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-node' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + - description: The catalog hierarchy ID. + name: hierarchy_id + in: path + required: true + schema: + type: string + responses: + '200': + description: The child nodes of a catalog hierarchy. + content: + application/json: + schema: + $ref: '#/components/schemas/node-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /catalog/hierarchies/{hierarchy_id}/children: + get: + tags: + - Shopper Catalog API + summary: Get a Hierarchy's Children + description: | + Returns the parent nodes for the specified hierarchy. + + ![Parent Nodes](/assets/rootnodes.PNG) + + If you have multiple catalog rules defined, the rule that best matches the shopperʼs context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + In the `bread_crumb` metadata, you can identify the parent nodes that a node is associated with. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + + ### Filtering + + The following operators and attributes are available when filtering on this endpoint. + + | Operator | Description | Supported Attributes | Example | + |:--- |:--- |:--- |:--- | + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | + | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | + + For more information, see [Filtering](/docs/commerce-cloud/api-overview/filtering). + + ### Building breadcrumbs in a storefront + + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + - Specify the node Ids in the filter expression. + - You can have as many node Ids as you want. + - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + operationId: getByContextHierarchyChildNodes + parameters: + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-node' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + - description: The catalog hierarchy ID. + name: hierarchy_id + in: path + required: true + schema: + type: string + responses: + '200': + description: The child nodes of a catalog hierarchy. + content: + application/json: + schema: + $ref: '#/components/schemas/node-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /catalog/nodes: + get: + tags: + - Shopper Catalog API + summary: Get all Nodes + description: | + Returns all nodes in the catalog. + + If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. For more information, see [Building breadcrumbs in a storefront](#building-breadcrumbs-in-a-storefront). + + The response lists the products associated with the nodes. If products are [curated](https://beta.elasticpath.dev/guides/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront. + + - You can only curate 20 products or less. You cannot have more than 20 curated products. + - If a curated product is removed from a node, the product is also removed from the `curated_products` list. + + ### Filtering + + This endpoint supports filtering. For general syntax, see (/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available. + + | Operator | Description | Attributes | Example | + | --- | --- | --- | --- | + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug` | `filter=eq(name,some-name)` | + | `in` | Checks if the values are included in the specified string. If they are, the condition is true. + | `Id` | `filter=in(id,9214719b-17fe-4ea7-896c-d61e60fc0d05,e104d541-2c52-47fa-8a9a-c4382480d97c,65daaf68-ff2e-4632-8944-370de835967d)` | + + ### Building breadcrumbs in a storefront + + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + - Specify the node Ids in the filter expression. + - You can have as many node Ids as you want. + - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + operationId: getByContextAllNodes + parameters: + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-node' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The nodes of the catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/node-list-data' + default: + description: An unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /catalog/nodes/{node_id}: + get: + tags: + - Shopper Catalog API + summary: Get a Node + description: | + Returns a node from the catalog. + + If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + + The response lists the products associated with a node. If products are curated, they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your nodes, enabling you to create unique product collections in your storefront. + + - If you don't provide any `curated_products`, products are listed by their `updated_at` time in descending order, with the most recently updated product first. + - If you configure `curated_products` for only a few products, the curated products are displayed first and the other products are displayed in the order of `updated_at` time. + - You can only curate 20 products or less. You cannot have more than 20 curated products. + - A product that is curated has the `"curated_product": true` attribute displayed. + - If a curated product is removed from a node, the product is also removed from the `curated_products` list. + operationId: getByContextNode + parameters: + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - $ref: '#/components/parameters/accept-language' + - description: The catalog node ID. + name: node_id + in: path + required: true + schema: + type: string + responses: + '200': + description: The catalog node. + content: + application/json: + schema: + $ref: '#/components/schemas/node-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /catalog/nodes/{node_id}/relationships/children: + get: + tags: + - Shopper Catalog API + summary: Get a Node's Children + description: | + Returns the child nodes for a node in the catalog. + + If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + You can see which parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + + The response lists the products associated with the nodes. If products are [curated](https://beta.elasticpath.dev/guides/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront. + + - If you don't provide any curated_products, products are listed by their updated_at time in descending order, with the most recently updated product first. + - If you configure curated_products for only a few products, the curated products are displayed first and the other products are displayed in the order of updated_at time. + - You can only curate 20 products or less. You cannot have more than 20 curated products. + - A product that is curated has the "curated_product": true attribute displayed. + - If a curated product is removed from a node, the product is also removed from the curated_products list. + + ### Filtering + + This endpoint supports filtering. For general syntax, see (/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available. + + | Operator | Description | Attributes | Example | + | --- | --- | --- | --- | + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug` | `filter=eq(name,some-name)` | + | `in` | Checks if the values are included in the specified string. If they are, the condition is true. + | `Id` | `filter=in(id,9214719b-17fe-4ea7-896c-d61e60fc0d05,e104d541-2c52-47fa-8a9a-c4382480d97c,65daaf68-ff2e-4632-8944-370de835967d)` | + + ### Building breadcrumbs in a storefront + + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + - Specify the node Ids in the filter expression. + - You can have as many node Ids as you want. + - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + operationId: getByContextChildNodes + parameters: + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-node' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + - description: The catalog node ID. + name: node_id + in: path + required: true + schema: + type: string + responses: + '200': + description: The child nodes of a catalog node. + content: + application/json: + schema: + $ref: '#/components/schemas/node-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /catalog/products: + get: + tags: + - Shopper Catalog API + summary: Get all Products + description: | + Retrieves the list of products from the catalog. Only the products in a live status are retrieved. + + ### Catalog Rules + + If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. If no catalog rules are configured, the first catalog found is returned. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + ### Product and Node Associations + + You can see the parent nodes a product is associated within the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. For example, this is useful if you want to improve how your shoppers search your store. See [Product and Node Associations in Breadcrumb Metadata](https://elasticpath.dev/guides/Catalogs/breadcrumbs). + + + ### Including Resources + + Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + + | Parameter | Required | Description | + | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + | `main_image` | Optional | The main images associated with a product. | + | `files` | Optional | Any files associated with a product. | + + See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + + ### Filtering + + This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. + + | Operator | Description | Supported Attributes | Example | + |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | + + ### Building breadcrumbs in a storefront + + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + - Specify the node Ids in the filter expression. + - You can have as many node Ids as you want. + - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + + ### Including Resources + + Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + + | Parameter | Required | Description | + | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + | `main_image` | Optional | The main images associated with a product. | + | `files` | Optional | Any files associated with a product. | + + See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + operationId: getByContextAllProducts + parameters: + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - $ref: '#/components/parameters/filter-product' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The products of a catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/product-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /catalog/products/{product_id}: + get: + tags: + - Shopper Catalog API + summary: Get a Product + description: | + Returns the specified product from the catalog. The product must be in the `live` status. + + If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://elasticpath.dev/guides/Catalogs/breadcrumbs). + + Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + + | Parameter | Required | Description | + | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + | `main_image` | Optional | The main images associated with a product. | + | `files` | Optional | Any files associated with a product. | + + See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + operationId: getByContextProduct + parameters: + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - description: The product ID. + name: product_id + in: path + required: true + schema: + type: string + - $ref: '#/components/parameters/include' + responses: + '200': + description: The product of a catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/product-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /catalog/products/{product_id}/relationships/component_products: + get: + tags: + - Shopper Catalog API + summary: Get a Bundle's Component Products + description: | + With Product Experience Manager, you can [create](/docs/api/pxm/products/create-product) and manage bundles. A bundle is a purchasable product, comprising of one or more products that you want to sell together. + + You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. + + This endpoint returns a list of component product IDs for the specified bundle. + operationId: getByContextComponentProductIDs + parameters: + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - description: The product ID. + name: product_id + in: path + required: true + schema: + type: string + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The list of component product IDs of a bundle product from a catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/product-reference-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /catalog/products/{product_id}/relationships/children: + get: + tags: + - Shopper Catalog API + summary: Get a Parent Product's Child Products + description: | + For a specified product and catalog release, retrieves a list of child products from a parent product. Any product other than a base product results in a `422 Unprocessable Entity` response. Only the products in a `live` status are retrieved. + + If you have multiple catalog rules defined, the rule that best matches the shopperʼs context is used to determine which catalog is retrieved. If no catalog rules are configured, the first catalog found is returned. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + You can see the parent nodes a product is associated within the `breadcrumbs` metadata for each product. For example, this is useful if you want to improve how your shoppers search your store. See [Product and Node Associations in Breadcrumb Metadata](https://elasticpath.dev/guides/Catalogs/breadcrumbs). + + ### Filtering + + This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. + + | Operator | Description | Supported Attributes | Example | + |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | + + ### Building breadcrumbs in a storefront + + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + - Specify the node Ids in the filter expression. + - You can have as many node Ids as you want. + - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + + ### Including Resources + + Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + + | Parameter | Required | Description | + | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + | `main_image` | Optional | The main images associated with a product. | + | `files` | Optional | Any files associated with a product. | + + See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + operationId: getByContextChildProducts + parameters: + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - description: The product ID. + name: product_id + in: path + required: true + schema: + type: string + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-product' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The list of child products of a parent product from a catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/product-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /catalog/hierarchies/{hierarchy_id}/products: + get: + tags: + - Shopper Catalog API + summary: Get a Hierarchy's Products + description: | + Returns the products associated with the specified hierarchy in the catalog. The products must be in the live status. + + If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. See [Resolving catalog rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://elasticpath.dev/guides/Catalogs/breadcrumbs). + + ### Filtering + + This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. + + | Operator | Description | Supported Attributes | Example | + |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | + + ### Building breadcrumbs in a storefront + + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + - Specify the node Ids in the filter expression. + - You can have as many node Ids as you want. + - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + + ### Including Resources + + Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + + | Parameter | Required | Description | + | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + | `main_image` | Optional | The main images associated with a product. | + `files` | Optional | Any files associated with a product. | + + See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + operationId: getByContextProductsForHierarchy + parameters: + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - $ref: '#/components/parameters/filter-product' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + - description: The catalog hierarchy ID. + name: hierarchy_id + in: path + required: true + schema: + type: string + responses: + '200': + description: The products of a catalog hierarchy. + content: + application/json: + schema: + $ref: '#/components/schemas/product-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /catalog/nodes/{node_id}/relationships/products: + get: + tags: + - Shopper Catalog API + summary: Get a Node's Products + description: | + Returns the products associated with the specified hierarchy node in the catalog. The products must be in the `live` status. If the products have been curated then the products are returned in the order specified in the `curated_products` attribute. A product that is curated has the `"curated_product": true` attribute displayed. + + If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. See [Resolving catalog rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://elasticpath.dev/guides/Catalogs/breadcrumbs). + + ### Filtering + + This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. + + | Operator | Description | Supported Attributes | Example | + |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | + + ### Building breadcrumbs in a storefront + + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + - Specify the node Ids in the filter expression. + - You can have as many node Ids as you want. + - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + + ### Including Resources + + Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + + | Parameter | Required | Description | + | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + | `main_image` | Optional | The main images associated with a product. | + | `files` | Optional | Any files associated with a product. | + + See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + operationId: getByContextProductsForNode + parameters: + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - $ref: '#/components/parameters/filter-product' + - description: The catalog node ID. + name: node_id + in: path + required: true + schema: + type: string + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The products of a catalog node. + content: + application/json: + schema: + $ref: '#/components/schemas/product-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /catalog/products/{product_id}/configure: + post: + tags: + - Shopper Catalog API + summary: Configure a Shopper Bundle + description: | + Once you have configured your product bundles, you can display them in your storefront in your published catalog. Depending on how you have configured the minimum and maximum values for the product options in your components, you can allow your shoppers to choose which products they want to select. For example, you can enable a shopper to select 1 or more product options from a list of 10, giving your shoppers greater flexibility when selecting products in your store front. + + - Products must be in a `live` status. + - If you have not specified any minimum or maximum values for the product options in your components, your shoppers can select any combination of product options. + + If you have configured minimum and maximum values using [Create a Bundle](/docs/api/pxm/products/create-product), this becomes part of the `bundle_configuration`. You can check how your bundle is configured using [Get a product in a catalog release](/docs/api/pxm/catalog/get-product) in `bundle_configuration` under `meta`. The `bundle_configuration` forms the body of the request. + + The response updates the `bundle_configuration` with the product options the shopper selects. The `meta` data is updated with the `meta` data of the selected product options. In your storefront, you could display this as a summary of the product options a shopper has selected. + + ### Including Resources + + Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + + | Parameter | Required | Description | + | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + | `main_image` | Optional | The main images associated with a product. | + | `files` | Optional | Any files associated with a product. | + + See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + operationId: configureByContextProduct + parameters: + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - description: The product ID. + name: product_id + in: path + required: true + schema: + type: string + requestBody: + $ref: '#/components/requestBodies/bundle-configuration-data' + responses: + '200': + description: The configured product of a catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/product-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' +components: + parameters: + channel: + description: The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. + in: header + name: EP-Channel + required: false + schema: + type: string + accept-language: + description: The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + in: header + name: accept-language + required: false + schema: + type: string + tag: + description: Product tags are used to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. You can enhance your product list using tags, enabling you to refine your product list and run targeted promotions. Tags are used to refine the eligibility criteria for a rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. + in: header + name: EP-Context-Tag + required: false + schema: + type: string + limit: + description: The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + name: page[limit] + in: query + required: false + schema: + type: integer + format: int64 + minimum: 1 + offset: + description: The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + name: page[offset] + in: query + required: false + schema: + type: integer + format: int64 + minimum: 0 + maximum: 10000 + filter-rule: + name: filter + in: query + description: | + This endpoint supports filtering. See [Filtering](#filtering). + required: false + schema: + type: string + filter-hierarchy: + name: filter + in: query + description: | + + This endpoints supports filtering. See [Filtering](#filtering). + required: false + schema: + type: string + filter-node: + name: filter + in: query + description: | + This endpoint supports filtering, see [Filtering](#filtering). + required: false + schema: + type: string + filter-product: + name: filter + in: query + description: | + This endpoints support filtering. See [Filtering](#filtering). + required: false + schema: + type: string + include-component-products: + name: include + in: query + description: | + Using the `include=component_products` parameter, you can retrieve key attribute data for the bundle component products in the product bundle, such as SKU or slug . + required: false + schema: + type: string + include: + name: include + in: query + description: | + Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products. + required: false + schema: + type: array + items: + type: string + enum: [ main_images, files, component_products ] + requestBodies: + bundle-configuration-data: + content: + application/json: + schema: + $ref: '#/components/schemas/bundle-configuration-data' + description: The bundle configuration. + required: true + products-for-cart-configuration: + content: + application/json: + schema: + $ref: '#/components/schemas/products-for-cart-configuration' + description: A list of product id or sku and bundle configuration for cart. + required: true + securitySchemes: + bearerAuth: + type: http + name: Authorization + in: header + scheme: bearer + schemas: + amount: + type: object + description: The three-letter ISO code for the currency associated with this price. + title: Amount + properties: + amount: + description: The price in the lowest denomination for the specified currency. This is a product's list price. + type: integer + example: 100 + format: int64 + x-omitempty: false + x-go-name: Amount + includes_tax: + description: Whether this price includes tax. + type: boolean + example: false + default: false + x-go-name: IncludesTax + x-go-name: PriceAmount + prioritized-pricebooks: + description: If you want multiple price books for different scenarios, such as seasonal sales, business versus retail pricing, and reward programs, when creating a catalog, you can specify up to five price books. You must configure a priority for your price books. Product prices are displayed in the catalog according to the priority of the price books. + type: array + maxItems: 5 + items: + type: object + properties: + id: + description: A unique identifier of a price book. + type: string + format: uuid + priority: + description: Priority is a number and the price book with the highest number has the highest priority. + type: integer + required: + - priority + - id + x-go-name: PrioritizedPricebook + catalog: + type: object + title: Catalog + description: Creates a catalog with the following attributes. + properties: + id: + type: string + description: A unique identifier of a catalog. + example: 8dbb35b2-ef04-477e-974d-e5f3abe6faae + attributes: + type: object + properties: + name: + description: The name of a catalog. + type: string + example: catalog-123 + description: + description: A brief description of the catalog, such as the purpose of the catalog. + type: string + example: Catalog for Store 123 + default: '' + hierarchy_ids: + description: The unique identifiers of the hierarchies associated with a catalog. + type: array + items: + type: string + pricebook_id: + description: The unique identifier of a price book associated with a catalog. If no price book is selected, the catalog is displayed without prices. + type: string + pricebook_ids: + $ref: '#/components/schemas/prioritized-pricebooks' + locales: + description: Product Experience Manager supports localization of products and hierarchies. If you store supports multiple languages, you can localize product names and descriptions. + type: object + additionalProperties: + description: A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used. + type: object + additionalProperties: + description: A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used. + type: string + created_at: + description: The date and time a catalog is created. + type: string + example: '2020-09-22T09:00:00' + format: date-time + updated_at: + description: The date and time a catalog was updated. + type: string + example: '2020-09-22T09:00:00' + format: date-time + owner: + description: The owner of this resource, can be either `organization` or `store`. + type: string + enum: + - store + - organization + x-go-name: Owner + default: store + nullable: true + required: + - name + - hierarchy_ids + - created_at + - updated_at + relationships: + description: Relationships are established between different catalog entities. For example, a catalog rule and a price book are related to a catalog, as both are associated with it. + type: object + title: CatalogRelationships + properties: + rules: + description: The catalog rules related to a catalog. + type: object + properties: + links: + $ref: '#/components/schemas/related-link' + releases: + description: When a catalog is published, a catalog release is created. This is a URL to all catalog published releases available for this catalog. + type: object + properties: + links: + $ref: '#/components/schemas/related-link' + meta: + type: object + properties: + count: + description: The number releases available for a catalog. + type: integer + type: + type: string + example: catalog + enum: + - catalog + required: + - id + - type + - attributes + catalog-create-data: + type: object + title: CatalogCreateData + description: Creates a catalog with the following attributes. + properties: + data: + type: object + properties: + attributes: + type: object + properties: + name: + description: The name of the catalog. + type: string + minLength: 1 + example: catalog-123 + description: + description: A brief description of the catalog. + type: string + example: Catalog for Store 123 + nullable: true + hierarchy_ids: + description: The unique identifiers of the hierarchies to associate with a catalog. + type: array + items: + type: string + pricebook_id: + description: | + The unique identifier of the price book to associate with this catalog. You can specify either a `pricebook_id` or `pricebook_ids` but not both. If you specify both a `pricebook_id` and `pricebook_ids`, a `422 Unprocessable Entity` error is displayed. + type: string + pricebook_ids: + $ref: '#/components/schemas/prioritized-pricebooks' + locales: + description: Product Experience Manager supports localization of products and hierarchies. If you store supports multiple languages, you can localize product names and descriptions. + type: object + additionalProperties: + description: A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used. + type: object + additionalProperties: + description: A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used. + type: string + required: + - name + - hierarchy_ids + type: + description: Represents the type of object being returned. Always `Catalog`. + type: string + example: catalog + enum: + - catalog + required: + - type + - attributes + required: + - data + catalog-data: + type: object + title: CatalogData + description: Container for a single catalog. + properties: + data: + $ref: '#/components/schemas/catalog' + links: + $ref: '#/components/schemas/links' + required: + - data + catalog-list-data: + type: object + title: CatalogListData + description: Container for a list of catalogs. + properties: + data: + type: array + items: + $ref: '#/components/schemas/catalog' + links: + $ref: '#/components/schemas/links' + required: + - data + catalog-update-data: + type: object + title: CatalogUpdateData + description: A catalog combines price books, product lists, and hierarchies. + properties: + data: + type: object + properties: + attributes: + type: object + properties: + name: + description: The name of the catalog. + type: string + minLength: 1 + example: catalog-123 + nullable: true + description: + description: A brief description of the catalog. + type: string + example: Catalog for Store 123 + nullable: true + hierarchy_ids: + description: The unique identifiers of the hierarchies to associate with a catalog. + type: array + items: + type: string + nullable: true + pricebook_id: + description: The unique identifier of a price book to associate with a catalog. You can specify a `pricebook_id` or a `pricebook_ids` but not both. If you specify both, a `422 unprocessable entity` error is displayed. + type: string + nullable: true + pricebook_ids: + $ref: '#/components/schemas/prioritized-pricebooks' + locales: + description: Product Experience Manager supports localization of products and hierarchies. If you store supports multiple languages, you can localize product names and descriptions. + type: object + additionalProperties: + description: A [three-letter language code](https://www.loc.gov/standards/iso639-2/) that represents the name of language you have used. + type: object + additionalProperties: + description: A [three-letter language code](https://www.loc.gov/standards/iso639-2/) that represents the name of language you have used. + type: string + id: + description: The unique identifier of the catalog to be updated. + type: string + x-go-name: ID + example: 8dbb35b2-ef04-477e-974d-e5f3abe6faae + type: + description: This represents the type of object being returned. Always `catalog`. + type: string + example: catalog + enum: + - catalog + required: + - type + - id + - attributes + required: + - data + component-product: + type: object + title: Component Product + description: The unique identifier of the component, for example, `games`. + properties: + name: + description: The component name is the name that is displayed in your storefront. + type: string + x-go-name: Name + min: + description: The minimum number of product options a shopper can select from this component. + type: integer + x-go-name: Min + nullable: true + max: + description: The maximum number of product options a shopper can select from this component. + type: integer + x-go-name: Max + nullable: true + sort_order: + description: The sort order of the components. The `create a bundle` and `update a bundle` endpoints do not sort the components. You can use the `sort_order` attribute when programming your storefront to display the components in the order that you want. + type: integer + x-go-name: Sort Order + nullable: true + options: + description: The product options included in a component. This can be the ID of another bundle. + type: array + items: + $ref: '#/components/schemas/component-product-option' + x-go-name: Options + component-product-option: + type: object + title: Component Product Option + description: The product options included in a component. This can be the ID of another bundle. + properties: + id: + description: A unique identifier of the product you want to add to a component. + type: string + format: uuid + x-go-name: ID + type: + description: This represents the type of object being returned. Always `product`. + type: string + x-go-name: Type + default: product + example: product + enum: + - product + quantity: + description: The number of this product option that a shopper must purchase. + type: integer + example: 2 + x-go-name: Quantity + sort_order: + description: The sort order of the options. The `create a bundle` and `update a bundle` endpoints do not sort the options. You can use the `sort_order` attribute when programming your storefront to display the options in the order that you want. + type: integer + example: 15 + x-go-name: Sort Order + nullable: true + default: + description: The boolean indicates whether the current option is a default option for the component. + type: boolean + example: true + default: false + x-go-name: Default + nullable: true + components: + type: object + title: Components + description: A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. + additionalProperties: + $ref: '#/components/schemas/component-product' + custom-input-validation-rule-options: + type: object + description: The length of the custom input text field. + x-go-name: CustomInputValidationRuleOptions + properties: + max_length: + description: The number of characters the custom text field can be. You can specify a maximum length up to 255 characters, as the limit is 255 characters. + type: integer + x-go-name: MaxLength + example: 255 + custom-input-validation-rule: + type: object + title: Custom Input Validation Rule + description: The validation rules for the custom text. + x-go-name: CustomInputValidationRule + properties: + type: + description: This represents the type of object being returned. Must be `string`. + type: string + x-go-name: Type + default: string + example: string + enum: + - string + options: + $ref: '#/components/schemas/custom-input-validation-rule-options' + custom-input: + type: object + title: Custom Input + description: The name of the custom input. You can rename the input to something more representative of the input that shoppers are adding, for example, `message` or `front`. + properties: + name: + description: The name for the custom text field that is displayed in your storefront. + type: string + x-go-name: Name + example: Message + validation_rules: + description: The validation rules for the custom text. + type: array + x-go-name: ValidationRules + items: + $ref: '#/components/schemas/custom-input-validation-rule' + required: + description: This is `true` or `false` depending on whether the custom text is required. + type: boolean + x-go-name: Required + example: false + default: false + nullable: true + custom_inputs: + type: object + title: Custom Inputs + description: | + You can allow your shoppers to add custom text to a product when adding product items to their carts. This is useful, for example, if you have a product like a T-shirt that can be personalized or you sell greetings cards that can be printed with your shoppers personalized messages. You can do this using the `custom_inputs` attribute. + + - You can rename input to something more representative of the input that shoppers are adding, for example, `message` or `front`. + - `name` is the name that is displayed in your storefront. + - You can add validation rules. For example, the input field must be a string and/or up to 255 characters in length. The limit is 255 characters. + additionalProperties: + $ref: '#/components/schemas/custom-input' + currencies: + type: object + description: A collection of one or more currencies objects that consists of the [**three-letter ISO code**](https://www.iso.org/iso-3166-country-codes.html) of the currencies associated with this price and the amount. This is the product's price. + title: Currencies + additionalProperties: + $ref: '#/components/schemas/amount' + shopper_attributes: + type: object + description: The optional price extension with values in string format, viewable by shoppers. + title: ShopperAttributes + additionalProperties: + type: string + diff-list-data: + type: object + title: DiffListData + description: A list of differences between two releases. + properties: + data: + type: array + items: + $ref: '#/components/schemas/product-diff' + links: + $ref: '#/components/schemas/links' + display-price: + type: object + description: A price formatted for display. + x-omitempty: true + properties: + with_tax: + $ref: '#/components/schemas/formatted-price' + without_tax: + $ref: '#/components/schemas/formatted-price' + error: + type: object + title: APIError + description: APIError is a json-api style part of an error response. + properties: + detail: + type: string + example: not processable + x-go-name: Detail + status: + type: string + example: '422' + x-go-name: Status + title: + type: string + example: There was a problem processing your request. + x-go-name: Title + x-go-name: APIError + error-response: + type: object + title: ErrorResponse + description: ErrorResponse is a json-api style Error response. + properties: + errors: + type: array + items: + $ref: '#/components/schemas/error' + x-go-name: Errors + x-go-name: ErrorResponse + extension: + type: object + title: Extension + description: The name of the product template. + additionalProperties: + description: The product attributes available for this template. + type: object + extensions: + type: object + title: Extensions + description: With extension templates, you can attach a specific set of custom fields to your products in Product Experience Manager. For example, a **Book** template might contain the attributes, such as **ISBN**, **Author**, **Number of pages**, **Year Published**, or **Condition (New/Used)**. + additionalProperties: + $ref: '#/components/schemas/extension' + file-reference: + description: In Product Experience Manager, products can have associated rich media assets, such as product images or a file containing additional product details. + type: object + properties: + type: + description: This represents the type of object being returned. Always `file`. + type: string + example: file + enum: + - file + id: + description: A unique identifier for a file. + type: string + format: uuid + created_at: + description: The date and time a file is created. + type: string + format: date-time + example: '1970-01-01T00:00:00.000' + x-go-name: CreatedAt + x-go-name: FileRelationship + files-relationship: + description: In Product Experience Manager, products can have associated rich media assets, such as product images or a file containing additional product details. + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/file-reference' + x-omitempty: true + component-products-relationship: + description: A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. You can link to the products that make up your bundle components. + type: object + properties: + data: + $ref: '#/components/schemas/product-references' + links: + $ref: '#/components/schemas/self-link' + x-omitempty: true + formatted-price: + type: object + title: FormattedPrice + x-omitempty: true + description: A price formatted for display. + properties: + amount: + description: The price in the lowest denomination for the specified currency. This is a product's list price. + type: integer + x-omitempty: false + example: '47500' + currency: + description: The three-letter ISO code of the currencies associated with this price and the amount. + type: string + example: USD + formatted: + description: The format of the price for display. + type: string + example: $475.00 + hierarchy: + type: object + title: Hierarchy + description: A category hierarchy in a catalog. Hierarchies can have parent nodes and child nodes, as well as a list of attached products. + properties: + attributes: + $ref: '#/components/schemas/hierarchy-attributes' + id: + description: A unique identifier of a hierarchy. + type: string + example: e871df93-c769-49a9-9394-a6fd555b8e8a + x-go-name: ID + relationships: + $ref: '#/components/schemas/hierarchy-relationships' + type: + description: This represents the type of object being returned. Always `hierarchy`. + type: string + example: hierarchy + x-go-name: Type + meta: + $ref: '#/components/schemas/hierarchy-meta' + x-go-name: Hierarchy + hierarchy-meta: + type: object + title: HierarchyMeta + description: A hierarchy's metadata. + properties: + language: + description: Product Experience Manager supports localization of hierarchies. If your store supports multiple languages, you can localize hierarchy names and descriptions. This is [**three-letter language code**](https://www.iso.org/iso-639-language-code) that represents the name of the language you have used. + type: string + example: en-GB + x-go-name: HierarchyMeta + x-omitempty: true + hierarchy-attributes: + type: object + title: HierarchyAttributes + description: Resource attributes of a catalog hierarchy. + properties: + created_at: + description: The date and time a hierarchy is created. + type: string + format: date-time + example: '1970-01-01T00:00:00.000' + x-go-name: CreatedAt + published_at: + description: The date and time a hierarchy is published in a catalog. + type: string + format: date-time + example: '1970-01-01T00:00:00.000' + nullable: true + description: + description: A description of a hierarchy. + type: string + example: Formal dresswear + x-go-name: Description + name: + description: The name of a hierarchy. + type: string + example: Formal dresswear + x-go-name: Name + slug: + description: A unique slug for a hierarchy. + type: string + example: formal + x-go-name: Slug + updated_at: + description: The date and time a hierarchy was updated. + type: string + format: date-time + example: '1970-01-01T00:00:00.000' + x-go-name: UpdatedAt + x-go-name: HierarchyAttributes + hierarchy-data: + type: object + title: HierarchyData + description: Container for hierarchies. + properties: + data: + $ref: '#/components/schemas/hierarchy' + links: + $ref: '#/components/schemas/links' + hierarchy-list-data: + type: object + title: HierarchyListData + description: Container for a list of hierarchies. + properties: + meta: + $ref: '#/components/schemas/page-meta' + data: + type: array + items: + $ref: '#/components/schemas/hierarchy' + links: + $ref: '#/components/schemas/links' + hierarchy-relationships: + type: object + title: HierarchyRelationships + description: Relationships to child nodes, and products. + properties: + products: + description: A URL to all the products associated with a hierarchy. + type: object + properties: + links: + $ref: '#/components/schemas/related-link' + children: + description: A URL to all the child products associated with a hierarchy. + type: object + properties: + links: + $ref: '#/components/schemas/related-link' + required: + - links + nodes: + description: A URL to all the nodes associated with a hierarchy. + type: object + properties: + links: + $ref: '#/components/schemas/related-link' + required: + - links + x-go-name: HierarchyRelationships + links: + description: Links allow you to move between requests. + type: object + properties: + self: + description: Single entities use a `self` parameter with a link the specific resource. + type: string + format: uri + nullable: true + first: + description: Always the first page. + type: string + format: uri + nullable: true + last: + description: This is `null` if there is only one page. + type: string + format: uri + nullable: true + prev: + description: This is `null` if there is only one page. + type: string + format: uri + nullable: true + next: + description: This is `null` if there is only one page. + type: string + format: uri + nullable: true + included: + description: Included is an array of resources that are included in the response. + type: object + properties: + main_images: + description: The main images associated with a product. + type: array + items: + $ref: '#/components/schemas/file' + component_products: + description: The component products associated with a product. + type: array + items: + $ref: '#/components/schemas/product' + files: + description: The files associated with a product. + type: array + items: + $ref: '#/components/schemas/file' + main-image-relationship: + type: object + description: In Product Experience Manager, products can also have associated product images. + properties: + data: + description: The images associated with a product. + type: object + x-nullable: 'true' + properties: + type: + description: This represents the type of object being returned. Always `main_image`. + type: string + example: main_image + enum: + - main_image + id: + description: A unique identifier for an image. + type: string + format: uuid + x-omitempty: true + node: + type: object + title: Node + description: A category node in a catalog. Nodes can have child nodes, as well as a list of attached products. + properties: + attributes: + $ref: '#/components/schemas/node-attributes' + id: + description: The unique identifier of a node. + type: string + example: e871df93-c769-49a9-9394-a6fd555b8e8a + x-go-name: ID + relationships: + $ref: '#/components/schemas/node-relationships' + type: + description: This represents the type of object being returned. Always `node`. + type: string + example: node + x-go-name: Type + meta: + $ref: '#/components/schemas/node-meta' + x-go-name: Node + node-attributes: + type: object + title: NodeAttributes + description: Resource attributes of a catalog node. + properties: + created_at: + description: The date and time a node was created. + type: string + format: date-time + example: '1970-01-01T00:00:00.000' + x-go-name: CreatedAt + published_at: + description: The date and time a node was published in a catalog. + type: string + format: date-time + example: '1970-01-01T00:00:00.000' + nullable: true + description: + type: string + description: A description of a node. + example: Formal dresswear + x-go-name: Description + label: + type: string + example: category + x-go-name: Label + name: + description: The name of a node. Names must be unique among sibling nodes in a hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies. + type: string + example: Formal dresswear + x-go-name: Name + slug: + description: A slug for the node. Slugs must be unique among sibling nodes in the hierarchy. Otherwise, a slug can be non-unique within the hierarchy and across multiple hierarchies. + type: string + example: formal + x-go-name: Slug + curated_products: + description: A list of curated products for a node. You can curate your products in your nodes product lists. Product curation allows you to promote specific products within each node in a hierarchy, enabling you to create unique product collections in your storefront. + type: array + items: + type: string + example: 8dbb35b2-ef04-477e-974d-e5f3abe6faae + x-omitempty: true + status: + type: string + example: live + x-go-name: Status + updated_at: + description: The date and time a node was updated. + type: string + format: date-time + example: '1970-01-01T00:00:00.000' + x-go-name: UpdatedAt + x-go-name: NodeAttributes + node-create-data: + type: object + title: NodeCreateData + description: Container for nodes. + properties: + data: + type: object + title: NodeCreateArgs + description: A node in a catalog (e.g. a category node). Nodes can have child nodes, as well as a list of attached products + properties: + attributes: + type: object + title: NodeCreateAttributes + description: Resource attributes of a catalog node. + properties: + description: + type: string + example: Formal dresswear + x-go-name: Description + hierarchy_id: + type: string + description: hierarchy id of the node + example: ddd401ac-db06-4d9e-af60-cf5206abb9bc + label: + type: string + example: category + x-go-name: Label + name: + type: string + example: Formal dresswear + x-go-name: Name + slug: + type: string + example: formal + x-go-name: Slug + status: + type: string + example: Live + x-go-name: Status + locales: + type: object + additionalProperties: + type: object + additionalProperties: + type: string + required: + - name + relationships: + $ref: '#/components/schemas/node-relationships' + id: + type: string + example: 8fccaa19-dba9-4621-8d11-31a222a68c7c + x-go-name: ID + type: + type: string + example: node + x-go-name: Type + required: + - type + - attributes + links: + $ref: '#/components/schemas/links' + required: + - data + node-data: + type: object + title: NodeData + description: Container for nodes. + properties: + data: + $ref: '#/components/schemas/node' + links: + $ref: '#/components/schemas/links' + node-list-data: + type: object + title: NodeListData + description: Container for a list of nodes. + properties: + meta: + $ref: '#/components/schemas/page-meta' + data: + type: array + items: + $ref: '#/components/schemas/node' + links: + $ref: '#/components/schemas/links' + node-meta: + type: object + title: NodeMeta + description: A node's metadata. + properties: + language: + description: The node details localized in the supported languages. + type: string + example: en-GB + bread_crumb: + description: Helps you understand the association of products with nodes. It explains how products are associated with parent nodes and the relationship among the array of nodes. This is useful if you want to improve how your shoppers search within you store. + type: array + items: + type: string + example: 8dbb35b2-ef04-477e-974d-e5f3abe6faae + x-omitempty: true + x-go-name: NodeMeta + x-omitempty: true + node-reference: + type: object + title: NodeReference + description: Minimum set of information to identify a catalog node. + properties: + id: + description: The unique identifier of a hierarchy. + type: string + example: 65477ce0-fcb8-436b-a120-3d57979421dd + x-go-name: ID + label: + description: A label for a hierarchy. + type: string + example: category + x-go-name: Label + name: + description: The name of a hierarchy. + type: string + example: Formal dresswear + x-go-name: Name + x-go-name: NodeReference + node-relationships: + type: object + title: NodeRelationships + description: Relationships to parent and child nodes, and products. + properties: + products: + description: A URL to all products associated with a node. + type: object + properties: + data: + type: array + x-omitempty: true + items: + $ref: '#/components/schemas/product-reference' + links: + $ref: '#/components/schemas/related-link' + children: + description: A URL to all child nodes associated with a node. + type: object + properties: + links: + $ref: '#/components/schemas/related-link' + required: + - links + parent: + description: A URL to all parent nodes associated with a node. + type: object + properties: + data: + type: object + properties: + type: + type: string + example: node + enum: + - node + id: + type: string + example: 8fccaa19-dba9-4621-8d11-31a222a68c7c + x-go-name: ID + required: + - id + - type + links: + $ref: '#/components/schemas/related-link' + required: + - data + hierarchy: + description: A URL to the hierarchies associated with a node. + type: object + properties: + data: + type: object + properties: + type: + type: string + example: hierarchy + enum: + - hierarchy + id: + type: string + example: 8fccaa19-dba9-4621-8d11-31a222a68c7c + x-go-name: ID + required: + - id + - type + links: + $ref: '#/components/schemas/related-link' + required: + - data + x-go-name: NodeRelationships + node-relationships-data: + type: object + title: NodeRelationshipsData + description: Container for node relationships. + properties: + data: + $ref: '#/components/schemas/node-relationships' + links: + $ref: '#/components/schemas/links' + page-meta: + type: object + description: Contains the results for the entire collection. + title: PageMeta + properties: + results: + description: Total number of results for the entire collection. + type: object + properties: + total: + description: Total number of results for the entire collection. + type: integer + format: int64 + page: + type: object + properties: + limit: + description: The maximum number of records for all pages. + type: integer + format: int64 + offset: + description: The current offset by number of pages. + type: integer + format: int64 + current: + description: The current number of pages. + type: integer + format: int64 + total: + description: The total number of records for the entire collection. + type: integer + format: int64 + pricebook: + type: object + title: Pricebook + description: Top level entity in the pricebooks domain model. It contains a list of product prices. + properties: + id: + description: The unique identifier of a price book. + type: string + example: 4c45e4ec-26e0-4043-86e4-c15b9cf985a7 + x-go-name: ID + type: + description: This represents the type of object being returned. Always `pricebook`. + type: string + x-go-name: Type + default: pricebook + example: pricebook + enum: + - pricebook + attributes: + type: object + properties: + created_at: + type: string + format: date-time + example: '2020-09-22T09:00:00' + x-go-name: CreatedAt + description: + type: string + example: This is a pricebook + x-go-name: Description + nullable: true + name: + type: string + example: pricebook-store-abc + x-go-name: Name + nullable: true + updated_at: + type: string + example: '2020-09-22T09:00:00' + format: date-time + x-go-name: UpdatedAt + required: + - name + required: + - type + - attributes + additionalProperties: false + x-go-name: Pricebook + pricebook-create-data: + type: object + title: PricebookData + description: Container for pricebooks. + properties: + data: + type: object + description: New top level pricebook. + title: PricebookCreateArgs + properties: + type: + type: string + x-go-name: Type + default: pricebook + example: pricebook + enum: + - pricebook + attributes: + type: object + properties: + description: + type: string + example: This is a pricebook + x-go-name: Description + nullable: true + name: + type: string + example: pricebook-store-abc + x-go-name: Name + nullable: true + required: + - name + required: + - type + - attributes + additionalProperties: false + links: + $ref: '#/components/schemas/links' + required: + - data + pricebook-data: + type: object + title: PricebookData + description: Container for pricebooks. + properties: + data: + $ref: '#/components/schemas/pricebook' + links: + $ref: '#/components/schemas/links' + required: + - data + pricebook-price: + type: object + title: PricebookPrice + description: ProductPrice associates a collection of locale specific prices with a product ID. + properties: + type: + type: string + example: product-price + default: product-price + enum: + - product-price + attributes: + type: object + properties: + currencies: + $ref: '#/components/schemas/tiered-currencies' + sales: + $ref: '#/components/schemas/sales' + sku: + type: string + example: 4c45e4ec-sku + required: + - currencies + - sku + id: + type: string + example: 4c45e4ec-26e0-4043-86e4-c15b9cf985a7 + x-go-name: ID + required: + - type + - id + - attributes + additionalProperties: false + pricebook-price-create-data: + type: object + title: PricebookPriceCreateData + description: Container for pricebook prices. + properties: + data: + type: object + title: PricebookPriceCreateArgs + description: ProductPrice associates a collection of locale specific prices with a product ID. + properties: + type: + type: string + example: product-price + default: product-price + enum: + - product-price + attributes: + type: object + properties: + currencies: + $ref: '#/components/schemas/tiered-currencies' + sales: + $ref: '#/components/schemas/sales' + sku: + type: string + example: 4c45e4ec-sku + required: + - currencies + - sku + required: + - type + - attributes + links: + $ref: '#/components/schemas/links' + required: + - data + pricebook-price-data: + type: object + title: PricebookPriceData + description: Container for pricebook prices. + properties: + data: + $ref: '#/components/schemas/pricebook-price' + links: + $ref: '#/components/schemas/links' + required: + - data + product: + type: object + title: Product + description: A product in a catalog with the following attributes. + properties: + attributes: + $ref: '#/components/schemas/product-attributes' + id: + description: A unique identifier for a product. + type: string + example: 8fccaa19-dba9-4621-8d11-31a222a68c7c + x-go-name: ID + relationships: + $ref: '#/components/schemas/product-relationships' + type: + description: This represents the type of object being returned. Always `product`. + type: string + example: product + x-go-name: Type + meta: + $ref: '#/components/schemas/product-meta' + x-go-name: Product + product-attributes: + type: object + title: ProductAttributes + description: A product's attributes. + properties: + published_at: + description: The date and time a product was published in a catalog. + type: string + format: date-time + example: '1970-01-01T00:00:00.000' + nullable: true + base_product: + description: If this product is a `parent` product. A `parent` product is a product that has child products that have been built using the `build child products` endpoint. + type: boolean + example: false + default: false + x-go-name: BaseProduct + base_product_id: + description: The unique identifier of a `parent` product. + type: string + example: cdf574bc-e36e-48fc-9eac-01c87839b285 + x-go-name: BaseProductID + commodity_type: + description: The commodity type, either `physical` or `digital`. + type: string + example: physical + x-go-name: CommodityType + curated_product: + description: If a product is curated, then the `curated_product` attribute with a value of `true` is displayed. If a product is not curated, the `curated_product` attribute is not displayed. + type: boolean + example: true + x-omitempty: true + x-go-name: CuratedProduct + upc_ean: + description: The universal product code or european article number of the product. + type: string + example: '0123456' + x-go-name: UpcEan + manufacturer_part_num: + description: The manufacturer part number of the product. + type: string + example: mfn1 + x-go-name: ManufacturerPartNum + tags: + type: array + description: A list of tags associated with the product. A tag must be HTML compatible characters excluding commas and will be stored in lowercase letters. + items: + description: A tag associated with the product. + type: string + example: tag-a + x-go-name: Tags + x-omitempty: true + price_modifiers: + type: array + description: A list of price modifier names. + items: + description: A list of price modifier names. + type: string + example: modifier-1 + x-go-name: PriceModifiers + x-omitempty: true + created_at: + description: The date and time a product was created. + type: string + format: date-time + example: '1970-01-01T00:00:00.000' + x-go-name: CreatedAt + description: + description: A description of the product. + type: string + example: This is a product + x-go-name: Description + name: + description: A name of a product. + type: string + example: Blue shirt + x-go-name: Name + price: + $ref: '#/components/schemas/currencies' + shopper_attributes: + $ref: '#/components/schemas/shopper_attributes' + tiers: + $ref: '#/components/schemas/tiers' + components: + $ref: '#/components/schemas/components' + custom_inputs: + $ref: '#/components/schemas/custom_inputs' + sku: + description: The unique stock keeping unit of the product. + type: string + example: blue-shirt + x-go-name: Sku + slug: + description: A label for the product that is used in the URL paths. A slug can contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. By default, the product name is used as the slug. + type: string + example: blue-shirt + x-go-name: Slug + status: + description: The status of the product, either `live` or `draft`. + type: string + example: live + x-go-name: Status + external_ref: + description: The unique attribute associated with the product. This could be an external reference from a separate company system, for example. + type: string + x-go-name: ExternalRef + nullable: true + updated_at: + description: The date and time a product was updated. + type: string + example: '1970-01-01T00:00:00.000' + format: date-time + x-go-name: UpdatedAt + extensions: + $ref: '#/components/schemas/extensions' + x-go-name: ProductAttributes + product-create-data: + type: object + title: ProductData + description: Container for products. + properties: + data: + type: object + title: ProductCreateArgs + description: A new product in a catalog. + properties: + attributes: + type: object + title: ProductCreateAttributes + description: A product's attributes. + properties: + description: + type: string + example: This is a product + name: + type: string + example: Blue shirt + sku: + type: string + example: blue-shirt + slug: + type: string + example: blue-shirt + status: + type: string + example: live + locales: + type: object + additionalProperties: + type: object + additionalProperties: + type: string + required: + - name + - status + id: + type: string + example: 8fccaa19-dba9-4621-8d11-31a222a68c7c + x-go-name: ID + type: + type: string + example: product + x-go-name: Type + required: + - attributes + - type + links: + $ref: '#/components/schemas/links' + product-data: + type: object + title: ProductData + description: Container for products. + properties: + data: + $ref: '#/components/schemas/product' + links: + $ref: '#/components/schemas/links' + included: + $ref: '#/components/schemas/included' + product-diff: + x-go-name: ProductDiff + type: object + properties: + id: + type: string + example: e871df93-c769-49a9-9394-a6fd555b8e8a + x-go-name: ID + type: + type: string + example: product_diff + x-go-name: Type + attributes: + type: object + properties: + sku: + type: string + this_release_id: + type: string + other_release_id: + type: string + diff_created_at: + type: string + format: date-time + example: '1970-01-01T00:00:00.000' + exists: + x-go-name: ProductDiffExists + type: object + properties: + this: + type: boolean + other: + type: boolean + required: + - this + - other + updated_at: + x-go-name: ProductDiffUpdatedAt + type: object + properties: + this: + type: string + format: date-time + example: '1970-01-01T00:00:00.000' + x-omitempty: true + nullable: true + other: + type: string + format: date-time + example: '1970-01-01T00:00:00.000' + x-omitempty: true + nullable: true + product-list-data: + type: object + title: ProductListData + description: Container for a list of products. + properties: + meta: + $ref: '#/components/schemas/page-meta' + data: + type: array + items: + $ref: '#/components/schemas/product' + x-go-name: Data + links: + $ref: '#/components/schemas/links' + product-meta: + type: object + title: ProductMeta + description: A product's metadata contains information about products, for example, the nodes a product is associated with, any child products, bundle configurations, and so on. + properties: + bread_crumbs: + description: The relationship among the array of nodes a product is associated with, demonstrating the linking of the children nodes with the parent nodes. Up to 10 levels of parent nodes are displayed, depending on the number of levels of parent nodes you have. + type: object + additionalProperties: + type: array + items: + type: string + example: 8dbb35b2-ef04-477e-974d-e5f3abe6faae + x-omitempty: true + bread_crumb_nodes: + description: An array of parent node IDs that a product is associated with. Up to 10 levels of parent nodes are displayed, depending on the number of levels of parent nodes you have. + type: array + items: + type: string + example: 8dbb35b2-ef04-477e-974d-e5f3abe6faae + x-omitempty: true + catalog_id: + description: A unique identifier of the catalog a product is associated with. + type: string + example: 362a16dc-f7c6-4280-83d6-4fcc152af091 + x-go-name: CatalogID + pricebook_id: + description: The unique identifier of the price book a product is associated with. + type: string + example: f5466169-0037-460c-b181-b02682b6f4de + x-go-name: PricebookID + nullable: true + display_price: + $ref: '#/components/schemas/display-price' + catalog_source: + description: The source of a catalog. Always `pim`. + type: string + example: pim + enum: + - pim + x-go-name: CatalogSource + sale_id: + description: With sales pricing, a store can optionally add a sale price to a product price. For example, a store can schedule seasonal pricing on products without creating a new price book and catalog ruleset. Optionally, a store can schedule the date ranges for the sale products. This is the unique identifier of a sale. + type: string + x-go-name: SaleID + sale_expires: + description: The date and time a sale expires. + type: string + format: date-time + example: '1970-01-01T00:00:00.000' + x-go-name: SaleExpires + nullable: true + original_price: + $ref: '#/components/schemas/currencies' + original_display_price: + $ref: '#/components/schemas/display-price' + bundle_configuration: + $ref: '#/components/schemas/bundle-configuration' + component_products: + description: A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. + type: object + additionalProperties: + type: object + properties: + sale_id: + description: With sales pricing, a store can optionally add a sale price to a product price. For example, a store can schedule seasonal pricing on products without creating a new price book and catalog ruleset. Optionally, a store can schedule the date ranges for the sale products. This is the unique identifier of a sale. + type: string + x-go-name: SaleID + sale_expires: + description: The date and time a sale expires. + type: string + format: date-time + example: '1970-01-01T00:00:00.000' + x-go-name: SaleExpires + nullable: true + price: + $ref: '#/components/schemas/currencies' + display_price: + $ref: '#/components/schemas/display-price' + original_price: + $ref: '#/components/schemas/currencies' + original_display_price: + $ref: '#/components/schemas/display-price' + pricebook_id: + type: string + example: f5466169-0037-460c-b181-b02682b6f4de + x-go-name: PricebookID + nullable: true + x-go-name: ComponentProductMeta + price_modifiers: + type: object + description: You can use price modifiers to change the price property of child products. By default, child products inherit the same price as their base products. Using price modifiers, you can enable child products to inherit a different price. + additionalProperties: + description: A name for the modifier. The name must be unique and is case-sensitive. + type: object + properties: + modifier_type: + description: | + There are three modifier types. + + - The `price_increment` type increases the prices of a product. + - The `price_decrement` type decreases the price of a product. + - The `price_equals` type sets the price of a product to an amount you specify. + type: string + example: price_equals + currencies: + $ref: '#/components/schemas/currencies' + x-go-name: PriceModifierMeta + tiers: + description: You can use tiers to allow your store to offer different pricing for minimum quantities of items that your shoppers purchase. + type: object + additionalProperties: + description: The name of the tier, such as `Pencils`. + type: object + properties: + sale_id: + description: The unique identifier of a sale. + type: string + x-go-name: SaleID + sale_expires: + description: The date and time a sale expires. + type: string + format: date-time + example: '1970-01-01T00:00:00.000' + x-go-name: SaleExpires + nullable: true + display_price: + $ref: '#/components/schemas/display-price' + original_price: + $ref: '#/components/schemas/currencies' + original_display_price: + $ref: '#/components/schemas/display-price' + x-go-name: ProductMetaTier + x-go-name: ProductMetaTiers + variation_matrix: + description: The `variation_matrix` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. If no variations are available, the `variation_matrix` is empty. + type: object + variations: + description: If you specified `build_rules` for a product, the `variations` object lists the variation option IDs that you specified to include when building your child products. If no `build_rules` are specified, all the variation and variation options available for a product are displayed. If a product does not have any variations, then the `variations` object is not displayed. + type: array + items: + $ref: '#/components/schemas/variation' + x-omitempty: true + child_option_ids: + description: An array of variation options IDs that a child product has. + type: array + items: + type: string + example: + - 8dbb35b2-ef04-477e-974d-e5f3abe6faae + - 6ddf2a66-d805-449c-a0e1-8e81335e31a6 + x-omitempty: true + nullable: true + child_variations: + description: If this is a child product, the `child_variations` object lists the variation option IDs that define this child product. + type: array + items: + $ref: '#/components/schemas/variation' + x-omitempty: true + nullable: true + product_types: + description: | + Commerce automatically assigns types to the products you create. In Commerce Manager, you can see at a glance the product types in a list of a products. In addition, you can filter on product types in both the API and Commerce Manager. + + Product types can also be used in catalogs. For example, in your catalog, you can filter on parent so that only your parent products are displayed in your storefront. + + Products have one of the following types: + + - **standard** - Standard products are a standalone products. + - **parent** - A parent product is a product that has child products that have been built using the `Build Child Products` endpoint. + - **child** - When you configure product variations and variation options for parent products, the child products derived from the parent products are automatically created in Commerce. + - **bundle** - A bundle is a purchasable product, comprising two or more standalone products (in other words, components) to be sold together. + type: array + items: + type: string + x-omitempty: true + x-go-name: ProductTypes + language: + description: If you storefront supports multiple languages, your storefront's preferred language and locale. + type: string + example: en-GB + x-go-name: ProductMeta + x-omitempty: true + variation_option: + description: The options available for a variation. + type: object + properties: + id: + description: A unique identifier for an option. + type: string + format: uuid + x-go-name: ID + name: + description: The name of the option. + type: string + sort_order: + description: If you specified a `sort_order` when creating your variations and variation options, then use the `sort_order` value to program your storefront to display the variations and variation options in the order that you want. + type: integer + x-go-name: Sort Order + nullable: true + description: + description: The option description to display to customers. + type: string + x-go-name: ProductVariationOption + variation: + type: object + properties: + id: + description: A unique identifier of a variation. + type: string + format: uuid + x-go-name: ID + name: + description: The name of a variation. + type: string + sort_order: + description: If you specified a `sort_order` when creating your variations and variation options, then use the `sort_order` value to program your storefront to display the variations and variation options in the order that you want. + type: integer + x-go-name: Sort Order + nullable: true + option: + $ref: '#/components/schemas/variation_option' + options: + description: The options available for this variation. + type: array + x-omitempty: true + items: + $ref: '#/components/schemas/variation_option' + x-go-name: ProductVariation + bundle-configuration-data: + type: object + title: BundleConfigurationData + description: Container for a bundle configuration. + properties: + data: + $ref: '#/components/schemas/bundle-configuration' + required: + - data + bundle-configuration: + type: object + title: BundleConfiguration + description: A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. + properties: + selected_options: + type: object + description: The product options included in a component. This can be the ID of another bundle. + additionalProperties: + description: The unique identifier of the component, for example, `games`. + type: object + additionalProperties: + description: The number of this product option that a shopper must purchase. + type: integer + format: int64 + required: + - selected_options + x-go-name: ProductBundleConfiguration + product-reference: + type: object + title: ProductReference + description: A product identifier. + x-nullable: 'true' + properties: + id: + description: A unique identifier for a product. + type: string + format: uuid + x-go-name: ID + type: + description: This represents the type of object being returned. Always `product`. + type: string + x-go-name: Type + example: product + enum: + - product + x-go-name: ProductReference + product-reference-list-data: + type: object + title: ProductReferenceListData + description: Container for a list of product references. + properties: + meta: + $ref: '#/components/schemas/page-meta' + data: + $ref: '#/components/schemas/product-references' + links: + $ref: '#/components/schemas/links' + product-references: + type: array + title: ProductReferences + description: A list of product identifiers. + items: + $ref: '#/components/schemas/product-reference' + x-go-name: ProductReferences + product-relationships: + type: object + title: ProductRelationships + description: Relationships allow you to move between requests. Includes links to the parent and child products, bundle component products, files, and main images associated with a product. + properties: + parent: + description: The details of a `parent` product. A `parent` product is a product that has child products that have been built using the `Build Child Products` endpoint. + type: object + properties: + data: + $ref: '#/components/schemas/product-reference' + x-go-name: Parent + x-omitempty: true + children: + description: The details of a `child` product. When you configure product variations and variation options for parent products, the child products derived from the parent products are automatically created in Commerce. + type: object + properties: + data: + $ref: '#/components/schemas/product-references' + links: + $ref: '#/components/schemas/self-link' + x-go-name: Children + x-omitempty: true + files: + $ref: '#/components/schemas/files-relationship' + main_image: + $ref: '#/components/schemas/main-image-relationship' + component_products: + $ref: '#/components/schemas/component-products-relationship' + x-go-name: ProductRelationships + x-omitempty: true + product-relationships-data: + type: object + title: ProductRelationshipsData + description: Container for product relationships. + properties: + data: + $ref: '#/components/schemas/product-relationships' + links: + $ref: '#/components/schemas/links' + products-for-cart: + type: object + title: ProductsForCart + description: A list of products to be added to cart. Can be type product-data or error-response. + properties: + data: + type: array + items: {} + x-go-name: Data + included: + type: object + x-go-name: Included + properties: + component_products: + type: array + items: + $ref: '#/components/schemas/product' + x-go-name: ComponentProducts + nullable: true + required: + - data + x-go-name: ProductsForCart + products-for-cart-configuration: + type: object + title: ProductsForCartConfiguration + description: A list of product id or sku and bundle configuration for cart. + properties: + data: + type: array + minItems: 1 + items: + type: object + properties: + id: + type: string + format: uuid + x-go-name: ID + nullable: true + sku: + type: string + x-go-name: SKU + nullable: true + bundle_configuration: + $ref: '#/components/schemas/bundle-configuration' + x-go-name: Data + required: + - data + x-go-name: ProductsForCartConfiguration + related-link: + description: A URL to a related object, for example, catalog rules, hierarchies, price books, products and deltas. + type: object + properties: + related: + description: A URL to a related object, for example, catalog rules, hierarchies, price books, products and deltas. + type: string + required: + - related + self-link: + description: Links are used to allow you to move between requests. + type: object + properties: + self: + description: Single entities use a self parameter with a link to that specific resource. + type: string + required: + - self + release: + type: object + title: Release + description: A catalog release represents a collection of hierarchical product data, price books and catalogs rules. + properties: + id: + description: A unique identifier for the catalog release. + type: string + x-go-name: ID + example: 8dbb35b2-ef04-477e-974d-e5f3abe6faae + attributes: + type: object + properties: + name: + description: The name of a release. + type: string + example: Clothing + published_at: + description: The date and time a release was published. + type: string + format: date-time + example: '1970-01-01T00:00:00.000' + nullable: true + catalog_id: + description: A unique identifier for the catalog. + type: string + example: 0194f54d-f2a1-4e33-9a6e-9ec366152490 + description: + description: A description of the catalog release. + type: string + example: Catalog for Store 123 + default: '' + hierarchies: + description: An array of hierarchy IDs associated with the release. + type: array + items: + $ref: '#/components/schemas/node-reference' + x-go-name: RootNodes + relationships: + $ref: '#/components/schemas/release-relationships' + type: + description: This represents the type of object being returned. Always `catalog-release`. + type: string + x-go-name: Type + meta: + $ref: '#/components/schemas/release-meta' + x-go-name: Release + release-data: + type: object + title: Release Data + description: Container for a catalog release. + properties: + data: + $ref: '#/components/schemas/release' + links: + $ref: '#/components/schemas/links' + release-list-data: + type: object + title: ReleaseListData + description: Container for a list of catalog releases. + properties: + data: + type: array + items: + $ref: '#/components/schemas/release' + links: + $ref: '#/components/schemas/links' + release-meta: + type: object + title: ReleaseMeta + description: A release's metadata. + properties: + created_at: + description: The date and time a release is created. + type: string + format: date-time + example: '1970-01-01T00:00:00.000' + started_at: + description: The date and time a release is available for use. In other words, the date and time the status of a catalog release changes to PUBLISHED, rather than IN PROGRESS. + type: string + format: date-time + example: '1970-01-01T00:00:00.000' + nullable: true + updated_at: + description: The date and time a release is updated. + type: string + format: date-time + example: '1970-01-01T00:00:00.000' + nullable: true + release_status: + description: The status of the current release. + type: string + enum: + - PENDING + - IN_PROGRESS + - FAILED + - PUBLISHED + language: + description: Your storefront's preferred language code and locale. + type: string + example: en-GB + is_full_publish: + description: | + Indicates that a full publish was performed (either because this is the first time a catalog has been published or because of a change that occurred, for example, adding/removing a price book or hierarchy). When determining whether delta data needs to be refreshed, ignore this attribute and always use the `is_full_delta` attribute. + type: boolean + example: false + default: false + x-go-name: IsFullPublish + is_full_delta: + description: | + Indicates whether the release delta file contains the full content of a catalog release. Using a search service as an example, if the `is_full_delta` attribute is `true`, you should remove all data about that catalog release from the search service before injecting fresh data from the delta file. If the `is_full_delta` attribute is `false`, then data from the previous catalog release overlays the existing data in the delta file. The `is_full_delta` attribute is always `true` the first time a catalog is published. + type: boolean + example: false + default: false + x-go-name: IsFullDelta + total_products: + description: The total number of products displayed in a catalog release. + type: integer + format: int64 + x-go-name: TotalProducts + nullable: true + total_nodes: + description: The total number of hierarchy nodes displayed in a catalog release. + type: integer + format: int64 + x-go-name: TotalNodes + nullable: true + percent_completed: + description: An integer that represents the progress of a catalog publish. The attribute starts at `0` and reaches `100` when publishing is complete. + type: integer + format: int32 + x-go-name: PercentCompleted + nullable: true + owner: + description: The owner of the resource, can be either `organization` or `store`. + type: string + enum: + - store + - organization + x-go-name: Owner + nullable: true + x-go-name: ReleaseMeta + x-omitempty: true + release-relationships: + type: object + title: ReleaseRelationships + description: Relationships are established between different catalog entities. For example, products, hierarchies, price books, and catalog rules are related to a catalog, as they are associated with it. + properties: + delta: + description: A URL to a delta document that describes the changes between catalog releases. + type: object + properties: + links: + $ref: '#/components/schemas/related-link' + products: + description: A URL to all products included in a catalog release. + type: object + properties: + links: + $ref: '#/components/schemas/related-link' + hierarchies: + description: A URL to all hierarchies included in a catalog release. + type: object + properties: + links: + $ref: '#/components/schemas/related-link' + required: + - links + x-go-name: ReleaseRelationships + rule: + type: object + title: Catalog Rule + description: A catalog rule specifies which catalog to use for a given shopper context. + properties: + id: + type: string + description: The catalog rule ID. Use this to get, modify, or delete the catalog rule. + example: 8dbb35b2-ef04-477e-974d-e5f3abe6faae + attributes: + type: object + properties: + name: + description: The name of a catalog rule. The name must not contain any spaces. + type: string + example: rule-123 + description: + description: A brief description of the purpose of a catalog rule. + type: string + example: Catalog Rule for most favored customers + default: '' + x-omitempty: true + account_ids: + description: The list of accounts who are eligible to see this catalog. If this field is empty, the rule matches all accounts. + type: array + items: + type: string + x-omitempty: true + customer_ids: + description: The list of customers who are eligible to see this catalog. If empty, the rule matches all customers. + type: array + items: + type: string + x-omitempty: true + channels: + description: The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. + type: array + items: + type: string + x-omitempty: true + tags: + description: A list of user-defined tags that can be used to further restrict the eligibility criteria for this rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. + type: array + items: + type: string + x-omitempty: true + schedules: + description: | + Specifies a time period when a catalog is displayed, such as on a specific date or during summer. Requests populate the rule tag using the `EP-Context-Tag` header. + + The schedules attribute must include the following. + + - `valid_from` matches the date and time that the catalog is displayed from. + - `valid_to` matches the date and time the catalog is displayed to. + + Commerce runs on UTC time. + + You can offset the timezone by adding the offset to the end of the date and time. For example, a catalog which contains a sale hierarchy that should appear for a set timeframe may be scheduled to publish on a given date and time within a given timezone. For instance, a sale that should begin on 1st of June 2022 05:00 ET and end on the 15th of June 2022 at 23:50 PT would have a valid schedule of `"valid_from": "2022-06-01T05:00:00.000-05:00"`, `"valid_to": "2022-06-15T11:59:99.000-08:00"`. + type: array + items: + $ref: '#/components/schemas/rule-schedule' + x-omitempty: true + catalog_id: + type: string + description: The unique identifier of a catalog. + example: d09b4e16-08a5-4f42-817c-6e0d98acbb63 + created_at: + description: The date and time a catalog rule was created. + type: string + example: '2020-09-22T09:00:00' + format: date-time + updated_at: + description: The date and time a catalog release is updated. + type: string + example: '2020-09-22T09:00:00' + format: date-time + required: + - name + - catalog_id + - created_at + - updated_at + type: + description: This represents the type of object being returned. Always `catalog_rule`. + type: string + example: catalog_rule + enum: + - catalog_rule + required: + - id + - type + - attributes + rule-create-data: + type: object + title: CatalogRuleCreateData + description: A catalog rule specifies which catalog to use for a given shopper context. + properties: + data: + type: object + properties: + attributes: + type: object + properties: + name: + description: The name of a catalog rule. The name must not contain spaces. + type: string + minLength: 1 + example: rule-123 + description: + description: A brief description of the purpose of a catalog rule. + type: string + example: Catalog Rule for most favored customers + default: '' + nullable: true + account_ids: + description: The list of accounts who are eligible to see this catalog. If this field is empty, the rule matches all accounts. + type: array + items: + type: string + nullable: true + customer_ids: + description: The list of customers who are eligible to see this catalog. If empty, the rule matches all customers. + type: array + items: + type: string + nullable: true + channels: + description: The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. + type: array + items: + type: string + nullable: true + tags: + description: A list of user-defined tags that can be used to further restrict the eligibility criteria for this rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. + type: array + items: + type: string + nullable: true + schedules: + description: | + Specifies a time period when a catalog is displayed, such as on a specific date or during summer. Requests populate the rule tag using the `EP-Context-Tag` header. + + The schedules attribute must include the following. + + - `valid_from` matches the date and time that the catalog is displayed from. + - `valid_to` matches the date and time the catalog is displayed to. + + Commerce runs on UTC time. + + You can offset the timezone by adding the offset to the end of the date and time. For example, a catalog which contains a sale hierarchy that should appear for a set timeframe may be scheduled to publish on a given date and time within a given timezone. For instance, a sale that should begin on 1st of June 2022 05:00 ET and end on the 15th of June 2022 at 23:50 PT would have a valid schedule of `"valid_from": "2022-06-01T05:00:00.000-05:00"`, `"valid_to": "2022-06-15T11:59:99.000-08:00"`. + type: array + items: + $ref: '#/components/schemas/rule-schedule' + nullable: true + catalog_id: + type: string + description: The unique identifier of a catalog. + example: d09b4e16-08a5-4f42-817c-6e0d98acbb63 + required: + - name + - catalog_id + type: + description: This represents the type of object being returned. Always `catalog_rule`. + type: string + example: catalog_rule + enum: + - catalog_rule + required: + - type + - attributes + required: + - data + rule-data: + type: object + title: CatalogRuleData + description: Container for a single catalog rule. + properties: + data: + $ref: '#/components/schemas/rule' + links: + $ref: '#/components/schemas/links' + required: + - data + rule-list-data: + type: object + title: CatalogRuleListData + description: Container for a list of catalog rules. + properties: + meta: + $ref: '#/components/schemas/page-meta' + data: + type: array + items: + $ref: '#/components/schemas/rule' + links: + $ref: '#/components/schemas/links' + required: + - data + rule-schedule: + type: object + title: Catalog Schedule + description: A period of time during which a catalog is valid + properties: + valid_from: + description: Matches the date and time that the catalog is displayed from. + type: string + example: '2020-09-22T09:00:00' + format: date-time + x-go-name: ValidFrom + nullable: true + valid_to: + description: Matches the date and time the catalog is displayed to. + type: string + example: '2020-09-22T09:00:00' + format: date-time + x-go-name: ValidTo + nullable: true + x-go-name: RuleSchedule + rule-update-data: + type: object + title: CatalogRuleUpdateData + description: A catalog rule specifies which catalog to use for a given shopper context. + properties: + data: + type: object + properties: + id: + type: string + description: The catalog rule ID. Use this to get, modify, or delete the catalog rule. + example: 8dbb35b2-ef04-477e-974d-e5f3abe6faae + attributes: + type: object + properties: + name: + description: The name of a catalog rule. The name must not contain spaces. + type: string + minLength: 1 + example: rule-123 + nullable: true + description: + description: A description of the purpose of a catalog rule. + type: string + example: Catalog Rule for most favored customers + default: '' + nullable: true + account_ids: + description: Specifies the list of accounts who are eligible to see this catalog. If this field is empty, the rule matches all accounts. + type: array + items: + type: string + nullable: true + customer_ids: + description: The list of customers who are eligible to see this catalog. If empty, the rule matches all customers. + type: array + items: + type: string + nullable: true + channels: + description: The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. + type: array + items: + type: string + nullable: true + schedules: + description: | + Specifies a time period when a catalog is displayed, such as on a specific date or during summer. Requests populate the rule tag using the `EP-Context-Tag` header. + + The schedules attribute must include the following. + + - `valid_from` matches the date and time that the catalog is displayed from. + - `valid_to` matches the date and time the catalog is displayed to. + + Commerce runs on UTC time. + + You can offset the timezone by adding the offset to the end of the date and time. For example, a catalog which contains a sale hierarchy that should appear for a set timeframe may be scheduled to publish on a given date and time within a given timezone. For instance, a sale that should begin on 1st of June 2022 05:00 ET and end on the 15th of June 2022 at 23:50 PT would have a valid schedule of `"valid_from": "2022-06-01T05:00:00.000-05:00"`, `"valid_to": "2022-06-15T11:59:99.000-08:00"`. + type: array + items: + $ref: '#/components/schemas/rule-schedule' + nullable: true + tags: + description: A list of user-defined tags that can be used to further restrict the eligibility criteria for this rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. + type: array + items: + type: string + nullable: true + catalog_id: + type: string + description: The unique identifier of a catalog rule. + example: d09b4e16-08a5-4f42-817c-6e0d98acbb63 + nullable: true + type: + description: This represents the type of object being returned. Always `catalog_rule`. + type: string + example: catalog_rule + enum: + - catalog_rule + required: + - id + - type + required: + - data + sale: + type: object + description: A set of sale prices and a validity period. + properties: + schedule: + $ref: '#/components/schemas/schedule' + currencies: + $ref: '#/components/schemas/tiered-currencies' + sales: + type: object + title: Sales + description: A set of sale specifications + additionalProperties: + $ref: '#/components/schemas/sale' + schedule: + type: object + description: A definition of the times at which a sale is valid + properties: + valid_from: + type: string + example: '2020-09-22T09:00:00' + format: date-time + x-go-name: ValidFrom + nullable: true + valid_to: + type: string + example: '2020-09-22T09:00:00' + format: date-time + x-go-name: ValidTo + nullable: true + x-go-name: Schedule + tier: + type: object + title: Tier + description: The name of the tier, for example, `Pencils`. + properties: + minimum_quantity: + description: The minimum quantity of 1 or more defined for the specified price. If a minimum quantity is not specified, an error is returned. + type: integer + example: '5' + price: + $ref: '#/components/schemas/currencies' + tiered-amount: + type: object + title: TieredAmount + description: The three-letter ISO code for the currency associated with this price. + properties: + amount: + description: The price in the lowest denomination for the specified currency. This is a product's list price. + type: integer + example: 100 + format: int64 + x-omitempty: false + x-go-name: Amount + includes_tax: + description: Whether this price includes tax. + type: boolean + example: false + default: false + x-go-name: IncludesTax + tiers: + description: The price tier that an item is eligible for based on the quantity purchased. You cannot have conflicting tiers within the same currencies block. + type: object + additionalProperties: + description: The name of the tier, for example, `Pencils`. + type: object + properties: + minimum_quantity: + description: The minimum quantity of 1 or more defined for the specified price. If a minimum quantity is not specified, an error is returned. + type: integer + example: 5 + x-go-name: MinimumQuantity + amount: + description: The price for each quantity. + type: integer + example: 100 + format: int64 + x-omitempty: false + x-go-name: Amount + x-go-name: TierAmount + x-go-name: Tiers + x-go-name: TieredAmount + tiered-currencies: + type: object + title: TieredCurrencies + description: Collection of currency specific prices for a product. + additionalProperties: + $ref: '#/components/schemas/tiered-amount' + tiers: + type: object + title: Tiers + description: The price tier that an item is eligible for based on the quantity purchased. You cannot have conflicting tiers within the same currencies block. + additionalProperties: + $ref: '#/components/schemas/tier' + catalog-release-create-data: + type: object + title: CatalogReleaseCreateData + description: Creates a catalog release with the following attributes. + properties: + data: + type: object + properties: + export_full_delta: + type: boolean + description: | + Set to `true` if you want to export all the data from a catalog release in a delta link. The `is_full_delta` attribute is returned from the `get a release of a catalog` endpoint. The `is_full_delta` attribute tells you if the delta file contains the full content of a catalog release. You can use the `is_full_delta` to determine if you need to refresh the data in your company system before publishing a catalog release with fresh data in a delta link. Using a search service as an example, if the `is_full_delta` attribute is true, you should remove all data about that catalog from the search service before publishing a catalog release and injecting fresh data from the delta file. If the `is_full_delta` attribute is false, then data from the previous catalog overlays the existing data in the delta file. The `is_full_delta` attribute is always `true` the first time a catalog is published. + x-go-name: ExportFullDelta + include_organization_resources: + type: boolean + description: If you are publishing a catalog in a store that contains resources from an organization, you must set this to true and you must enable the **Include Organization Resources in Catalog Publishes** checkbox in Commerce Manager. See [**Multi-Store Management Solutions**](/docs/api/pxm/catalog/publish-release). + x-go-name: IncludeOrganizationResources + nullable: true + file: + properties: + id: + type: string + description: The unique identifier for this file. + format: uuid + type: + description: The type represents the object being returned. + type: string + example: file + file_name: + description: The name of the file. + type: string + example: file_name.jpg + mime_type: + description: The mime type of the file. + type: string + example: image/jpeg + file_size: + description: The size of the file. Required when uploading files. + type: integer + example: 36000 + public: + description: DEPRECATED Whether the file public or not. Required when uploading files. + type: boolean + example: true + meta: + $ref: '#/components/schemas/file-meta' + links: + $ref: '#/components/schemas/links' + link: + $ref: '#/components/schemas/file-link' + file-meta: + properties: + timestamps: + type: object + description: The date and time the file was created. + properties: + created_at: + description: The date and time the file was created. + type: string + example: '2023-10-11T13:02:25.293Z' + dimensions: + description: The file dimensions. + type: object + properties: + width: + description: The width of the file. + type: integer + example: 1800 + height: + description: The height of the file. + type: integer + example: 1000 + file-link: + type: object + description: The publicly available URL for this file. + properties: + href: + description: The publicly available URL for this file. + type: string + example: https://files-eu.epusercontent.com/e8c53cb0-120d-4ea5-8941-ce74dec06038/f8cf26b3-6d38-4275-937a-624a83994702.png From a79dd17bcbd9c44eb30a6518820ab6ac56030303 Mon Sep 17 00:00:00 2001 From: Robert Field Date: Wed, 14 Aug 2024 13:57:11 +0100 Subject: [PATCH 06/30] feat: clean up unused service --- examples/simple/src/services/products.ts | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/examples/simple/src/services/products.ts b/examples/simple/src/services/products.ts index 82a3324d..721c1b8c 100644 --- a/examples/simple/src/services/products.ts +++ b/examples/simple/src/services/products.ts @@ -1,25 +1,6 @@ import type { ProductResponse, ResourcePage } from "@elasticpath/js-sdk"; import { wait300 } from "../lib/product-helper"; import { ElasticPath } from "@elasticpath/js-sdk"; -import { getByContextProduct } from "@epcc-sdk/sdks-shopper"; - -export async function getProductById(productId: string, client: ElasticPath) { - return getByContextProduct({ - path: { - product_id: productId, - }, - query: { - include: "main_images,files,component_products", - }, - }); - // return client.ShopperCatalog.Products.With([ - // "main_image", - // "files", - // "component_products", - // ]).Get({ - // productId, - // }); -} export function getAllProducts( client: ElasticPath, From d667b3edb6e4900399b2887442fe22455ed61e59 Mon Sep 17 00:00:00 2001 From: Robert Field Date: Mon, 19 Aug 2024 12:04:14 +0100 Subject: [PATCH 07/30] feat: add inlcudes to product list data --- .../sdks/shopper/src/client/schemas.gen.ts | 3 +++ packages/sdks/shopper/src/client/types.gen.ts | 24 +++++++++++-------- packages/sdks/specs/catalog_view.yaml | 2 ++ 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/packages/sdks/shopper/src/client/schemas.gen.ts b/packages/sdks/shopper/src/client/schemas.gen.ts index 7903af50..9c50157e 100644 --- a/packages/sdks/shopper/src/client/schemas.gen.ts +++ b/packages/sdks/shopper/src/client/schemas.gen.ts @@ -1984,6 +1984,9 @@ export const $product_list_data = { links: { $ref: "#/components/schemas/links", }, + included: { + $ref: "#/components/schemas/included", + }, }, } as const diff --git a/packages/sdks/shopper/src/client/types.gen.ts b/packages/sdks/shopper/src/client/types.gen.ts index 227b7ddf..8e6f26d4 100644 --- a/packages/sdks/shopper/src/client/types.gen.ts +++ b/packages/sdks/shopper/src/client/types.gen.ts @@ -1081,6 +1081,7 @@ export type ProductListData = { meta?: PageMeta data?: Array links?: Links + included?: Included } /** @@ -4323,11 +4324,24 @@ export const ProductModelResponseTransformer: ProductModelResponseTransformer = return data } +export type IncludedModelResponseTransformer = (data: any) => Included + +export const IncludedModelResponseTransformer: IncludedModelResponseTransformer = + (data) => { + if (Array.isArray(data?.component_products)) { + data.component_products.forEach(ProductModelResponseTransformer) + } + return data + } + export const ProductListDataModelResponseTransformer: ProductListDataModelResponseTransformer = (data) => { if (Array.isArray(data?.data)) { data.data.forEach(ProductModelResponseTransformer) } + if (data?.included) { + IncludedModelResponseTransformer(data.included) + } return data } @@ -4343,16 +4357,6 @@ export type GetProductResponseTransformer = ( export type ProductDataModelResponseTransformer = (data: any) => ProductData -export type IncludedModelResponseTransformer = (data: any) => Included - -export const IncludedModelResponseTransformer: IncludedModelResponseTransformer = - (data) => { - if (Array.isArray(data?.component_products)) { - data.component_products.forEach(ProductModelResponseTransformer) - } - return data - } - export const ProductDataModelResponseTransformer: ProductDataModelResponseTransformer = (data) => { if (data?.data) { diff --git a/packages/sdks/specs/catalog_view.yaml b/packages/sdks/specs/catalog_view.yaml index d764c586..c60ae1ae 100644 --- a/packages/sdks/specs/catalog_view.yaml +++ b/packages/sdks/specs/catalog_view.yaml @@ -4026,6 +4026,8 @@ components: x-go-name: Data links: $ref: '#/components/schemas/links' + included: + $ref: '#/components/schemas/included' product-meta: type: object title: ProductMeta From 7e1eb2c80c0747a1a00f09e884fbea292d9ade1c Mon Sep 17 00:00:00 2001 From: Robert Field Date: Mon, 19 Aug 2024 12:04:47 +0100 Subject: [PATCH 08/30] feat: remove service layer use sdk directly --- examples/simple/src/services/products.ts | 45 ------------------------ 1 file changed, 45 deletions(-) diff --git a/examples/simple/src/services/products.ts b/examples/simple/src/services/products.ts index 721c1b8c..e9221ca4 100644 --- a/examples/simple/src/services/products.ts +++ b/examples/simple/src/services/products.ts @@ -1,53 +1,8 @@ -import type { ProductResponse, ResourcePage } from "@elasticpath/js-sdk"; -import { wait300 } from "../lib/product-helper"; import { ElasticPath } from "@elasticpath/js-sdk"; -export function getAllProducts( - client: ElasticPath, -): Promise { - return _getAllProductPages(client)(); -} - export function getProducts(client: ElasticPath, offset = 0, limit = 100) { return client.ShopperCatalog.Products.With(["main_image"]) .Limit(limit) .Offset(offset) .All(); } - -const _getAllPages = - ( - nextPageRequestFn: ( - limit: number, - offset: number, - client?: ElasticPath, - ) => Promise>, - ) => - async ( - offset: number = 0, - limit: number = 25, - accdata: T[] = [], - ): Promise => { - const requestResp = await nextPageRequestFn(limit, offset); - const { - meta: { - page: newPage, - results: { total }, - }, - data: newData, - } = requestResp; - - const updatedOffset = offset + newPage.total; - const combinedData = [...accdata, ...newData]; - if (updatedOffset < total) { - return wait300.then(() => - _getAllPages(nextPageRequestFn)(updatedOffset, limit, combinedData), - ); - } - return Promise.resolve(combinedData); - }; - -const _getAllProductPages = (client: ElasticPath) => - _getAllPages((limit = 25, offset = 0) => - client.ShopperCatalog.Products.Limit(limit).Offset(offset).All(), - ); From 80e4c41a021f4ab5ebb7e455416b4a3ca0ecf204 Mon Sep 17 00:00:00 2001 From: Robert Field Date: Mon, 19 Aug 2024 12:05:20 +0100 Subject: [PATCH 09/30] feat: wip fetch featured products using new sdk --- .../fetchFeaturedProducts.ts | 28 ++++++++++++++----- .../lib/connect-products-with-main-images.ts | 8 +++--- .../simple/src/lib/types/product-types.ts | 4 ++- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/examples/simple/src/components/featured-products/fetchFeaturedProducts.ts b/examples/simple/src/components/featured-products/fetchFeaturedProducts.ts index a5b9f7bf..c29b43e6 100644 --- a/examples/simple/src/components/featured-products/fetchFeaturedProducts.ts +++ b/examples/simple/src/components/featured-products/fetchFeaturedProducts.ts @@ -1,19 +1,33 @@ -import { getProducts } from "../../services/products"; import { ElasticPath } from "@elasticpath/js-sdk"; import { ProductResponseWithImage } from "../../lib/types/product-types"; import { connectProductsWithMainImages } from "../../lib/connect-products-with-main-images"; +import { + getByContextAllProducts, + GetByContextAllProductsResponse, +} from "@epcc-sdk/sdks-shopper"; // Fetching the first 4 products of in the catalog to display in the featured-products component export const fetchFeaturedProducts = async ( client: ElasticPath, -): Promise => { - const { data: productsResponse, included: productsIncluded } = - await getProducts(client); +): Promise => { + const productsResponse = await getByContextAllProducts({ + query: { + "page[limit]": 100, + "page[offset]": 0, + }, + }); - return productsIncluded?.main_images + if (!productsResponse.data) { + return []; + } + + const productData = productsResponse.data; + const productIncluded = productData.included; + + return productIncluded?.main_images && productData.data ? connectProductsWithMainImages( - productsResponse.slice(0, 4), // Only need the first 4 products to feature - productsIncluded?.main_images, + productData.data.slice(0, 4), // Only need the first 4 products to feature + productIncluded.main_images, ) : productsResponse; }; diff --git a/examples/simple/src/lib/connect-products-with-main-images.ts b/examples/simple/src/lib/connect-products-with-main-images.ts index f1976000..77f9d8b9 100644 --- a/examples/simple/src/lib/connect-products-with-main-images.ts +++ b/examples/simple/src/lib/connect-products-with-main-images.ts @@ -1,12 +1,12 @@ -import { File, ProductResponse } from "@elasticpath/js-sdk"; import { ProductImageObject, ProductResponseWithImage, } from "./types/product-types"; +import { Product } from "@epcc-sdk/sdks-shopper"; export const connectProductsWithMainImages = ( - products: ProductResponse[], - images: File[], + products: Product[], + images: any[], // TODO fix file type in new sdk ): ProductResponseWithImage[] => { // Object with image id as a key and File data as a value let imagesObject: ProductImageObject = {}; @@ -18,7 +18,7 @@ export const connectProductsWithMainImages = ( productList.forEach((product) => { if ( - product.relationships.main_image?.data && + product.relationships?.main_image?.data?.id && imagesObject[product.relationships.main_image.data?.id] ) { product.main_image = diff --git a/examples/simple/src/lib/types/product-types.ts b/examples/simple/src/lib/types/product-types.ts index e2cc5337..c9c54a0b 100644 --- a/examples/simple/src/lib/types/product-types.ts +++ b/examples/simple/src/lib/types/product-types.ts @@ -1,5 +1,7 @@ import type { ProductResponse, File } from "@elasticpath/js-sdk"; import type { Dispatch, SetStateAction } from "react"; +import type { GetByContextAllProductsResponse } from "@epcc-sdk/sdks-shopper"; +import { Product } from "@epcc-sdk/sdks-shopper"; export type IdentifiableBaseProduct = ProductResponse & { id: string; @@ -22,7 +24,7 @@ export interface OptionDict { [key: string]: string; } -export interface ProductResponseWithImage extends ProductResponse { +export interface ProductResponseWithImage extends Product { main_image?: File; } From 2c05757163c6716ba6eee9e2e2af5edda965c5a8 Mon Sep 17 00:00:00 2001 From: Robert Field Date: Sun, 25 Aug 2024 13:26:38 +0100 Subject: [PATCH 10/30] chore: update lock file --- pnpm-lock.yaml | 298 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 264 insertions(+), 34 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 642b90ab..0f4719a8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -554,6 +554,12 @@ importers: '@elasticpath/react-shopper-hooks': specifier: workspace:* version: link:../../packages/react-shopper-hooks + '@epcc-sdk/sdks-nextjs': + specifier: workspace:* + version: link:../../packages/sdks/nextjs + '@epcc-sdk/sdks-shopper': + specifier: workspace:* + version: link:../../packages/sdks/shopper '@floating-ui/react': specifier: ^0.26.3 version: 0.26.6(react-dom@18.3.1)(react@18.3.1) @@ -1249,6 +1255,45 @@ importers: specifier: ^0.31.1 version: 0.31.4 + packages/sdks/nextjs: + dependencies: + '@hey-api/client-fetch': + specifier: ^0.1.7 + version: 0.1.14 + devDependencies: + next: + specifier: ^14.0.0 + version: 14.0.0(@babel/core@7.23.2)(react-dom@18.3.1)(react@18.3.1) + typescript: + specifier: ^5.5.3 + version: 5.5.4 + + packages/sdks/pim: + dependencies: + '@hey-api/client-fetch': + specifier: ^0.1.7 + version: 0.1.14 + devDependencies: + '@hey-api/openapi-ts': + specifier: ^0.48.2 + version: 0.48.3(typescript@5.5.4) + typescript: + specifier: ^5.5.3 + version: 5.5.4 + + packages/sdks/shopper: + dependencies: + '@hey-api/client-fetch': + specifier: ^0.1.7 + version: 0.1.14 + devDependencies: + '@hey-api/openapi-ts': + specifier: ^0.48.2 + version: 0.48.3(typescript@5.5.4) + typescript: + specifier: ^5.5.3 + version: 5.5.4 + packages/shopper-common: dependencies: '@elasticpath/js-sdk': @@ -1553,6 +1598,15 @@ packages: - chokidar dev: false + /@apidevtools/json-schema-ref-parser@11.6.4: + resolution: {integrity: sha512-9K6xOqeevacvweLGik6LnZCb1fBtCOSIWQs8d096XGeqoLKC33UVMGz9+77Gw44KvbH4pKcQPWo4ZpxkXYj05w==} + engines: {node: '>= 16'} + dependencies: + '@jsdevtools/ono': 7.1.3 + '@types/json-schema': 7.0.15 + js-yaml: 4.1.0 + dev: true + /@ardatan/relay-compiler@12.0.0(graphql@16.8.1): resolution: {integrity: sha512-9anThAaj1dQr6IGmzBMcfzOQKTa5artjuPmw8NYK/fiGEMjADbSguBY2FMDykt+QhilR3wc9VA/3yVju7JHg7Q==} hasBin: true @@ -7550,6 +7604,27 @@ packages: react: 18.3.1 dev: false + /@hey-api/client-fetch@0.1.14: + resolution: {integrity: sha512-6RoO2prOVrQfx2wClJ7DkeIVWQokiRLIdqiuxvFTfWEQVfOc+hQhAw6/IijYrSM9cA7A7DzmHpzTLc/gbQ7/2Q==} + dev: false + + /@hey-api/openapi-ts@0.48.3(typescript@5.5.4): + resolution: {integrity: sha512-R53Nr4Gicz77icS+RiH0fwHa9A0uFPtzsjC8SBaGwtOel5ZyxeBbayWE6HhE789hp3dok9pegwWncwwOrr4WFA==} + engines: {node: ^18.0.0 || >=20.0.0} + hasBin: true + peerDependencies: + typescript: ^5.x + dependencies: + '@apidevtools/json-schema-ref-parser': 11.6.4 + c12: 1.11.1 + camelcase: 8.0.0 + commander: 12.1.0 + handlebars: 4.7.8 + typescript: 5.5.4 + transitivePeerDependencies: + - magicast + dev: true + /@hookform/error-message@2.0.1(react-dom@18.3.1)(react-hook-form@7.49.3)(react@18.3.1): resolution: {integrity: sha512-U410sAr92xgxT1idlu9WWOVjndxLdgPUHEB8Schr27C9eh7/xUnITWpCMF93s+lGiG++D4JnbSnrb5A21AdSNg==} peerDependencies: @@ -8345,7 +8420,6 @@ packages: cpu: [arm64] os: [darwin] requiresBuild: true - dev: false optional: true /@next/swc-darwin-x64@14.0.0: @@ -8354,7 +8428,6 @@ packages: cpu: [x64] os: [darwin] requiresBuild: true - dev: false optional: true /@next/swc-linux-arm64-gnu@14.0.0: @@ -8363,7 +8436,6 @@ packages: cpu: [arm64] os: [linux] requiresBuild: true - dev: false optional: true /@next/swc-linux-arm64-musl@14.0.0: @@ -8372,7 +8444,6 @@ packages: cpu: [arm64] os: [linux] requiresBuild: true - dev: false optional: true /@next/swc-linux-x64-gnu@14.0.0: @@ -8381,7 +8452,6 @@ packages: cpu: [x64] os: [linux] requiresBuild: true - dev: false optional: true /@next/swc-linux-x64-musl@14.0.0: @@ -8390,7 +8460,6 @@ packages: cpu: [x64] os: [linux] requiresBuild: true - dev: false optional: true /@next/swc-win32-arm64-msvc@14.0.0: @@ -8399,7 +8468,6 @@ packages: cpu: [arm64] os: [win32] requiresBuild: true - dev: false optional: true /@next/swc-win32-ia32-msvc@14.0.0: @@ -8408,7 +8476,6 @@ packages: cpu: [ia32] os: [win32] requiresBuild: true - dev: false optional: true /@next/swc-win32-x64-msvc@14.0.0: @@ -8417,7 +8484,6 @@ packages: cpu: [x64] os: [win32] requiresBuild: true - dev: false optional: true /@nodelib/fs.scandir@2.1.5: @@ -10275,7 +10341,7 @@ packages: ts-dedent: 2.2.0 util: 0.12.5 util-deprecate: 1.0.2 - watchpack: 2.4.0 + watchpack: 2.4.1 ws: 8.14.2 transitivePeerDependencies: - bufferutil @@ -10708,7 +10774,6 @@ packages: resolution: {integrity: sha512-E4KcWTpoLHqwPHLxidpOqQbcrZVgi0rsmmZXUle1jXmJfuIf/UWpczUJ7MZZ5tlxytgJXyp0w4PGkkeLiuIdZw==} dependencies: tslib: 2.6.2 - dev: false /@szmarczak/http-timer@5.0.1: resolution: {integrity: sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw==} @@ -11752,7 +11817,7 @@ packages: dependencies: '@vitest/utils': 0.29.8 p-limit: 4.0.0 - pathe: 1.1.1 + pathe: 1.1.2 dev: true /@vitest/runner@0.31.4: @@ -11761,7 +11826,7 @@ packages: '@vitest/utils': 0.31.4 concordance: 5.0.4 p-limit: 4.0.0 - pathe: 1.1.1 + pathe: 1.1.2 dev: true /@vitest/runner@0.34.6: @@ -11776,7 +11841,7 @@ packages: resolution: {integrity: sha512-LemvNumL3NdWSmfVAMpXILGyaXPkZbG5tyl6+RQSdcHnTj6hvA49UAI8jzez9oQyE/FWLKRSNqTGzsHuk89LRA==} dependencies: magic-string: 0.30.5 - pathe: 1.1.1 + pathe: 1.1.2 pretty-format: 27.5.1 dev: true @@ -12100,12 +12165,12 @@ packages: dependencies: acorn: 8.10.0 - /acorn-jsx@5.3.2(acorn@8.11.2): + /acorn-jsx@5.3.2(acorn@8.12.1): resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: - acorn: 8.11.2 + acorn: 8.12.1 dev: false /acorn-walk@7.2.0: @@ -12137,7 +12202,6 @@ packages: resolution: {integrity: sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==} engines: {node: '>=0.4.0'} hasBin: true - dev: true /address@1.2.2: resolution: {integrity: sha512-4B/qKCfeE/ODUaAUpSwfzazo5x29WD4r3vXiWsB7I2mSDAihwEqKO+g8GELZUQSSAo5e1XTYh3ZVfLyxBc12nA==} @@ -13154,6 +13218,28 @@ packages: resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==} engines: {node: '>= 0.8'} + /c12@1.11.1: + resolution: {integrity: sha512-KDU0TvSvVdaYcQKQ6iPHATGz/7p/KiVjPg4vQrB6Jg/wX9R0yl5RZxWm9IoZqaIHD2+6PZd81+KMGwRr/lRIUg==} + peerDependencies: + magicast: ^0.3.4 + peerDependenciesMeta: + magicast: + optional: true + dependencies: + chokidar: 3.6.0 + confbox: 0.1.7 + defu: 6.1.4 + dotenv: 16.4.5 + giget: 1.2.3 + jiti: 1.21.6 + mlly: 1.7.1 + ohash: 1.1.3 + pathe: 1.1.2 + perfect-debounce: 1.0.0 + pkg-types: 1.2.0 + rc9: 2.1.2 + dev: true + /cac@6.7.14: resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} engines: {node: '>=8'} @@ -13236,11 +13322,16 @@ packages: engines: {node: '>=14.16'} dev: false + /camelcase@8.0.0: + resolution: {integrity: sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA==} + engines: {node: '>=16'} + dev: true + /caniuse-api@3.0.0: resolution: {integrity: sha512-bsTwuIg/BZZK/vreVTYYbSWoe2F+71P7K5QGEX+pT250DZbfU1MQ5prOKpPR+LL6uWKK3KMwMCAS74QB3Um1uw==} dependencies: browserslist: 4.22.1 - caniuse-lite: 1.0.30001554 + caniuse-lite: 1.0.30001651 lodash.memoize: 4.1.2 lodash.uniq: 4.5.0 dev: false @@ -13250,7 +13341,6 @@ packages: /caniuse-lite@1.0.30001651: resolution: {integrity: sha512-9Cf+Xv1jJNe1xPZLGuUXLNkE1BoDkqRqYyFJ9TDYSqhduqA4hu4oR9HluGoWYQC/aj8WHjsGVV+bwkh0+tegRg==} - dev: true /capital-case@1.0.4: resolution: {integrity: sha512-ds37W8CytHgwnhGGTi88pcPyR15qoNkOpYwmMMfnWqqWgESapLqvDx6huFjQ5vqWSn2Z06173XNA7LtMOeUh1A==} @@ -13421,6 +13511,21 @@ packages: optionalDependencies: fsevents: 2.3.3 + /chokidar@3.6.0: + resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==} + engines: {node: '>= 8.10.0'} + dependencies: + anymatch: 3.1.3 + braces: 3.0.2 + glob-parent: 5.1.2 + is-binary-path: 2.1.0 + is-glob: 4.0.3 + normalize-path: 3.0.0 + readdirp: 3.6.0 + optionalDependencies: + fsevents: 2.3.3 + dev: true + /chownr@1.1.4: resolution: {integrity: sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==} dev: true @@ -13447,6 +13552,12 @@ packages: resolution: {integrity: sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==} engines: {node: '>=8'} + /citty@0.1.6: + resolution: {integrity: sha512-tskPPKEs8D2KPafUypv2gxwJP8h/OaJmC82QQGGDQcHvXX43xF2VDACcJVmZ0EuSxkpO9Kc4MlrA3q0+FG58AQ==} + dependencies: + consola: 3.2.3 + dev: true + /cjs-module-lexer@1.2.3: resolution: {integrity: sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ==} dev: true @@ -13554,7 +13665,6 @@ packages: /client-only@0.0.1: resolution: {integrity: sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==} - dev: false /cliui@5.0.0: resolution: {integrity: sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==} @@ -13695,6 +13805,11 @@ packages: engines: {node: '>=16'} dev: true + /commander@12.1.0: + resolution: {integrity: sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==} + engines: {node: '>=18'} + dev: true + /commander@2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} @@ -13812,6 +13927,10 @@ packages: semver: 7.5.4 dev: false + /confbox@0.1.7: + resolution: {integrity: sha512-uJcB/FKZtBMCJpK8MQji6bJHgu1tixKPxRLeGkNzBoOZzpnZUJm0jm2/sBDWcuBx1dYgxV4JU+g5hmNxCyAmdA==} + dev: true + /config-chain@1.1.13: resolution: {integrity: sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ==} dependencies: @@ -13839,6 +13958,11 @@ packages: resolution: {integrity: sha512-9vAdYbHj6x2fLKC4+oPH0kFzY/orMZyG2Aj+kNylHxKGJ/Ed4dpNyAQYwJOdqO4zdM7XpVHmyejQDcQHrnuXbw==} dev: false + /consola@3.2.3: + resolution: {integrity: sha512-I5qxpzLv+sJhTVEoLYNcTW+bThDCPsit0vLNKShZx6rLtpilNpmmeTPaeqJb9ZE9dV3DGaeby6Vuhrw38WjeyQ==} + engines: {node: ^14.18.0 || >=16.10.0} + dev: true + /constant-case@3.0.4: resolution: {integrity: sha512-I2hSBi7Vvs7BEuJDr5dDHfzb/Ruj3FyvFyh7KLilAjNQw3Be+xgqUBA2W6scVEcL0hL1dwPRtIqEPVUCKkSsyQ==} dependencies: @@ -14477,6 +14601,10 @@ packages: resolution: {integrity: sha512-Vy2wmG3NTkmHNg/kzpuvHhkqeIx3ODWqasgCRbKtbXEN0G+HpEEv9BtJLp7ZG1CZloFaC41Ah3ZFbq7aqCqMeQ==} dev: true + /defu@6.1.4: + resolution: {integrity: sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==} + dev: true + /del@6.1.1: resolution: {integrity: sha512-ua8BhapfP0JUJKC/zV9yHHDW/rDoDxP4Zhn3AkA6/xT6gY7jYXJiaeyBZznYVujhZZET+UgcbZiQ7sN3WqcImg==} engines: {node: '>=10'} @@ -14512,6 +14640,10 @@ packages: resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} engines: {node: '>=6'} + /destr@2.0.3: + resolution: {integrity: sha512-2N3BOUU4gYMpTP24s5rF5iP7BDr7uNTCs4ozw3kf/eKfvWSIu93GEBi5m427YoyJoeOzQ5smuu4nNAPGb8idSQ==} + dev: true + /destroy@1.2.0: resolution: {integrity: sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==} engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16} @@ -14713,6 +14845,11 @@ packages: engines: {node: '>=12'} dev: true + /dotenv@16.4.5: + resolution: {integrity: sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==} + engines: {node: '>=12'} + dev: true + /dset@3.1.2: resolution: {integrity: sha512-g/M9sqy3oHe477Ar4voQxWtaPIFw1jTdKZuomOjhCcBx9nHUNn0pu6NopuFFrTh/TRZIKEj+76vLWFu9BNKk+Q==} engines: {node: '>=4'} @@ -16120,6 +16257,21 @@ packages: strip-final-newline: 3.0.0 dev: true + /execa@8.0.1: + resolution: {integrity: sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==} + engines: {node: '>=16.17'} + dependencies: + cross-spawn: 7.0.3 + get-stream: 8.0.1 + human-signals: 5.0.0 + is-stream: 3.0.0 + merge-stream: 2.0.0 + npm-run-path: 5.1.0 + onetime: 6.0.0 + signal-exit: 4.1.0 + strip-final-newline: 3.0.0 + dev: true + /exit@0.1.2: resolution: {integrity: sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==} engines: {node: '>= 0.8.0'} @@ -16784,6 +16936,11 @@ packages: resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==} engines: {node: '>=10'} + /get-stream@8.0.1: + resolution: {integrity: sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==} + engines: {node: '>=16'} + dev: true + /get-symbol-description@1.0.0: resolution: {integrity: sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==} engines: {node: '>= 0.4'} @@ -16807,12 +16964,26 @@ packages: https-proxy-agent: 7.0.2 mri: 1.2.0 node-fetch-native: 1.4.1 - pathe: 1.1.1 + pathe: 1.1.2 tar: 6.2.0 transitivePeerDependencies: - supports-color dev: true + /giget@1.2.3: + resolution: {integrity: sha512-8EHPljDvs7qKykr6uw8b+lqLiUc/vUg+KVTI0uND4s63TdsZM2Xus3mflvF0DDG9SiM4RlCkFGL+7aAjRmV7KA==} + hasBin: true + dependencies: + citty: 0.1.6 + consola: 3.2.3 + defu: 6.1.4 + node-fetch-native: 1.6.4 + nypm: 0.3.9 + ohash: 1.1.3 + pathe: 1.1.2 + tar: 6.2.0 + dev: true + /github-slugger@1.5.0: resolution: {integrity: sha512-wIh+gKBI9Nshz2o46B0B3f5k/W+WI9ZAv6y5Dn5WJ5SK1t0TnDimB4WE5rmTD05ZAIn8HALCZVmCsvj0w0v0lw==} @@ -17535,6 +17706,11 @@ packages: engines: {node: '>=14.18.0'} dev: true + /human-signals@5.0.0: + resolution: {integrity: sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==} + engines: {node: '>=16.17.0'} + dev: true + /iconv-lite@0.4.24: resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} engines: {node: '>=0.10.0'} @@ -18914,6 +19090,11 @@ packages: resolution: {integrity: sha512-3TV69ZbrvV6U5DfQimop50jE9Dl6J8O1ja1dvBbMba/sZ3YBEQqJ2VZRoQPVnhlzjNtU1vaXRZVrVjU4qtm8yA==} hasBin: true + /jiti@1.21.6: + resolution: {integrity: sha512-2yTgeWTWzMWkHu6Jp9NKgePDaYHbntiwvYuuJLbbN9vl7DC9DvXKOB2BC3ZZ92D3cvV/aflH0osDfwpHepQ53w==} + hasBin: true + dev: true + /jju@1.4.0: resolution: {integrity: sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==} dev: true @@ -20089,8 +20270,8 @@ packages: /micromark-extension-mdxjs@3.0.0: resolution: {integrity: sha512-A873fJfhnJ2siZyUrJ31l34Uqwy4xIFmvPY1oj+Ean5PHcPBYzEsvqvWGaWcfEIr11O5Dlw3p2y0tZWpKHDejQ==} dependencies: - acorn: 8.11.2 - acorn-jsx: 5.3.2(acorn@8.11.2) + acorn: 8.12.1 + acorn-jsx: 5.3.2(acorn@8.12.1) micromark-extension-mdx-expression: 3.0.0 micromark-extension-mdx-jsx: 3.0.0 micromark-extension-mdx-md: 2.0.0 @@ -20483,11 +20664,20 @@ packages: resolution: {integrity: sha512-i/Ykufi2t1EZ6NaPLdfnZk2AX8cs0d+mTzVKuPfqPKPatxLApaBoxJQ9x1/uckXtrS/U5oisPMDkNs0yQTaBRg==} dependencies: acorn: 8.10.0 - pathe: 1.1.1 + pathe: 1.1.2 pkg-types: 1.0.3 ufo: 1.3.1 dev: true + /mlly@1.7.1: + resolution: {integrity: sha512-rrVRZRELyQzrIUAVMHxP97kv+G786pHmOKzuFII8zDYahFBS7qnHh2AlYSl1GAHhaMPCz6/oHjVMcfFYgFYHgA==} + dependencies: + acorn: 8.12.1 + pathe: 1.1.2 + pkg-types: 1.2.0 + ufo: 1.5.4 + dev: true + /moo@0.5.2: resolution: {integrity: sha512-iSAJLHYKnX41mKcJKjqvnAN9sf0LMDTXDEvFv+ffuRR9a1MIuXLjMNL6EsnDHSkKLTWNqQQ5uo61P4EbU4NU+Q==} dev: true @@ -20656,7 +20846,7 @@ packages: '@next/env': 14.0.0 '@swc/helpers': 0.5.2 busboy: 1.6.0 - caniuse-lite: 1.0.30001554 + caniuse-lite: 1.0.30001651 postcss: 8.4.31 react: 18.3.1 react-dom: 18.3.1(react@18.3.1) @@ -20675,7 +20865,6 @@ packages: transitivePeerDependencies: - '@babel/core' - babel-plugin-macros - dev: false /no-case@3.0.4: resolution: {integrity: sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==} @@ -20713,6 +20902,10 @@ packages: resolution: {integrity: sha512-NsXBU0UgBxo2rQLOeWNZqS3fvflWePMECr8CoSWoSTqCqGbVVsvl9vZu1HfQicYN0g5piV9Gh8RTEvo/uP752w==} dev: true + /node-fetch-native@1.6.4: + resolution: {integrity: sha512-IhOigYzAKHd244OC0JIMIUrjzctirCmPkaIfhDeGcEETWof5zKYUW7e7MYvChGWh/4CJeXEgsRyGzuF334rOOQ==} + dev: true + /node-fetch@1.7.3: resolution: {integrity: sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==} dependencies: @@ -20830,6 +21023,19 @@ packages: resolution: {integrity: sha512-2vPPEi+Z7WqML2jZYddDIfy5Dqb0r2fze2zTxNNknZaFpVHU3mFB3R+DWeJWGVx0ecvttSGlJTI+WG+8Z4cDWw==} dev: true + /nypm@0.3.9: + resolution: {integrity: sha512-BI2SdqqTHg2d4wJh8P9A1W+bslg33vOE9IZDY6eR2QC+Pu1iNBVZUqczrd43rJb+fMzHU7ltAYKsEFY/kHMFcw==} + engines: {node: ^14.16.0 || >=16.10.0} + hasBin: true + dependencies: + citty: 0.1.6 + consola: 3.2.3 + execa: 8.0.1 + pathe: 1.1.2 + pkg-types: 1.2.0 + ufo: 1.5.4 + dev: true + /object-assign@4.1.1: resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} engines: {node: '>=0.10.0'} @@ -20919,6 +21125,10 @@ packages: resolution: {integrity: sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==} dev: false + /ohash@1.1.3: + resolution: {integrity: sha512-zuHHiGTYTA1sYJ/wZN+t5HKZaH23i4yI1HMwbuXm24Nid7Dv0KcuRlKoNKS9UNfAVSBlnGLcuQrnOKWOZoEGaw==} + dev: true + /on-finished@2.4.1: resolution: {integrity: sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==} engines: {node: '>= 0.8'} @@ -21287,7 +21497,6 @@ packages: /pathe@1.1.2: resolution: {integrity: sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==} - dev: false /pathval@1.1.1: resolution: {integrity: sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==} @@ -21305,6 +21514,10 @@ packages: resolution: {integrity: sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==} dev: true + /perfect-debounce@1.0.0: + resolution: {integrity: sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==} + dev: true + /periscopic@3.1.0: resolution: {integrity: sha512-vKiQ8RRtkl9P+r/+oefh25C3fhybptkHKCZSPlcXiJux2tJF55GnEj3BVn4A5gKfq9NWWXXrxkHBwVPUfH0opw==} dependencies: @@ -21318,7 +21531,6 @@ packages: /picocolors@1.0.1: resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==} - dev: true /picomatch@2.3.1: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} @@ -21378,7 +21590,15 @@ packages: dependencies: jsonc-parser: 3.2.0 mlly: 1.4.2 - pathe: 1.1.1 + pathe: 1.1.2 + dev: true + + /pkg-types@1.2.0: + resolution: {integrity: sha512-+ifYuSSqOQ8CqP4MbZA5hDpb97n3E8SVWdJe+Wms9kj745lmd3b7EZJiqvmLwAlmRfjrI7Hi5z3kdBJ93lFNPA==} + dependencies: + confbox: 0.1.7 + mlly: 1.7.1 + pathe: 1.1.2 dev: true /pkg-up@3.1.0: @@ -22391,6 +22611,13 @@ packages: react-is: 18.2.0 dev: false + /rc9@2.1.2: + resolution: {integrity: sha512-btXCnMmRIBINM2LDZoEmOogIZU7Qe7zn4BpomSKZ/ykbLObuBdvG+mFq11DL6fjH1DRwHhrlgtYWG96bJiC7Cg==} + dependencies: + defu: 6.1.4 + destr: 2.0.3 + dev: true + /rc@1.2.8: resolution: {integrity: sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==} hasBin: true @@ -24344,7 +24571,6 @@ packages: '@babel/core': 7.23.2 client-only: 0.0.1 react: 18.3.1 - dev: false /stylehacks@5.1.1(postcss@8.4.31): resolution: {integrity: sha512-sBpcd5Hx7G6seo7b1LkpttvTz7ikD0LlH5RmdcBNb6fFR0Fl7LQwHDFr300q4cwUqi+IYrFGmsIHieMBfnN/Bw==} @@ -25336,6 +25562,10 @@ packages: resolution: {integrity: sha512-uY/99gMLIOlJPwATcMVYfqDSxUR9//AUcgZMzwfSTJPDKzA1S8mX4VLqa+fiAtveraQUBCz4FFcwVZBGbwBXIw==} dev: true + /ufo@1.5.4: + resolution: {integrity: sha512-UsUk3byDzKd04EyoZ7U4DOlxQaD14JUKQl6/P7wiX4FNvUfm3XL246n9W5AmqwW5RSFJ27NAuM0iLscAOYUiGQ==} + dev: true + /uglify-js@3.19.2: resolution: {integrity: sha512-S8KA6DDI47nQXJSi2ctQ629YzwOVs+bQML6DAtvy0wgNdpi+0ySpQK0g2pxBq2xfF2z3YCscu7NNA8nXT9PlIQ==} engines: {node: '>=0.8.0'} @@ -25507,7 +25737,7 @@ packages: /unplugin@1.5.1: resolution: {integrity: sha512-0QkvG13z6RD+1L1FoibQqnvTwVBXvS4XSPwAyinVgoOCl2jAgwzdUKmEj05o4Lt8xwQI85Hb6mSyYkcAGwZPew==} dependencies: - acorn: 8.11.2 + acorn: 8.12.1 chokidar: 3.5.3 webpack-sources: 3.2.3 webpack-virtual-modules: 0.6.1 @@ -25526,7 +25756,7 @@ packages: dependencies: browserslist: 4.22.1 escalade: 3.1.1 - picocolors: 1.0.0 + picocolors: 1.0.1 /update-browserslist-db@1.1.0(browserslist@4.23.3): resolution: {integrity: sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ==} @@ -25819,7 +26049,7 @@ packages: cac: 6.7.14 debug: 4.3.4 mlly: 1.4.2 - pathe: 1.1.1 + pathe: 1.1.2 picocolors: 1.0.0 vite: 4.5.0(@types/node@18.7.3) transitivePeerDependencies: @@ -25841,7 +26071,7 @@ packages: cac: 6.7.14 debug: 4.3.4 mlly: 1.4.2 - pathe: 1.1.1 + pathe: 1.1.2 picocolors: 1.0.0 vite: 4.5.0(@types/node@18.7.3) transitivePeerDependencies: From e1d6cdca3ada10233d4b8148fdab66f911159fdf Mon Sep 17 00:00:00 2001 From: Robert Field Date: Sun, 25 Aug 2024 15:04:43 +0100 Subject: [PATCH 11/30] feat: renamed file to get it to stop treating the type as binary --- .../fetchFeaturedProducts.ts | 28 ++++--------------- .../sdks/shopper/src/client/schemas.gen.ts | 8 ++++-- packages/sdks/shopper/src/client/types.gen.ts | 6 ++-- packages/sdks/shopper/src/index.ts | 1 + 4 files changed, 14 insertions(+), 29 deletions(-) diff --git a/examples/simple/src/components/featured-products/fetchFeaturedProducts.ts b/examples/simple/src/components/featured-products/fetchFeaturedProducts.ts index c29b43e6..fa90fd1d 100644 --- a/examples/simple/src/components/featured-products/fetchFeaturedProducts.ts +++ b/examples/simple/src/components/featured-products/fetchFeaturedProducts.ts @@ -1,33 +1,15 @@ -import { ElasticPath } from "@elasticpath/js-sdk"; -import { ProductResponseWithImage } from "../../lib/types/product-types"; -import { connectProductsWithMainImages } from "../../lib/connect-products-with-main-images"; import { getByContextAllProducts, - GetByContextAllProductsResponse, + client as sdkClient, } from "@epcc-sdk/sdks-shopper"; // Fetching the first 4 products of in the catalog to display in the featured-products component -export const fetchFeaturedProducts = async ( - client: ElasticPath, -): Promise => { - const productsResponse = await getByContextAllProducts({ +export const fetchFeaturedProducts = async (client: typeof sdkClient) => { + return await getByContextAllProducts({ + client, query: { - "page[limit]": 100, + "page[limit]": 4, "page[offset]": 0, }, }); - - if (!productsResponse.data) { - return []; - } - - const productData = productsResponse.data; - const productIncluded = productData.included; - - return productIncluded?.main_images && productData.data - ? connectProductsWithMainImages( - productData.data.slice(0, 4), // Only need the first 4 products to feature - productIncluded.main_images, - ) - : productsResponse; }; diff --git a/packages/sdks/shopper/src/client/schemas.gen.ts b/packages/sdks/shopper/src/client/schemas.gen.ts index 9c50157e..2321df55 100644 --- a/packages/sdks/shopper/src/client/schemas.gen.ts +++ b/packages/sdks/shopper/src/client/schemas.gen.ts @@ -957,7 +957,7 @@ export const $included = { description: "The main images associated with a product.", type: "array", items: { - $ref: "#/components/schemas/file", + $ref: "#/components/schemas/elastic-path-file", }, }, component_products: { @@ -971,7 +971,7 @@ export const $included = { description: "The files associated with a product.", type: "array", items: { - $ref: "#/components/schemas/file", + $ref: "#/components/schemas/elastic-path-file", }, }, }, @@ -3315,7 +3315,9 @@ export const $catalog_release_create_data = { }, } as const -export const $file = { +export const $elastic_path_file = { + type: "object", + title: "ElasticPathFile", properties: { id: { type: "string", diff --git a/packages/sdks/shopper/src/client/types.gen.ts b/packages/sdks/shopper/src/client/types.gen.ts index 8e6f26d4..3b91c05a 100644 --- a/packages/sdks/shopper/src/client/types.gen.ts +++ b/packages/sdks/shopper/src/client/types.gen.ts @@ -576,7 +576,7 @@ export type Included = { /** * The main images associated with a product. */ - main_images?: Array + main_images?: Array /** * The component products associated with a product. */ @@ -584,7 +584,7 @@ export type Included = { /** * The files associated with a product. */ - files?: Array + files?: Array } /** @@ -1829,7 +1829,7 @@ export type CatalogReleaseCreateData = { } } -export type binary = { +export type ElasticPathFile = { /** * The unique identifier for this file. */ diff --git a/packages/sdks/shopper/src/index.ts b/packages/sdks/shopper/src/index.ts index b583818f..95283e62 100644 --- a/packages/sdks/shopper/src/index.ts +++ b/packages/sdks/shopper/src/index.ts @@ -1,3 +1,4 @@ export * from "./client" import { createClient, client } from "@hey-api/client-fetch" export { createClient, client } +export { extractProductImage } from "./utils" From 8d4c84cde2bb45d7c5b9e253cc4e6c97b4c0e911 Mon Sep 17 00:00:00 2001 From: Robert Field Date: Mon, 26 Aug 2024 17:51:55 +0100 Subject: [PATCH 12/30] build: override features for open api specs --- .gitignore | 5 +- packages/sdks/shopper/package.json | 14 +- packages/sdks/specs/cart_checkout.yaml | 4792 ++++++ packages/sdks/specs/catalog_view.yaml | 2572 ++- packages/sdks/specs/config/redocly.yaml | 26 + .../overrides/catalog_view_components.yaml | 105 + packages/sdks/specs/overrides/getACart.yaml | 1 + .../specs/overrides/getByContextProduct.yaml | 2 + .../specs/overrides/security-schemes.yaml | 7 + .../plugins/decorators/component-merge.js | 51 + .../decorators/operation-property-override.js | 58 + packages/sdks/specs/plugins/override.js | 16 + packages/sdks/specs/shopper.yaml | 12991 ++++++++++++++++ pnpm-lock.yaml | 1121 +- 14 files changed, 20366 insertions(+), 1395 deletions(-) create mode 100644 packages/sdks/specs/cart_checkout.yaml create mode 100644 packages/sdks/specs/config/redocly.yaml create mode 100644 packages/sdks/specs/overrides/catalog_view_components.yaml create mode 100644 packages/sdks/specs/overrides/getACart.yaml create mode 100644 packages/sdks/specs/overrides/getByContextProduct.yaml create mode 100644 packages/sdks/specs/overrides/security-schemes.yaml create mode 100644 packages/sdks/specs/plugins/decorators/component-merge.js create mode 100644 packages/sdks/specs/plugins/decorators/operation-property-override.js create mode 100644 packages/sdks/specs/plugins/override.js create mode 100644 packages/sdks/specs/shopper.yaml diff --git a/.gitignore b/.gitignore index f7824810..b0a4d6fa 100644 --- a/.gitignore +++ b/.gitignore @@ -42,4 +42,7 @@ dist-schema/ # Local Netlify folder .netlify -*.tsbuildinfo \ No newline at end of file +*.tsbuildinfo + +# Bundled sdk specs +packages/sdks/specs/bundled/ \ No newline at end of file diff --git a/packages/sdks/shopper/package.json b/packages/sdks/shopper/package.json index 49a78256..9d4a381f 100644 --- a/packages/sdks/shopper/package.json +++ b/packages/sdks/shopper/package.json @@ -4,8 +4,15 @@ "description": "", "main": "dist/index.js", "scripts": { - "build": "tsc -p tsconfig.node.json", - "openapi-ts": "openapi-ts" + "build": "pnpm oas:build && pnpm oas:openapi-ts && pnpm tsc:build", + "tsc:build": "tsc -p tsconfig.node.json", + "oas:build": "pnpm oas:redocly:bundle && pnpm oas:openapi-format:convert && pnpm oas:redocly:join:shopper", + "oas:openapi-ts": "openapi-ts", + "oas:redocly": "redocly --config ./redocly.json", + "oas:redocly:lint": "redocly lint --config ../specs/config/redocly.yaml", + "oas:redocly:join:shopper": "redocly join --config ../specs/config/redocly.yaml --output ../specs/shopper.yaml ../specs/bundled/catalog_view_3.1.yaml ../specs/bundled/cart_checkout.yaml", + "oas:redocly:bundle": "redocly bundle --config ../specs/config/redocly.yaml --output ../specs/bundled", + "oas:openapi-format:convert": "pnpm dlx openapi-format ../specs/bundled/catalog_view.yaml -o ../specs/bundled/catalog_view_3.1.yaml --convertTo \"3.1\"" }, "exports": { ".": { @@ -24,6 +31,9 @@ "keywords": [], "devDependencies": { "@hey-api/openapi-ts": "^0.48.2", + "@redocly/cli": "^1.21.0", + "@redocly/openapi-core": "^1.21.0", + "lodash": "^4.17.21", "typescript": "^5.5.3" }, "dependencies": { diff --git a/packages/sdks/specs/cart_checkout.yaml b/packages/sdks/specs/cart_checkout.yaml new file mode 100644 index 00000000..cba53d93 --- /dev/null +++ b/packages/sdks/specs/cart_checkout.yaml @@ -0,0 +1,4792 @@ +openapi: 3.1.0 +info: + title: Carts, Checkout, Orders Introduction + description: | + A cart contains a list of the products that a shopper adds to the cart while browsing your catalog. In the context of a cart, a selected product is called a cart item. + + A cart item identifies the product, the product price, the quantity selected, and the total price for the quantity selected. The cart displays a running total of the cost for the selected products plus the calculated tax. + + You can allow your shoppers to add custom text to a product when adding an item to their carts. This is useful, for example, if you have a product like a T-shirt that can be personalized. See [Add product to cart](/docs/api/carts/manage-carts#add-product-to-cart). + + After a shopper checks out, the cart is converted to an order, and you can manually delete the cart. If you donʼt delete the cart, it is purged automatically after seven days. + + The preview cart feature allows you to set a future date for your shopping cart and view the promotions that will be available during that time period. This feature enables you to validate your promotion settings and observe how they will be applied in the cart. See [Create a Preview Cart](/docs/api/carts/create-a-cart#preview-cart). + + The following diagram shows a typical cart workflow: + + ![Shows a cart workflow, starting from adding the first item to a cart, through cart creation and checkout](/assets/cart-workflow.png) + + ### Multiple Carts + + Buyers often make purchases based on jobs that they need to perform or outcomes they need to achieve and therefore require more than one shopping cart. For example, a corporate buyer places orders for multiple locations. Each location has a different frequency of ordering and require different products. The buyer can create one cart per location, fill the carts, and then check out the carts quickly. Similarly, shoppers can also create multiple carts for the ease of managing various shopping experiences, such as birthdays or holidays. + + Each cart is discrete and separate. Any updates or changes to one cart has no effect on the other carts. A cart persists, that is, it stays with the buyer or shopper even after they use the cart in a checkout. Carts remain available after a checkout. + contact: + name: Elastic Path + url: https://elasticpath.com + version: 1.0.0 +security: + - bearerAuth: [ ] +servers: + - url: https://useast.api.elasticpath.com + description: US East Production Server + variables: { } + - url: https://euwest.api.elasticpath.com + description: EU West Production Server + variables: { } +paths: + /v2/carts: + get: + tags: + - Cart Management + summary: Get Shopper Carts + description: | + You can retrieve the carts that are associated with an [account](/docs/api/carts/account-cart-associations) or a [customer](/docs/api/carts/customer-cart-associations). + + When a shopper retrieves their latest carts, the carts are sorted in descending order by the updated_date. For more information, see [Pagination](/guides/Getting-Started/pagination). + + :::note + + Requires an `implicit` token with only one of [Account Management Authentication Token](/docs/api/accounts/post-v-2-account-members-tokens) or [customer token](/docs/customer-management/customer-management-api/customer-tokens). + + ::: + operationId: getCarts + parameters: + - name: EP-Account-Management-Authentication-Token + in: header + description: An Account Management Authentication token to access a specific account's carts. + style: simple + schema: + type: string + example: '{{accountToken}}' + - name: x-moltin-customer-token + in: header + description: A customer token to access a specific customer's carts. + style: simple + schema: + type: string + example: '{{customerToken}}' + responses: + '200': + description: '' + headers: { } + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + type: array + items: + $ref: '#/components/schemas/CartResponse' + links: + $ref: '#/components/schemas/Response.PageLinks' + meta: + $ref: '#/components/schemas/Response.Meta.Carts' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + post: + tags: + - Cart Management + summary: Create a Cart + description: | + + Creates a cart. Call this endpoint each time a customer creates a cart. + + Each shopper can have multiple carts. Use the carts API to create a cart. The carts are distinct from one another. Shoppers can add different items to their carts. They can check out one of the carts without affecting the content or status of their other carts. + + After the shopper checks out the cart, the cart remains available to the shopper. The cart is persistent and stays with the shopper after it is used. + + You can also create a cart to specify custom discounts. You can enable custom discounts when the `discount_settings.custom_discounts_enabled` field is set to `true`. Default is set from cart discount settings for the store. See [Update Cart Settings](/docs/api/settings/put-v-2-settings-cart). + + ### Preview Cart + + You can set a future date for your shopping cart and view the promotions that will be available during that time period. This feature enables you to validate your promotion settings and observe how they will be applied in the cart. + + :::caution + - Once the cart is in preview mode, you cannot revert it to a regular cart. + - Carts with `snapshot_date` are same as preview carts. + - You cannot checkout a cart that includes a `snapshot_date`. + - To delete a promotion preview cart, use [Delete a cart](/docs/api/carts/delete-a-cart) endpoint. + - The promotion preview cart has the same expiration time as a regular cart based on the store's [cart settings](/docs/api/settings/put-v-2-settings-cart). + - Preview cart interactions skip inventory checks and events, allowing users to preview future carts without impacting related external systems. + ::: + + ### Errors + + - `400 Bad Request` : This is returned when the submitted request does not adhere to the expected API contract for the endpoint. + + - For example, in the case of string fields, this error might indicate issues in the length or format of submitted strings. For more information about valid string fields, refer to Safe Characters section. + - In the case of preview carts (those with `snapshot_date`), an error is returned for invalid actions, such as removing the preview date, setting a preview date in the past, or attempting to checkout a cart with a `snapshot_date`. + operationId: createACart + parameters: + - name: x-moltin-customer-token + in: header + description: A customer token to be associated with the cart. + style: simple + schema: + type: string + example: '{{customerToken}}' + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/CartsRequest' + required: false + responses: + '200': + description: '' + headers: { } + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/CartResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + parameters: [ ] + /v2/carts/{cartID}: + get: + tags: + - Cart Management + summary: Get a Cart + description: | + Use this endpoint to retrieve a specific cart. If a cart ID does not exist, a new cart will be automatically created. If the cart is associated with shipping groups, calling this endpoint displays the associated shipping group IDs in the `relationships` section. + + You can easily get a new or existing cart by providing the unique cart reference in the request. If the cart is associated with shipping groups, calling this endpoint displays the associated shipping group IDs in the relationships section. + + :::note + + - The default cart name is Cart. However, you can update the cart name as required. Ensure that the string length of the name is greater than or equal to one. Follow the safe character guidelines for name and description naming. For more information about cart ID naming requirements, see the [Safe Characters](/guides/Getting-Started/safe-characters) section. + - Outside of the JS-SDK, we don’t handle creating cart references. You need to create your own. + + ::: + + :::caution + + An empty cart is returned for any carts that don’t currently exist. For more information about the cart items object, see [Get Cart Items](/docs/api/carts/get-cart-items). + + ::: + + ### Query parameters + + + | Name | Required | Type | Description | + |:----------|:---------|:---------|:-------------------------------------------| + | `include` | Optional | `string` | Comma-delimited string of entities that can be included. The information included are `items`,`tax_items`, `custom_discounts`, or `promotions`. | + operationId: getACart + parameters: + - name: cartID + in: path + description: The unique identifier for this cart that you created. + required: true + style: simple + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/CartResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + put: + tags: + - Cart Management + summary: Update a Cart + description: | + Updates cart properties for the specified cartID. + + You can also update a cart to specify custom discounts. You can enable custom discounts when the `discount_settings.custom_discounts_enabled` field is set to `true`. Default is set from cart discount settings for the store. See [Cart Settings](/docs/api/settings/put-v-2-settings-cart). + operationId: updateACart + parameters: + - name: cartID + in: path + description: The unique identifier of a cart created by you. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/CartsRequest' + required: false + responses: + '200': + description: '' + headers: { } + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/CartResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + delete: + tags: + - Cart Management + summary: Delete a Cart + description: | + You can delete a cart, including the items, name, description, and remove all associations. + + ### Errors + + The following error message is received when you attempt to delete a cart that is associated with a customer. Before deletion, ensure that the cart is disassociated. + + ```json + message: { + errors: [ + { + status: 400, + title: 'Last cart', + detail: 'This is the last cart associated with a customer and it cannot be deleted, try disassociating instead' + } + ] + } + ```` + operationId: deleteACart + parameters: + - name: cartID + in: path + description: The unique identifier of the cart that you want to delete. + required: true + style: simple + schema: + type: string + responses: + '204': + description: 'No Content' + headers: { } + content: { } + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + parameters: [ ] + /v2/carts/{cartID}/items: + get: + tags: + - Cart Items + summary: Get Cart Items + description: | + + Use this endpoint to retrieve cart items. If the cart is associated with shipping groups, calling this endpoint displays the associated shipping group IDs. + + You can use this endpoint to retrieve the breakdown of cart items by promotion ID. For example, if you have Promotions Standard item discount with code *sale2024*, Rule Promotions item discount with code *sale2024*, and Rule Promotions cart discount with code *sale2024*, the `discounts.constituents` field in the response example will show the breakdown of the same promotion code used in both Promotions Standard and Rule Promotions. + + ```json + "data": [ + { + "id": "98de010d-dd10-4fa5-a070-0b9bcdc72974", + "type": "cart_item", + "product_id": "5a4662d2-9a2b-4f6e-a215-2970db914b0c", + "name": "sku1", + "description": "sku1", + "sku": "sku1", + "slug": "sku1", + "image": { + "mime_type": "", + "file_name": "", + "href": "" + }, + "quantity": 1, + "manage_stock": false, + "unit_price": { + "amount": 10000, + "currency": "USD", + "includes_tax": false + }, + "value": { + "amount": 10000, + "currency": "USD", + "includes_tax": false + }, + "discounts": [ + { + "amount": { + "amount": -2000, + "currency": "USD", + "includes_tax": false + }, + "code": "sale2024", + "id": "e4d929d5-f471-4317-9a86-a84a6c572b44", + "promotion_source": "rule-promotion", + "is_cart_discount": true + }, + { + "amount": { + "amount": -1000, + "currency": "USD", + "includes_tax": false + }, + "code": "sale2024", + "id": "de19a043-a6da-4bde-b896-d17e16b77e25", + "promotion_source": "rule-promotion" + }, + { + "amount": { + "amount": -1000, + "currency": "USD", + "includes_tax": false + }, + "code": "sale2024", + "id": "509295ee-2971-45b6-801e-95df09756989" + }, + { + "amount": { + "amount": -1000, + "currency": "USD", + "includes_tax": false + }, + "code": "sale2024", + "id": "ca79e606-7ecd-41ac-9478-af4c8c28c546", + "promotion_source": "rule-promotion", + "is_cart_discount": true + } + ], + "links": { + "product": "https://useast.api.elasticpath.com/v2/products/5a4662d2-9a2b-4f6e-a215-2970db914b0c" + }, + "meta": { + "display_price": { + "with_tax": { + "unit": { + "amount": 5000, + "currency": "USD", + "formatted": "$50.00" + }, + "value": { + "amount": 5000, + "currency": "USD", + "formatted": "$50.00" + } + }, + "without_tax": { + "unit": { + "amount": 5000, + "currency": "USD", + "formatted": "$50.00" + }, + "value": { + "amount": 5000, + "currency": "USD", + "formatted": "$50.00" + } + }, + "tax": { + "unit": { + "amount": 0, + "currency": "USD", + "formatted": "$0.00" + }, + "value": { + "amount": 0, + "currency": "USD", + "formatted": "$0.00" + } + }, + "discount": { + "unit": { + "amount": -5000, + "currency": "USD", + "formatted": "-$50.00" + }, + "value": { + "amount": -5000, + "currency": "USD", + "formatted": "-$50.00" + } + }, + "without_discount": { + "unit": { + "amount": 10000, + "currency": "USD", + "formatted": "$100.00" + }, + "value": { + "amount": 10000, + "currency": "USD", + "formatted": "$100.00" + } + }, + "discounts": { + "sale2024": { + "amount": -5000, + "currency": "USD", + "formatted": "-$50.00", + "constituents": { + "509295ee-2971-45b6-801e-95df09756989": { + "amount": -1000, + "currency": "USD", + "formatted": "-$10.00" + }, + "ca79e606-7ecd-41ac-9478-af4c8c28c546": { + "amount": -1000, + "currency": "USD", + "formatted": "-$10.00" + }, + "de19a043-a6da-4bde-b896-d17e16b77e25": { + "amount": -1000, + "currency": "USD", + "formatted": "-$10.00" + }, + "e4d929d5-f471-4317-9a86-a84a6c572b44": { + "amount": -2000, + "currency": "USD", + "formatted": "-$20.00" + } + } + } + } + }, + "timestamps": { + "created_at": "2024-05-24T18:00:58Z", + "updated_at": "2024-05-24T18:00:58Z" + } + }, + "catalog_id": "09b9359f-897f-407f-89a2-702e167fe781", + "catalog_source": "pim" + } + ``` + operationId: getCartItems + parameters: + - name: cartID + in: path + description: The unique identifier of the cart that you created. + required: true + style: simple + schema: + type: string + responses: + '200': + description: '' + headers: { } + content: + application/json: + schema: + $ref: '#/components/schemas/CartsResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + put: + tags: + - Cart Items + summary: Bulk Update Items in Cart + description: | + The bulk update feature allows shoppers to update an array of items to their cart in one action, rather than updating each item one at a time. Shoppers can update quantity and shipping group details in bulk requests. This minimizes the time for shoppers while updating items to their cart. Shoppers can even update multiple items with the same or different shipping groups to their cart. + + When you update multiple items that qualify for free gifts in the cart, the corresponding free gifts for all eligible products are also automatically updated in the cart. + operationId: bulkUpdateItemsInCart + parameters: + - name: cartID + in: path + description: The unique identifier of the cart that you created. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/BulkUpdateCartsItems' + required: false + responses: + '200': + description: '' + headers: { } + content: { } + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + post: + tags: + - Cart Items + summary: Manage Carts + description: | + + ### Add Product to Cart + + Adding a Product to Cart is the most common Cart action. If you want to add any custom products or promotions, you need to do that as a separate action. + + #### Dynamic Bundles + + A bundle is a purchasable product that is composed of a combination of two or more products that you want to sell together. You can create multiple components within a bundle. Each component can have one or more options. Each option is a product and a quantity. You can configure minimum and/or maximum values for the number of product options in a component that your shoppers can select. For example, you can enable a shopper to select 1 or more product options from a list of 10. These are called [dynamic bundles](/docs/api/pxm/products/products#dynamic-bundles). + + Your dynamic bundles are displayed in your published catalogs. + + 1. Use the configure a shopper endpoint to allow shoppers to make their selections from a bundle. + 2. In the response of the configure a shopper, the `bundle_configuration` object contains the bundle selections a shopper has made. + 3. In the add a product to cart request, use the `bundle_configuration` object to add the customers selections to a cart. + + ```json + "bundle_configuration": { + "selected_options": { + "games": { + "d7b79eb8-19d8-45ea-86ed-2324a604dd9c": 1 + }, + "toys": { + "0192ccdd-6d33-4898-87d7-c4d87f2bf8ea": 1, + "1aea6f97-f0d9-452c-b3c1-7fb5629ead82": 1 + } + } + } + ``` + + When a cart is checked out, the options a shopper selected are added to the order. See [order items](/docs/api/carts/get-order-items). + + #### Personalized Products + + You can allow shoppers to personalize their goods by adding custom text inputs to products directly. This feature is particularly useful for customizable items, such as personalized T-shirts or greeting cards. You can use this functionality by leveraging the `custom_inputs` attribute, and defining the details and validation rules for the custom text. + + First, you must configure a `custom_inputs` attribute when creating a new product or updating an existing product. Once you have defined your custom inputs on a product, you must configure the custom inputs in your orders. + + For example, you may sell T-shirts that can have personalized text on the front and back of the shirt. + + ```json + { + "data": { + "type": "product", + "attributes": { + "custom_inputs": { + "front": { + "name": "T-Shirt Front", + "validation_rules": [ + { + "type": "string", + "options": { + "max_length": 50 + } + } + ], + "required": false + }, + "back": { + "name": "T-Shirt Back", + "validation_rules": [ + { + "type": "string", + "options": { + "max_length": 50 + } + } + ], + "required": false + } + } + } + } + } + ``` + + If the same product has different `custom_inputs` attributes, then these are added as separate items in a cart. + + The `custom_inputs` attribute is stored in the cart item and the text for `custom_input` must not exceed 255 characters in length. When a cart is checked out, the `custom_inputs` attribute becomes part of the order. + + #### Limitations on Usage of `custom_inputs` with Specific Promotion Types + + When you add products to a cart with `custom_inputs`, there are certain limitations on usage of the `custom_inputs` with the following promotion types: + + - For [Free Gift Promotions](/docs/api/promotions/create-a-promotion), you can add `custom_inputs` to gift items. + - For [Fixed Bundle Discount Promotions](/docs/api/promotions/create-a-promotion), the promotion applies as long as the cart contains the bundle SKUs even when there are different `custom_inputs`. + - For [X for Y Discount Promotion and X for amount discount promotion](/docs/api/promotions/create-a-promotion), the promotion applies when there are two SKUs with the same `custom_inputs`. The promotion does not apply when there are different `custom_inputs` and the SKUs are in different line items. + + :::note + + - Any requests to add a product to cart returns the collection of cart items. + - [Tax items](/docs/api/carts/tax-items) may optionally be added with the product. Only administrators with [client credentials](/docs/authentication/Tokens/client-credential-token) are able to do this. If included, they replace any existing taxes on the product. + - The cart currency is set when the first item is added to the cart. + - The product being added to the cart requires a price in the same currency as the other items in the cart. The API returns a 400 error if a price is not defined in the correct currency. + - A cart can contain a maximum of 100 unique items. Items include products, custom items, tax items, and promotions. + - There are a number of actions that happen to your inventory when checking out and paying for an order. For more information, see the [Inventory](/docs/api/pxm/inventory/inventories-introduction) documentation. + + ::: + + ### Add Custom Item to Cart + + You can add a custom item to the cart when you don't manage things like shipping, taxes and inventory in Commerce. + + For [Shipping Groups](/docs/ship-groups/shipping-groups), once you have created a [cart shipping group](/docs/ship-groups/shipping-groups/shipping-groups-api/create-cart-shipping-group), you need to link it to the cart items. This is important, because it is necessary to associate items with shipping groups in order to include shipping groups in the corresponding cart, order, and totals. + + :::note + + - Custom Cart Items are available through [implicit authentication](/docs/authentication/Tokens/implicit-token). Ensure that you always check each order has the correct details for each item, most importantly, price. + + ::: + + ### Add Promotion to Cart + + You can use the Promotions API to apply discounts to your cart as a special cart item type. Any requests to add a product to cart will return a collection of cart items. + + There are certain limitations on usage of the `custom_inputs` attribute with some promotion types. See [Limitations on Usage of `custom_inputs` with Specific Promotion Types](/docs/api/carts/manage-carts#limitations-on-usage-of-custom_inputs-with-specific-promotion-types). + + To remove promotion from the cart via the promotion code, see [Delete Promotion Code from Cart](/docs/api/carts/delete-a-promotion-via-promotion-code). + + ### Re-order + + From a shopper’s order history, they can add the items from a previous order into their carts. Shoppers can add items regardless of past order status, such as incomplete or not paid. For more information, see [Orders](/docs/api/carts/orders). + + :::note + - Any requests to add an item to cart return a collection of [cart items](/docs/api/carts/cart-items). + - A cart can contain a maximum of 100 unique items. Items include products, custom items, and promotions. + - When a shopper creates a cart and re-orders items from an order with properties such as custom attributes, custom discounts, and payment intent ID, these properties will remain unchanged in the original cart. + - Custom items do not exist in catalogs, and therefore cannot be reordered. + ::: + + ### Merging Carts + + A shopper can have multiple carts, and the system may automatically merge items from an anonymous cart into the shopper's registered cart when they sign in. For example, if a shopper has an existing cart with items `A`, `B` and `C`, and later adds items `D` and `E` while not signed in, the system can merge these carts when the shopper signs in. After the carts merge, the cart contains items `A`, `B`, `C`, `D` and `E`. + + If any items are duplicated from the anonymous cart to the registered cart, their quantities are incremented accordingly. For example, if a shopper's existing cart with items `A`, `B` and `C`, and they later add two more `A` items and one `B` item while not signed in, the system will merge the carts when the shopper signs in. The existing cart will now contain three `A` items, two `B` items, and one `C` item. + + :::note + + When the system merges items from one cart into another cart, properties such as custom attributes, custom discounts, and payment intent ID will remain unchanged in the original cart. + + ::: + + ### Best Practices + + We recommend to include a unique `sku` code within the request body while adding custom items to carts. If the same `sku` is used for multiple products, they are merged into a single line item. + + For example, if a cart consists of the following items: + + - `product-1` with quantity 1 and sku code as `sku-1` + - `product-2` with quantity 1 and sku code as `sku-1` + - `product-3` with quantity 1 and sku code as `sku-2`. + + The following response is returned where it combines all products with the same sku codes into a single line item, while products with a unique sku codes are represented as separate items: + + ```json + { + "data": [ + { + "id": "c58760f4-8889-4719-b34d-be1f1d11ae59", + "type": "custom_item", + "name": "product-1", + "description": "My first custom item!", + "sku": "sku-1", + "slug": "", + "image": { + "mime_type": "", + "file_name": "", + "href": "" + }, + "quantity": 2, + "manage_stock": false, + "unit_price": { + "amount": 20000, + "currency": "USD", + "includes_tax": true + }, + "value": { + "amount": 40000, + "currency": "USD", + "includes_tax": true + }, + "links": {}, + "meta": { + "display_price": { + "with_tax": { + "unit": { + "amount": 20000, + "currency": "USD", + "formatted": "$200.00" + }, + "value": { + "amount": 40000, + "currency": "USD", + "formatted": "$400.00" + } + }, + "without_tax": { + "unit": { + "amount": 20000, + "currency": "USD", + "formatted": "$200.00" + }, + "value": { + "amount": 40000, + "currency": "USD", + "formatted": "$400.00" + } + }, + "tax": { + "unit": { + "amount": 0, + "currency": "USD", + "formatted": "$0.00" + }, + "value": { + "amount": 0, + "currency": "USD", + "formatted": "$0.00" + } + }, + "discount": { + "unit": { + "amount": 0, + "currency": "USD", + "formatted": "$0.00" + }, + "value": { + "amount": 0, + "currency": "USD", + "formatted": "$0.00" + } + }, + "without_discount": { + "unit": { + "amount": 20000, + "currency": "USD", + "formatted": "$200.00" + }, + "value": { + "amount": 40000, + "currency": "USD", + "formatted": "$400.00" + } + } + }, + "timestamps": { + "created_at": "2023-05-02T16:28:11Z", + "updated_at": "2023-05-02T16:28:18Z" + } + } + } + ``` + operationId: manageCarts + parameters: + - name: cartID + in: path + description: The unique identifier of the cart that you created. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/CartItemsObjectRequest' + - $ref: "#/components/schemas/CartMergeObjectRequest" + - $ref: "#/components/schemas/CustomItemObject" + - $ref: "#/components/schemas/ReOrderObjectRequest" + - $ref: "#/components/schemas/PromotionItemObject" + - $ref: "#/components/schemas/BulkAddItemsRequest" + + responses: + '200': + description: '' + headers: { } + content: + application/json: + schema: + $ref: '#/components/schemas/CartsResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + delete: + tags: + - Cart Items + summary: Delete all Cart Items + description: | + A shopper can clean up their cart, deleting custom items, promotions, and so on, while the empty cart remains available. The cart id, name, description, and any account or customer associations persist. The shopper can continue to add items to the cart. + operationId: deleteAllCartItems + parameters: + - name: cartID + in: path + description: The unique identifier of the cart created by you. + required: true + style: simple + schema: + type: string + responses: + '204': + description: 'No Content' + headers: { } + content: { } + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + parameters: [ ] + /v2/carts/{cartID}/items/{cartitemID}: + put: + tags: + - Cart Items + summary: Update a Cart Item + description: You can easily update a cart item. A successful update returns the cart items. + operationId: updateACartItem + parameters: + - name: cartID + in: path + description: A unique identifier of the cart that you created. + required: true + style: simple + schema: + type: string + - name: cartitemID + in: path + description: A unique identifier of the cart item. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/UpdateCartsItems' + required: false + responses: + '200': + description: '' + headers: { } + content: + application/json: + schema: + $ref: '#/components/schemas/CartsResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + delete: + tags: + - Cart Items + summary: Delete a Cart Item + description: Use this endpoint to delete a cart item. + operationId: deleteACartItem + parameters: + - name: cartID + in: path + description: The unique identifier of the cart created by you. + required: true + style: simple + schema: + type: string + - name: cartitemID + in: path + description: The unique identifier of the cart that you want to delete. + required: true + style: simple + schema: + type: string + responses: + '204': + description: 'No Content' + headers: { } + content: { } + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + parameters: [ ] + /v2/carts/{cartID}/relationships/accounts: + post: + tags: + - Account Cart Associations + summary: Create an Account Cart Association + description: You can create associations between an account and one or more carts. After cart associations exist for an account, the account can access those carts across any device. + operationId: createAccountCartAssociation + parameters: + - name: cartID + in: path + description: The ID for the cart created by the account. Ensure that you follow the guidelines for [Safe Characters](/guides/Getting-Started/safe-characters). + required: true + style: simple + schema: + type: string + - name: EP-Account-Management-Authentication-Token + in: header + description: An Account Management Authentication token to access a specific account's carts. + style: simple + schema: + type: string + example: '{{accountToken}}' + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/CartsRelationshipsAccountsData' + required: false + responses: + '200': + description: 'OK' + headers: { } + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/CartsRelationshipsAccountsData' + '204': + description: 'No Content is sent back in case the account has already been associated to the cart.' + headers: { } + content: { } + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + delete: + tags: + - Account Cart Associations + summary: Delete Account Cart Association + description: You can delete an association between an account and a cart. + operationId: deleteAccountCartAssociation + parameters: + - name: cartID + in: path + description: The ID for the cart created by the account. + required: true + style: simple + schema: + type: string + - name: EP-Account-Management-Authentication-Token + in: header + description: An Account Management Authentication token to access a specific account's carts. + style: simple + schema: + type: string + example: '{{accountToken}}' + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/CartsRelationshipsAccountsData' + required: false + responses: + '204': + description: 'No Content' + headers: { } + content: { } + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + parameters: [ ] + /v2/carts/{cartID}/relationships/customers: + post: + tags: + - Customer Cart Associations + summary: Create a Customer Cart Association + description: You can create associations between a customer and one or more carts. After cart associations exist for a customer, the customer can access those carts across any device. + operationId: createCustomerCartAssociation + parameters: + - name: cartID + in: path + description: The ID for the cart created by the customer. Ensure that you follow the guidelines for [Safe Characters](/guides/Getting-Started/safe-characters). + required: true + style: simple + schema: + type: string + - name: x-moltin-customer-token + in: header + description: A customer token to access a specific customer's carts. + style: simple + schema: + type: string + example: '{{customerToken}}' + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/CartsRelationshipsCustomersData' + required: false + responses: + '200': + description: 'OK' + headers: { } + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/CartsRelationshipsCustomersData' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + delete: + tags: + - Customer Cart Associations + summary: Delete Customer Cart Association + description: You can delete an association between a customer and a cart. + operationId: deleteCustomerCartAssociation + parameters: + - name: cartID + in: path + description: The ID for the cart created by the customer. + required: true + style: simple + schema: + type: string + - name: x-moltin-customer-token + in: header + description: A customer token to access a specific customer's carts. + style: simple + schema: + type: string + example: '{{customerToken}}' + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/CartsRelationshipsCustomersData' + required: false + responses: + '204': + description: 'No Content' + headers: { } + content: { } + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + parameters: [ ] + /v2/carts/{cartID}/discounts/{promoCode}: + delete: + tags: + - Cart Items + summary: Delete a Promotion via Promotion Code + description: You can remove promotion code from a cart if it was applied manually. This endpoint does not work if the promotion is applied automatically. + operationId: deleteAPromotionViaPromotionCode + parameters: + - name: cartID + in: path + description: Specifies the unique identifier of a cart created by you. + required: true + style: simple + schema: + type: string + - name: promoCode + in: path + description: Specifies the promotion code to be deleted. + required: true + style: simple + schema: + type: string + responses: + '204': + description: 'No Content' + headers: { } + content: { } + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + parameters: [ ] + + /v2/carts/{cartID}/items/{cartitemID}/taxes: + post: + tags: + - Tax Items + summary: Add Tax Item to Cart + description: | + + Use this endpoint to add a tax item to a cart. + + :::note + + There is a soft limit of 5 unique tax items per cart item at any one time. + + ::: + operationId: addTaxItemToCart + parameters: + - name: cartID + in: path + description: The unique identifier of the cart. + required: true + style: simple + schema: + type: string + - name: cartitemID + in: path + description: The unique identifier of the cart item. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/CartsItemsTaxesObject' + required: false + responses: + '200': + description: '' + headers: { } + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/CartsItemsTaxesObject' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + '422': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 422 + title: Unprocessable Entity + deprecated: false + parameters: [ ] + /v2/carts/{cartID}/taxes: + post: + tags: + - Tax Items + summary: Bulk Add Tax Items to Cart + description: | + :::note + + A cart item can only have a maximum of five tax items. + + ::: + + ### Errors + + `422 Unprocessable Entity` + + In this example, when `options.add_all_or_nothing` is set to `true` and if one of cart items is not found or or has reached its maximum tax item limit, the following error response is returned: + + ```json + { + "status": 422, + "title": "Add all or nothing.", + "detail": "Add all or nothing set to (true). Could not bulk add tax items to cart." + } + + ``` + + In this example, if you add more than five tax items to the same cart item, the following error response is returned: + + ```json + { + "status": 422, + "title": "Tax item not added to cart item.", + "detail": "Cannot exceed tax item limit of (5) on cart item.", + "meta": { + "id": "f88e6370-cb35-40b2-a998-c759f31dec0a" + } + } + ``` + + `404` + + In this example, if there is a mismatch between `cart_item`/`custom_item` and the `relationships.item.data.type` specified in the bulk add tax item, the following error response is returned: + + ```json + { + "data": [], + "errors": [ + { + "status": 404, + "title": "Tax item not added to cart item.", + "detail": "Mismatch between bulk tax item type(cart_item) and cart item type(custom_item).", + "meta": { + "id": "56aab5d1-1dd4-45ed-88ed-4d0cc396b62d" + } + }, + { + "status": 404, + "title": "Tax item not added to cart item.", + "detail": "Mismatch between bulk tax item type(cart_item) and cart item type(custom_item).", + "meta": { + "id": "56aab5d1-1dd4-45ed-88ed-4d0cc396b62d" + } + } + ] + } + ``` + operationId: bulkAddTaxItemsToCart + parameters: + - name: cartID + in: path + description: The unique identifier of the cart. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/CartsBulkTaxes' + required: false + responses: + '200': + description: '' + headers: { } + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/CartsBulkTaxes' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + delete: + tags: + - Tax Items + summary: Bulk Delete Tax Items from Cart + description: Use this endpoint to bulk delete tax items from cart. + operationId: bulkDeleteTaxItemsFromCart + parameters: + - name: cartID + in: path + description: The unique identifier of the cart. + required: true + style: simple + schema: + type: string + responses: + '204': + description: 'No Content' + headers: { } + content: { } + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + parameters: [ ] + /v2/carts/{cartID}/items/{cartitemID}/taxes/{taxitemID}: + put: + tags: + - Tax Items + summary: Update a TaxItem + description: Use this endpoint to update a tax item. + operationId: updateATaxItem + parameters: + - name: cartID + in: path + description: The unique identifier of the cart. + required: true + style: simple + schema: + type: string + - name: cartitemID + in: path + description: The unique identifier of the cart item. + required: true + style: simple + schema: + type: string + - name: taxitemID + in: path + description: The unique identifier of the tax item. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/CartsItemsTaxesObject' + required: false + responses: + '200': + description: '' + headers: { } + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/CartsItemsTaxesObject' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + delete: + tags: + - Tax Items + summary: Delete a Tax Item + description: Use this endpoint to delete a tax item. + operationId: deleteATaxItem + parameters: + - name: cartID + in: path + description: The unique identifier of the cart. + required: true + style: simple + schema: + type: string + - name: cartitemID + in: path + description: The unique identifier of the cart item. + required: true + style: simple + schema: + type: string + - name: taxitemID + in: path + description: The unique identifier of the tax item. + required: true + style: simple + schema: + type: string + responses: + '204': + description: 'No Content' + headers: { } + content: { } + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + parameters: [ ] + /v2/carts/{cartID}/custom-discounts: + post: + tags: + - Custom Discounts + summary: Bulk Add Custom Discounts to Cart + description: | + The default value for custom discounts on both the cart and cart items is set to 5 if this parameter is not configured in the store. To verify the custom discount limit value, call [Get all settings](/docs/api/settings/get-v-2-settings) endpoint. + + To increase the custom discount value, contact [Elastic Path Support team](https://support.elasticpath.com/hc/en-us). + + + operationId: bulkAddCustomDiscountsToCart + parameters: + - name: cartID + in: path + description: Specifies the system generated ID for the cart that the shopper created. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/CartsBulkCustomDiscounts' + required: false + responses: + '200': + description: '' + headers: { } + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/CartsBulkCustomDiscountsResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + delete: + tags: + - Custom Discounts + summary: Bulk Delete Custom Discounts From Cart + description: Use this endpoint to bulk delete custom discounts from cart. + operationId: bulkDeleteCustomDiscountsFromCart + parameters: + - name: cartID + in: path + description: Specifies the unique ID for the cart. + required: true + style: simple + schema: + type: string + responses: + '204': + description: 'No Content' + headers: { } + content: { } + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + parameters: [ ] + /v2/carts/{cartID}/custom-discounts/{customdiscountID}: + put: + tags: + - Custom Discounts + summary: Update Custom Discount For Cart + description: Use this endpoint to update a custom discount in your cart. + operationId: updateCustomDiscountForCart + parameters: + - name: cartID + in: path + description: Specifies the unique ID for the cart. + required: true + style: simple + schema: + type: string + - name: customdiscountID + in: path + description: Specifies the ID for the custom discount to be updated. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/CartsCustomDiscountsObject' + required: false + responses: + '200': + description: '' + headers: { } + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/CartsCustomDiscountsResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + delete: + tags: + - Custom Discounts + summary: Delete Custom Discount From Cart + description: Use this endpoint to delete custom discount from cart. + operationId: deleteCustomDiscountFromCart + parameters: + - name: cartID + in: path + description: Specifies the unique ID for the cart. + required: true + style: simple + schema: + type: string + - name: customdiscountID + in: path + description: Specifies the ID for the custom discount to be deleted. + required: true + style: simple + schema: + type: string + responses: + '204': + description: 'No Content' + headers: { } + content: { } + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + parameters: [ ] + /v2/carts/{cartID}/items/{cartitemID}/custom-discounts: + post: + tags: + - Custom Discounts + summary: Add Custom Discount To Cart Item + description: Use this endpoint to add a custom discount to cart item. + operationId: addCustomDiscountToCartItem + parameters: + - name: cartID + in: path + description: Specifies the ID for the cart. + required: true + style: simple + schema: + type: string + - name: cartitemID + in: path + description: Specifies the unique identifier for the cart item. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/CartsCustomDiscountsObject' + required: false + responses: + '200': + description: '' + headers: { } + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/CartsCustomDiscountsResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + parameters: [ ] + /v2/carts/{cartID}/items/{cartitemID}/custom-discounts/{customdiscountID}: + put: + tags: + - Custom Discounts + summary: Update Custom Discount For Cart Item + description: Use this endpoint to update a custom discount in your cart item. + operationId: updateCustomDiscountForCartItem + parameters: + - name: cartID + in: path + description: Specifies the ID for the cart. + required: true + style: simple + schema: + type: string + - name: cartitemID + in: path + description: Specifies the ID for the cart item. + required: true + style: simple + schema: + type: string + - name: customdiscountID + in: path + description: Specifies the ID for the custom discount to be updated. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/CartsCustomDiscountsObject' + required: false + responses: + '200': + description: '' + headers: { } + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/CartsCustomDiscountsResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + delete: + tags: + - Custom Discounts + summary: Delete Custom Discount From Cart Item + description: Use this endpoint to delete custom discount from cart item. + operationId: deleteCustomDiscountFromCartItem + parameters: + - name: cartID + in: path + description: Specifies the ID for the cart. + required: true + style: simple + schema: + type: string + - name: cartitemID + in: path + description: Specifies the ID for the cart item. + required: true + style: simple + schema: + type: string + - name: customdiscountID + in: path + description: Specifies the ID for the custom discount to be deleted. + required: true + style: simple + schema: + type: string + responses: + '204': + description: 'No Content' + headers: { } + content: { } + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + parameters: [ ] + + /v2/carts/{cartID}/payments: + post: + tags: + - Payments + summary: Create Stripe Payment Intent for a Cart + description: | + The Cart Payment Intent feature enables the creation of a Stripe Payment Intent specifically tied to a shopping cart and its subsequent order. This allows Payment Intent users to track payment details from the cart stage and seamlessly maintain consistency in payment information throughout the order stage. Using these features, you can create Payment Intents for their carts, update Payment Intents with final cart details, and synchronize Payment Intents from Stripe to Commerce. + + :::note + + - Typically, in Commerce, inventory is allocated at the time of payment initiation after an order is created. However, in the case of Cart Payment Intent, information about the payment is received only upon synchronizing the order from Stripe to Commerce. This may happen after the payment is completed. Therefore, there might be a delay between the payment made and allocation, increasing the chance of paying for items that are not in stock. + - There are certain fields you can choose to set up when [creating a payment intent](https://stripe.com/docs/api/payment_intents/create). However, if you decide to update a payment intent, the available options may not be the same as those allowed while creating a payment intent. See [updating a payment intent](https://stripe.com/docs/api/payment_intents/update). + + ::: + + The following steps outline the workflow associated with the Payment Intent: + + 1. [Add items to cart](/docs/api/carts/manage-carts#add-custom-item-to-cart). + 1. [Create a Payment Intent for the cart](/docs/api/carts/create-cart-payment-intent). The Payment Intent is created in Stripe, reflecting the cart and transaction details, including currency, amounts, payment type, and any optional Stripe details. The Payment Intent ID is generated and linked to the cart. + 1. [Update a Payment Intent](/docs/carts-orders/update-cart-payment-intent). This step is optional but becomes necessary when there are changes in the cart details at the time of payment. It ensures the Payment Intent accurately reflects the current cart details when processing the payments on the front end. + 1. [Checkout the cart](/docs/api/carts/checkout). An unpaid order is created, and the Payment Intent ID is linked to the order. + 1. [Confirm the order](/docs/carts-orders/confirm-an-order). This is important because after checkout, it is essential to confirm the Payment Intent and synchronize it with Commerce. This results in a corresponding transaction and change in order statuses in Commerce. Additionally, the Payment Intent ID is removed from the order once it is linked via the transaction. + + ### Best Practices + + We recommend you follow these practices to maintain consistency and accuracy when using Cart Payment Intent. + + - After checkout, we recommend clearing the shopping cart. You can achieve this using a [Delete a cart](/docs/api/carts/delete-a-cart) endpoint or [Update a cart](/docs/api/carts/update-a-cart) to remove the Payment Intent ID. This helps to avoid potential issues where subsequent checkouts for the same cart might unintentionally use the previous Stripe Payment Intent ID. + - If it is not reasonable to clear the cart immediately after checkout due to several subsequent, duplicate checkouts to the same cart, ensure that you only synchronize the Payment Intent when finalizing the order. Each order confirmation is unaware of the others, and syncing Payment Intent IDs for each confirmation can lead to duplicate transactions in Commerce. In other words, if you synchronize Payment Intents for earlier versions of a repeated checkout, you'll end up with multiple orders from the same cart, each having transactions linked to the same Payment Intent. + - To pay the entire amount at once, use the [Update Cart Payment Intent](/docs/carts-orders/update-cart-payment-intent) endpoint to update the Stripe Payment Intent with the final cart details when preparing to take the payment. Doing so, ensures that the Payment Intent accurately reflects the current cart details when processing payments on the front end. We do not recommend calling the [Update Cart Payment Intent](/docs/carts-orders/update-cart-payment-intent) for each individual change in the cart, as this can lead to more requests and may slow down the front-end performance. + operationId: createCartPaymentIntent + parameters: + - name: cartID + in: path + required: true + style: simple + schema: + type: string + description: The universally unique identifier of the cart for which you want to create a payment intent. + requestBody: + required: false + content: + application/json: + schema: + $ref: '#/components/schemas/ElasticPathPaymentsPoweredByStripePayment' + responses: + '201': + description: Payment Intent created successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/CartResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + parameters: [ ] + + /v2/carts/{cartID}/checkout: + post: + tags: + - Checkout + summary: Checkout API + description: | + When a Cart is ready for checkout, you can convert the cart to an order. The cart remains and can be modified and checked out again if required. + + A cart can be checked out with a customer ID, customer object, or with an account by authenticating with the `Client Credentials Token`. + + After a successful checkout, a response that contains the order is returned. If the cart is linked to a shipping group, the shipping group is also associated with the order after checkout. + + You can checkout using one of the following methods: + - Customer ID. You can checkout a cart with an existing customer ID. + - Guest Checkout (Checkout with Customer Object). You can checkout a cart with an associated customer name and email. + - Checkout with Account. The shopper authenticates with the `Client Credentials` Token. + - Checkout with Account Management Authentication Token. The shopper authenticates with the `Implicit Token` and the `EP-Account-Management-Authentication-Token`. + + :::note + + - The cart currency is set when the first item is added to the cart. + - The product being added to the cart requires a price in the same currency as the other items in the cart. The API returns a 400 error if a price is not defined in the correct currency. + - To ensure that a free gift is automatically applied to an order, set the promotion to automatic. The checkout process will not be successful if free gift items are out of stock. See [Errors](#errors) section. + + ::: + + :::caution + + - By default, carts are automatically deleted 7 days after the last update. You can change this setting by [updating cart settings](/docs/api/settings/put-v-2-settings-cart). + - Your inventory is modified during checkout and payment of an order. For more information about the changes in the inventory, see the [Inventory](/docs/api/pxm/inventory/inventories-introduction) section. + + ::: + + ### Next Steps + + After a cart has been converted to an Order using either of the previous methods, you most likely want to capture payment for order. See [Paying for an Order](/docs/api/carts/payments). + + ### Errors + + The following error response is returned during checkout when an eligible item is added to the cart, and the free gift is out of stock. + + ```json + { + "errors": [ + { + "status": 400, + "title": "Insufficient stock", + "detail": "There is not enough stock to add gift2 to your cart", + "meta": { + "id": "f2b68648-9621-45a3-aed6-1b526b0f5beb", + "sku": "gift2" + } + } + ] + } + ``` + operationId: checkoutAPI + parameters: + - name: cartID + in: path + description: The ID of the cart that you want to checkout. + required: true + style: simple + schema: + type: string + - name: EP-Account-Management-Authentication-Token + in: header + description: An account management authentication token that identifies the authenticated account member. + style: simple + schema: + type: string + example: '{{accountToken}}' + requestBody: + description: '' + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/CustomerCheckout' + - $ref: '#/components/schemas/AccountCheckout' + required: false + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/OrderResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + parameters: [ ] + /v2/orders: + get: + tags: + - Orders + summary: Get All Orders + description: | + This endpoint returns all orders with custom flow fields. The pagination offset is set to fetch a maximum of 10,000 orders. If the store has 10,000 orders and you fetch the orders without using filters, an error is returned. Use a filter to view orders when the order is beyond the 10,000 mark. + + :::note + + - Pass the `X-Moltin-Customer-Token` header to limit orders to a specific customer. See [Customer Tokens](/docs/customer-management/customer-management-api/customer-tokens). + - Pass the `EP-Account-Management-Authentication-Token` header to limit orders to a specific account. See [Account Management Token](/docs/api/accounts/post-v-2-account-members-tokens). + - You can use pagination with this resource. For more information, see [pagination](/guides/Getting-Started/pagination). + + ::: + + ### Filtering + + The following operators and attributes are available for filtering orders. + + | Attribute | Type | Operator | Example | + | :--- | :--- | :--- | :--- | + | `status` | `string` | `eq` | `eq(status,complete)` | + | `payment` | `string` | `eq` | `eq(payment,paid)` | + | `shipping` | `string` | `eq` | `eq(shipping,unfulfilled)` | + | `name` (`customer.name`) | `string` | `eq` / `like` | `like(name,Brad*)` | + | `email` (`customer.email`) | `string` | `eq` / `like` | `like(email,*@elasticpath.com)` | + | `customer_id` | `string` | `eq` / `like` | `eq(customer_id, e5a0d684-a4af-4919-a348-f66b0b4955e0)` | + | `account_id` | `string` | `eq` / `like` | `eq(account_id,3d7200c9-a9bc-4085-9822-63e80fd94a09)` | + | `account_member_id` | `string` | `eq` / `like` | `eq(account_member_id,2a8a3a92-2ccd-4b2b-a7af-52d3896eaecb)` | + | `contact.name` | `string` | `eq` / `like` | `eq(name,John Doe)` | + | `contact.email` | `string` | `eq` / `like` | `eq(email,John Doe)` | + | `shipping_postcode` | `string` | `eq` / `like` | `like(shipping_postcode,117*)` | + | `billing_postcode` | `string` | `eq` / `like` | `like(billing_postcode,117*)` | + | `with_tax` | `integer` | `gt`/`ge`/`lt`/`le` | `ge(with_tax,10000)` | + | `without_tax` | `integer` | `gt`/`ge`/`lt`/`le` | `ge(without_tax,10000)` | + | `currency` | `string` | `eq` | `eq(currency,USD)` | + | `product_id` | `string` | `eq` | `eq(product_id,6837058c-ae42-46db-b3c6-7f01e0c34b40)` | + | `product_sku` | `string` | `eq` | `eq(product_sku,deck-shoe-001)` | + | `created_at` | `date` | `eq` / `gt` / `ge`/ `le` / `lt` | `gt(created_at,YYYY-MM-DD)` | + | `updated_at` | `date` | `eq` / `gt` / `ge`/ `le`/ `lt` | `lt(updated_at,YYYY-MM-DD)` | + | `external_ref` | `string` | `eq` / `like` | `like(external_ref, 16be*)` | + + operationId: getCustomerOrders + parameters: + - name: x-moltin-customer-token + in: header + description: A customer token to access a specific customer's orders. + style: simple + schema: + type: string + example: '{{customerToken}}' + responses: + '200': + description: '' + headers: { } + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + type: array + items: + $ref: '#/components/schemas/OrderResponse' + links: + $ref: '#/components/schemas/Response.PageLinks' + meta: + $ref: '#/components/schemas/Response.Meta.Orders' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + parameters: [ ] + /v2/orders/{orderID}: + get: + tags: + - Orders + summary: Get an Order + description: Use this endpoint to retrieve a specific order. + operationId: getAnOrder + parameters: + - name: orderID + in: path + description: The ID of the order. + required: true + style: simple + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/OrderResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + put: + tags: + - Orders + summary: Update an Order + description: | + You can only update custom data, `shipping`, `shipping_address`, and status on orders. All other settings in the order object are immutable. + + :::caution + + You can update `shipping`, `shipping_address`, and status of an order only if the order is not fulfilled. You can use the refund API to refund an order only if the payment status is `paid`. Canceling an order does not automatically refund a payment. You must refund the orders manually. + + ::: + + :::note + + - This request is only accessible to client credentials token users with Seller Admin role. + - Non client credentials token users cannot access this endpoint. See [Permissions](/docs/authentication/Tokens/permissions). + + ::: + operationId: updateAnOrder + parameters: + - name: orderID + in: path + description: The unique identifier of the order. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/OrdersUpdateRequest' + required: false + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/OrderResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + parameters: [ ] + /v2/orders/{orderID}/items: + get: + tags: + - Orders + summary: Get Order Items + description: Use this endpoint to retrieve order items. + operationId: getOrderItems + parameters: + - name: orderID + in: path + description: The ID of the order. + required: true + style: simple + schema: + type: string + responses: + '200': + description: '' + headers: { } + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + type: array + items: + $ref: '#/components/schemas/OrderItemResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + parameters: [ ] + /v2/orders/anonymize: + post: + tags: + - Orders + summary: Anonymize Orders + description: | + You can anonymize an order when it is fulfilled, canceled, or fully refunded. + + When anonymization is successful, Personal Identifiable Information such as customer details, `shipping_address`, and `billing_address` are replaced with *. + operationId: anonymizeOrders + parameters: [ ] + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/OrdersAnonymizeRequest' + contentMediaType: application/json + required: false + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/OrderResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + '422': + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + detail: "Order has status: order:incomplete, payment:unpaid, shipping:unfulfilled; only fulfilled or refunded or cancelled orders may be anonymized" + status: 422 + title: "Could not anonymize orders" + meta: + order_id: "496c29a1-6e7a-4ab6-a4e7-d1ec9a08b85e" + deprecated: false + parameters: [ ] + /v2/orders/{orderID}/payments: + post: + tags: + - Payments + summary: Authorize Setup + description: Authorize setup + operationId: authorizeSetup + parameters: + - name: orderID + in: path + description: The Universally Unique Identifier (UUID) of the order you want to pay for. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/PaymentsRequest' + required: false + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/TransactionResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + parameters: [ ] + /v2/orders/{orderID}/transactions/{transactionID}/confirm: + post: + tags: + - Payments + summary: Confirm Setup + description: Confirm setup + operationId: confirmSetup + parameters: + - name: orderID + in: path + description: The unique identifier of the order. + required: true + style: simple + schema: + type: string + - name: transactionID + in: path + description: The unique identifier of the transaction. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/OrdersTransactionsConfirmRequest' + responses: + '200': + description: '' + headers: { } + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/TransactionResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + parameters: [ ] + /v2/orders/{orderID}/transactions/{transactionID}/capture: + post: + tags: + - Transactions + summary: Capture a Transaction + description: Use this endpoint to capture a previously authorized payment. In this step, you can also pass in a custom reference, such as the payment reference from your chosen gateway. + operationId: captureATransaction + parameters: + - name: orderID + in: path + description: The UUID of the order. + required: true + style: simple + schema: + type: string + - name: transactionID + in: path + description: The UUID of the transaction to capture. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/OrdersTransactionsCaptureRequest' + required: false + responses: + '200': + description: '' + headers: { } + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/TransactionResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + parameters: [ ] + /v2/orders/{orderID}/transactions/{transactionID}/refund: + post: + tags: + - Transactions + summary: Refund a Transaction + description: | + There are two ways to refund; through your payment gateway and mark it refunded in Commerce Manager, or directly through Commerce Manager or API. + + * Mark as Refunded: You can manually mark a transaction as refunded. Before you can mark the order as refunded, you need to handle the actual refund on your side with your payment provider. Mark as Refunded is a full refund made to the transaction. + * Refund through Composable Commerce: You can process a full or partial refund to a supported payment provider directly from Commerce Manager or API by providing the refund amount. When you start the refund process, the request is directly sent to the payment gateway. + + :::caution + + If you use manual gateway for partial or full refund, you need to handle the actual refund on your side with your payment provider. + + ::: + operationId: refundATransaction + parameters: + - name: orderID + in: path + description: The UUID of the order. + required: true + style: simple + schema: + type: string + - name: transactionID + in: path + description: The UUID of the transaction you want to refund. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/OrdersTransactionsRefundRequest' + required: false + responses: + '200': + description: '' + headers: { } + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/TransactionResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + parameters: [ ] + /v2/orders/{orderID}/transactions: + get: + tags: + - Transactions + summary: Get Order Transactions + description: Get order transactions + operationId: getOrderTransactions + parameters: + - name: orderID + in: path + description: The unique identifier of the order. + required: true + style: simple + schema: + type: string + responses: + '200': + description: '' + headers: { } + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + type: array + items: + $ref: '#/components/schemas/TransactionResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + parameters: [ ] + /v2/orders/{orderID}/transactions/{transactionID}: + get: + tags: + - Transactions + summary: Get a Transaction + description: Retrieves a transaction + operationId: getATransaction + parameters: + - name: orderID + in: path + description: The unique identifier of the order that you require transactions for. + required: true + style: simple + schema: + type: string + - name: transactionID + in: path + description: The unique identifier of the transaction. + required: true + style: simple + schema: + type: string + responses: + '200': + description: '' + headers: { } + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/TransactionResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + parameters: [ ] + /v2/orders/{orderID}/transactions/{transactionID}/cancel: + post: + tags: + - Transactions + summary: Cancel a Transaction + description: | + Use this endpoint to cancel or void a pending or authorized transaction. The transaction can be canceled or voided when it is in `pending` and `completed` statuses. + + :::caution + + This endpoint works only for Stripe and PayPal and does not work for manual gateway. + + ::: + operationId: cancelATransaction + parameters: + - name: orderID + in: path + description: The unique identifier of the order. + required: true + style: simple + schema: + type: string + - name: transactionID + in: path + description: The unique identifier of the transaction to be canceled or voided. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/OrdersTransactionsCancelRequest' + required: false + responses: + '200': + description: '' + headers: { } + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/TransactionResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + parameters: [ ] +components: + securitySchemes: + bearerAuth: + type: http + scheme: bearer + schemas: + CartsRequest: + title: CartsRequest + type: object + properties: + description: + type: string + description: The cart description. + example: cart description + discount_settings: + $ref: '#/components/schemas/DiscountSettings' + name: + description: The cart name provided by the shopper. A cart name must contain 1 to 255 characters. You cannot use whitespace characters, but special characters are permitted. For more information, see the [Safe Characters](/guides/Getting-Started/safe-characters) section. + type: string + example: my cart name + snapshot_date: + description: This optional parameter sets a reference date for the cart. If this parameter is set, it allows the cart to act as one that might occur on that specified date. For example, such future carts might acquire future-enabled discounts, allowing users to test and validate future interactions with carts. The snapshot_date must be in the format 2026-02-21T15:07:25Z. By default, this parameter is left empty. + type: string + example: "2026-09-10T00:12:00Z" + custom_attributes: + $ref: '#/components/schemas/CustomAttributes' + payment_intent_id: + description: To remove the Stripe payment intent from a cart, pass the empty value in the `payment_intent_id` field. You must use an empty value for this field. You cannot use this endpoint to directly update the cart to use an existing Payment Intent. + type: string + example: '' + DiscountSettings: + title: DiscountSettings + type: object + properties: + custom_discounts_enabled: + description: This parameter enables custom discounts for a cart. When set to true, Elastic Path promotions will not be applied to the new carts. Default is set from cart discount settings for the store. See [Cart Settings](/docs/api/settings/put-v-2-settings-cart). + type: boolean + example: false + use_rule_promotions: + description: When set to true, this parameter allows the cart to use rule promotions. + type: boolean + example: false + CustomAttributes: + title: CustomAttributes + type: object + properties: + custom_attributes: + description: Specifies the custom attributes for the cart object. The attribute can be any string, numerical, and underscore. A cart can have maximum of 20 custom attributes. + type: object + properties: + attribute: + description: Specifies the attribute `type` and `value`. + type: object + properties: + type: + description: Specifies the type of the attribute such as string, integer, boolean, and float. + type: string + value: + description: Specifies the value of the attribute. + oneOf: + - type: string + - type: number + - type: boolean + CartResponse: + title: CartResponse + type: object + properties: + id: + description: The unique identifier for the cart. Use SDK or create it yourself. + type: string + type: + description: The type of object being returned. + type: string + example: cart + name: + description: The name of this cart. + type: string + example: cart name + description: + description: A description of the cart. + type: string + example: cart description + discount_settings: + $ref: '#/components/schemas/DiscountSettings' + payment_intent_id: + description: Stripe-assigned unique identifier for the linked Payment Intent + type: string + links: + type: object + properties: + self: + description: A link to that specific resource. + type: string + example: https://useast.api.elasticpath.com/v2/carts/1 + meta: + type: object + properties: + display_price: + type: object + properties: + with_tax: + $ref: '#/components/schemas/FormattedPriceData' + without_tax: + $ref: '#/components/schemas/FormattedPriceData' + tax: + $ref: '#/components/schemas/FormattedPriceData' + discount: + $ref: '#/components/schemas/FormattedPriceData' + without_discount: + $ref: '#/components/schemas/FormattedPriceData' + shipping: + $ref: '#/components/schemas/FormattedPriceData' + timestamps: + $ref: '#/components/schemas/Timestamps' + relationships: + type: object + properties: + customers: + type: object + properties: + data: + type: object + properties: + type: + description: The type of related object. + type: string + example: customers + id: + description: The ID of the customer. + type: string + format: uuid + readOnly: true + example: 662461ad-ddcb-4dbd-8ed7-ade9aa63b5f9 + items: + type: object + properties: + data: + type: object + properties: + type: + description: The type of related object. + type: string + example: cart_item + id: + description: The unique identifier for the cart item + type: string + format: uuid + readOnly: true + example: 1cf8b15b-4f12-43c5-837c-dbbc09aefa55 + CartItemsObjectRequest: + title: Cart Items Object Request + oneOf: + - $ref: "#/components/schemas/CartItemObject" + - $ref: "#/components/schemas/CartMergeObjectRequest" + - $ref: "#/components/schemas/CustomItemObject" + - $ref: "#/components/schemas/ReOrderObjectRequest" + - $ref: "#/components/schemas/PromotionItemObject" + CartItemObject: + title: Cart Item Object + type: object + properties: + data: + allOf: + - $ref: '#/components/schemas/CartItemObjectData' + - $ref: '#/components/schemas/CartItemResponse' + CartItemObjectData: + title: Cart Item Object Data + type: object + required: + - type + - quantity + properties: + type: + description: The type of object being returned. + type: string + enum: + - cart_item + quantity: + description: The number of items added to the cart. + type: number + example: 2 + id: + type: string + format: uuid + description: Specifies the ID of the product you want to add to cart. (use this OR sku) + example: 78d7b5c2-c852-40ad-87bb-beb161f61f37 + sku: + type: string + description: Specifies the item SKU that you want to add to cart. (use this OR id) + example: my-item + custom_inputs: + description: The custom text to be added to a product. + type: object + bundle_configuration: + description: Object used to describe the bundle options selected. + type: object + properties: + selected_options: + description: Specifies selected options. + type: object + shipping_group_id: + description: Identifier for a created Cart Shipping Group + type: string + CartMergeObjectRequest: + title: Cart Merge Object Request + type: object + properties: + data: + type: array + items: + allOf: + - $ref: '#/components/schemas/CartMergeObject' + description: '' + options: + $ref: '#/components/schemas/AddAllOrNothingOptionsObject' + CartMergeObject: + title: Cart Merge Object + type: object + required: + - type + - cart_id + properties: + type: + description: The type of object being returned. Must be `cart_items`. + type: string + enum: + - cart_items + cart_id: + description: The original cart to be merged from. + type: string + format: uuid + example: 78d7b5c2-c852-40ad-87bb-beb161f61f37 + CustomItemObject: + title: Custom Item Object + type: object + properties: + data: + allOf: + - $ref: '#/components/schemas/CustomItemObjectData' + description: '' + CustomItemObjectData: + title: Custom Item Object Data + type: object + required: + - type + - name + - quantity + - price + properties: + type: + description: The type of object being returned. Must be `custom_item`. + type: string + enum: + - custom_item + quantity: + description: The number of custom items to add to cart. + type: number + example: 2 + price: + type: object + required: + - amount + properties: + amount: + description: The unit price of the custom item. + type: number + example: 10000 + includes_tax: + description: Set to`true` if relevant taxes have been included in the price, `false` if not. Defaults to `true`. + type: boolean + description: + description: A description of the custom item. + type: string + example: My first custom item! + sku: + type: string + description: The `SKU` code to use for the custom item. See [best practices](https://elasticpath.dev/docs/commerce-cloud/carts/cart-items/add-custom-item-to-cart#best-practices) to use the `SKU` code. + example: my-custom-item + name: + type: string + description: The name of the custom item. + example: My Custom Item + custom_inputs: + description: The custom text to be added to a product. + type: object + shipping_group_id: + description: Identifier for a created Cart Shipping Group + type: string + ReOrderObjectRequest: + title: Re-Order Object Request + type: object + properties: + data: + allOf: + - $ref: '#/components/schemas/ReOrderObject' + options: + $ref: '#/components/schemas/AddAllOrNothingOptionsObject' + + ReOrderObject: + title: Re Order Object + type: object + required: + - type + - order_id + properties: + type: + description: The type of resource being returned. Use `order_items`. + type: string + enum: + - order_items + order_id: + description: The unique identifier of the order. + type: string + format: uuid + example: 78d7b5c2-c852-40ad-87bb-beb161f61f37 + BulkAddItemsRequest: + title: Bulk Add Items Request + type: object + properties: + data: + anyOf: + - $ref: '#/components/schemas/CartItemsObjectRequest' + - $ref: "#/components/schemas/CartMergeObjectRequest" + - $ref: "#/components/schemas/CustomItemObject" + - $ref: "#/components/schemas/ReOrderObjectRequest" + - $ref: "#/components/schemas/PromotionItemObject" + PromotionItemObject: + title: Promotion Item Object + type: object + properties: + data: + allOf: + - $ref: '#/components/schemas/PromotionItemObjectData' + PromotionItemObjectData: + title: Promotion Item Object Data + type: object + required: + - type + - code + properties: + type: + description: Specifies the type of resource, which is `promotion_item`. + type: string + enum: + - promotion_item + code: + description: Specifies the promotion code. For more information about codes[].user[], see the [Create Promotion codes](/docs/api/promotions/create-promotion-codes) section. + type: string + example: PROMO_CODE + BulkUpdateCartsItems: + title: Bulk Update Carts Items + type: object + required: + - id + - quantity + properties: + data: + type: array + items: + type: object + properties: + id: + description: Specifies the ID of the cart item that you want to update in cart. + type: string + example: '{{cartitemID}}' + quantity: + description: Specifies the amount of items to update in the cart. + type: number + example: 2 + custom_inputs: + description: Specifies the custom text to be added to a product. See [custom inputs](https://elasticpath.dev/docs/pxm/products/ep-pxm-products-api/update-a-product#using-custom-inputs-attribute). + type: object + options: + $ref: '#/components/schemas/UpdateAllOrNothingOptionsObject' + UpdateCartsItems: + title: Update Carts Items + type: object + required: + - quantity + properties: + data: + type: object + properties: + id: + description: The unique identifier of the cart item. + type: string + format: uuid + example: '{{cartitemID}}' + quantity: + description: The amount of products to add to cart. + type: number + example: 2 + custom_inputs: + description: The custom text to be added to a product. + type: object + shipping_group_id: + description: The unique identifier of the shipping group to be added to the cart. + type: string + format: uuid + example: 900ab9c1-4b39-43fe-b080-0dc2806065d9 + + AddAllOrNothingOptionsObject: + title: Add All Or Nothing Options Object + type: object + properties: + add_all_or_nothing: + description: When `true`, if an error occurs for any item, no items are added to the cart. When `false`, valid items are added to the cart and the items with errors are reported in the response. Default is `false`. + type: boolean + example: false + UpdateAllOrNothingOptionsObject: + title: Update All Or Nothing Options Object + type: object + properties: + update_all_or_nothing: + description: When set to`true`, if an error occurs for any item, no items are updated in the cart. When set to `false`, valid items are updated in the cart and the items with errors are reported in the response. Default is `true`. + type: boolean + example: false + CartItemResponse: + title: Cart Item Relationship + type: object + properties: + product_id: + description: The unique ID of the product. + type: string + format: uuid + readOnly: true + example: 55cda543-f9d7-42a4-b40a-665f2e4ff7c5 + name: + description: The name of this item + type: string + readOnly: true + example: shirt + description: + description: A description of the cart item. + type: string + readOnly: true + example: T-shirt. + catalog_id: + description: The unique identifier of the catalog associated with the product is shown if catalog_source=pim is set. + type: string + readOnly: true + format: uuid + example: 11d3f9d2-c99b-472c-96c3-51842333daea + catalog_source: + description: The catalog source. Always `pim` or `legacy`. + type: string + readOnly: true + example: pim + image: + type: object + readOnly: true + properties: + mime_type: + description: The MIME type for the uploaded file. + type: string + readOnly: true + example: image/png + file_name: + description: The name of the image file that was uploaded. + type: string + readOnly: true + example: shirt-trans.png + href: + description: The link to the image. + type: string + readOnly: true + example: https://files-eu.epusercontent.com/e8c53cb0-120d-4ea5-8941-ce74dec06038/7cc08cbb-256e-4271-9b01-d03a9fac9f0a.png + manage_stock: + description: + type: boolean + readOnly: true + example: true + unit_price: + readOnly: true + $ref: '#/components/schemas/ItemPriceData' + value: + readOnly: true + $ref: '#/components/schemas/ItemPriceData' + links: + type: object + readOnly: true + properties: + product: + description: A URL related to the resource. + type: string + example: https://useast.api.elasticpath.com/products/9eda5ba0-4f4a-4074-8547-ccb05d1b5981 + meta: + type: object + readOnly: true + properties: + display_price: + type: object + properties: + with_tax: + $ref: '#/components/schemas/FormattedPriceData' + without_tax: + $ref: '#/components/schemas/FormattedPriceData' + tax: + $ref: '#/components/schemas/FormattedPriceData' + discount: + $ref: '#/components/schemas/FormattedPriceData' + without_discount: + $ref: '#/components/schemas/FormattedPriceData' + timestamps: + $ref: '#/components/schemas/Timestamps' + CartsResponse: + title: Carts Response + type: object + properties: + data: + type: array + items: + type: object + anyOf: + - $ref: '#/components/schemas/CartItemObject' + meta: + type: object + properties: + display_price: + type: object + properties: + with_tax: + $ref: '#/components/schemas/FormattedPriceData' + without_tax: + $ref: '#/components/schemas/FormattedPriceData' + tax: + $ref: '#/components/schemas/FormattedPriceData' + discount: + $ref: '#/components/schemas/FormattedPriceData' + without_discount: + $ref: '#/components/schemas/FormattedPriceData' + discounts: + type: object + additionalProperties: + type: object + properties: + amount: + type: number + example: -1000 + currency: + type: string + example: USD + formatted: + type: string + example: -$1.00 + timestamps: + $ref: '#/components/schemas/CartTimestamps' + ItemPriceData: + title: Order Price Data + type: object + properties: + amount: + description: The amount for this item as an integer. + type: number + readOnly: true + example: 10000 + currency: + description: The currency this item was added to the cart as. + type: string + readOnly: true + example: USD + includes_tax: + description: Whether or not this price is tax inclusive. + type: boolean + readOnly: true + example: false + CartsRelationshipsAccountsData: + title: Carts Relationships Accounts Data + type: object + properties: + data: + type: array + items: + properties: + id: + description: The ID of the account. + type: string + example: '{{accountID}}' + type: + description: The type of related object. Ensure that it is account. + type: string + example: account + CartsRelationshipsCustomersData: + title: Carts Relationships Customers Data + type: object + properties: + data: + type: array + items: + properties: + id: + description: The ID of the customer. + type: string + example: '{{customerID}}' + type: + description: The type of related object. Ensure that it is customer. + type: string + example: customer + CartsItemsTaxesObject: + title: Carts Items Taxes Object + type: object + required: + - type + - rate + properties: + code: + description: A unique tax code in this jurisdiction. + type: string + example: TAX01 + jurisdiction: + description: The relevant tax jurisdiction. + type: string + example: UK + name: + description: The name of the tax item. + type: string + example: Tax name + rate: + description: The tax rate represented as a decimal (12.5% -> 0.125). + type: number + example: 0.2 + type: + description: The type of object being returned. Use `tax_item`. + type: string + example: tax_item + id: + description: The unique identifier for this tax item. + type: string + format: uuid + readOnly: true + example: 662461ad-ddcb-4dbd-8ed7-ade9aa63b5f9 + CartsBulkCustomDiscounts: + title: CartsBulkCustomDiscounts + type: object + properties: + data: + type: array + items: + allOf: + - $ref: '#/components/schemas/CartsCustomDiscountsObject' + - $ref: '#/components/schemas/CartItemBulkCustomDiscountObject' + options: + $ref: '#/components/schemas/AddAllOrNothingOptionsObject' + CartsBulkCustomDiscountsResponse: + title: CartsBulkCustomDiscountsResponse + type: object + properties: + data: + type: array + items: + allOf: + - $ref: '#/components/schemas/CartsCustomDiscountsResponse' + - $ref: '#/components/schemas/artItemBulkCustomDiscountResponse' + options: + $ref: '#/components/schemas/AddAllOrNothingOptionsObject' + CartItemBulkCustomDiscountObject: + title: CartItemBulkCustomDiscountObject + type: object + allOf: + - $ref: '#/components/schemas/CartsCustomDiscountsObject' + - $ref: '#/components/schemas/CustomDiscountRelationshipsCartItemRequest' + artItemBulkCustomDiscountResponse: + title: artItemBulkCustomDiscountResponse + type: object + allOf: + - $ref: '#/components/schemas/CartsCustomDiscountsResponse' + - $ref: '#/components/schemas/CustomDiscountRelationshipsCartItemRequest' + CartsCustomDiscountsObject: + title: CartsCustomDiscountsObject + type: object + required: + - amount + - description + - discount_code + - discount_engine + - external_id + - type + properties: + amount: + description: Specifies an amount to be applied for the custom discount. It must be less than zero. + type: number + example: -1000 + description: + description: Specifies a description for the custom discount. + type: string + example: Custom discount description + discount_code: + description: Specifies the discount code used for the custom discount. + type: string + example: cart-custom-promo-code + discount_engine: + description: Specifies from where the custom discount is applied. For example, Talon.one. + type: string + example: Custom Discount Engine + external_id: + description: Specifies an external id for the custom discount. + type: string + example: custom-discount-external-id + type: + description: Specifies the type of the resource. Always `custom_discount`. + type: string + example: custom_discount + CartsCustomDiscountsResponse: + title: CartsCustomDiscountsResponse + type: object + properties: + amount: + type: object + properties: + amount: + description: Specifies an amount to be applied for the custom discount. It must be less than zero. + type: number + example: -1000 + currency: + description: The currency set for the custom discount. + type: string + example: USD + formatted: + description: The formatted value for the custom discount. + type: string + example: -$10.00 + description: + description: Specifies a description for the custom discount. + type: string + example: Custom discount description + discount_code: + description: Specifies the discount code used for the custom discount. + type: string + example: cart-custom-promo-code + discount_engine: + description: Specifies from where the custom discount is applied. For example, Talon.one. + type: string + example: Custom Discount Engine + external_id: + description: Specifies an external id for the custom discount. + type: string + example: custom-discount-external-id + type: + description: Specifies the type of the resource. Always `custom_discount`. + type: string + example: custom_discount + id: + description: Specifies the UUID of the custom discount. + type: string + format: uuid + readOnly: true + example: 662461ad-ddcb-4dbd-8ed7-ade9aa63b5f9 + CustomDiscountRelationshipsCartItemRequest: + title: CustomDiscountRelationshipsCartItemRequest + type: object + required: + - type + - id + properties: + relationships: + type: object + properties: + item: + type: object + properties: + data: + type: object + properties: + type: + description: Specifies the type of item. For example, `custom_item` or `cart_item`. + type: string + example: cart_item + id: + description: Specifies the unique identifier of the `cart_item` or `custom_item` in the cart. + type: string + format: uuid + example: 5601a4b1-9d13-42d3-8fb7-03b35169d1b6 + CartItemRelationship: + title: CartItemRelationship + type: object + required: + - type + - id + properties: + relationships: + type: object + properties: + order: + type: object + properties: + data: + type: object + properties: + type: + description: This specifies the type of item. + type: string + example: order + id: + description: This specifies the ID of the cart_item or custom_item in the cart. + type: string + format: uuid + example: 5601a4b1-9d13-42d3-8fb7-03b35169d1b6 + CartsBulkTaxes: + title: CartsBulkTaxes + type: object + properties: + data: + type: array + items: + allOf: + - $ref: '#/components/schemas/CartsItemsTaxesObject' + - $ref: '#/components/schemas/CartItemRelationship' + options: + $ref: '#/components/schemas/AddAllOrNothingOptionsObject' + OrdersAnonymizeRequest: + title: OrdersAnonymizeRequest + type: object + properties: + data: + $ref: '#/components/schemas/OrdersAnonymizeData' + OrdersAnonymizeData: + title: OrdersAnonymizeData + type: object + properties: + order_ids: + description: The unique identifiers of the orders to be anonymized. You can anonymize multiple orders at the same time. + type: array + items: + type: string + example: '{{orderID}}' + + OrdersUpdateRequest: + title: OrdersUpdateRequest + type: object + properties: + data: + oneOf: + - $ref: '#/components/schemas/OrdersAddressData' + - $ref: '#/components/schemas/OrdersCancelData' + - $ref: '#/components/schemas/OrdersFulfulledData' + OrdersAddressData: + title: OrdersAddressData + type: object + required: + - type + - shipping_address + properties: + external_ref: + description: Represents an optional external ID reference for an order. It can contain alphanumeric characters, special characters, and spaces, and does not required to be unique. The maximum allowed length is 64 characters. It can be used to include an external reference from a separate company system. + type: string + example: external_order_123 + shipping_address: + type: object + properties: + first_name: + description: Specifies the first name of the address holder. + type: string + example: James + last_name: + description: Specifies the last name of the address holder. + type: string + example: Doe + phone_number: + description: Specifies the phone number of the address holder. + type: string + example: 5558679305 + company_name: + description: Specifies the company name. + type: string + example: company name + line_1: + description: Specifies the first line of the address. + type: string + example: 1234 Disney Drive + line_2: + description: Specifies the second line of the address. + type: string + example: Disney Resort + city: + description: Specifies the name of the city in the shipping address. + type: string + example: Anaheim + county: + description: Specifies the county of the shipping address. + type: string + example: Orange + region: + description: Specifies the state, province, or region of the shipping address. + type: string + example: CA + postcode: + description: Specifies the postcode or ZIP code of the address. + type: string + example: 92802 + country: + description: Specifies the country in the shipping address. + type: string + example: US + instructions: + description: Specifies any instructions provided with the shipping address. + type: string + example: Buzzer 10233 + OrdersCancelData: + title: OrdersCancelData + type: object + required: + - type + - status + properties: + status: + description: The status of the order. You can only update the status to `cancelled`. + type: string + example: cancelled + type: + description: The type of the resource. You must use order. + type: string + example: order + external_ref: + description: Represents an optional external ID reference for an order. It can contain alphanumeric characters, special characters, and spaces, and does not required to be unique. The maximum allowed length is 64 characters. It can be used to include an external reference from a separate company system. + type: string + example: external_order_123 + OrdersFulfulledData: + title: OrdersFulfulledData + type: object + required: + - type + - shipping + properties: + shipping: + description: The shipping status of the order. You can only update the shipping status to `fulfilled`. + type: string + example: fulfilled + type: + description: The type of the resource. You must use order. + type: string + example: order + external_ref: + description: Represents an optional external ID reference for an order. It can contain alphanumeric characters, special characters, and spaces, and does not required to be unique. The maximum allowed length is 64 characters. It can be used to include an external reference from a separate company system. + type: string + example: external_order_123 + PaymentsRequest: + title: PaymentsRequest + type: object + properties: + data: + $ref: '#/components/schemas/Data.PaymentObject' + Data.BasePayments: + title: Data.BasePayments + type: object + required: + - gateway + - method + properties: + gateway: + type: string + enum: + - adyen + - authorize_net + - braintree + - card_connect + - cyber_source + - elastic_path_payments_stripe + - manual + - paypal_express_checkout + - stripe + - stripe_connect + - stripe_payment_intents + method: + description: Specifies the transaction method, such as `purchase` or `authorize`. + type: string + enum: + - authorize + - purchase + - purchase_setup + - authorize_setup + amount: + description: The amount to be paid for the transaction. + type: number + example: 10000 + Data.AdyenPayment: + title: Data.AdyenPayment + required: + - payment + - gateway + allOf: + - $ref: '#/components/schemas/Data.BasePayments' + - type: object + properties: + gateway: + description: Specifies the gateway. You must use `adyen`. + type: string + enum: + - adyen + options: + type: object + properties: + shopper_reference: + description: The shopper reference token associated with the saved payment method. + type: string + recurring_processing_model: + description: Enter CardOnFile for a one-time purchase. + type: string + payment: + description: The Adyen recurringDetailReference payment method identifier. + type: string + Data.AuthorizeNetPayment: + title: Data.AuthorizeNetPayment + required: + - payment + - gateway + allOf: + - $ref: '#/components/schemas/Data.BasePayments' + - type: object + properties: + gateway: + description: Specifies the gateway. You must use `authorize_net`. + type: string + enum: + - authorize_net + options: + type: object + properties: + customer_payment_profile_id: + description: The Authorize.net customer payment profile ID. + type: string + payment: + description: The Authorize.net customer profile ID. + type: string + Data.BraintreePayment: + title: Data.BraintreePayment + required: + - payment + - gateway + allOf: + - $ref: '#/components/schemas/Data.BasePayments' + - type: object + properties: + gateway: + description: Specifies the gateway. You must use `braintree`. + type: string + enum: + - braintree + payment: + description: The Braintree Customer ID that you want to bill. + type: string + Data.CardConnectPayment: + title: Data.CardConnectPayment + required: + - payment + - gateway + allOf: + - $ref: '#/components/schemas/Data.BasePayments' + - type: object + properties: + gateway: + description: Specifies the gateway. You must use `card_connect`. + type: string + enum: + - card_connect + payment: + description: Enter account_id, profile_id from CardPointe API. For example, 1|16178397535388255208. + type: string + Data.CyberSourcePayment: + title: Data.CyberSourcePayment + required: + - payment + - gateway + allOf: + - $ref: '#/components/schemas/Data.BasePayments' + - type: object + properties: + gateway: + description: Specifies the gateway. You must use `cyber_source`. + type: string + enum: + - cyber_source + payment: + description: The CyberSource token. + type: string + ElasticPathPaymentsPoweredByStripePayment: + title: Elastic Path Payments Powered By Stripe + required: + - gateway + allOf: + - $ref: '#/components/schemas/Data.BasePayments' + - type: object + properties: + gateway: + description: Specifies the gateway. You must use `elastic_path_payments_stripe`. + type: string + enum: + - elastic_path_payments_stripe + options: + type: object + properties: + receipt_email: + description: Provides the email address to which you want to send the Stripe receipts for the transactions within the store. This feature is available only in the live mode. + type: string + automatic_payment_methods: + type: object + description: Parent object determining whether to use Stripe's `automatic_payment_methods` setting. + properties: + enabled: + type: boolean + description: When set to true, it displays all enabled payment methods from the Stripe dashboard. When set to false, the Stripe default, which is card, is used. + payment_method_types: + type: array + items: + type: string + description: Specifies the Stripe payment method types configured for the store. See [Stripe Documentation](https://docs.stripe.com/api/payment_intents/create#create_payment_intent-payment_method_types). + example: card + payment: + description: Specifies the Stripe token or source. + type: string + Data.ManualPayment: + title: Data.ManualPayment + required: + - gateway + allOf: + - $ref: '#/components/schemas/Data.BasePayments' + - type: object + properties: + gateway: + description: Specifies the type of payment gateway. You must use `manual`. + type: string + enum: + - manual + paymentmethod_meta: + type: object + properties: + custom_reference: + description: A reference associated with the payment method. This might include loyalty points or gift card identifiers. We recommend not to include personal information in this field. + type: string + name: + description: A custom name associated with the payment method. + type: string + Data.PayPalExpressCheckoutPayment: + title: Data.PayPalExpressCheckoutPayment + required: + - gateway + allOf: + - $ref: '#/components/schemas/Data.BasePayments' + - type: object + properties: + gateway: + description: Specifies the type of payment gateway. You must use `paypal_express_checkout`. + type: string + enum: + - paypal_express_checkout + options: + type: object + properties: + description: + description: The description for the payment. + type: string + soft_descriptor: + description: The descriptor appended to PayPal generated descriptor that is visible on the card statement of the payer. + type: string + application_context: + type: object + properties: + brand_name: + description: The label that overrides the business name in the PayPal account on the payPal site. + type: string + locale: + description: The locale pages that appear based on language and country code. PayPal supports a five-character code. For example, ja-JP. + type: string + landing_page: + description: The type of landing page to show on the PayPal site for customer checkout. Use values LOGIN, BILLING, or NO_PREFERENCE. + type: string + shipping_preference: + description: The shipping preference. Use SET_PROVIDED_ADDRESS value. This parameter does allow the user to change their address on PayPal site. + type: string + user_action: + description: If you set `useraction=commit` in the query string, the flow redirects the buyer to the PayPal payment page and displays a Pay Now button. When the shopper clicks **Pay Now**, call `DoExpressCheckoutPayment` to complete the payment without additional interaction from the shopper. Choose this flow when you know the final payment amount when you initiate the checkout flow. + type: string + return_url: + description: The callback URL for PayPal to redirect the user in the case of approved payment. + type: string + cancel_url: + description: The callback URL for PayPal to redirect user in the case a cancelled payment. + type: string + Data.StripePayment: + title: Data.StripePayment + required: + - gateway + allOf: + - $ref: '#/components/schemas/Data.BasePayments' + - type: object + properties: + gateway: + description: Specifies the type of payment gateway. You must use `stripe`. + type: string + enum: + - stripe + options: + type: object + properties: + receipt_email: + description: The option to provide an email for Stripe receipts. Specify live mode to access this feature. + type: string + payment: + description: The Stripe token or source. + type: string + Data.StripeConnectPayment: + title: Data.StripeConnectPayment + required: + - gateway + allOf: + - $ref: '#/components/schemas/Data.BasePayments' + - type: object + properties: + gateway: + description: Specifies the type of payment gateway. You must use `stripe_connect`. + type: string + enum: + - stripe_connect + options: + type: object + properties: + receipt_email: + description: Provides the email address to which you want to send the Stripe receipts for the transactions within the store. This feature is available only in the live mode. + type: string + payment: + description: Specifies the Stripe token or source. + type: string + Data.StripePaymentIntentsPayment: + title: Data.StripePaymentIntentsPayment + required: + - gateway + allOf: + - $ref: '#/components/schemas/Data.BasePayments' + - type: object + properties: + gateway: + description: Specifies the type of payment gateway. You must use `stripe_payment_intents`. + type: string + enum: + - stripe_payment_intents + options: + type: object + properties: + receipt_email: + description: Provides the email address to which you want to send the Stripe receipts for the transactions within the store. This feature is available only in the live mode. + type: string + payment: + description: Specifies the Stripe token or source. + type: string + Data.PaymentObject: + oneOf: + - $ref: "#/components/schemas/Data.AdyenPayment" + - $ref: "#/components/schemas/Data.AuthorizeNetPayment" + - $ref: "#/components/schemas/Data.BraintreePayment" + - $ref: "#/components/schemas/Data.CardConnectPayment" + - $ref: "#/components/schemas/Data.CyberSourcePayment" + - $ref: "#/components/schemas/ElasticPathPaymentsPoweredByStripePayment" + - $ref: "#/components/schemas/Data.ManualPayment" + - $ref: "#/components/schemas/Data.PayPalExpressCheckoutPayment" + - $ref: "#/components/schemas/Data.StripePayment" + - $ref: "#/components/schemas/Data.StripeConnectPayment" + - $ref: "#/components/schemas/Data.StripePaymentIntentsPayment" + TransactionResponse: + title: TransactionResponse + type: object + properties: + id: + description: The ID of the transaction. + type: string + format: uuid + readOnly: true + reference: + description: The payment gateway reference. + type: string + example: manual + name: + description: A custom name associated with the payment method. + type: string + example: payment method name + custom_reference: + description: A reference associated with the payment method. This might include loyalty points or gift card identifiers. We recommend you not to include personal information in this field. + type: string + example: custom reference + gateway: + description: The name of the payment gateway used. + type: string + enum: + - adyen + - authorize_net + - braintree + - card_connect + - cyber_source + - elastic_path_payments_stripe + - manual + - paypal_express_checkout + - stripe + - stripe_connect + - stripe_payment_intents + amount: + description: The amount for this transaction. + type: number + example: 10000 + refunded_amount: + description: The refunded amount. + type: number + example: 0 + currency: + description: The transaction currency. + type: string + example: USD + transaction-type: + description: The type of transaction, such as `purchase`, `capture`, `authorize` or `refund`. + type: string + example: capture + status: + description: The status provided by the gateway for this transaction, such as `complete` or `failed`. + type: string + example: complete + relationships: + type: object + properties: + order: + type: object + properties: + data: + type: object + properties: + type: + description: Represents the type of the object being returned. It is always `order`. + type: string + example: order + id: + description: The ID of the order. + type: string + format: uuid + example: 5601a4b1-9d13-42d3-8fb7-03b35169d1b6 + meta: + type: object + properties: + display_price: + $ref: '#/components/schemas/FormattedPriceData' + display_refunded_amount: + $ref: '#/components/schemas/FormattedPriceData' + timestamps: + $ref: '#/components/schemas/Timestamps' + OrdersTransactionsConfirmRequest: + title: OrdersTransactionsConfirmRequest + type: object + properties: + data: + type: object + OrdersTransactionsCaptureRequest: + title: OrdersTransactionsCaptureRequest + type: object + properties: + data: + type: object + properties: + options: + type: object + properties: + soft_descriptor: + type: string + note_to_payer: + type: string + OrdersTransactionsRefundRequest: + title: OrdersTransactionsRefundRequest + type: object + properties: + data: + type: object + properties: + amount: + description: The amount value to be refunded. If this field is not provided, it will be considered as manual refund (Mark as Refunded) and the refund process must be manually handled via payment provider. If the amount value is same as payment value, then it will be treated as a full refund and sent to the payment provider to process refund automatically. + type: number + example: 1000 + options: + type: object + properties: + note: + description: Provides comments about the refund. It is used by PayPal Express. + type: string + OrdersTransactionsCancelRequest: + title: OrdersTransactionsCancelRequest + type: object + properties: + data: + type: object + properties: + options: + type: object + reason: + description: Specifies the reason for canceling the transaction. The reason may include `duplicate`, `fraudulent`, `requested_by_customer`, or `abandoned`. + type: string + example: requested_by_customer + OrderPriceData: + title: OrderPriceData + type: object + properties: + amount: + description: The amount for this item. + type: number + example: 10000 + currency: + description: The currency this item. + type: string + example: USD + includes_tax: + description: Whether or not this price is tax inclusive. + type: boolean + example: false + FormattedPriceData: + title: FormattedPriceData + type: object + properties: + amount: + description: The raw total of this cart. + type: number + example: 10000 + currency: + description: The currency set for this cart. + type: string + example: USD + formatted: + description: The tax inclusive formatted total based on the currency. + type: string + example: $10.00 + OrderItemFormattedUnitPriceData: + title: OrderItemFormattedUnitPriceData + type: object + properties: + unit: + $ref: '#/components/schemas/FormattedPriceData' + value: + $ref: '#/components/schemas/FormattedPriceData' + DiscountData: + title: DiscountData + type: object + properties: + amount: + $ref: '#/components/schemas/OrderPriceData' + code: + type: string + example: 10_off + id: + type: string + format: uuid + readOnly: true + example: a01cf221-751b-46e4-b612-57ad3c645ee6 + OrderItemResponse: + title: OrderItemResponse + type: object + properties: + type: + description: The type represents the object being returned. + type: string + example: order_item + id: + description: The unique identifier for this order item. + type: string + format: uuid + readOnly: true + example: 68bf8510-bebf-47b1-96ba-8a9930c7d928 + quantity: + description: The quantity of this item were ordered. + type: number + example: 1 + product_id: + description: The unique identifier for this order item. + type: string + format: uuid + readOnly: true + example: 4e9c6098-9701-4839-a69c-54d8256d9012 + name: + description: The name of this order item. + type: string + example: Product 123 + sku: + description: The SKU code for the order item. + type: string + example: IFD-1 + unit_price: + $ref: '#/components/schemas/OrderPriceData' + value: + + $ref: '#/components/schemas/OrderPriceData' + discounts: + type: array + items: + $ref: '#/components/schemas/DiscountData' + links: + type: object + meta: + type: object + properties: + display_price: + type: object + properties: + with_tax: + $ref: '#/components/schemas/OrderItemFormattedUnitPriceData' + without_tax: + $ref: '#/components/schemas/OrderItemFormattedUnitPriceData' + tax: + $ref: '#/components/schemas/OrderItemFormattedUnitPriceData' + discount: + $ref: '#/components/schemas/OrderItemFormattedUnitPriceData' + without_discount: + $ref: '#/components/schemas/OrderItemFormattedUnitPriceData' + discounts: + type: object + additionalProperties: + type: object + properties: + amount: + type: number + example: -1000 + currency: + type: string + example: USD + formatted: + type: string + example: -$1.00 + timestamps: + $ref: '#/components/schemas/Timestamps' + relationships: + type: object + properties: + cart_item: + type: object + properties: + data: + type: object + properties: + type: + description: The type represents the object being returned. + type: string + example: order_item + id: + description: The unique identifier for this item. + type: string + format: uuid + readOnly: true + example: 5601a4b1-9d13-42d3-8fb7-03b35169d1b6 + catalog_id: + description: The unique identifier of the catalog associated with the product is shown if `catalog_source=pim` is set. + type: string + example: default + catalog_source: + description: The catalog source. Always `pim` or `legacy`. + type: string + example: pim + - legacy + + OrderResponse: + title: OrderResponse + type: object + properties: + type: + description: Specifies the type of object being returned. You must use `order`. + type: string + example: order + id: + description: Specifies the unique identifier of the order. + type: string + format: uuid + readOnly: true + example: aa854b8f-5930-476d-951a-e9b9cfbdefb1 + status: + description: Specifies the status of the order, such as `incomplete`, `complete`, `processing`, or `cancelled`. + type: string + example: complete + - incomplete + - cancelled + payment: + description: Specifies the status of the payment, such as `unpaid`, `authorized`, `paid`, or `refunded`. + type: string + example: authorized + - paid + - unpaid + - refunded + shipping: + description: Specifies the status of the shipment, such as `fulfilled` or `unfulfilled`. + type: string + example: unfulfilled + - fulfilled + anonymized: + description: Specifies if the order is anonymized. + type: boolean + example: false + meta: + $ref: '#/components/schemas/OrderMeta' + billing_address: + $ref: '#/components/schemas/BillingAddress' + contact: + $ref: '#/components/schemas/Contact' + shipping_address: + $ref: '#/components/schemas/ShippingAddress' + OrderMeta: + title: OrderMeta + type: object + properties: + timestamps: + $ref: '#/components/schemas/Timestamps' + with_tax: + $ref: '#/components/schemas/FormattedPriceData' + without_tax: + $ref: '#/components/schemas/FormattedPriceData' + tax: + $ref: '#/components/schemas/FormattedPriceData' + discount: + $ref: '#/components/schemas/FormattedPriceData' + paid: + $ref: '#/components/schemas/FormattedPriceData' + authorized: + $ref: '#/components/schemas/FormattedPriceData' + without_discount: + $ref: '#/components/schemas/FormattedPriceData' + CustomerCheckout: + title: Customer Checkout + type: object + properties: + data: + type: object + properties: + customer: + type: object + properties: + id: + description: The ID of the customer. + type: string + billing_address: + $ref: '#/components/schemas/BillingAddress' + shipping_address: + $ref: '#/components/schemas/ShippingAddress' + AccountCheckout: + title: Account Checkout + type: object + properties: + data: + type: object + properties: + account: + type: object + properties: + id: + description: The account ID. + type: string + member_id: + description: The account member ID. + type: string + contact: + type: object + properties: + name: + description: The name of the account member. + type: string + email: + description: The email address of the account member. + type: string + format: email + billing_address: + $ref: '#/components/schemas/BillingAddress' + shipping_address: + $ref: '#/components/schemas/ShippingAddress' + BillingAddress: + title: BillingAddress + type: object + required: + - first_name + - last_name + - line_1 + - region + - postcode + - country + properties: + company_name: + description: Company name of the billing recipient. + type: string + example: John Doe Enterprises + country: + description: Specifies the country of the billing address. + type: string + example: US + county: + description: Specifies the county of the billing address. + type: string + example: Orange + first_name: + description: First name of the billing recipient. + type: string + example: John + last_name: + description: Last name of the billing recipient. + type: string + example: Doe + line_1: + description: First line of the billing address. + type: string + example: 1 Sunny Street + line_2: + description: Second line of the billing address. + type: string + postcode: + description: Postcode of the billing address. + type: string + example: '92802' + region: + description: Specifies state, province, or region of the billing address. + type: string + example: CA + Contact: + title: Contact + type: object + properties: + email: + description: The email address of the contact. + type: string + example: johndoe@email.com + name: + description: The name of the contact. + type: string + example: John Doe + ShippingAddress: + title: ShippingAddress + type: object + required: + - first_name + - last_name + - line_1 + - region + - postcode + - country + properties: + company_name: + description: Company of the shipping recipient. + type: string + example: John Doe Enterprises + country: + description: Specifies the country of the shipping address. + type: string + example: US + county: + description: Specifies the county of the shipping address. + type: string + example: Orange + first_name: + description: First name of the shipping recipient. + type: string + example: John + last_name: + description: Last name of the shipping recipient. + type: string + example: Doe + line_1: + description: First line of the shipping address. + type: string + example: 1 Sunny Street + line_2: + description: Second line of the shipping address. + type: string + postcode: + description: Post code of the shipping address. + type: string + example: '92802' + region: + description: Specifies the state, province, or region of the shipping address. + type: string + example: CA + Response.Meta.Carts: + type: object + properties: + page: + $ref: '#/components/schemas/Response.PaginationPage' + results: + $ref: '#/components/schemas/Response.PaginationResults' + Response.Meta.Orders: + type: object + properties: + page: + $ref: '#/components/schemas/Response.PaginationPage' + results: + $ref: '#/components/schemas/Response.PaginationResults' + Response.PaginationPage: + type: object + properties: + current: + description: The current page. + type: integer + limit: + description: The maximum number of records per page for this response. You can set this value up to 100. + type: integer + offset: + description: The current offset by number of records, not pages. Offset is zero-based. + type: integer + total: + description: The total page count. + type: integer + Response.PaginationResults: + type: object + properties: + total: + description: The total page count. + type: integer + Response.PageLinks: + type: object + properties: + current: + description: Always the current page. + type: string + first: + description: Always the first page. + type: string + last: + description: If there is only one page, it is `null`. + type: string + next: + description: If there is only one page, it is `null`. + type: string + prev: + description: if the user is on the first page, it is `null`. + type: string + Response.Data: + type: object + properties: + data: { } + Response.Error: + type: array + properties: + detail: + type: string + status: + type: string + title: + type: string + Timestamps: + type: object + properties: + created_at: + description: The date this was created. + type: string + example: '2023-11-07T23:04:18.845Z' + updated_at: + description: The date this was last updated. + example: '2023-11-07T23:04:18.845Z' + CartTimestamps: + type: object + properties: + created_at: + type: string + example: '2023-11-07T23:04:18.845Z' + updated_at: + example: '2023-11-07T23:04:18.845Z' + expires_at: + example: '2023-11-12T23:04:18.845Z' +tags: + - name: Cart Management + description: | + A Cart contains the product and custom cart items that a user intends to purchase. After a Cart is ready for Checkout, you can use the [Checkout endpoint](/docs/api/carts/checkout) to convert the cart to an order. + + :::note + + - Adding, modifying, or removing any cart items, custom items, or promotions always returns the cart meta, calculated using the calculation method. This is useful to update the client with up-to-date totals. + - We will automatically delete carts 7 days after they were last updated. + - If you do not pass a `X-MOLTIN-CURRENCY` header specifying what currency you would like the cart to use, the products in the cart are converted to your default currency. + + ::: + - name: Account Cart Associations + description: | + You can create associations between an account and one or more carts. After cart associations exist for a account, those carts are accessible across any device. You can delete associations as required. + + There are two ways to access the cart: with an [Account Management Authentication Tokens](/docs/api/accounts/post-v-2-account-members-tokens) and without one. + + ### With an `Account Management Authentication` token + + These endpoints are for users who authenticated implicitly and require a Account Management Authentication token in the header to access the account cart associations APIs. For more information, see the [Account Token](/docs/api/accounts/post-v-2-account-members-tokens) documentation. + + #### Cart creation + + Shoppers create carts and can use any of the carts that they created to check out an order. + + :::note + + You can create a cart id, name, and description for the cart. The cart requires a name. Ensure that the string length is greater than or equal to one. Use any symbol in the name and description. For cart id, ensure that you follow the guidelines for safe characters. For more information about cart id naming requirements, see [Safe Characters](/guides/Getting-Started/safe-characters). + + ::: + + ### Without an `Account Management Authentication` token + + These endpoints are for users who use the Client Credentials Token and do not require an account management authentication token in the header to access the account cart associations APIs. For more information, see the [Authentication](/docs/authentication/security) documentation. + + This user acts as a system administrator and can call any account cart association operations for any account and cart. + + ### Error Codes + + You might encounter the following response codes, depending on the scenario: + + * `400` - `The type does not exist or is not listed as account` - Ensure that the type is `account` and is present. + + * `403` - `Cannot associate more than one account`. + + * `403` - `Account does not have the required permissions to fulfill this request`. + + * `403` - `Invalid json payload` - Check JSON input. The request body must be an array `[]`. If the request body is an object, the error is generated. + - name: Customer Cart Associations + description: | + You can create associations between a customer and one or more carts. After cart associations exist for a customer, those carts are accessible across any device. You can delete associations as required. + + There are two ways to access the cart: with a customer token and without one. + + ### With a `customer` token + + These endpoints are for users who authenticated implicitly and require a customer token in the header to access the customer cart associations APIs. For more information, see the [Customer Token](/docs/customer-management/customer-management-api/customer-tokens) documentation. + + #### Cart creation + + Shoppers create carts and can use any of the carts that they created to check out an order. + + :::note + + You can create a cart id, name, and description for the cart. The cart requires a name. Ensure that the string length is greater than or equal to one. Use any symbol in the name and description. For cart id, ensure that you follow the guidelines for safe characters. For more information about cart id naming requirements, see [Safe Characters](/guides/Getting-Started/safe-characters). + + ::: + + ### Without a `customer` token + + These endpoints are for users who use the Client Credentials Token and do not require a Customer token in the header to access the customer cart associations APIs. For more information, see the [Authentication](/docs/authentication/security) documentation. + + This user acts as a system administrator and can call any customer cart association operations for any customer and cart. + + ### Error Codes + + You might encounter the following response codes, depending on the scenario: + + * `400` - `The type does not exist or is not listed as customer` - Ensure that the type is `customer` and is present. + + * `403` - `Cannot associate more than one customer`. + + * `403` - `Customer does not have the required permissions to fulfill this request`. + + * `403` - `Invalid json payload` - Check JSON input. The request body must be an array `[]`. If the request body is an object, the error is generated. + - name: Cart Items + description: Products added to a cart are referred to as a `cart_item`. + - name: Checkout + description: | + + The checkout workflow ties together many of the key concepts covered in this section. When a customer initiates the checkout process, an order is created from the cart. The order is incomplete until after a successful payment is made. A complete order can be shipped and the product deducted from inventory counts. + + ![Checkout workflow](/assets/checkout-flow.png) + + ### Summary of the checkout workflow + + 1. Add a product to a cart. A cart and its reference number is generated. + 2. Manage the cart items. For example, you might add items, remove items, and change quantities. + 3. Check out the cart. An incomplete order is created. + 4. Pay for an order: provide billing and shipping details, if you are a new customer. The order is now in the processing status. + 5. If using a manual gateway, after you authorize and capture it, Composable Commerce considers the order complete. If you use a third-party integration supported by Composable Commerce (such as Stripe), after the third-party gateway authorizes and captures the payment, the order becomes complete. Usually capture does not occur at the same time as authorization. For more information, see the Capture section. + 6. After the order is shipped, you can manually flag it as fulfilled. + + ### Carts + + When a product is added to a cart, a cart is generated together with its unique reference ID that on checkout becomes a part of the order ID. If you are using our JavaScript software development kit, generating a cart reference ID is done for you; otherwise, add a cart reference generator to your functionality. + + ### Promotions and custom items + + Optionally, apply a promotion code on a cart, or add custom_items to modify the product price (typically to handle taxes, customs, or shipping). + + ### Checkout + + You can checkout a cart with an associated customer name and email (customer object). Typically, this would be used for new customers or ones that prefer to shop as guests. Use the customer.id checkout option to checkout for an existing customer. After a successful checkout is completed, the response contains an order. + + Email addresses that either begin or end with a period, or contain consecutive periods, are considered invalid, resulting in the following error: + ```json + "errors": [ + { + "status": 400, + "source": "data.customer.email", + "title": "format", + "detail": "Does not match format 'email" + } + ] + ``` + + ### Payments + + On checkout, an incomplete order is created. You can then use a third-party integration to handle your payment gateway. If the payment gateway is supported by Composable Commerce, such as Stripe, the payment is processed externally but handled internally. When a successful validation is returned, Composable Commerce flags the order as complete. + + If you are using a payment method not officially supported by Composable Commerce, the gateway needs to be implemented and handled manually. After the payment has been authorized and captured either through Commerce Manager or API, the status of an order becomes complete. + + ### Shipping + + The status of an order and the status of shipping are handled separately, and so an order can be complete but not shipped. Orders that have not been shipped yet have a status of unfulfilled. This flag is generated automatically by Composable Commerce when an order is created. Currently, you can only update the shipping status manually, through the API. After the order is shipped, flag its shipping status as fulfilled. + + ### Inventory + + If enabled, you can manage your stock. As such, your stock is automatically updated as soon as a product is checked out. + + - name: Orders + description: | + An Order is created through the [checkout](/docs/api/carts/checkout) endpoint within the Carts API. + + An order is created after a customer checks out their cart. On creation, the order is marked unpaid. The customer is prompted for a shipping address, a billing address, and a payment method. After the order is successfully paid, you can trigger an inventory process and a shipping process. + + You can keep a history of orders associated with the customer account. + + ### Reorder + + A re-order is when a shopper copies items from a previous order from their order history into a cart of their choice. If a shopper re-orders to an empty cart, the same quantities as the past order are applied. If the shopper re-orders to an existing cart, and orders the same item, the quantity increases. If an item is out of stock, the item is not added to the cart, and the shopper sees an insufficient stock error. The tax for the items in a re-order is not applied. For more information, see [Tax Items](/docs/api/carts/tax-items). + - name: Payments + description: | + When you [checkout](/docs/api/carts/checkout) a [cart](/docs/api/carts/cart-management), an unpaid [order](/docs/api/carts/orders) is returned. You can process the payment for the order though a payment gateway. + + :::note + + - You need to configure and enable a payment gateway before you can accept payments for orders. + - Configure your store to use [Manual Gateway](/docs/api/payments/update-manual-gateway) to process payments if the order total is zero or the payment is through non-supported payment providers. + - There are a number of actions that happen to your inventory when checking out and paying for an order. For more information, see [Inventory](/docs/api/pxm/inventory/inventories-introduction). + - We recommend to wait until the payment confirmation process is fully completed before proceeding with any additional updates to the order. Making simultaneous updates to the same entity immediately after payment confirmation can lead to a race condition. To learn more information on handling parallel calls to API objects, see [Parallel Calls to API Objects](https://beta.elasticpath.dev/guides/Getting-Started/api-contract#parallel-calls-to-api-objects). + + ::: + + ### Payment Methods + + Depending on the chosen gateway, you may or may not have access to capture funds immediately or authorize for later payment. For more information, see [Transactions](/docs/api/carts/transactions). + + To make a partial payment in Postman through any payment gateway, specify the desired payment amount in the amount field within the request body. To learn about Split Payments, see the [Split Payments](/docs/api/payments/payment-gateways-introduction#split-payments) section. + + #### Purchase + + The simplest method is purchase. The gateway attempts to charge the customer immediately, and the result of the attempt is returned. + + You can partially pay funds using purchase method. The gateway attempts to charge the customer immediately, and the payment status for an order shows `partially_paid`. + + When you Get an order, you can see the following fields in the meta object: + + - `balance_owing`: Specifies the outstanding funds required to complete an order. It considers all complete or pending transactions, including authorized, paid, and captured transactions. (`balance_owing` = order total - `authorized` amount - `paid` amount). + - `paid`: Specifies the total amount of purchased or captured transactions. + - `authorized`: Specifies the total amount of completed or pending authorized transactions for an order. + + #### Authorize + + You can `authorize` a payment so funds can later be captured when an item is dispatched or restocked. + + You can partially pay for an order using `authorize` payment method so that the order is `partially_authorized`. The transaction must be complete for the order status to be `partially_authorized`. + + For more information about order and payment statuses for split payments, see [Split Payments](/docs/api/payments/payment-gateways-introduction#split-payments). + + #### Capture + + After authorizing a transaction, you have to capture the authorized funds. + + :::note + + We recommend capturing payments several hours to days after the authorization to mitigate risks of fraud and chargebacks. When you sell digital goods that are delivered immediately, we recommend using a single purchase call instead of separate authorize and capture calls. + + ::: + + After the payment is `partially_authorized`, you must `capture` the authorized transaction later. Once you capture the authorized transactions, the order payment status will change to `partially_paid`. + + #### Refunds + + You can use either the Refund through Composable Commerce or use the Mark as Refunded capability, or a combination of both capabilities. + + For more information about refund for split payments, see [Refund a Payment](/docs/api/carts/refund-a-transaction). + + #### Refund through Composable Commerce + + You can start a full or partial refund to a supported payment provider directly from Commerce Manager or the API. When you start the refund process, the refund request is sent to the payment gateway. You no longer have to log on to your payment gateway’s console to process the refund. + + When you process a refund, use the refund endpoint to pass the refund amount. If you don’t pass an amount, the refund is processed as Mark as refunded. For more information, see the Mark as Refunded section. + + Each time a partial refund is triggered, the transaction.updated event is generated and updated with refunded.amount. The `order.updated` event is also triggered. The `order.refunded` event generates when the full amount is refunded. + + + #### Mark as Refunded + + You can use your payment gateway’s console to process a refund. Process the refund first in the payment gateway and then use the **Mark as Refunded** capability in Composable Commerce to complete the process. + + When an order is **Marked as refunded**, the payment status `order.payment.status` is set to refunded. In this case, the `order.updated`, `transaction.updated` and `order.refunded` events are generated. + - name: Transactions + - name: Custom Discounts + description: | + With custom discounts, you can allow your shoppers to apply discounts from external services to their purchases. To apply custom discounts to carts and cart items, you need to set `custom_discounts_enabled` field to `true` in your [Cart Settings](/docs/api/settings/put-v-2-settings-cart). + + You cannot add custom discounts to an empty cart. + + :::caution + + - You can apply up to five custom discounts to cart and cart item. + - The stores that use [simple calculation method](/guides/How-To/Carts/calculate-totals) do not support custom discounts. + + ::: + - name: Tax Items + description: | + Taxes differ by country and can differ within the country by region, state, or province. Each jurisdiction has a unique tax code and rate. If your store serves many jurisdictions, integrate a third-party tax generator to manage taxes. If your store serves a few jurisdictions, you can use the API to define the tax codes and rates in Composable Commerce. + + Taxes are calculated after all promotional discounts have been applied. When calculating taxes on a cart or order, you can choose from the following methods for calculating taxes: + + - Simple calculation method: Taxes are calculated at the unit level and are rounded to the nearest penny for the unit. + - Line calculation method: Default. Taxes are calculated at the line level and are rounded to the nearest penny for the line. + For more information about calculation methods, see [Calculate cart and order totals](/guides/How-To/Carts/calculate-totals). + + :::note + Tax items can be added and removed using [client credentials tokens](/docs/authentication/Tokens/client-credential-token). Only administrators with `client-credentials` are able to manage tax items. + ::: + diff --git a/packages/sdks/specs/catalog_view.yaml b/packages/sdks/specs/catalog_view.yaml index c60ae1ae..b6145a3e 100644 --- a/packages/sdks/specs/catalog_view.yaml +++ b/packages/sdks/specs/catalog_view.yaml @@ -212,511 +212,637 @@ tags: The cached entries disappear from the cached objects pool after 5 minutes. paths: - /pcm/catalogs: - post: + /catalog: + get: tags: - - Catalogs - summary: Creates a new catalog - description: | - Before you create a catalog, you must define the following resources: - - - Hierarchies - hierarchies and nodes to categorize the products. - - Products - product information, associated assets, and links to hierarchy nodes. - - Price Books - prices for the products associated with the hierarchies. You can create multiple price books for different scenarios, such as seasonal sales, business versus retail customer pricing, and reward programs. When creating a catalog, you can specify up to five price books. You must configure a priority for your price books. Product prices are displayed in the catalog according to the priority of the price books. Priority is a number and the price book with the highest number has the highest priority. - operationId: createCatalog - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/catalog-create-data' - description: Creates a catalog with the following attributes. - required: true + - Releases + summary: Get the catalog release as shoppers + description: Returns a list of all published releases of the specified catalog. + operationId: getByContextRelease + parameters: + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' responses: - '201': - description: The created catalog + '200': + description: The catalog. content: application/json: schema: - $ref: '#/components/schemas/catalog-data' + $ref: '#/components/schemas/release-data' default: - description: Unexpected error. + description: The unexpected error. content: application/json: schema: $ref: '#/components/schemas/error-response' + /catalog/hierarchies: get: tags: - - Catalogs - summary: Gets all authorized catalogs + - Shopper Catalog API + summary: Get all Hierarchies description: | - Retrieves a list of all the catalogs that you are authorized to view. Currently, published catalogs are limited to the current release and two releases prior to the current release. You can see the differences between the last 2 consecutive catalog releases using the delta link returned in the response of a [publish a catalog](/docs/api/pxm/catalog/publish-release) endpoint. - - You can use the `is_full_delta` attribute returned from the `get a release of a catalog` endpoint to determine if you need to refresh the data in your company system before publishing a catalog release and injecting fresh data in a delta link. The `is_full_delta` attribute tells you if this is a full publish of a catalog release. Using a search service as an example, if the `is_full_delta` attribute is `true`, you should remove all data about that catalog from the search service before publishing a catalog release and injecting fresh data from the delta file. See [Publish a catalog](/docs/api/pxm/catalog/publish-release). + Returns all hierarchies from a catalog. - If the `is_full_publish` attribute returned in the response is `false`, data from the previous catalog release overlaid the existing data in the delta file. The `is_full_publish` attribute is always `true` the first time a catalog is published. - operationId: getCatalogs + If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + ### Filtering + + This endpoint supports filtering. For general syntax, see [Filtering](/guides/Getting-Started/filtering). + + | Operator | Description | Supported Attributes | Example | + |:--- |:--- |:--- |:--- | + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | + | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | + + ### Building breadcrumbs in a storefront + + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + - Specify the node Ids in the filter expression. + - You can have as many node Ids as you want. + - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + operationId: getByContextAllHierarchies + parameters: + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - $ref: '#/components/parameters/filter-hierarchy' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' responses: '200': - description: The list of catalogs. + description: The hierarchies of the catalog. content: application/json: schema: - $ref: '#/components/schemas/catalog-list-data' + $ref: '#/components/schemas/hierarchy-list-data' default: description: An unexpected error. content: application/json: schema: $ref: '#/components/schemas/error-response' - /pcm/catalogs/{catalog_id}: + /catalog/hierarchies/{hierarchy_id}: get: tags: - - Catalogs - summary: Get a catalog by ID - description: Retrieves the specified catalog. - operationId: getCatalogByID + - Shopper Catalog API + summary: Get a Hierarchy + description: | + Returns a hierarchy from the catalog. + + If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog to retrieve. For information about how catalog rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules). + operationId: getByContextHierarchy parameters: - - description: The catalog ID. - name: catalog_id + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - description: The catalog hierarchy ID. + name: hierarchy_id in: path required: true schema: type: string responses: '200': - description: The catalog. + description: The catalog hierarchy. content: application/json: schema: - $ref: '#/components/schemas/catalog-data' + $ref: '#/components/schemas/hierarchy-data' default: - description: An unexpected error. + description: The unexpected error. content: application/json: schema: $ref: '#/components/schemas/error-response' - put: + /catalog/hierarchies/{hierarchy_id}/nodes: + get: tags: - - Catalogs - summary: Updates a catalog - description: Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the catalog is not updated. - operationId: updateCatalog + - Shopper Catalog API + summary: Get a Hierarchy's Nodes + description: | + Returns all the nodes for the specified hierarchy. + + If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + In the `bread_crumb` metadata, you can identify the parent nodes that a node is associated with. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). + + ### Filtering + + This endpoint supports filtering. For general syntax, see [Filtering](/guides/Getting-Started/filtering). + + | Operator | Description | Supported Attributes | Example | + |:--- |:--- |:--- |:--- | + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | + | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | + + ### Building breadcrumbs in a storefront + + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + - Specify the node Ids in the filter expression. + - You can have as many node Ids as you want. + - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + operationId: getByContextHierarchyNodes parameters: - - description: The catalog ID. - name: catalog_id + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-node' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + - description: The catalog hierarchy ID. + name: hierarchy_id in: path required: true schema: type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/catalog-update-data' - description: Updated catalog. - required: true responses: '200': - description: An updated catalog with the following attributes. + description: The child nodes of a catalog hierarchy. content: application/json: schema: - $ref: '#/components/schemas/catalog-data' + $ref: '#/components/schemas/node-list-data' default: - description: Unexpected error. + description: The unexpected error. content: application/json: schema: $ref: '#/components/schemas/error-response' - delete: + /catalog/hierarchies/{hierarchy_id}/children: + get: tags: - - Catalogs - summary: Deletes a catalog - description: Deletes an unpublished catalog. Use [**Delete a Release**](/docs/api/pxm/catalog/delete-release-by-id) and [**Delete All Releases**](/docs/api/pxm/catalog/delete-releases) to delete releases of a catalog. If the catalog is associated with any catalog rules, you must first update the catalog rules to remove the catalog. - operationId: deleteCatalogByID + - Shopper Catalog API + summary: Get a Hierarchy's Children + description: | + Returns the parent nodes for the specified hierarchy. + + ![Parent Nodes](/assets/rootnodes.PNG) + + If you have multiple catalog rules defined, the rule that best matches the shopperʼs context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + In the `bread_crumb` metadata, you can identify the parent nodes that a node is associated with. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). + + ### Filtering + + The following operators and attributes are available when filtering on this endpoint. + + | Operator | Description | Supported Attributes | Example | + |:--- |:--- |:--- |:--- | + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | + | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | + + For more information, see [Filtering](/guides/Getting-Started/filtering). + + ### Building breadcrumbs in a storefront + + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + - Specify the node Ids in the filter expression. + - You can have as many node Ids as you want. + - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + operationId: getByContextHierarchyChildNodes parameters: - - description: The catalog ID. - name: catalog_id + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-node' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + - description: The catalog hierarchy ID. + name: hierarchy_id in: path required: true schema: type: string responses: - '204': - description: A 204 response indicates that the catalog has been deleted. + '200': + description: The child nodes of a catalog hierarchy. + content: + application/json: + schema: + $ref: '#/components/schemas/node-list-data' default: - description: Unexpected error. + description: The unexpected error. content: application/json: schema: $ref: '#/components/schemas/error-response' - /pcm/catalogs/{catalog_id}/releases: - post: + /catalog/nodes: + get: tags: - - Releases - summary: Publishes a catalog + - Shopper Catalog API + summary: Get all Nodes description: | + Returns all nodes in the catalog. - Publishes a catalog. You must publish a catalog before you can retrieve that catalog in an organization or store. The hierarchies, live products, and prices associated with a published catalog are in read-only mode. If you make a change to these resources, for example, a change to your price book or hierarchies, you need to republish the catalog. - - You can get [a catalog release](/docs/api/pxm/catalog/get-release-by-id) to retrieve a published catalog. Currently, published catalogs are limited to the current release and two releases prior to the current release. - - You can see the differences between the last 2 consecutive catalog releases. This is useful if want to understand how your products have changed in your catalog, ensuring your site search integration is kept up-to-date. - - Once a catalog release has completed publishing, the delta relationship links to the delta document. + If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). - The `delta` links are signed and only valid for 1 hour. Re-reading a catalog release, for example, using [Getting a release of a catalog](/docs/pxm/catalogs/catalog-latest-release/get-a-release-of-a-catalog) returns a fresh a link. - - You can use the `is_full_delta` attribute returned from the `get a release of a catalog` endpoint to determine if you need to refresh the data in your company system before injecting fresh data in a `delta` link. The `is_full_delta` attribute tells you if this is a full publish of the catalog. Using a search service as an example, if the `is_full_delta` attribute is `true`, you should remove all data about that catalog from the search service before injecting fresh data from the `delta` file. If the `is_full_delta` attribute is `false`, then data from the previous catalog overlays the existing data in the `delta` file. To publish a catalog and inject fresh data in a `delta` link, set `export_full_delta` to `true`. - - If a previous catalog publish date is greater than 90 days, then a full catalog publish is automatically performed. If you publish your catalogs infrequently, Commerce may perform a full publish when you are expecting a delta publish. - - :::caution + You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). - Generating a full delta is resource intensive and slows down the publishing process and so should only be performed in certain circumstances, for example, when initializing an integration with a service like Algolia. - - ::: - - The `is_full_delta` attribute is always `true` the first time a catalog is published. The information is stored in a collection of `json` documents in a compressed file. You can either manually check the file or, for example, use them to automatically update another company system you may have. - - - Delta files are only available for 30 days. - - Delta files are removed when a catalog release is deleted. - - Each document has a `delta_type` with one of the following values, depending on whether a product has been deleted, updated or created in a catalog release. - - - `delete` describes products deleted from this release of a catalog. - - `createupdate` describes products updated in this release of a catalog. - - ### Multi-Store Management Solutions - - In a multi-store management solution. - - - You can create organization catalogs. Your organization catalogs are available for your stores to use. - - Your stores can create their own catalogs. - - Your stores can create catalogs that have a combination of organization products and store products. - - If you are publishing a catalog in a store that contains resources from an organization, in Commerce Manager, you must enable the **Include Organization Resources in Catalog Publishes** checkbox. - - 1. Go to **SYSTEM** > **Store Settings**. - 2. Click **General Settings**. - 3. Select **PXM** from the list. - 4. Select the **Include Organization Resources in Catalog Publishes** checkbox. - operationId: publishRelease + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. For more information, see [Building breadcrumbs in a storefront](#building-breadcrumbs-in-a-storefront). + + The response lists the products associated with the nodes. If products are [curated](/guides/How-To/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront. + + - You can only curate 20 products or less. You cannot have more than 20 curated products. + - If a curated product is removed from a node, the product is also removed from the `curated_products` list. + + ### Filtering + + This endpoint supports filtering. For general syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available. + + | Operator | Description | Attributes | Example | + | --- | --- | --- | --- | + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug` | `filter=eq(name,some-name)` | + | `in` | Checks if the values are included in the specified string. If they are, the condition is true. + | `Id` | `filter=in(id,9214719b-17fe-4ea7-896c-d61e60fc0d05,e104d541-2c52-47fa-8a9a-c4382480d97c,65daaf68-ff2e-4632-8944-370de835967d)` | + + ### Building breadcrumbs in a storefront + + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + - Specify the node Ids in the filter expression. + - You can have as many node Ids as you want. + - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + operationId: getByContextAllNodes parameters: - - description: The catalog ID. - name: catalog_id - in: path - required: true - schema: - type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/catalog-release-create-data' - description: Options for catalog release publishing + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-node' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' responses: - '201': - description: Publishes a catalog release with the following attributes. + '200': + description: The nodes of the catalog. content: application/json: schema: - $ref: '#/components/schemas/release-data' + $ref: '#/components/schemas/node-list-data' default: - description: Unexpected error. + description: An unexpected error. content: application/json: schema: $ref: '#/components/schemas/error-response' + /catalog/nodes/{node_id}: get: tags: - - Releases - summary: Gets all authorized catalog releases + - Shopper Catalog API + summary: Get a Node description: | - Returns a list of all published releases of the specified catalog. Currently, published catalogs are limited to the current release and two releases prior to the current release. You can see the differences between the last 2 consecutive catalog releases using the `delta` link returned in the response of a `publish a catalog` endpoint. + Returns a node from the catalog. - You can use the `is_full_delta` attribute returned from the `get a release of a catalog` endpoint to determine if you need to refresh the data in your company system before publishing a catalog release and injecting fresh data in a delta link. The `is_full_delta` attribute tells you if this is a full publish of a catalog release. Using a search service as an example, if the `is_full_delta` attribute is `true`, you should remove all data about that catalog from the search service before publishing a catalog release and injecting fresh data from the delta file. + If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). - If the `is_full_publish` attribute returned in the response is `false`, data from the previous catalog release overlaid the existing data in the delta file. The `is_full_publish` attribute is always `true` the first time a catalog is published. - operationId: getReleases + You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). + + The response lists the products associated with a node. If products are [curated](/guides/How-To/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your nodes, enabling you to create unique product collections in your storefront. + + - If you don't provide any `curated_products`, products are listed by their `updated_at` time in descending order, with the most recently updated product first. + - If you configure `curated_products` for only a few products, the curated products are displayed first and the other products are displayed in the order of `updated_at` time. + - You can only curate 20 products or less. You cannot have more than 20 curated products. + - A product that is curated has the `"curated_product": true` attribute displayed. + - If a curated product is removed from a node, the product is also removed from the `curated_products` list. + operationId: getByContextNode parameters: + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' - $ref: '#/components/parameters/accept-language' - - description: The catalog ID. - name: catalog_id + - description: The catalog node ID. + name: node_id in: path required: true schema: type: string responses: '200': - description: The list of catalogs. + description: The catalog node. content: application/json: schema: - $ref: '#/components/schemas/release-list-data' + $ref: '#/components/schemas/node-data' default: description: The unexpected error. content: application/json: schema: $ref: '#/components/schemas/error-response' - delete: + /catalog/nodes/{node_id}/relationships/children: + get: tags: - - Releases - summary: Deletes all releases - description: Deletes all releases of the specified published catalog. - operationId: deleteReleases + - Shopper Catalog API + summary: Get a Node's Children + description: | + Returns the child nodes for a node in the catalog. + + If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + You can see which parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). + + The response lists the products associated with the nodes. If products are [curated](/guides/How-To/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront. + + - If you don't provide any curated_products, products are listed by their updated_at time in descending order, with the most recently updated product first. + - If you configure curated_products for only a few products, the curated products are displayed first and the other products are displayed in the order of updated_at time. + - You can only curate 20 products or less. You cannot have more than 20 curated products. + - A product that is curated has the "curated_product": true attribute displayed. + - If a curated product is removed from a node, the product is also removed from the curated_products list. + + ### Filtering + + This endpoint supports filtering. For general syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available. + + | Operator | Description | Attributes | Example | + | --- | --- | --- | --- | + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug` | `filter=eq(name,some-name)` | + | `in` | Checks if the values are included in the specified string. If they are, the condition is true. + | `Id` | `filter=in(id,9214719b-17fe-4ea7-896c-d61e60fc0d05,e104d541-2c52-47fa-8a9a-c4382480d97c,65daaf68-ff2e-4632-8944-370de835967d)` | + + ### Building breadcrumbs in a storefront + + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + - Specify the node Ids in the filter expression. + - You can have as many node Ids as you want. + - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + operationId: getByContextChildNodes parameters: - - description: The catalog ID. - name: catalog_id + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-node' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + - description: The catalog node ID. + name: node_id in: path required: true schema: type: string responses: - '204': - description: A 204 response indicates that the releases have been deleted. + '200': + description: The child nodes of a catalog node. + content: + application/json: + schema: + $ref: '#/components/schemas/node-list-data' default: - description: Unexpected error. + description: The unexpected error. content: application/json: schema: $ref: '#/components/schemas/error-response' - /pcm/catalogs/{catalog_id}/releases/{release_id}: + /catalog/products: get: tags: - - Releases - summary: Get a catalog release by ID - description: Retrieves the specified catalog release. - operationId: getReleaseByID + - Shopper Catalog API + summary: Get all Products + description: | + Retrieves the list of products from the catalog. Only the products in a live status are retrieved. + + ### Catalog Rules + + If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. If no catalog rules are configured, the first catalog found is returned. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + ### Product and Node Associations + + You can see the parent nodes a product is associated within the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. For example, this is useful if you want to improve how your shoppers search your store. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). + + + ### Including Resources + + Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + + | Parameter | Required | Description | + | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + | `main_image` | Optional | The main images associated with a product. | + | `files` | Optional | Any files associated with a product. | + + See [**Including Resources**](/guides/Getting-Started/includes). + + ### Filtering + + This endpoint supports filtering. For general filtering syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available when filtering on this endpoint. + + | Operator | Description | Supported Attributes | Example | + |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | + + ### Building breadcrumbs in a storefront + + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + - Specify the node Ids in the filter expression. + - You can have as many node Ids as you want. + - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + operationId: getByContextAllProducts parameters: - $ref: '#/components/parameters/accept-language' - - description: The catalog ID. - name: catalog_id - in: path - required: true - schema: - type: string - - description: The catalog release ID. - name: release_id - in: path - required: true - schema: - type: string + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - $ref: '#/components/parameters/filter-product' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' responses: '200': - description: The catalog. + description: The products of a catalog. content: application/json: schema: - $ref: '#/components/schemas/release-data' + $ref: '#/components/schemas/product-list-data' default: description: The unexpected error. content: application/json: schema: $ref: '#/components/schemas/error-response' - delete: + /catalog/products/{product_id}: + get: tags: - - Releases - summary: Deletes a release - description: Deletes the specified published catalog release. - operationId: deleteReleaseByID + - Shopper Catalog API + summary: Get a Product + description: | + Returns the specified product from the catalog. The product must be in the `live` status. + + If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). + + Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + + | Parameter | Required | Description | + | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + | `main_image` | Optional | The main images associated with a product. | + | `files` | Optional | Any files associated with a product. | + + See [**Including Resources**](/guides/Getting-Started/includes). + operationId: getByContextProduct parameters: - - description: The catalog ID. - name: catalog_id + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - description: The product ID. + name: product_id in: path required: true schema: type: string - - description: The catalog release ID. - name: release_id - in: path - required: true - schema: - type: string - responses: - '204': - description: A 204 response indicates that the release has been deleted. - default: - description: Unexpected error. - content: - application/json: - schema: - $ref: '#/components/schemas/error-response' - /pcm/catalogs/rules: - post: - tags: - - Rules - summary: Creates a new catalog rule - description: | - If you have multiple catalogs, create catalog rule resources. With catalog rules, you can display different catalogs to different shoppers. For example, you can display a preferred pricing catalog to a few special customers. Or you can display one catalog to shoppers using your website and a different catalog to shoppers using your mobile app. Finally, you can define custom criteria by creating tags. - - :::note - - - If you have one catalog for all customers and channels, you can omit creating this resource. - - Due to the way catalogs are cached in Commerce, using catalog rules to display catalogs sometimes causes a 5-minute time delay before the catalogs are displayed. - - You cannot create catalog rules for organization catalogs. - - ::: - - For ideas about the kinds of business scenarios you can achieve with catalog rules, see [Catalog Rules](/docs/api/pxm/catalog/rules). To understand how catalogs are matched to shoppers by using rules, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). - operationId: createRule - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/rule-create-data' - description: Creates a catalog rule with the following attributes. - required: true responses: - '201': - description: The created catalog rule + '200': + description: The product of a catalog. content: application/json: schema: - $ref: '#/components/schemas/rule-data' + $ref: '#/components/schemas/product-data' default: - description: Unexpected error. + description: The unexpected error. content: application/json: schema: $ref: '#/components/schemas/error-response' + /catalog/products/{product_id}/relationships/component_products: get: tags: - - Rules - summary: Gets all authorized catalog rules + - Shopper Catalog API + summary: Get a Bundle's Component Products description: | - Retrieves all authorized catalog rules. - - ### Filtering + With Product Experience Manager, you can [create](/docs/api/pxm/products/create-product) and manage bundles. A bundle is a purchasable product, comprising of one or more products that you want to sell together. - This endpoint supports filtering. For general filtering syntax, see [Filtering](https://elasticpath.dev/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are supported. + You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. - | Operator | Description | Supported Attributes | Example | - |:--- |:--- |:--- |:--- | - | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | - operationId: getRules - parameters: - - $ref: '#/components/parameters/filter-rule' - - $ref: '#/components/parameters/limit' - - $ref: '#/components/parameters/offset' - responses: - '200': - description: The list of catalog rules. - content: - application/json: - schema: - $ref: '#/components/schemas/rule-list-data' - default: - description: An unexpected error. - content: - application/json: - schema: - $ref: '#/components/schemas/error-response' - /pcm/catalogs/rules/{catalog_rule_id}: - get: - tags: - - Rules - summary: Get a catalog rule by ID - operationId: getRuleByID + This endpoint returns a list of component product IDs for the specified bundle. + operationId: getByContextComponentProductIDs parameters: - - description: The catalog rule ID. - name: catalog_rule_id + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - description: The product ID. + name: product_id in: path required: true schema: type: string + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' responses: '200': - description: The catalog rile. + description: The list of component product IDs of a bundle product from a catalog. content: application/json: schema: - $ref: '#/components/schemas/rule-data' + $ref: '#/components/schemas/product-reference-list-data' default: - description: An unexpected error. + description: The unexpected error. content: application/json: schema: $ref: '#/components/schemas/error-response' - put: + /catalog/products/{product_id}/relationships/children: + get: tags: - - Rules - summary: Updates a catalog rule - description: Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the catalog rule is not updated. - operationId: updateRule + - Shopper Catalog API + summary: Get a Parent Product's Child Products + description: | + For a specified product and catalog release, retrieves a list of child products from a parent product. Any product other than a base product results in a `422 Unprocessable Entity` response. Only the products in a `live` status are retrieved. + + If you have multiple catalog rules defined, the rule that best matches the shopperʼs context is used to determine which catalog is retrieved. If no catalog rules are configured, the first catalog found is returned. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + You can see the parent nodes a product is associated within the `breadcrumbs` metadata for each product. For example, this is useful if you want to improve how your shoppers search your store. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). + + ### Filtering + + This endpoint supports filtering. For general filtering syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available when filtering on this endpoint. + + | Operator | Description | Supported Attributes | Example | + |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | + + ### Building breadcrumbs in a storefront + + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + - Specify the node Ids in the filter expression. + - You can have as many node Ids as you want. + - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + + ### Including Resources + + Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + + | Parameter | Required | Description | + | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + | `main_image` | Optional | The main images associated with a product. | + | `files` | Optional | Any files associated with a product. | + + See [**Including Resources**](/guides/Getting-Started/includes). + operationId: getByContextChildProducts parameters: - - description: The catalog rule ID. - name: catalog_rule_id + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - description: The product ID. + name: product_id in: path required: true schema: type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/rule-update-data' - description: An updated catalog rule with the following attributes. - required: true + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-product' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' responses: '200': - description: An Updated catalog rule with the following attributes. - content: - application/json: - schema: - $ref: '#/components/schemas/rule-data' - default: - description: Unexpected error. + description: The list of child products of a parent product from a catalog. content: application/json: schema: - $ref: '#/components/schemas/error-response' - delete: - tags: - - Rules - summary: Deletes a catalog rule - operationId: deleteRuleByID - parameters: - - description: The catalog rule ID. - name: catalog_rule_id - in: path - required: true - schema: - type: string - responses: - '204': - description: A 204 response indicates that the catalog rule has been deleted. + $ref: '#/components/schemas/product-list-data' default: - description: Unexpected error. + description: The unexpected error. content: application/json: schema: $ref: '#/components/schemas/error-response' - /pcm/catalogs/{catalog_id}/releases/{release_id}/hierarchies: + /catalog/hierarchies/{hierarchy_id}/products: get: tags: - - Administrator Latest Releases Catalog API - summary: Get all Hierarchies + - Shopper Catalog API + summary: Get a Hierarchy's Products description: | - Returns the hierarchies from a published catalog. - - :::note - - Currently, published catalogs are limited to the current release and two releases prior to the current release. - - ::: + Returns the products associated with the specified hierarchy in the catalog. The products must be in the live status. + + If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. See [Resolving catalog rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). ### Filtering - - This endpoint supports filtering. For general syntax, see [Filtering](https://beta.elasticpath.dev/docs/commerce-cloud/api-overview/filtering). - | Operator | Description | Supported Attributes | Example | - |:--- |:--- |:--- |:--- | - | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | - | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | - + This endpoint supports filtering. For general filtering syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available when filtering on this endpoint. + + | Operator | Description | Supported Attributes | Example | + |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | + ### Building breadcrumbs in a storefront In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. @@ -726,108 +852,66 @@ paths: - Specify the node Ids in the filter expression. - You can have as many node Ids as you want. - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. - operationId: getAllHierarchies + + ### Including Resources + + Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + + | Parameter | Required | Description | + | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + | `main_image` | Optional | The main images associated with a product. | + `files` | Optional | Any files associated with a product. | + + + See [**Including Resources**](/guides/Getting-Started/includes). + operationId: getByContextProductsForHierarchy parameters: - $ref: '#/components/parameters/accept-language' - - description: The catalog ID. - name: catalog_id - in: path - required: true - schema: - type: string - - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. - name: release_id + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - $ref: '#/components/parameters/filter-product' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + - description: The catalog hierarchy ID. + name: hierarchy_id in: path required: true schema: type: string - - $ref: '#/components/parameters/filter-hierarchy' - - $ref: '#/components/parameters/limit' - - $ref: '#/components/parameters/offset' responses: '200': - description: The hierarchies of a catalog. + description: The products of a catalog hierarchy. content: application/json: schema: - $ref: '#/components/schemas/hierarchy-list-data' + $ref: '#/components/schemas/product-list-data' default: - description: An unexpected error. + description: The unexpected error. content: application/json: schema: $ref: '#/components/schemas/error-response' - /pcm/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}: + /catalog/nodes/{node_id}/relationships/products: get: tags: - - Administrator Latest Releases Catalog API - summary: Get a Hierarchy + - Shopper Catalog API + summary: Get a Node's Products description: | - Returns the specified hierarchy from a published catalog. + Returns the products associated with the specified hierarchy node in the catalog. The products must be in the `live` status. If the products have been curated then the products are returned in the order specified in the `curated_products` attribute. A product that is curated has the `"curated_product": true` attribute displayed. - :::note - - Currently, published catalogs are limited to the current release and two releases prior to the current release. - - ::: - operationId: getHierarchy - parameters: - - $ref: '#/components/parameters/accept-language' - - description: The catalog ID. - name: catalog_id - in: path - required: true - schema: - type: string - - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. - name: release_id - in: path - required: true - schema: - type: string - - description: The catalog hierarchy ID. - name: hierarchy_id - in: path - required: true - schema: - type: string - responses: - '200': - description: The catalog hierarchy. - content: - application/json: - schema: - $ref: '#/components/schemas/hierarchy-data' - default: - description: The unexpected error. - content: - application/json: - schema: - $ref: '#/components/schemas/error-response' - /pcm/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/nodes: - get: - tags: - - Administrator Latest Releases Catalog API - summary: Get a Hierarchy's Nodes - description: | - Returns all nodes for the specified hierarchy from a published catalog. - - :::note - - Currently, published catalogs are limited to the current release and two releases prior to the current release. - - ::: - - In the `bread_crumb` metadata, you can identify the parent nodes that a node is associated with. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. See [Resolving catalog rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). + ### Filtering - This endpoint supports filtering. For general syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). + This endpoint supports filtering. For general filtering syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available when filtering on this endpoint. - | Operator | Description | Supported Attributes | Example | - |:--- |:--- |:--- |:--- | - | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | - | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | + | Operator | Description | Supported Attributes | Example | + |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | ### Building breadcrumbs in a storefront @@ -838,295 +922,186 @@ paths: - Specify the node Ids in the filter expression. - You can have as many node Ids as you want. - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. - operationId: getHierarchyNodes + + ### Including Resources + + Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + + | Parameter | Required | Description | + | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + | `main_image` | Optional | The main images associated with a product. | + | `files` | Optional | Any files associated with a product. | + + See [**Including Resources**](/guides/Getting-Started/includes). + operationId: getByContextProductsForNode parameters: - - description: The catalog ID. - name: catalog_id - in: path - required: true - schema: - type: string - - description: The catalog release ID. - name: release_id - in: path - required: true - schema: - type: string - - description: The catalog hierarchy ID. - name: hierarchy_id + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - $ref: '#/components/parameters/filter-product' + - description: The catalog node ID. + name: node_id in: path required: true schema: type: string - - $ref: '#/components/parameters/accept-language' - - $ref: '#/components/parameters/filter-node' - $ref: '#/components/parameters/limit' - $ref: '#/components/parameters/offset' responses: '200': - description: The child nodes of a catalog hierarchy. + description: The products of a catalog node. content: application/json: schema: - $ref: '#/components/schemas/node-list-data' + $ref: '#/components/schemas/product-list-data' default: description: The unexpected error. content: application/json: schema: $ref: '#/components/schemas/error-response' - /pcm/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/children: - get: + /catalog/products/{product_id}/configure: + post: tags: - - Administrator Latest Releases Catalog API - summary: Get a Hierarchy's Children + - Shopper Catalog API + summary: Configure a Shopper Bundle description: | - Returns the parent nodes for the specified hierarchy from a published catalog. - - ![Parent Nodes](/assets/rootnodes.PNG) - - :::note - - Currently, published catalogs are limited to the current release and two releases prior to the current release. - - ::: - - In the `bread_crumb` metadata, you can identify the parent nodes that a node is associated with. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + Once you have configured your product bundles, you can display them in your storefront in your published catalog. Depending on how you have configured the minimum and maximum values for the product options in your components, you can allow your shoppers to choose which products they want to select. For example, you can enable a shopper to select 1 or more product options from a list of 10, giving your shoppers greater flexibility when selecting products in your store front. - ### Filtering + - Products must be in a `live` status. + - If you have not specified any minimum or maximum values for the product options in your components, your shoppers can select any combination of product options. - This endpoint supports filtering. For general syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). + If you have configured minimum and maximum values using [Create a Bundle](/docs/api/pxm/products/create-product), this becomes part of the `bundle_configuration`. You can check how your bundle is configured using [Get a product in a catalog release](/docs/api/pxm/catalog/get-product) in `bundle_configuration` under `meta`. The `bundle_configuration` forms the body of the request. - | Operator | Description | Supported Attributes | Example | - |:--- |:--- |:--- |:--- | - | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | - | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | + The response updates the `bundle_configuration` with the product options the shopper selects. The `meta` data is updated with the `meta` data of the selected product options. In your storefront, you could display this as a summary of the product options a shopper has selected. - ### Building breadcrumbs in a storefront + ### Including Resources - In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. - `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + | Parameter | Required | Description | + | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + | `main_image` | Optional | The main images associated with a product. | + | `files` | Optional | Any files associated with a product. | - - Specify the node Ids in the filter expression. - - You can have as many node Ids as you want. - - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. - operationId: getHierarchyChildNodes + See [**Including Resources**](/guides/Getting-Started/includes). + operationId: configureByContextProduct parameters: - - description: The catalog ID. - name: catalog_id - in: path - required: true - schema: - type: string - - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. - name: release_id - in: path - required: true - schema: - type: string - - description: The catalog hierarchy ID. - name: hierarchy_id + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - description: The product ID. + name: product_id in: path required: true schema: type: string - - $ref: '#/components/parameters/accept-language' - - $ref: '#/components/parameters/filter-node' - - $ref: '#/components/parameters/limit' - - $ref: '#/components/parameters/offset' + requestBody: + $ref: '#/components/requestBodies/bundle-configuration-data' responses: '200': - description: The child nodes of a catalog hierarchy. + description: The configured product of a catalog. content: application/json: schema: - $ref: '#/components/schemas/node-list-data' + $ref: '#/components/schemas/product-data' default: description: The unexpected error. content: application/json: schema: $ref: '#/components/schemas/error-response' - /pcm/catalogs/{catalog_id}/releases/{release_id}/nodes: - get: + /catalogs: + post: tags: - - Administrator Latest Releases Catalog API - summary: Get all Nodes + - Catalogs + summary: Creates a new catalog description: | - Returns the child nodes from a published catalog. - - :::note - - Currently, published catalogs are limited to the current release and two releases prior to the current release. - - ::: - - You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). - - In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. See [Building breadcrumbs in a storefront](#building-breadcrumbs-in-a-storefront). - - The response lists the products associated with the nodes. If products are [curated](https://beta.elasticpath.dev/guides/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront. - - - If you don't provide any `curated_products`, products are listed by their `updated_at` time in descending order, with the most recently updated product first. - - If you configure `curated_products` for only a few products, the curated products are displayed first and the other products are displayed in the order of `updated_at` time. - - You can only curate 20 products or less. You cannot have more than 20 curated products. - - If a curated product is removed from a node, the product is also removed from the `curated_products` list. - - A product that is curated has the `"curated_product": true` attribute displayed. - - ### Filtering - - This endpoint supports filtering. For general syntax, see (/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available. - - | Operator | Description | Attributes | Example | - | --- | --- | --- | --- | - | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug` | `filter=eq(name,some-name)` | - | `in` | Checks if the values are included in the specified string. If they are, the condition is true. - | `Id` | `filter=in(id,9214719b-17fe-4ea7-896c-d61e60fc0d05,e104d541-2c52-47fa-8a9a-c4382480d97c,65daaf68-ff2e-4632-8944-370de835967d)` | - - ### Building breadcrumbs in a storefront - - In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. - - `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + Before you create a catalog, you must define the following resources: - - Specify the node Ids in the filter expression. - - You can have as many node Ids as you want. - - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. - operationId: getAllNodes - parameters: - - description: The catalog ID. - name: catalog_id - in: path - required: true - schema: - type: string - - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. - name: release_id - in: path - required: true - schema: - type: string - - $ref: '#/components/parameters/accept-language' - - $ref: '#/components/parameters/filter-node' - - $ref: '#/components/parameters/limit' - - $ref: '#/components/parameters/offset' + - Hierarchies - hierarchies and nodes to categorize the products. + - Products - product information, associated assets, and links to hierarchy nodes. + - Price Books - prices for the products associated with the hierarchies. You can create multiple price books for different scenarios, such as seasonal sales, business versus retail customer pricing, and reward programs. When creating a catalog, you can specify up to five price books. You must configure a priority for your price books. Product prices are displayed in the catalog according to the priority of the price books. Priority is a number and the price book with the highest number has the highest priority. + operationId: createCatalog + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/catalog-create-data' + description: Creates a catalog with the following attributes. + required: true responses: - '200': - description: The nodes of a catalog. + '201': + description: The created catalog content: application/json: schema: - $ref: '#/components/schemas/node-list-data' + $ref: '#/components/schemas/catalog-data' default: - description: An unexpected error. + description: Unexpected error. content: application/json: schema: $ref: '#/components/schemas/error-response' - /pcm/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}: get: tags: - - Administrator Latest Releases Catalog API - summary: Get a Node + - Catalogs + summary: Gets all authorized catalogs description: | - Returns a node from a published catalog. + Retrieves a list of all the catalogs that you are authorized to view. Currently, published catalogs are limited to the current release and two releases prior to the current release. You can see the differences between the last 2 consecutive catalog releases using the delta link returned in the response of a [publish a catalog](/docs/api/pxm/catalog/publish-release) endpoint. - :::note - - Currently, published catalogs are limited to the current release and two releases prior to the current release. - - ::: - - You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). - - The response lists the products associated with the nodes. If products are [curated](https://beta.elasticpath.dev/guides/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront. - - - If you don't provide any `curated_products`, products are listed by their `updated_at` time in descending order, with the most recently updated product first. - - If you configure `curated_products` for only a few products, the curated products are displayed first and the other products are displayed in the order of `updated_at` time. - - You can only curate 20 products or less. You cannot have more than 20 curated products. - - If a curated product is removed from a node, the product is also removed from the `curated_products` list. - - A product that is curated has the `"curated_product": true` attribute displayed. - operationId: getNode + You can use the `is_full_delta` attribute returned from the `get a release of a catalog` endpoint to determine if you need to refresh the data in your company system before publishing a catalog release and injecting fresh data in a delta link. The `is_full_delta` attribute tells you if this is a full publish of a catalog release. Using a search service as an example, if the `is_full_delta` attribute is `true`, you should remove all data about that catalog from the search service before publishing a catalog release and injecting fresh data from the delta file. See [Publish a catalog](/docs/api/pxm/catalog/publish-release). + + If the `is_full_publish` attribute returned in the response is `false`, data from the previous catalog release overlaid the existing data in the delta file. The `is_full_publish` attribute is always `true` the first time a catalog is published. + operationId: getCatalogs + responses: + '200': + description: The list of catalogs. + content: + application/json: + schema: + $ref: '#/components/schemas/catalog-list-data' + default: + description: An unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /catalogs/{catalog_id}: + get: + tags: + - Catalogs + summary: Get a catalog by ID + description: Retrieves the specified catalog. + operationId: getCatalogByID parameters: - - $ref: '#/components/parameters/accept-language' - description: The catalog ID. name: catalog_id in: path required: true schema: type: string - - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. - name: release_id - in: path - required: true - schema: - type: string - - description: The catalog node ID. - name: node_id - in: path - required: true - schema: - type: string responses: '200': - description: The catalog node. + description: The catalog. content: application/json: schema: - $ref: '#/components/schemas/node-data' + $ref: '#/components/schemas/catalog-data' default: - description: The unexpected error. + description: An unexpected error. content: application/json: schema: $ref: '#/components/schemas/error-response' - /pcm/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/children: - get: + put: tags: - - Administrator Latest Releases Catalog API - summary: Get a Node's Children - description: | - Returns the child nodes for a node from a published catalog. - - :::note - - Currently, published catalogs are limited to the current release and two releases prior to the current release. - - ::: - - You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). - - In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. For more information, see [Building breadcrumbs in a storefront](#building-breadcrumbs-in-a-storefront). - - The response lists the products associated with the nodes. If products are [curated](https://beta.elasticpath.dev/guides/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront. - - - If you don't provide any `curated_products`, products are listed by their `updated_at` time in descending order, with the most recently updated product first. - - If you configure `curated_products` for only a few products, the curated products are displayed first and the other products are displayed in the order of `updated_at` time. - - You can only curate 20 products or less. You cannot have more than 20 curated products. - - If a curated product is removed from a node, the product is also removed from the `curated_products` list. - - A product that is curated has the `"curated_product": true` attribute displayed. - - ### Filtering - - This endpoint supports filtering. For general syntax, see (/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available. - - | Operator | Description | Attributes | Example | - | --- | --- | --- | --- | - | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug` | `filter=eq(name,some-name)` | - | `in` | Checks if the values are included in the specified string. If they are, the condition is true. - | `Id` | `filter=in(id,9214719b-17fe-4ea7-896c-d61e60fc0d05,e104d541-2c52-47fa-8a9a-c4382480d97c,65daaf68-ff2e-4632-8944-370de835967d)` | - - ### Building breadcrumbs in a storefront - - In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. - - `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` - - - Specify the node Ids in the filter expression. - - You can have as many node Ids as you want. - - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. - operationId: getChildNodes + - Catalogs + summary: Updates a catalog + description: Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the catalog is not updated. + operationId: updateCatalog parameters: - description: The catalog ID. name: catalog_id @@ -1134,280 +1109,164 @@ paths: required: true schema: type: string - - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. - name: release_id - in: path - required: true - schema: - type: string - - description: The catalog node ID. - name: node_id - in: path - required: true - schema: - type: string - - $ref: '#/components/parameters/accept-language' - - $ref: '#/components/parameters/filter-node' - - $ref: '#/components/parameters/limit' - - $ref: '#/components/parameters/offset' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/catalog-update-data' + description: Updated catalog. + required: true responses: '200': - description: The child nodes of a catalog node. + description: An updated catalog with the following attributes. content: application/json: schema: - $ref: '#/components/schemas/node-list-data' + $ref: '#/components/schemas/catalog-data' default: - description: The unexpected error. + description: Unexpected error. content: application/json: schema: $ref: '#/components/schemas/error-response' - /pcm/catalogs/{catalog_id}/releases/{release_id}/products: - get: + delete: tags: - - Administrator Latest Releases Catalog API - summary: Get all Products - description: | - Returns the products from a published catalog. Only the products in a `live` status are retrieved. Currently, published catalogs are limited to the current release and two releases prior to the current release. - - You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). - - The `variations` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. The `variations` object can then be added to your catalogs. By default, variations and variation options are sorted randomly. You can use the `sort_order` attribute to sort the order of your variation and variation options in `variations`. Once a parent product is published in a catalog, the [Get a List of products in a catalog release](/docs/api/pxm/catalog/get-all-products) response displays the sorted variations and variation options. Variations and variation options are displayed in descending order according to their `sort_order` values. - - Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. - - | Parameter | Required | Description | - | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | - | `main_image` | Optional | The main images associated with a product. | - | `files` | Optional | Any files associated with a product. - - See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). - - ### Filtering - - This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. - - | Operator | Description | Supported Attributes | Example | - |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | - | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types`, you can only specify one product type. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | - | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | - - ### Building breadcrumbs in a storefront - - In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. - - `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` - - - Specify the node Ids in the filter expression. - - You can have as many node Ids as you want. - - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. - - ### Including Resources - - Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. - - | Parameter | Required | Description | - | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | - | `main_image` | Optional | The main images associated with a product. | - | `files` | Optional | Any files associated with a product. | - - See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). - operationId: getAllProducts + - Catalogs + summary: Deletes a catalog + description: Deletes an unpublished catalog. Use [**Delete a Release**](/docs/api/pxm/catalog/delete-release-by-id) and [**Delete All Releases**](/docs/api/pxm/catalog/delete-releases) to delete releases of a catalog. If the catalog is associated with any catalog rules, you must first update the catalog rules to remove the catalog. + operationId: deleteCatalogByID parameters: - - $ref: '#/components/parameters/accept-language' - - $ref: '#/components/parameters/filter-product' - description: The catalog ID. name: catalog_id in: path required: true schema: type: string - - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. - name: release_id - in: path - required: true - schema: - type: string - - $ref: '#/components/parameters/limit' - - $ref: '#/components/parameters/offset' responses: - '200': - description: The products of a catalog. - content: - application/json: - schema: - $ref: '#/components/schemas/product-list-data' + '204': + description: A 204 response indicates that the catalog has been deleted. default: - description: The unexpected error. + description: Unexpected error. content: application/json: schema: $ref: '#/components/schemas/error-response' - /pcm/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}: - get: + /catalogs/{catalog_id}/releases: + post: tags: - - Administrator Latest Releases Catalog API - summary: Get a Product + - Releases + summary: Publishes a catalog description: | - Returns a product from a published catalog. The product must be in `live` status. Currently, published catalogs are limited to the current release and two releases prior to the current release. - - ### Product and Node Associations in Breadcrumb Metadata - You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). - - ### Product Variations - - The `variations` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. The `variations` object can then be added to your catalogs. By default, variations and variation options are sorted randomly. You can use the `sort_order`attribute to sort the order of your variation and variation options in `variations`. Once a parent product is published in a catalog, the get a product in a catalog release response displays the sorted variations and variation options. Variations and variation options are displayed in descending order according to their `sort_order` values. - - ### Including Resources - - Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + Publishes a catalog. You must publish a catalog before you can retrieve that catalog in an organization or store. The hierarchies, live products, and prices associated with a published catalog are in read-only mode. If you make a change to these resources, for example, a change to your price book or hierarchies, you need to republish the catalog. + + You can get [a catalog release](/docs/api/pxm/catalog/get-release-by-id) to retrieve a published catalog. Currently, published catalogs are limited to the current release and two releases prior to the current release. + + You can see the differences between the last 2 consecutive catalog releases. This is useful if want to understand how your products have changed in your catalog, ensuring your site search integration is kept up-to-date. + + Once a catalog release has completed publishing, the delta relationship links to the delta document. - | Parameter | Required | Description | - | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | - | `main_image` | Optional | The main images associated with a product. | - | `files` | Optional | Any files associated with a product. + The `delta` links are signed and only valid for 1 hour. Re-reading a catalog release, for example, using [Getting a release of a catalog](/docs/pxm/catalogs/catalog-latest-release/get-a-release-of-a-catalog) returns a fresh a link. + + You can use the `is_full_delta` attribute returned from the `get a release of a catalog` endpoint to determine if you need to refresh the data in your company system before injecting fresh data in a `delta` link. The `is_full_delta` attribute tells you if this is a full publish of the catalog. Using a search service as an example, if the `is_full_delta` attribute is `true`, you should remove all data about that catalog from the search service before injecting fresh data from the `delta` file. If the `is_full_delta` attribute is `false`, then data from the previous catalog overlays the existing data in the `delta` file. To publish a catalog and inject fresh data in a `delta` link, set `export_full_delta` to `true`. + + If a previous catalog publish date is greater than 90 days, then a full catalog publish is automatically performed. If you publish your catalogs infrequently, Commerce may perform a full publish when you are expecting a delta publish. + + :::caution - See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). - operationId: getProduct + Generating a full delta is resource intensive and slows down the publishing process and so should only be performed in certain circumstances, for example, when initializing an integration with a service like Algolia. + + ::: + + The `is_full_delta` attribute is always `true` the first time a catalog is published. The information is stored in a collection of `json` documents in a compressed file. You can either manually check the file or, for example, use them to automatically update another company system you may have. + + - Delta files are only available for 30 days. + - Delta files are removed when a catalog release is deleted. + + Each document has a `delta_type` with one of the following values, depending on whether a product has been deleted, updated or created in a catalog release. + + - `delete` describes products deleted from this release of a catalog. + - `createupdate` describes products updated in this release of a catalog. + + ### Multi-Store Management Solutions + + In a multi-store management solution. + + - You can create organization catalogs. Your organization catalogs are available for your stores to use. + - Your stores can create their own catalogs. + - Your stores can create catalogs that have a combination of organization products and store products. + + If you are publishing a catalog in a store that contains resources from an organization, in Commerce Manager, you must enable the **Include Organization Resources in Catalog Publishes** checkbox. + + 1. Go to **SYSTEM** > **Store Settings**. + 2. Click **General Settings**. + 3. Select **PXM** from the list. + 4. Select the **Include Organization Resources in Catalog Publishes** checkbox. + operationId: publishRelease parameters: - - $ref: '#/components/parameters/accept-language' - description: The catalog ID. name: catalog_id in: path required: true schema: type: string - - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. - name: release_id - in: path - required: true - schema: - type: string - - description: The product ID. - name: product_id - in: path - required: true - schema: - type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/catalog-release-create-data' + description: Options for catalog release publishing responses: - '200': - description: The product of a catalog. + '201': + description: Publishes a catalog release with the following attributes. content: application/json: schema: - $ref: '#/components/schemas/product-data' + $ref: '#/components/schemas/release-data' default: - description: The unexpected error. + description: Unexpected error. content: application/json: schema: $ref: '#/components/schemas/error-response' - /pcm/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/component_products: get: tags: - - Administrator Latest Releases Catalog API - summary: Get a Bundle's Component Products + - Releases + summary: Gets all authorized catalog releases description: | - With Product Experience Manager, you can [create](/docs/api/pxm/products/create-product) and manage bundles. A bundle is a purchasable product, comprising of one or more products that you want to sell together. - - You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. - - This endpoint returns a list of component product IDs for the specified bundle. - - ### Including Resources - - Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + Returns a list of all published releases of the specified catalog. Currently, published catalogs are limited to the current release and two releases prior to the current release. You can see the differences between the last 2 consecutive catalog releases using the `delta` link returned in the response of a `publish a catalog` endpoint. - | Parameter | Required | Description | - | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | - | `main_image` | Optional | The main images associated with a product. | - | `files` | Optional | Any files associated with a product. | + You can use the `is_full_delta` attribute returned from the `get a release of a catalog` endpoint to determine if you need to refresh the data in your company system before publishing a catalog release and injecting fresh data in a delta link. The `is_full_delta` attribute tells you if this is a full publish of a catalog release. Using a search service as an example, if the `is_full_delta` attribute is `true`, you should remove all data about that catalog from the search service before publishing a catalog release and injecting fresh data from the delta file. - See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). - operationId: getComponentProductIDs + If the `is_full_publish` attribute returned in the response is `false`, data from the previous catalog release overlaid the existing data in the delta file. The `is_full_publish` attribute is always `true` the first time a catalog is published. + operationId: getReleases parameters: + - $ref: '#/components/parameters/accept-language' - description: The catalog ID. name: catalog_id in: path required: true schema: type: string - - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. - name: release_id - in: path - required: true - schema: - type: string - - description: The product ID. - name: product_id - in: path - required: true - schema: - type: string - - $ref: '#/components/parameters/limit' - - $ref: '#/components/parameters/offset' responses: '200': - description: The list of component product IDs of a specific bundle product from a catalog. + description: The list of catalogs. content: application/json: schema: - $ref: '#/components/schemas/product-reference-list-data' + $ref: '#/components/schemas/release-list-data' default: description: The unexpected error. content: application/json: schema: $ref: '#/components/schemas/error-response' - /pcm/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/children: - get: + delete: tags: - - Administrator Latest Releases Catalog API - summary: Get a Parent Product's Child Products - description: | - For a specified product and catalog release, retrieves a list of child products from a parent product. Any product other than a base product results in a `422 Unprocessable Entity` response. Only the products in a `live` status are retrieved. - - If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. If no catalog rules are configured, the first catalog found is returned. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). - - You can see the parent nodes a product is associated within the breadcrumbs metadata for each product. For example, this is useful if you want to improve how your shoppers search your store. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). - - ### Filtering - - This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. - - | Operator | Description | Supported Attributes | Example | - |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | - | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types`, you can only specify one product type. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | - | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | - - ### Building breadcrumbs in a storefront - - In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. - - `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` - - - Specify the node Ids in the filter expression. - - You can have as many node Ids as you want. - - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. - - ### Including Resources - - Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. - - | Parameter | Required | Description | - | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | - | `main_image` | Optional | The main images associated with a product. | - | `files` | Optional | Any files associated with a product. | - - See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). - operationId: getChildProducts + - Releases + summary: Deletes all releases + description: Deletes all releases of the specified published catalog. + operationId: deleteReleases parameters: - description: The catalog ID. name: catalog_id @@ -1415,246 +1274,250 @@ paths: required: true schema: type: string - - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. - name: release_id + responses: + '204': + description: A 204 response indicates that the releases have been deleted. + default: + description: Unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /catalogs/{catalog_id}/releases/{release_id}: + get: + tags: + - Releases + summary: Get a catalog release by ID + description: Retrieves the specified catalog release. + operationId: getReleaseByID + parameters: + - $ref: '#/components/parameters/accept-language' + - description: The catalog ID. + name: catalog_id in: path required: true schema: type: string - - description: The product ID. - name: product_id + - description: The catalog release ID. + name: release_id in: path required: true schema: type: string - - $ref: '#/components/parameters/accept-language' - - $ref: '#/components/parameters/filter-product' - - $ref: '#/components/parameters/limit' - - $ref: '#/components/parameters/offset' responses: '200': - description: The list of child products of a specific base product from a catalog. + description: The catalog. content: application/json: schema: - $ref: '#/components/schemas/product-list-data' + $ref: '#/components/schemas/release-data' default: description: The unexpected error. content: application/json: schema: $ref: '#/components/schemas/error-response' - /pcm/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/products: - get: + delete: tags: - - Administrator Latest Releases Catalog API - summary: Get a Hierarchy's Products - description: | - Returns the products associated with the specified hierarchy in the catalog. The products must be in the `live` status. - - If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. See [Resolving catalog rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). - - You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). - - The `variations` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. The variations object can then be added to your catalogs. By default, variations and variation options are sorted randomly. You can use the `sort_order` attribute to sort the order of your variation and variation options in variations. Once a parent product is published in a catalog, the [Get a List of products in a catalog](/docs/api/pxm/catalog/get-all-products) release response displays the sorted variations and variation options. Variations and variation options are displayed in descending order according to their `sort_order` values. - - ### Filtering - - This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. - - | Operator | Description | Supported Attributes | Example | - |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | - | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types`, you can only specify one product type. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | - | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | - - ### Building breadcrumbs in a storefront - - In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. - - `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` - - - Specify the node Ids in the filter expression. - - You can have as many node Ids as you want. - - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. - - ### Including Resources - - Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. - - | Parameter | Required | Description | - | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | - | `main_image` | Optional | The main images associated with a product. | - | `files` | Optional | Any files associated with a product. | - - See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). - operationId: getProductsForHierarchy + - Releases + summary: Deletes a release + description: Deletes the specified published catalog release. + operationId: deleteReleaseByID parameters: - - $ref: '#/components/parameters/accept-language' - description: The catalog ID. name: catalog_id in: path required: true schema: type: string - - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. + - description: The catalog release ID. name: release_id in: path required: true schema: type: string - - description: The catalog hierarchy ID. - name: hierarchy_id - in: path - required: true - schema: - type: string - - $ref: '#/components/parameters/filter-product' - - $ref: '#/components/parameters/limit' - - $ref: '#/components/parameters/offset' responses: - '200': - description: The products of a catalog hierarchy. - content: - application/json: - schema: - $ref: '#/components/schemas/product-list-data' + '204': + description: A 204 response indicates that the release has been deleted. default: - description: The unexpected error. + description: Unexpected error. content: application/json: schema: $ref: '#/components/schemas/error-response' - /pcm/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/products: - get: + /catalogs/rules: + post: tags: - - Administrator Latest Releases Catalog API - summary: Get a Node's Products + - Rules + summary: Creates a new catalog rule description: | - Returns the products associated with the specified hierarchy node in the catalog. The products must be in the `live` status. If the products have been curated, then the products are returned in the order specified in the `curated_products` attribute. A product that is curated has the `"curated_product": true` attribute displayed. - + If you have multiple catalogs, create catalog rule resources. With catalog rules, you can display different catalogs to different shoppers. For example, you can display a preferred pricing catalog to a few special customers. Or you can display one catalog to shoppers using your website and a different catalog to shoppers using your mobile app. Finally, you can define custom criteria by creating tags. + :::note - - Currently, published catalogs are limited to the current release and two releases prior to the current release. - - ::: - If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. See [Resolving catalog rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + - If you have one catalog for all customers and channels, you can omit creating this resource. + - Due to the way catalogs are cached in Commerce, using catalog rules to display catalogs sometimes causes a 5-minute time delay before the catalogs are displayed. + - You cannot create catalog rules for organization catalogs. - You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://elasticpath.dev/guides/Catalogs/breadcrumbs). - - The `variations` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. The `variations` object can then be added to your catalogs. By default, variations and variation options are sorted randomly. You can use the `sort_order` attribute to sort the order of your variation and variation options in `variations`. Once a parent product is published in a catalog, the [Get a List of products in a catalog release](/docs/api/pxm/catalog/get-all-products) response displays the sorted variations and variation options. Variations and variation options are displayed in descending order according to their `sort_order` values. + ::: - ### Filtering - - This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. - - | Operator | Description | Supported Attributes | Example | - |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | - | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | - | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | - - ### Building breadcrumbs in a storefront - - In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. - - `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` - - - Specify the node Ids in the filter expression. - - You can have as many node Ids as you want. - - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. - - ### Including Resources - - Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. - - | Parameter | Required | Description | - | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | - | `main_image` | Optional | The main images associated with a product. | - | `files` | Optional | Any files associated with a product. | - - See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). - operationId: getProductsForNode + For ideas about the kinds of business scenarios you can achieve with catalog rules, see [Catalog Rules](/docs/api/pxm/catalog/rules). To understand how catalogs are matched to shoppers by using rules, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + operationId: createRule + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/rule-create-data' + description: Creates a catalog rule with the following attributes. + required: true + responses: + '201': + description: The created catalog rule + content: + application/json: + schema: + $ref: '#/components/schemas/rule-data' + default: + description: Unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + get: + tags: + - Rules + summary: Gets all authorized catalog rules + description: | + Retrieves all authorized catalog rules. + + ### Filtering + + This endpoint supports filtering. For general filtering syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are supported. + + | Operator | Description | Supported Attributes | Example | + |:--- |:--- |:--- |:--- | + | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | + operationId: getRules parameters: - - $ref: '#/components/parameters/accept-language' - - $ref: '#/components/parameters/filter-product' - - description: The catalog ID. - name: catalog_id - in: path - required: true - schema: - type: string - - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. - name: release_id - in: path - required: true - schema: - type: string - - description: The catalog node ID. - name: node_id + - $ref: '#/components/parameters/filter-rule' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The list of catalog rules. + content: + application/json: + schema: + $ref: '#/components/schemas/rule-list-data' + default: + description: An unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /catalogs/rules/{catalog_rule_id}: + get: + tags: + - Rules + summary: Get a catalog rule by ID + operationId: getRuleByID + parameters: + - description: The catalog rule ID. + name: catalog_rule_id in: path required: true schema: type: string - - $ref: '#/components/parameters/limit' - - $ref: '#/components/parameters/offset' responses: '200': - description: The products of a catalog node. + description: The catalog rile. content: application/json: schema: - $ref: '#/components/schemas/product-list-data' + $ref: '#/components/schemas/rule-data' default: - description: The unexpected error. + description: An unexpected error. content: application/json: schema: $ref: '#/components/schemas/error-response' - /catalog: - get: + put: tags: - - Releases - summary: Get the catalog release as shoppers - description: Returns a list of all published releases of the specified catalog. - operationId: getByContextRelease + - Rules + summary: Updates a catalog rule + description: Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the catalog rule is not updated. + operationId: updateRule parameters: - - $ref: '#/components/parameters/accept-language' - - $ref: '#/components/parameters/channel' - - $ref: '#/components/parameters/tag' + - description: The catalog rule ID. + name: catalog_rule_id + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/rule-update-data' + description: An updated catalog rule with the following attributes. + required: true responses: '200': - description: The catalog. + description: An Updated catalog rule with the following attributes. content: application/json: schema: - $ref: '#/components/schemas/release-data' + $ref: '#/components/schemas/rule-data' default: - description: The unexpected error. + description: Unexpected error. content: application/json: schema: $ref: '#/components/schemas/error-response' - /catalog/hierarchies: + delete: + tags: + - Rules + summary: Deletes a catalog rule + operationId: deleteRuleByID + parameters: + - description: The catalog rule ID. + name: catalog_rule_id + in: path + required: true + schema: + type: string + responses: + '204': + description: A 204 response indicates that the catalog rule has been deleted. + default: + description: Unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + /catalogs/{catalog_id}/releases/{release_id}/hierarchies: get: tags: - - Shopper Catalog API + - Administrator Latest Releases Catalog API summary: Get all Hierarchies description: | - Returns all hierarchies from a catalog. - - If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). - + Returns the hierarchies from a published catalog. + + :::note + + Currently, published catalogs are limited to the current release and two releases prior to the current release. + + ::: + ### Filtering - - This endpoint supports filtering. For general syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). + + This endpoint supports filtering. For general syntax, see [Filtering](/guides/Getting-Started/filtering). | Operator | Description | Supported Attributes | Example | |:--- |:--- |:--- |:--- | | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | - | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | - + | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | + ### Building breadcrumbs in a storefront In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. @@ -1664,17 +1527,27 @@ paths: - Specify the node Ids in the filter expression. - You can have as many node Ids as you want. - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. - operationId: getByContextAllHierarchies + operationId: getAllHierarchies parameters: - $ref: '#/components/parameters/accept-language' - - $ref: '#/components/parameters/channel' - - $ref: '#/components/parameters/tag' + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. + name: release_id + in: path + required: true + schema: + type: string - $ref: '#/components/parameters/filter-hierarchy' - $ref: '#/components/parameters/limit' - $ref: '#/components/parameters/offset' responses: '200': - description: The hierarchies of the catalog. + description: The hierarchies of a catalog. content: application/json: schema: @@ -1685,20 +1558,34 @@ paths: application/json: schema: $ref: '#/components/schemas/error-response' - /catalog/hierarchies/{hierarchy_id}: + /catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}: get: tags: - - Shopper Catalog API + - Administrator Latest Releases Catalog API summary: Get a Hierarchy description: | - Returns a hierarchy from the catalog. + Returns the specified hierarchy from a published catalog. - If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog to retrieve. For information about how catalog rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules). - operationId: getByContextHierarchy + :::note + + Currently, published catalogs are limited to the current release and two releases prior to the current release. + + ::: + operationId: getHierarchy parameters: - $ref: '#/components/parameters/accept-language' - - $ref: '#/components/parameters/channel' - - $ref: '#/components/parameters/tag' + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. + name: release_id + in: path + required: true + schema: + type: string - description: The catalog hierarchy ID. name: hierarchy_id in: path @@ -1718,27 +1605,31 @@ paths: application/json: schema: $ref: '#/components/schemas/error-response' - /catalog/hierarchies/{hierarchy_id}/nodes: + /catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/nodes: get: tags: - - Shopper Catalog API + - Administrator Latest Releases Catalog API summary: Get a Hierarchy's Nodes description: | - Returns all the nodes for the specified hierarchy. + Returns all nodes for the specified hierarchy from a published catalog. - If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + :::note + + Currently, published catalogs are limited to the current release and two releases prior to the current release. + + ::: + + In the `bread_crumb` metadata, you can identify the parent nodes that a node is associated with. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). - In the `bread_crumb` metadata, you can identify the parent nodes that a node is associated with. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). - ### Filtering - This endpoint supports filtering. For general syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). + This endpoint supports filtering. For general syntax, see [Filtering](/guides/Getting-Started/filtering). | Operator | Description | Supported Attributes | Example | |:--- |:--- |:--- |:--- | | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | - | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | - + | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | + ### Building breadcrumbs in a storefront In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. @@ -1748,20 +1639,30 @@ paths: - Specify the node Ids in the filter expression. - You can have as many node Ids as you want. - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. - operationId: getByContextHierarchyNodes + operationId: getHierarchyNodes parameters: - - $ref: '#/components/parameters/channel' - - $ref: '#/components/parameters/tag' - - $ref: '#/components/parameters/accept-language' - - $ref: '#/components/parameters/filter-node' - - $ref: '#/components/parameters/limit' - - $ref: '#/components/parameters/offset' + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + - description: The catalog release ID. + name: release_id + in: path + required: true + schema: + type: string - description: The catalog hierarchy ID. name: hierarchy_id in: path required: true schema: type: string + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-node' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' responses: '200': description: The child nodes of a catalog hierarchy. @@ -1775,30 +1676,32 @@ paths: application/json: schema: $ref: '#/components/schemas/error-response' - /catalog/hierarchies/{hierarchy_id}/children: + /catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/children: get: tags: - - Shopper Catalog API + - Administrator Latest Releases Catalog API summary: Get a Hierarchy's Children description: | - Returns the parent nodes for the specified hierarchy. - + Returns the parent nodes for the specified hierarchy from a published catalog. + ![Parent Nodes](/assets/rootnodes.PNG) - - If you have multiple catalog rules defined, the rule that best matches the shopperʼs context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). - In the `bread_crumb` metadata, you can identify the parent nodes that a node is associated with. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). - + :::note + + Currently, published catalogs are limited to the current release and two releases prior to the current release. + + ::: + + In the `bread_crumb` metadata, you can identify the parent nodes that a node is associated with. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). + ### Filtering - The following operators and attributes are available when filtering on this endpoint. + This endpoint supports filtering. For general syntax, see [Filtering](/guides/Getting-Started/filtering). | Operator | Description | Supported Attributes | Example | |:--- |:--- |:--- |:--- | | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | - | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | - - For more information, see [Filtering](/docs/commerce-cloud/api-overview/filtering). + | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | ### Building breadcrumbs in a storefront @@ -1809,20 +1712,30 @@ paths: - Specify the node Ids in the filter expression. - You can have as many node Ids as you want. - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. - operationId: getByContextHierarchyChildNodes + operationId: getHierarchyChildNodes parameters: - - $ref: '#/components/parameters/channel' - - $ref: '#/components/parameters/tag' - - $ref: '#/components/parameters/accept-language' - - $ref: '#/components/parameters/filter-node' - - $ref: '#/components/parameters/limit' - - $ref: '#/components/parameters/offset' + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. + name: release_id + in: path + required: true + schema: + type: string - description: The catalog hierarchy ID. name: hierarchy_id in: path required: true schema: type: string + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-node' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' responses: '200': description: The child nodes of a catalog hierarchy. @@ -1836,35 +1749,42 @@ paths: application/json: schema: $ref: '#/components/schemas/error-response' - /catalog/nodes: + /catalogs/{catalog_id}/releases/{release_id}/nodes: get: tags: - - Shopper Catalog API + - Administrator Latest Releases Catalog API summary: Get all Nodes description: | - Returns all nodes in the catalog. - - If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). - - You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + Returns the child nodes from a published catalog. + + :::note + + Currently, published catalogs are limited to the current release and two releases prior to the current release. + + ::: + + You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). - In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. For more information, see [Building breadcrumbs in a storefront](#building-breadcrumbs-in-a-storefront). + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. See [Building breadcrumbs in a storefront](#building-breadcrumbs-in-a-storefront). - The response lists the products associated with the nodes. If products are [curated](https://beta.elasticpath.dev/guides/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront. + The response lists the products associated with the nodes. If products are [curated](/guides/How-To/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront. + - If you don't provide any `curated_products`, products are listed by their `updated_at` time in descending order, with the most recently updated product first. + - If you configure `curated_products` for only a few products, the curated products are displayed first and the other products are displayed in the order of `updated_at` time. - You can only curate 20 products or less. You cannot have more than 20 curated products. - If a curated product is removed from a node, the product is also removed from the `curated_products` list. - + - A product that is curated has the `"curated_product": true` attribute displayed. + ### Filtering - - This endpoint supports filtering. For general syntax, see (/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available. + + This endpoint supports filtering. For general syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available. | Operator | Description | Attributes | Example | | --- | --- | --- | --- | | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug` | `filter=eq(name,some-name)` | | `in` | Checks if the values are included in the specified string. If they are, the condition is true. | `Id` | `filter=in(id,9214719b-17fe-4ea7-896c-d61e60fc0d05,e104d541-2c52-47fa-8a9a-c4382480d97c,65daaf68-ff2e-4632-8944-370de835967d)` | - + ### Building breadcrumbs in a storefront In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. @@ -1874,17 +1794,27 @@ paths: - Specify the node Ids in the filter expression. - You can have as many node Ids as you want. - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. - operationId: getByContextAllNodes + operationId: getAllNodes parameters: - - $ref: '#/components/parameters/channel' - - $ref: '#/components/parameters/tag' + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. + name: release_id + in: path + required: true + schema: + type: string - $ref: '#/components/parameters/accept-language' - $ref: '#/components/parameters/filter-node' - $ref: '#/components/parameters/limit' - $ref: '#/components/parameters/offset' responses: '200': - description: The nodes of the catalog. + description: The nodes of a catalog. content: application/json: schema: @@ -1895,30 +1825,44 @@ paths: application/json: schema: $ref: '#/components/schemas/error-response' - /catalog/nodes/{node_id}: + /catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}: get: tags: - - Shopper Catalog API + - Administrator Latest Releases Catalog API summary: Get a Node description: | - Returns a node from the catalog. - - If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). - - You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). - - The response lists the products associated with a node. If products are curated, they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your nodes, enabling you to create unique product collections in your storefront. - + Returns a node from a published catalog. + + :::note + + Currently, published catalogs are limited to the current release and two releases prior to the current release. + + ::: + + You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). + + The response lists the products associated with the nodes. If products are [curated](/guides/How-To/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront. + - If you don't provide any `curated_products`, products are listed by their `updated_at` time in descending order, with the most recently updated product first. - If you configure `curated_products` for only a few products, the curated products are displayed first and the other products are displayed in the order of `updated_at` time. - You can only curate 20 products or less. You cannot have more than 20 curated products. - - A product that is curated has the `"curated_product": true` attribute displayed. - If a curated product is removed from a node, the product is also removed from the `curated_products` list. - operationId: getByContextNode + - A product that is curated has the `"curated_product": true` attribute displayed. + operationId: getNode parameters: - - $ref: '#/components/parameters/channel' - - $ref: '#/components/parameters/tag' - $ref: '#/components/parameters/accept-language' + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. + name: release_id + in: path + required: true + schema: + type: string - description: The catalog node ID. name: node_id in: path @@ -1938,59 +1882,75 @@ paths: application/json: schema: $ref: '#/components/schemas/error-response' - /catalog/nodes/{node_id}/relationships/children: + /catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/children: get: tags: - - Shopper Catalog API + - Administrator Latest Releases Catalog API summary: Get a Node's Children description: | - Returns the child nodes for a node in the catalog. - - If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + Returns the child nodes for a node from a published catalog. - You can see which parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + :::note - The response lists the products associated with the nodes. If products are [curated](https://beta.elasticpath.dev/guides/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront. - - - If you don't provide any curated_products, products are listed by their updated_at time in descending order, with the most recently updated product first. - - If you configure curated_products for only a few products, the curated products are displayed first and the other products are displayed in the order of updated_at time. + Currently, published catalogs are limited to the current release and two releases prior to the current release. + + ::: + + You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). + + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. For more information, see [Building breadcrumbs in a storefront](#building-breadcrumbs-in-a-storefront). + + The response lists the products associated with the nodes. If products are [curated](/guides/How-To/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront. + + - If you don't provide any `curated_products`, products are listed by their `updated_at` time in descending order, with the most recently updated product first. + - If you configure `curated_products` for only a few products, the curated products are displayed first and the other products are displayed in the order of `updated_at` time. - You can only curate 20 products or less. You cannot have more than 20 curated products. - - A product that is curated has the "curated_product": true attribute displayed. - - If a curated product is removed from a node, the product is also removed from the curated_products list. - + - If a curated product is removed from a node, the product is also removed from the `curated_products` list. + - A product that is curated has the `"curated_product": true` attribute displayed. + ### Filtering - - This endpoint supports filtering. For general syntax, see (/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available. - + + This endpoint supports filtering. For general syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available. + | Operator | Description | Attributes | Example | | --- | --- | --- | --- | | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug` | `filter=eq(name,some-name)` | | `in` | Checks if the values are included in the specified string. If they are, the condition is true. | `Id` | `filter=in(id,9214719b-17fe-4ea7-896c-d61e60fc0d05,e104d541-2c52-47fa-8a9a-c4382480d97c,65daaf68-ff2e-4632-8944-370de835967d)` | - + ### Building breadcrumbs in a storefront - + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. - + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` - + - Specify the node Ids in the filter expression. - You can have as many node Ids as you want. - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. - operationId: getByContextChildNodes + operationId: getChildNodes parameters: - - $ref: '#/components/parameters/channel' - - $ref: '#/components/parameters/tag' - - $ref: '#/components/parameters/accept-language' - - $ref: '#/components/parameters/filter-node' - - $ref: '#/components/parameters/limit' - - $ref: '#/components/parameters/offset' + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. + name: release_id + in: path + required: true + schema: + type: string - description: The catalog node ID. name: node_id in: path required: true schema: type: string + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-node' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' responses: '200': description: The child nodes of a catalog node. @@ -2004,71 +1964,64 @@ paths: application/json: schema: $ref: '#/components/schemas/error-response' - /catalog/products: + /catalogs/{catalog_id}/releases/{release_id}/products: get: tags: - - Shopper Catalog API + - Administrator Latest Releases Catalog API summary: Get all Products description: | - Retrieves the list of products from the catalog. Only the products in a live status are retrieved. - - ### Catalog Rules - - If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. If no catalog rules are configured, the first catalog found is returned. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). - - ### Product and Node Associations + Returns the products from a published catalog. Only the products in a `live` status are retrieved. Currently, published catalogs are limited to the current release and two releases prior to the current release. - You can see the parent nodes a product is associated within the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. For example, this is useful if you want to improve how your shoppers search your store. See [Product and Node Associations in Breadcrumb Metadata](https://elasticpath.dev/guides/Catalogs/breadcrumbs). + You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). + The `variations` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. The `variations` object can then be added to your catalogs. By default, variations and variation options are sorted randomly. You can use the `sort_order` attribute to sort the order of your variation and variation options in `variations`. Once a parent product is published in a catalog, the [Get a List of products in a catalog release](/docs/api/pxm/catalog/get-all-products) response displays the sorted variations and variation options. Variations and variation options are displayed in descending order according to their `sort_order` values. ### Including Resources Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. - | Parameter | Required | Description | + | Parameter | Required | Description | | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | - | `main_image` | Optional | The main images associated with a product. | - | `files` | Optional | Any files associated with a product. | + | `main_image` | Optional | The main images associated with a product. | + | `files` | Optional | Any files associated with a product. - See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + See [**Including Resources**](/guides/Getting-Started/includes). ### Filtering - This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. + This endpoint supports filtering. For general filtering syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available when filtering on this endpoint. | Operator | Description | Supported Attributes | Example | |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | - | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | - | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | - - ### Building breadcrumbs in a storefront + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types`, you can only specify one product type. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | + ### Building breadcrumbs in a storefront + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. - + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` - + - Specify the node Ids in the filter expression. - You can have as many node Ids as you want. - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. - - ### Including Resources - - Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. - - | Parameter | Required | Description | - | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | - | `main_image` | Optional | The main images associated with a product. | - | `files` | Optional | Any files associated with a product. | - - See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). - operationId: getByContextAllProducts + operationId: getAllProducts parameters: - $ref: '#/components/parameters/accept-language' - - $ref: '#/components/parameters/channel' - - $ref: '#/components/parameters/tag' - $ref: '#/components/parameters/filter-product' + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. + name: release_id + in: path + required: true + schema: + type: string - $ref: '#/components/parameters/limit' - $ref: '#/components/parameters/offset' responses: @@ -2084,39 +2037,54 @@ paths: application/json: schema: $ref: '#/components/schemas/error-response' - /catalog/products/{product_id}: + /catalogs/{catalog_id}/releases/{release_id}/products/{product_id}: get: tags: - - Shopper Catalog API + - Administrator Latest Releases Catalog API summary: Get a Product description: | - Returns the specified product from the catalog. The product must be in the `live` status. + Returns a product from a published catalog. The product must be in `live` status. Currently, published catalogs are limited to the current release and two releases prior to the current release. - If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + ### Product and Node Associations in Breadcrumb Metadata - You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://elasticpath.dev/guides/Catalogs/breadcrumbs). + You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). + + ### Product Variations + + The `variations` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. The `variations` object can then be added to your catalogs. By default, variations and variation options are sorted randomly. You can use the `sort_order`attribute to sort the order of your variation and variation options in `variations`. Once a parent product is published in a catalog, the get a product in a catalog release response displays the sorted variations and variation options. Variations and variation options are displayed in descending order according to their `sort_order` values. + + ### Including Resources Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. - | Parameter | Required | Description | + | Parameter | Required | Description | | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | - | `main_image` | Optional | The main images associated with a product. | - | `files` | Optional | Any files associated with a product. | + | `main_image` | Optional | The main images associated with a product. | + | `files` | Optional | Any files associated with a product. - See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). - operationId: getByContextProduct + See [**Including Resources**](/guides/Getting-Started/includes). + operationId: getProduct parameters: - $ref: '#/components/parameters/accept-language' - - $ref: '#/components/parameters/channel' - - $ref: '#/components/parameters/tag' + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. + name: release_id + in: path + required: true + schema: + type: string - description: The product ID. name: product_id in: path required: true schema: type: string - - $ref: '#/components/parameters/include' responses: '200': description: The product of a catalog. @@ -2130,21 +2098,43 @@ paths: application/json: schema: $ref: '#/components/schemas/error-response' - /catalog/products/{product_id}/relationships/component_products: + /catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/component_products: get: tags: - - Shopper Catalog API + - Administrator Latest Releases Catalog API summary: Get a Bundle's Component Products description: | With Product Experience Manager, you can [create](/docs/api/pxm/products/create-product) and manage bundles. A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. - This endpoint returns a list of component product IDs for the specified bundle. - operationId: getByContextComponentProductIDs + This endpoint returns a list of component product IDs for the specified bundle. + + ### Including Resources + + Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + + | Parameter | Required | Description | + | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + | `main_image` | Optional | The main images associated with a product. | + | `files` | Optional | Any files associated with a product. | + + See [**Including Resources**](/guides/Getting-Started/includes). + operationId: getComponentProductIDs parameters: - - $ref: '#/components/parameters/channel' - - $ref: '#/components/parameters/tag' + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. + name: release_id + in: path + required: true + schema: + type: string - description: The product ID. name: product_id in: path @@ -2155,7 +2145,7 @@ paths: - $ref: '#/components/parameters/offset' responses: '200': - description: The list of component product IDs of a bundle product from a catalog. + description: The list of component product IDs of a specific bundle product from a catalog. content: application/json: schema: @@ -2166,26 +2156,26 @@ paths: application/json: schema: $ref: '#/components/schemas/error-response' - /catalog/products/{product_id}/relationships/children: + /catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/children: get: tags: - - Shopper Catalog API + - Administrator Latest Releases Catalog API summary: Get a Parent Product's Child Products description: | For a specified product and catalog release, retrieves a list of child products from a parent product. Any product other than a base product results in a `422 Unprocessable Entity` response. Only the products in a `live` status are retrieved. - If you have multiple catalog rules defined, the rule that best matches the shopperʼs context is used to determine which catalog is retrieved. If no catalog rules are configured, the first catalog found is returned. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. If no catalog rules are configured, the first catalog found is returned. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). - You can see the parent nodes a product is associated within the `breadcrumbs` metadata for each product. For example, this is useful if you want to improve how your shoppers search your store. See [Product and Node Associations in Breadcrumb Metadata](https://elasticpath.dev/guides/Catalogs/breadcrumbs). + You can see the parent nodes a product is associated within the breadcrumbs metadata for each product. For example, this is useful if you want to improve how your shoppers search your store. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). ### Filtering - This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. + This endpoint supports filtering. For general filtering syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available when filtering on this endpoint. | Operator | Description | Supported Attributes | Example | |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | - | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | - | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types`, you can only specify one product type. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | ### Building breadcrumbs in a storefront @@ -2197,21 +2187,31 @@ paths: - You can have as many node Ids as you want. - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. - ### Including Resources + ### Including Resources - Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. - | Parameter | Required | Description | - | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | - | `main_image` | Optional | The main images associated with a product. | - | `files` | Optional | Any files associated with a product. | + | Parameter | Required | Description | + | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + | `main_image` | Optional | The main images associated with a product. | + | `files` | Optional | Any files associated with a product. | - See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). - operationId: getByContextChildProducts + See [**Including Resources**](/guides/Getting-Started/includes). + operationId: getChildProducts parameters: - - $ref: '#/components/parameters/channel' - - $ref: '#/components/parameters/tag' + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. + name: release_id + in: path + required: true + schema: + type: string - description: The product ID. name: product_id in: path @@ -2224,7 +2224,7 @@ paths: - $ref: '#/components/parameters/offset' responses: '200': - description: The list of child products of a parent product from a catalog. + description: The list of child products of a specific base product from a catalog. content: application/json: schema: @@ -2235,26 +2235,28 @@ paths: application/json: schema: $ref: '#/components/schemas/error-response' - /catalog/hierarchies/{hierarchy_id}/products: + /catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/products: get: tags: - - Shopper Catalog API + - Administrator Latest Releases Catalog API summary: Get a Hierarchy's Products description: | - Returns the products associated with the specified hierarchy in the catalog. The products must be in the live status. + Returns the products associated with the specified hierarchy in the catalog. The products must be in the `live` status. If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. See [Resolving catalog rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). - You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://elasticpath.dev/guides/Catalogs/breadcrumbs). - + You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). + + The `variations` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. The variations object can then be added to your catalogs. By default, variations and variation options are sorted randomly. You can use the `sort_order` attribute to sort the order of your variation and variation options in variations. Once a parent product is published in a catalog, the [Get a List of products in a catalog](/docs/api/pxm/catalog/get-all-products) release response displays the sorted variations and variation options. Variations and variation options are displayed in descending order according to their `sort_order` values. + ### Filtering - This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. + This endpoint supports filtering. For general filtering syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available when filtering on this endpoint. | Operator | Description | Supported Attributes | Example | |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | - | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | - | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types`, you can only specify one product type. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | ### Building breadcrumbs in a storefront @@ -2265,32 +2267,42 @@ paths: - Specify the node Ids in the filter expression. - You can have as many node Ids as you want. - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. - - ### Including Resources - - Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. - - | Parameter | Required | Description | - | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | - | `main_image` | Optional | The main images associated with a product. | - `files` | Optional | Any files associated with a product. | - - See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). - operationId: getByContextProductsForHierarchy + + ### Including Resources + + Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + + | Parameter | Required | Description | + | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + | `main_image` | Optional | The main images associated with a product. | + | `files` | Optional | Any files associated with a product. | + + See [**Including Resources**](/guides/Getting-Started/includes). + operationId: getProductsForHierarchy parameters: - $ref: '#/components/parameters/accept-language' - - $ref: '#/components/parameters/channel' - - $ref: '#/components/parameters/tag' - - $ref: '#/components/parameters/filter-product' - - $ref: '#/components/parameters/limit' - - $ref: '#/components/parameters/offset' + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. + name: release_id + in: path + required: true + schema: + type: string - description: The catalog hierarchy ID. name: hierarchy_id in: path required: true schema: type: string + - $ref: '#/components/parameters/filter-product' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' responses: '200': description: The products of a catalog hierarchy. @@ -2304,54 +2316,72 @@ paths: application/json: schema: $ref: '#/components/schemas/error-response' - /catalog/nodes/{node_id}/relationships/products: + /catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/products: get: tags: - - Shopper Catalog API + - Administrator Latest Releases Catalog API summary: Get a Node's Products description: | - Returns the products associated with the specified hierarchy node in the catalog. The products must be in the `live` status. If the products have been curated then the products are returned in the order specified in the `curated_products` attribute. A product that is curated has the `"curated_product": true` attribute displayed. + Returns the products associated with the specified hierarchy node in the catalog. The products must be in the `live` status. If the products have been curated, then the products are returned in the order specified in the `curated_products` attribute. A product that is curated has the `"curated_product": true` attribute displayed. + + :::note + + Currently, published catalogs are limited to the current release and two releases prior to the current release. + + ::: If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. See [Resolving catalog rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). - You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://elasticpath.dev/guides/Catalogs/breadcrumbs). + You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). - ### Filtering - - This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. + The `variations` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. The `variations` object can then be added to your catalogs. By default, variations and variation options are sorted randomly. You can use the `sort_order` attribute to sort the order of your variation and variation options in `variations`. Once a parent product is published in a catalog, the [Get a List of products in a catalog release](/docs/api/pxm/catalog/get-all-products) response displays the sorted variations and variation options. Variations and variation options are displayed in descending order according to their `sort_order` values. + ### Filtering + + This endpoint supports filtering. For general filtering syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available when filtering on this endpoint. + | Operator | Description | Supported Attributes | Example | |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | - | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | - + ### Building breadcrumbs in a storefront - + In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. - + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` - + - Specify the node Ids in the filter expression. - You can have as many node Ids as you want. - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. - + ### Including Resources - - Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. - + + Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + | Parameter | Required | Description | | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | | `main_image` | Optional | The main images associated with a product. | | `files` | Optional | Any files associated with a product. | - - See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). - operationId: getByContextProductsForNode + + See [**Including Resources**](/guides/Getting-Started/includes). + operationId: getProductsForNode parameters: - $ref: '#/components/parameters/accept-language' - - $ref: '#/components/parameters/channel' - - $ref: '#/components/parameters/tag' - $ref: '#/components/parameters/filter-product' + - description: The catalog ID. + name: catalog_id + in: path + required: true + schema: + type: string + - description: The unique identifier of a published release of the catalog or `latest` for the most recently published version. + name: release_id + in: path + required: true + schema: + type: string - description: The catalog node ID. name: node_id in: path @@ -2373,58 +2403,6 @@ paths: application/json: schema: $ref: '#/components/schemas/error-response' - /catalog/products/{product_id}/configure: - post: - tags: - - Shopper Catalog API - summary: Configure a Shopper Bundle - description: | - Once you have configured your product bundles, you can display them in your storefront in your published catalog. Depending on how you have configured the minimum and maximum values for the product options in your components, you can allow your shoppers to choose which products they want to select. For example, you can enable a shopper to select 1 or more product options from a list of 10, giving your shoppers greater flexibility when selecting products in your store front. - - - Products must be in a `live` status. - - If you have not specified any minimum or maximum values for the product options in your components, your shoppers can select any combination of product options. - - If you have configured minimum and maximum values using [Create a Bundle](/docs/api/pxm/products/create-product), this becomes part of the `bundle_configuration`. You can check how your bundle is configured using [Get a product in a catalog release](/docs/api/pxm/catalog/get-product) in `bundle_configuration` under `meta`. The `bundle_configuration` forms the body of the request. - - The response updates the `bundle_configuration` with the product options the shopper selects. The `meta` data is updated with the `meta` data of the selected product options. In your storefront, you could display this as a summary of the product options a shopper has selected. - - ### Including Resources - - Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. - - | Parameter | Required | Description | - | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| - | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | - | `main_image` | Optional | The main images associated with a product. | - | `files` | Optional | Any files associated with a product. | - - See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). - operationId: configureByContextProduct - parameters: - - $ref: '#/components/parameters/accept-language' - - $ref: '#/components/parameters/channel' - - $ref: '#/components/parameters/tag' - - description: The product ID. - name: product_id - in: path - required: true - schema: - type: string - requestBody: - $ref: '#/components/requestBodies/bundle-configuration-data' - responses: - '200': - description: The configured product of a catalog. - content: - application/json: - schema: - $ref: '#/components/schemas/product-data' - default: - description: The unexpected error. - content: - application/json: - schema: - $ref: '#/components/schemas/error-response' components: parameters: channel: @@ -2449,7 +2427,7 @@ components: schema: type: string limit: - description: The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + description: The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. name: page[limit] in: query required: false @@ -2458,7 +2436,7 @@ components: format: int64 minimum: 1 offset: - description: The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + description: The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. name: page[offset] in: query required: false @@ -2508,17 +2486,6 @@ components: required: false schema: type: string - include: - name: include - in: query - description: | - Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products. - required: false - schema: - type: array - items: - type: string - enum: [ main_images, files, component_products ] requestBodies: bundle-configuration-data: content: @@ -3228,25 +3195,6 @@ components: type: string format: uri nullable: true - included: - description: Included is an array of resources that are included in the response. - type: object - properties: - main_images: - description: The main images associated with a product. - type: array - items: - $ref: '#/components/schemas/file' - component_products: - description: The component products associated with a product. - type: array - items: - $ref: '#/components/schemas/product' - files: - description: The files associated with a product. - type: array - items: - $ref: '#/components/schemas/file' main-image-relationship: type: object description: In Product Experience Manager, products can also have associated product images. @@ -3958,8 +3906,6 @@ components: $ref: '#/components/schemas/product' links: $ref: '#/components/schemas/links' - included: - $ref: '#/components/schemas/included' product-diff: x-go-name: ProductDiff type: object @@ -4026,8 +3972,6 @@ components: x-go-name: Data links: $ref: '#/components/schemas/links' - included: - $ref: '#/components/schemas/included' product-meta: type: object title: ProductMeta @@ -5008,65 +4952,3 @@ components: description: If you are publishing a catalog in a store that contains resources from an organization, you must set this to true and you must enable the **Include Organization Resources in Catalog Publishes** checkbox in Commerce Manager. See [**Multi-Store Management Solutions**](/docs/api/pxm/catalog/publish-release). x-go-name: IncludeOrganizationResources nullable: true - file: - properties: - id: - type: string - description: The unique identifier for this file. - format: uuid - type: - description: The type represents the object being returned. - type: string - example: file - file_name: - description: The name of the file. - type: string - example: file_name.jpg - mime_type: - description: The mime type of the file. - type: string - example: image/jpeg - file_size: - description: The size of the file. Required when uploading files. - type: integer - example: 36000 - public: - description: DEPRECATED Whether the file public or not. Required when uploading files. - type: boolean - example: true - meta: - $ref: '#/components/schemas/file-meta' - links: - $ref: '#/components/schemas/links' - link: - $ref: '#/components/schemas/file-link' - file-meta: - properties: - timestamps: - type: object - description: The date and time the file was created. - properties: - created_at: - description: The date and time the file was created. - type: string - example: '2023-10-11T13:02:25.293Z' - dimensions: - description: The file dimensions. - type: object - properties: - width: - description: The width of the file. - type: integer - example: 1800 - height: - description: The height of the file. - type: integer - example: 1000 - file-link: - type: object - description: The publicly available URL for this file. - properties: - href: - description: The publicly available URL for this file. - type: string - example: https://files-eu.epusercontent.com/e8c53cb0-120d-4ea5-8941-ce74dec06038/f8cf26b3-6d38-4275-937a-624a83994702.png diff --git a/packages/sdks/specs/config/redocly.yaml b/packages/sdks/specs/config/redocly.yaml new file mode 100644 index 00000000..236b4c75 --- /dev/null +++ b/packages/sdks/specs/config/redocly.yaml @@ -0,0 +1,26 @@ +extends: + - recommended + +apis: + cart-checkout@v1: + root: ../cart_checkout.yaml + decorators: + override/operation-property-override: + operationIds: + getACart: /Users/robert.field/Documents/Projects/EP/muse/composable-frontend/packages/sdks/specs/overrides/getACart.yaml + catalog_view@v1: + root: ../catalog_view.yaml + decorators: + override/component-merge: + mergeRef: /Users/robert.field/Documents/Projects/EP/muse/composable-frontend/packages/sdks/specs/overrides/catalog_view_components.yaml + override/operation-property-override: + operationIds: + getByContextProduct: /Users/robert.field/Documents/Projects/EP/muse/composable-frontend/packages/sdks/specs/overrides/getByContextProduct.yaml + + +plugins: + - ../plugins/override.js + +decorators: + override/component-merge: + mergeRef: /Users/robert.field/Documents/Projects/EP/muse/composable-frontend/packages/sdks/specs/overrides/security-schemes.yaml \ No newline at end of file diff --git a/packages/sdks/specs/overrides/catalog_view_components.yaml b/packages/sdks/specs/overrides/catalog_view_components.yaml new file mode 100644 index 00000000..9a6bd4cf --- /dev/null +++ b/packages/sdks/specs/overrides/catalog_view_components.yaml @@ -0,0 +1,105 @@ +components: + parameters: + include: + name: include + in: query + description: | + Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products. + required: false + schema: + type: array + items: + type: string + enum: [ main_images, files, component_products ] + schemas: + included: + description: Included is an array of resources that are included in the response. + type: object + properties: + main_images: + description: The main images associated with a product. + type: array + items: + $ref: '#/components/schemas/elastic-path-file' + component_products: + description: The component products associated with a product. + type: array + items: + $ref: '#/components/schemas/product' + files: + description: The files associated with a product. + type: array + items: + $ref: '#/components/schemas/elastic-path-file' + product-data: + properties: + included: + $ref: '#/components/schemas/included' + product-list-data: + properties: + included: + $ref: '#/components/schemas/included' + elastic-path-file: + type: object + title: ElasticPathFile + properties: + id: + type: string + description: The unique identifier for this file. + format: uuid + type: + description: The type represents the object being returned. + type: string + example: file + file_name: + description: The name of the file. + type: string + example: file_name.jpg + mime_type: + description: The mime type of the file. + type: string + example: image/jpeg + file_size: + description: The size of the file. Required when uploading files. + type: integer + example: 36000 + public: + description: DEPRECATED Whether the file public or not. Required when uploading files. + type: boolean + example: true + meta: + $ref: '#/components/schemas/file-meta' + links: + $ref: '#/components/schemas/links' + link: + $ref: '#/components/schemas/file-link' + file-meta: + properties: + timestamps: + type: object + description: The date and time the file was created. + properties: + created_at: + description: The date and time the file was created. + type: string + example: '2023-10-11T13:02:25.293Z' + dimensions: + description: The file dimensions. + type: object + properties: + width: + description: The width of the file. + type: integer + example: 1800 + height: + description: The height of the file. + type: integer + example: 1000 + file-link: + type: object + description: The publicly available URL for this file. + properties: + href: + description: The publicly available URL for this file. + type: string + example: https://files-eu.epusercontent.com/e8c53cb0-120d-4ea5-8941-ce74dec06038/f8cf26b3-6d38-4275-937a-624a83994702.png diff --git a/packages/sdks/specs/overrides/getACart.yaml b/packages/sdks/specs/overrides/getACart.yaml new file mode 100644 index 00000000..7edc9a10 --- /dev/null +++ b/packages/sdks/specs/overrides/getACart.yaml @@ -0,0 +1 @@ +operationId: getCart \ No newline at end of file diff --git a/packages/sdks/specs/overrides/getByContextProduct.yaml b/packages/sdks/specs/overrides/getByContextProduct.yaml new file mode 100644 index 00000000..5dc6a942 --- /dev/null +++ b/packages/sdks/specs/overrides/getByContextProduct.yaml @@ -0,0 +1,2 @@ +parameters: + - $ref: '#/components/parameters/include' \ No newline at end of file diff --git a/packages/sdks/specs/overrides/security-schemes.yaml b/packages/sdks/specs/overrides/security-schemes.yaml new file mode 100644 index 00000000..be2c3cce --- /dev/null +++ b/packages/sdks/specs/overrides/security-schemes.yaml @@ -0,0 +1,7 @@ +components: + securitySchemes: + bearerAuth: + type: http + name: Authorization + in: header + scheme: bearer \ No newline at end of file diff --git a/packages/sdks/specs/plugins/decorators/component-merge.js b/packages/sdks/specs/plugins/decorators/component-merge.js new file mode 100644 index 00000000..615301cf --- /dev/null +++ b/packages/sdks/specs/plugins/decorators/component-merge.js @@ -0,0 +1,51 @@ +// import { readFileAsStringSync } from "../../utils" +const resolve1 = require("@redocly/openapi-core/lib/resolve") +const fs = require("fs") +const _ = require("lodash") + +const ComponentMerge = (props) => { + const { mergeRef } = props + return { + Root: { + leave(root, { report, location }) { + try { + const externalResolver = new resolve1.BaseResolver() + + if (fs.lstatSync(mergeRef).isDirectory()) { + throw new Error( + `Expected a file but received a folder at ${mergeRef}`, + ) + } + + const content = fs.readFileSync(mergeRef, "utf-8") + // In some cases file have \r\n line delimeters like on windows, we should skip it. + const source = new resolve1.Source( + mergeRef, + content.replace(/\r\n/g, "\n"), + ) + + const document = externalResolver.parseDocument(source, false) + + const updated = _.merge(root, document.parsed) + + updateObjectProperties(root, updated) + } catch (e) { + report({ + message: `Failed to merge component.`, + location: location.key(), + }) + } + }, + }, + } +} + +function updateObjectProperties(obj, newValues) { + for (let key in obj) { + if (obj.hasOwnProperty(key) && newValues.hasOwnProperty(key)) { + obj[key] = newValues[key] + } + } +} + +module.exports = ComponentMerge diff --git a/packages/sdks/specs/plugins/decorators/operation-property-override.js b/packages/sdks/specs/plugins/decorators/operation-property-override.js new file mode 100644 index 00000000..7f3b7f81 --- /dev/null +++ b/packages/sdks/specs/plugins/decorators/operation-property-override.js @@ -0,0 +1,58 @@ +const resolve1 = require("@redocly/openapi-core/lib/resolve") +const fs = require("fs") +const _ = require("lodash") + +const OperationPropertyOverride = (props) => { + const { operationIds } = props + return { + Operation: { + leave(operation, { report, location }) { + if (!operation.operationId) return + if (!operationIds) + throw new Error( + `Parameter "operationIds" is not provided for "operation-property-override" rule`, + ) + const operationId = operation.operationId + const operationFileRef = operationIds[operationId] + if (operationFileRef) { + try { + const externalResolver = new resolve1.BaseResolver() + + if (fs.lstatSync(operationFileRef).isDirectory()) { + throw new Error( + `Expected a file but received a folder at ${operationFileRef}`, + ) + } + + const content = fs.readFileSync(operationFileRef, "utf-8") + // In some cases file have \r\n line delimeters like on windows, we should skip it. + const source = new resolve1.Source( + operationFileRef, + content.replace(/\r\n/g, "\n"), + ) + + const document = externalResolver.parseDocument(source, false) + + const mergedValues = _.merge(operation, document.parsed) + updateObjectProperties(operation, mergedValues) + } catch (e) { + report({ + message: `Failed to read markdown override file for operation "${operationId}".\n${e.message}`, + location: location.child("operationId").key(), + }) + } + } + }, + }, + } +} + +function updateObjectProperties(obj, newValues) { + for (let key in obj) { + if (obj.hasOwnProperty(key) && newValues.hasOwnProperty(key)) { + obj[key] = newValues[key] + } + } +} + +module.exports = OperationPropertyOverride diff --git a/packages/sdks/specs/plugins/override.js b/packages/sdks/specs/plugins/override.js new file mode 100644 index 00000000..70199727 --- /dev/null +++ b/packages/sdks/specs/plugins/override.js @@ -0,0 +1,16 @@ +const OperationPropertyOverride = require("./decorators/operation-property-override.js") +const ComponentMerge = require("./decorators/component-merge.js") + +function overridePlugin() { + return { + id: "override", + decorators: { + oas3: { + "operation-property-override": OperationPropertyOverride, + "component-merge": ComponentMerge, + }, + }, + } +} + +module.exports = overridePlugin diff --git a/packages/sdks/specs/shopper.yaml b/packages/sdks/specs/shopper.yaml new file mode 100644 index 00000000..43bb3ed9 --- /dev/null +++ b/packages/sdks/specs/shopper.yaml @@ -0,0 +1,12991 @@ +openapi: 3.1.0 +info: + title: Catalogs Introduction + description: > + Use the catalog-view Service API to create your catalogs. + + You also have the flexibility to create catalogs for different scenarios by + combining hierarchies of products with a price book. Scenarios might + include: + + + - Multiple geographical regions. Display different catalogs in different + regions with suitable pricing or combine product hierarchies from two + different regions to display in a third region. + + - Multiple channels. Display different catalogs based on how a shopper + accesses your store, such as through a mobile app or a web storefront. + + - Direct to business versus direct to customers. Offer different products + and prices for business customers versus retail customers. + + - Preferred customers. Offer special pricing to preferred customers while + displaying a standard price catalog to all other shoppers. + + - Reward programs. Enable reward programs where catalog prices drop after a + certain spending level is reached. + + - Product sales. Offer sale items for a limited time. + + Scenarios are created by defining the context within which a catalog is + displays. Contexts can be a customer ID, a channel, or any other + user-defined tag that can be passed to the APIs from the front-end shopper + experiences. + version: 1.0.0 +servers: + - url: https://euwest.api.elasticpath.com + description: EU West Production Server + - url: https://useast.api.elasticpath.com + description: US East Production Server +tags: + - name: Catalogs + description: > + A catalog contains the products available for sale either in your + organization or store. A catalog also contains information about how to + organize those products for navigation menus and search facets in a + shopper experience. + + + Before you create a catalog you must define the following resources: + + + - Hierarchies: hierarchies and nodes to categorize the products. See + [**Hierarchies**](/docs/api/pxm/products/hierarchies). + + - Products: product information, associated assets, and links to hierarchy + nodes. See [**Products**](/docs/api/pxm/products/products). + + - Price Books: prices for the products associated with the hierarchies. + See [**Price Books**](/docs/api/pxm/pricebooks). + + + A catalog is a combination of hierarchies and a price book. + + ### Products + + Commerce automatically assigns types to the products you create. Product + types can be used in catalogs. For example, in your catalog, you can + filter on `parent` so that only your parent products are displayed in your + storefront. + + You can use product tags to store or assign a key word against a product + or service that you sell in your store. The product tag can then be used + to describe or label that product. Product tags represent similarities + between products who do not share the same attributes. Using product tags + means that you can group your products together, for example, by brand, + category, subcategory, colors, types, industries, and so on. Product tags + can be used in catalogs. For example, you can categorize your products + based on color. Your shoppers can then search your products by color, + enabling shoppers to quickly find what they are looking for, increasing + the likelihood of a purchase, and boosting conversion rates. + + ### Hierarchies + + The hierarchies determine which products appear in the catalog, that is, + only the products that are associated with the selected hierarchies are + included in the catalog. You can also specify the order you want your + hierarchies to display in a published catalog. You can order your + hierarchies on a catalog-by-catalog basis. + + ![Hierarchy_sorting](/assets/hierarchy_sorting.png) + + For more information, see [**create a + Catalog**](/docs/api/pxm/catalog/create-catalog). + + #### Understanding How Products And Nodes Are Associated + + You can use `breadcrumb` metadata to understand how products and nodes are + associated. it explains how products are associated with parent nodes and + the relationship among the array of nodes. This is useful if you want to + improve how your shoppers search within your store. + + The `breadcrumb` information that you get in an endpoint response depends + on whether the endpoint is retrieving product or node details. + + | Object | Product/Node | Description | + + | --- | --- | --- | + + | `breadcrumb` | Node | A list of nodes that a product is associated with. + Up to 10 levels of nodes are displayed, depending on the number of levels + of nodes you have. | + + | `bread_crumbs` | Product | The relationship among the array of nodes a + product is associated with, demonstrating the linking of the children + nodes with the parent nodes. Up to 10 levels of nodes are displayed, + depending on the number of levels of nodes you have. | + + | `bread_crumb_nodes` | Product | An array of parent node IDs that a + product is associated with. The `bread_crumb_node` metadata lists up to 10 + levels of parent nodes, depending on the number of levels of parent nodes + you have. | + + #### Understanding `bread_crumbs` Metadata + + The following diagram illustrates a parent and child nodes. + + ![Breadcrumbs](/assets/breadcrumbs.PNG) + + 1. The product is in **Node 2**. The ID for **Node 2** is shown first in + the first set of breadcrumbs. + + 1. **Node 2** is part of **Hierarchy 1**. The ID for **Hierarchy 1** is + shown second. + + 1. **Node 1** is the parent node of **Node 2**. The ID for **Node 1** is + shown last. + + 1. The product is also in **Node 3**. The ID for **Node 3** is shown first + in the second set of breadcrumbs. + + 1. **Node 3** is in the root of **Hierarchy 1**. The ID for **Hierarchy + 1** is shown last. + + In the `bread_crumb_nodes` metadata, you can see a list of parent nodes a + product is associated with. + + If you subsequently add a product to a new node, then the + `bread_crumb_nodes` metadata appends the new node to the top of the list. + Using the example above, if we add the product to **Node 1**: + + 1. The `bread_crumb_nodes` metadata is generated to show the new node + appended to the top of the list. + + 1. The `bread_crumbs` metadata is updated with the new node. + + #### Understanding Breadcrumb Metadata for Child Products + + When a catalog is published, the breadcrumb information for a child + product includes the metadata mentioned for the parent product, in + addition to the information specific to the child product. For example, + **Product A** is the parent product, associated with **Node 1** and **Node + 2**. The metadata for child **Product B** includes **Node 1** and **Node + 2**, in addition to its own metadata information. + + ### Nodes + + The nodes determine which products appear under this in the catalog, that + is, only the products that are associated with the selected node are shown + under this node. + + ### Price books + + + A price book contains the prices for each of the products in the catalog. + You can create multiple price books for different scenarios, such as + seasonal sales, business versus retail customer pricing, and reward + programs. When creating a catalog, you can specify up to five price books. + You must set a priority for your price books. Product prices are displayed + in the catalog according to the priority of the price books. See [Create a + catalog](/docs/api/pxm/catalog/create-catalog). + x-displayName: Catalogs + - name: Releases + description: > + When a catalog is published, a catalog release is created. A catalog + release provides a snapshot of the product information taken at the time + of publication. You can have one or more catalog releases available in + your organization or in your store. If you publish a catalog for your + organization, the catalog is available when the store is launched. + + + If you have more than one catalog published for your store, use catalog + rules to specify when to display each catalog. For example, you can use + [**catalog rules**](/docs/api/pxm/catalog/rules) to schedule a catalog to + appear during a particular date and time, such as a seasonal catalog. The + catalog may have different pricing than the other catalogs. + + + When a catalog is ready to be used in a store, you publish it. You can + create and publish catalogs for different contexts and channels. + + + Here are some pointers to understand a catalogs' lifecycle. + + + - The default catalog is always the oldest published catalog and must have + have at least one release. + + - At any time, the most recent three catalog releases are maintained. + Hence, if there is a fourth catalog release, the first catalog release is + automatically removed. + + - Until the catalog is published again, the previously created three + catalog releases stay permanently. + + - If you want any other catalog to become the default catalog, you must + create a catalog rule. + + - If you want the oldest published catalog to become the default catalog, + you must remove the catalog rule. + + - Use the `sort_order` value in the `variations` to program your + storefront to display the variation options in the order that you want. + + + Here is a diagram that describes a catalogs' lifecycle: + + + ![Catalogs' Lifecycle](/assets/catalog-lifecycle.png) + + ### Publishing catalogs + + When you publish a catalog, the `live` products in the hierarchies appear + in a catalog release. A catalog release provides a snapshot of product + information taken at the time of publication. You can have one or more + catalog releases available in your organization or in your store. If you + publish a catalog for your organization, the catalog is available when the + store is launched. + + If you have more than one catalog published for your store, use catalog + rules to specify when to display each catalog. For example, you can use + [catalog rules](/docs/api/pxm/catalog/rules) to schedule a catalog to + appear during a particular date and time, such as a seasonal catalog. The + catalog may have different pricing than the other catalogs. You can have + multiple published catalogs. + + When a catalog is ready to be used in a store, you publish it. You can + create and publish catalogs for different contexts and channels. You can + see the differences between the last two consecutive catalog releases. See + [Publish a catalog](/docs/api/pxm/catalog/publish-release). + + You retrieve catalogs for your shopper experience by using the [Catalog + View API](/docs/api/pxm/catalog/releases). + x-displayName: Releases + - name: Rules + description: > + If your store requires multiple catalogs, add catalog rules to control + when a catalog is displayed. A catalog rule contains a catalog plus the + criteria under which to display the catalog. + + + :::caution + + + You cannot create catalog rules for organization catalogs. + + + ::: + + + You can use catalog rules to schedule a catalog to appear during a + particular period, such as on a specific date or during summer. The + catalog might offer different pricing during this period. The pricing + depends on the associated price book. + + + The following scenarios provides a few examples for using catalog rules. + + + - **Multiple geographical regions**. Display different catalogs in + different regions with suitable pricing or combine product hierarchies + from two different regions to display in a third region. + + - **Multiple channels**. Display different catalogs based on how a shopper + accesses your store, such as through a mobile app or a web storefront. + + - **Direct to business versus direct to customers**. Offer different + products and prices for business customers versus retail customers. + + - **Preferred accounts**. Offer special pricing to a group of users while + displaying a standard price catalog to other users. + + - **Preferred customers**. Offer special pricing to preferred customers + while displaying a standard price catalog to all other shoppers. + + - **Reward programs**. Enable reward programs where catalog prices drop + after a certain spending level is reached. + + - **Product sales**. Offer sale items for a limited time. + + - **Standard pricing**. Display a default catalog to the shoppers who do + not meet the criteria of the other catalog rules. + + + You can define a catalog rule with any of the following criteria. + + + - **Accounts**. List the accounts that should see a catalog. When a user + has logged in with the account, they see the configured catalog. + + - **Customers**. List the customers that should see a catalog. When the + customer is logged in, they see the configured catalog. + + - **Channel**. Specify a shopper experience, such as web storefront or + mobile app. Set up the channel to retrieve the catalog from the catalog + rule that matches that channel. + + - **Other tags**. Create your own user-defined tags. For example, you + might want to tag by regions or you might want to distinguish between + business and consumer customers. + + + If a catalog rule has no criteria defined, it is the default catalog rule. + + + ### Resolving catalog rules + + + When there is a request for a catalog, the store displays the catalog with + the rule that matches the most attributes of the shoppers context. + + + The request triggers the following steps: + + + 1. Compares the shoppers context against the defined catalog rules. + + 1. Determines the best match. + + 1. Retrieves the catalog associated with the matching catalog rule. + + + The follow examples show how the best match might be resolved: + + + - A shopper matches one of the `customer_ids` in one catalog rule only. + The catalog for that catalog rule is displayed. + + - A shopper matches one of the `customer_ids` in one catalog rule only, + but doesnʼt match any of the `tags` specified in that catalog rule. + Because there are no other catalog rules for this `customer_id`, the + catalog for the catalog rule is displayed because it is the best match. + + - A shopper is browsing a store using the stores mobile app, which matches + `channel=mobile` in two catalog rules. The catalog displayed depends on + matches with the `tags` or `customer_ids` attributes. If there is no other + matching attribute, the first catalog rule found by the store is used. The + best practice is to create catalog rules that cover all cases so that you + avoid this situation. + + - An unknown shopper is browsing the only channel offered by the seller. + The store displays the base catalog. + x-displayName: Rules + - name: Administrator Latest Releases Catalog API + description: > + Use the Administrator Latest Releases Catalog View API to retrieve + product, hierarchy and node information. + + + :::danger + + + The Administrator Latest Releases Catalog View API is for Administrator + use only. Do not use these endpoints on your customer-facing frontends. + + + ::: + + + Publishing a catalog creates a release of that catalog that you can use in + an organization or in a specific store or other shopper experience. You + can retrieve the hierarchies, nodes, and the `live` products associated + with a catalog release. You can see which parent nodes a product is + associated with. This is useful if want to improve how your shoppers + search your store, for example. + + + Currently, published catalogs are limited to the current release and two + releases prior to the current release. + x-displayName: Administrator Latest Releases Catalog API + - name: Shopper Catalog API + description: > + Use the Shopper Catalog View API to retrieve hierarchy, node and product + information for a catalog release. When you publish a catalog for a store, + you can define catalog rules so that you can show catalogs with different + pricing or different products to preferred customers or channels. These + endpoints can be used in your customer-facing frontends. + + + A catalog is a combination of one or more hierarchies, products, and a + price book. Use the Products API and Hierarchies API to create a hierarchy + of products that can be included in a catalog. Use the Price Book API to + associate prices with products. + + + ### Characteristics of Shopper Catalogs + + + Shopper catalogs can have the following characteristics. + + + - Use catalog rules to schedule a catalog to appear during a particular + date and time, such as a seasonal catalog. The catalog may have different + pricing than the other catalogs. You can have multiple published catalogs. + + - If you have defined catalog rules and you want to retrieve a published + catalog for a particular channel or a user-defined tag, you must set the + appropriate headers in the request: + - `EP-Channel` - The channel, such as website or mobile app. See [**Create a Catalog Rule**](/docs/api/pxm/catalog/create-rule). + - `EP-Context-Tag` - A tag defined in the store, such as `clearance`. See [**Create a Catalog Rule**](/docs/api/pxm/catalog/create-rule). + * When a catalog is ready to be used in a store, you publish it. See + [**Publish a Catalog**](/docs/api/pxm/catalog/publish-release). + + * You can create and publish catalogs for different contexts and channels. + You can see the differences between the last 2 consecutive catalog + releases. See [**Publish a + Catalog**](/docs/api/pxm/catalog/publish-release). + + * You retrieve catalogs for your shopper experience by using the Shopper + Catalog View API. For more information on how you can retrieve a catalog + as a shopper using the Catalog API. + + * When a catalog is published for a store, the corresponding events + contain `store_id` and `org_id`. + + * When a catalog is published for an organization, the corresponding + events contain `org_id`. + + * Use the `sort_order` value in `variations` to program your storefront to + display the variation options in the order that you want. + + + ### Shopper Catalog Caching + + + When conducting a `GET` on `catalog` endpoints, all data returned, + including catalog releases, products, nodes and hierarchies, are cached + for 5 minutes. This means, if you call the same endpoint again, the + catalog data is retrieved from the cached objects pool, optimizing the + performance and efficiency of your store front. + + + If you use any of the `catalog` endpoints with a `filter` or `include` + query parameter, these are cached separately. + + + The cached entries disappear from the cached objects pool after 5 minutes. + x-displayName: Shopper Catalog API + - name: Cart Management + description: > + A Cart contains the product and custom cart items that a user intends to + purchase. After a Cart is ready for Checkout, you can use the [Checkout + endpoint](/docs/api/carts/checkout) to convert the cart to an order. + + + :::note + + + - Adding, modifying, or removing any cart items, custom items, or + promotions always returns the cart meta, calculated using the calculation + method. This is useful to update the client with up-to-date totals. + + - We will automatically delete carts 7 days after they were last updated. + + - If you do not pass a `X-MOLTIN-CURRENCY` header specifying what currency + you would like the cart to use, the products in the cart are converted to + your default currency. + + + ::: + x-displayName: Cart Management + - name: Account Cart Associations + description: > + You can create associations between an account and one or more carts. + After cart associations exist for a account, those carts are accessible + across any device. You can delete associations as required. + + + There are two ways to access the cart: with an [Account Management + Authentication Tokens](/docs/api/accounts/post-v-2-account-members-tokens) + and without one. + + + ### With an `Account Management Authentication` token + + + These endpoints are for users who authenticated implicitly and require a + Account Management Authentication token in the header to access the + account cart associations APIs. For more information, see the [Account + Token](/docs/api/accounts/post-v-2-account-members-tokens) documentation. + + + #### Cart creation + + + Shoppers create carts and can use any of the carts that they created to + check out an order. + + + :::note + + + You can create a cart id, name, and description for the cart. The cart + requires a name. Ensure that the string length is greater than or equal to + one. Use any symbol in the name and description. For cart id, ensure that + you follow the guidelines for safe characters. For more information about + cart id naming requirements, see [Safe + Characters](/guides/Getting-Started/safe-characters). + + + ::: + + + ### Without an `Account Management Authentication` token + + + These endpoints are for users who use the Client Credentials Token and do + not require an account management authentication token in the header to + access the account cart associations APIs. For more information, see the + [Authentication](/docs/authentication/security) documentation. + + + This user acts as a system administrator and can call any account cart + association operations for any account and cart. + + + ### Error Codes + + + You might encounter the following response codes, depending on the + scenario: + + + * `400` - `The type does not exist or is not listed as account` - Ensure + that the type is `account` and is present. + + + * `403` - `Cannot associate more than one account`. + + + * `403` - `Account does not have the required permissions to fulfill this + request`. + + + * `403` - `Invalid json payload` - Check JSON input. The request body must + be an array `[]`. If the request body is an object, the error is + generated. + x-displayName: Account Cart Associations + - name: Customer Cart Associations + description: > + You can create associations between a customer and one or more carts. + After cart associations exist for a customer, those carts are accessible + across any device. You can delete associations as required. + + + There are two ways to access the cart: with a customer token and without + one. + + + ### With a `customer` token + + + These endpoints are for users who authenticated implicitly and require a + customer token in the header to access the customer cart associations + APIs. For more information, see the [Customer + Token](/docs/customer-management/customer-management-api/customer-tokens) + documentation. + + + #### Cart creation + + + Shoppers create carts and can use any of the carts that they created to + check out an order. + + + :::note + + + You can create a cart id, name, and description for the cart. The cart + requires a name. Ensure that the string length is greater than or equal to + one. Use any symbol in the name and description. For cart id, ensure that + you follow the guidelines for safe characters. For more information about + cart id naming requirements, see [Safe + Characters](/guides/Getting-Started/safe-characters). + + + ::: + + + ### Without a `customer` token + + + These endpoints are for users who use the Client Credentials Token and do + not require a Customer token in the header to access the customer cart + associations APIs. For more information, see the + [Authentication](/docs/authentication/security) documentation. + + + This user acts as a system administrator and can call any customer cart + association operations for any customer and cart. + + + ### Error Codes + + + You might encounter the following response codes, depending on the + scenario: + + + * `400` - `The type does not exist or is not listed as customer` - Ensure + that the type is `customer` and is present. + + + * `403` - `Cannot associate more than one customer`. + + + * `403` - `Customer does not have the required permissions to fulfill this + request`. + + + * `403` - `Invalid json payload` - Check JSON input. The request body must + be an array `[]`. If the request body is an object, the error is + generated. + x-displayName: Customer Cart Associations + - name: Cart Items + description: Products added to a cart are referred to as a `cart_item`. + x-displayName: Cart Items + - name: Checkout + description: > + + The checkout workflow ties together many of the key concepts covered in + this section. When a customer initiates the checkout process, an order is + created from the cart. The order is incomplete until after a successful + payment is made. A complete order can be shipped and the product deducted + from inventory counts. + + + ![Checkout workflow](/assets/checkout-flow.png) + + + ### Summary of the checkout workflow + + + 1. Add a product to a cart. A cart and its reference number is generated. + + 2. Manage the cart items. For example, you might add items, remove items, + and change quantities. + + 3. Check out the cart. An incomplete order is created. + + 4. Pay for an order: provide billing and shipping details, if you are a + new customer. The order is now in the processing status. + + 5. If using a manual gateway, after you authorize and capture it, + Composable Commerce considers the order complete. If you use a third-party + integration supported by Composable Commerce (such as Stripe), after the + third-party gateway authorizes and captures the payment, the order becomes + complete. Usually capture does not occur at the same time as + authorization. For more information, see the Capture section. + + 6. After the order is shipped, you can manually flag it as fulfilled. + + + ### Carts + + + When a product is added to a cart, a cart is generated together with its + unique reference ID that on checkout becomes a part of the order ID. If + you are using our JavaScript software development kit, generating a cart + reference ID is done for you; otherwise, add a cart reference generator to + your functionality. + + + ### Promotions and custom items + + + Optionally, apply a promotion code on a cart, or add custom_items to + modify the product price (typically to handle taxes, customs, or + shipping). + + + ### Checkout + + + You can checkout a cart with an associated customer name and email + (customer object). Typically, this would be used for new customers or ones + that prefer to shop as guests. Use the customer.id checkout option to + checkout for an existing customer. After a successful checkout is + completed, the response contains an order. + + + Email addresses that either begin or end with a period, or contain + consecutive periods, are considered invalid, resulting in the following + error: + + ```json + + "errors": [ + { + "status": 400, + "source": "data.customer.email", + "title": "format", + "detail": "Does not match format 'email" + } + ] + ``` + + ### Payments + + + On checkout, an incomplete order is created. You can then use a + third-party integration to handle your payment gateway. If the payment + gateway is supported by Composable Commerce, such as Stripe, the payment + is processed externally but handled internally. When a successful + validation is returned, Composable Commerce flags the order as complete. + + + If you are using a payment method not officially supported by Composable + Commerce, the gateway needs to be implemented and handled manually. After + the payment has been authorized and captured either through Commerce + Manager or API, the status of an order becomes complete. + + + ### Shipping + + + The status of an order and the status of shipping are handled separately, + and so an order can be complete but not shipped. Orders that have not been + shipped yet have a status of unfulfilled. This flag is generated + automatically by Composable Commerce when an order is created. Currently, + you can only update the shipping status manually, through the API. After + the order is shipped, flag its shipping status as fulfilled. + + + ### Inventory + + + If enabled, you can manage your stock. As such, your stock is + automatically updated as soon as a product is checked out. + x-displayName: Checkout + - name: Orders + description: > + An Order is created through the [checkout](/docs/api/carts/checkout) + endpoint within the Carts API. + + + An order is created after a customer checks out their cart. On creation, + the order is marked unpaid. The customer is prompted for a shipping + address, a billing address, and a payment method. After the order is + successfully paid, you can trigger an inventory process and a shipping + process. + + + You can keep a history of orders associated with the customer account. + + + ### Reorder + + + A re-order is when a shopper copies items from a previous order from their + order history into a cart of their choice. If a shopper re-orders to an + empty cart, the same quantities as the past order are applied. If the + shopper re-orders to an existing cart, and orders the same item, the + quantity increases. If an item is out of stock, the item is not added to + the cart, and the shopper sees an insufficient stock error. The tax for + the items in a re-order is not applied. For more information, see [Tax + Items](/docs/api/carts/tax-items). + x-displayName: Orders + - name: Payments + description: > + When you [checkout](/docs/api/carts/checkout) a + [cart](/docs/api/carts/cart-management), an unpaid + [order](/docs/api/carts/orders) is returned. You can process the payment + for the order though a payment gateway. + + + :::note + + + - You need to configure and enable a payment gateway before you can accept + payments for orders. + + - Configure your store to use [Manual + Gateway](/docs/api/payments/update-manual-gateway) to process payments if + the order total is zero or the payment is through non-supported payment + providers. + + - There are a number of actions that happen to your inventory when + checking out and paying for an order. For more information, see + [Inventory](/docs/api/pxm/inventory/inventories-introduction). + + - We recommend to wait until the payment confirmation process is fully + completed before proceeding with any additional updates to the order. + Making simultaneous updates to the same entity immediately after payment + confirmation can lead to a race condition. To learn more information on + handling parallel calls to API objects, see [Parallel Calls to API + Objects](https://beta.elasticpath.dev/guides/Getting-Started/api-contract#parallel-calls-to-api-objects). + + + ::: + + + ### Payment Methods + + + Depending on the chosen gateway, you may or may not have access to capture + funds immediately or authorize for later payment. For more information, + see [Transactions](/docs/api/carts/transactions). + + + To make a partial payment in Postman through any payment gateway, specify + the desired payment amount in the amount field within the request body. To + learn about Split Payments, see the [Split + Payments](/docs/api/payments/payment-gateways-introduction#split-payments) + section. + + + #### Purchase + + + The simplest method is purchase. The gateway attempts to charge the + customer immediately, and the result of the attempt is returned. + + + You can partially pay funds using purchase method. The gateway attempts to + charge the customer immediately, and the payment status for an order shows + `partially_paid`. + + + When you Get an order, you can see the following fields in the meta + object: + + + - `balance_owing`: Specifies the outstanding funds required to complete an + order. It considers all complete or pending transactions, including + authorized, paid, and captured transactions. (`balance_owing` = order + total - `authorized` amount - `paid` amount). + + - `paid`: Specifies the total amount of purchased or captured + transactions. + + - `authorized`: Specifies the total amount of completed or pending + authorized transactions for an order. + + + #### Authorize + + + You can `authorize` a payment so funds can later be captured when an item + is dispatched or restocked. + + + You can partially pay for an order using `authorize` payment method so + that the order is `partially_authorized`. The transaction must be complete + for the order status to be `partially_authorized`. + + + For more information about order and payment statuses for split payments, + see [Split + Payments](/docs/api/payments/payment-gateways-introduction#split-payments). + + + #### Capture + + + After authorizing a transaction, you have to capture the authorized funds. + + + :::note + + + We recommend capturing payments several hours to days after the + authorization to mitigate risks of fraud and chargebacks. When you sell + digital goods that are delivered immediately, we recommend using a single + purchase call instead of separate authorize and capture calls. + + + ::: + + + After the payment is `partially_authorized`, you must `capture` the + authorized transaction later. Once you capture the authorized + transactions, the order payment status will change to `partially_paid`. + + + #### Refunds + + + You can use either the Refund through Composable Commerce or use the Mark + as Refunded capability, or a combination of both capabilities. + + + For more information about refund for split payments, see [Refund a + Payment](/docs/api/carts/refund-a-transaction). + + + #### Refund through Composable Commerce + + + You can start a full or partial refund to a supported payment provider + directly from Commerce Manager or the API. When you start the refund + process, the refund request is sent to the payment gateway. You no longer + have to log on to your payment gateway’s console to process the refund. + + + When you process a refund, use the refund endpoint to pass the refund + amount. If you don’t pass an amount, the refund is processed as Mark as + refunded. For more information, see the Mark as Refunded section. + + + Each time a partial refund is triggered, the transaction.updated event is + generated and updated with refunded.amount. The `order.updated` event is + also triggered. The `order.refunded` event generates when the full amount + is refunded. + + + + #### Mark as Refunded + + + You can use your payment gateway’s console to process a refund. Process + the refund first in the payment gateway and then use the **Mark as + Refunded** capability in Composable Commerce to complete the process. + + + When an order is **Marked as refunded**, the payment status + `order.payment.status` is set to refunded. In this case, the + `order.updated`, `transaction.updated` and `order.refunded` events are + generated. + x-displayName: Payments + - name: Transactions + x-displayName: Transactions + - name: Custom Discounts + description: > + With custom discounts, you can allow your shoppers to apply discounts from + external services to their purchases. To apply custom discounts to carts + and cart items, you need to set `custom_discounts_enabled` field to `true` + in your [Cart Settings](/docs/api/settings/put-v-2-settings-cart). + + + You cannot add custom discounts to an empty cart. + + + :::caution + + + - You can apply up to five custom discounts to cart and cart item. + + - The stores that use [simple calculation + method](/guides/How-To/Carts/calculate-totals) do not support custom + discounts. + + + ::: + x-displayName: Custom Discounts + - name: Tax Items + description: > + Taxes differ by country and can differ within the country by region, + state, or province. Each jurisdiction has a unique tax code and rate. If + your store serves many jurisdictions, integrate a third-party tax + generator to manage taxes. If your store serves a few jurisdictions, you + can use the API to define the tax codes and rates in Composable Commerce. + + + Taxes are calculated after all promotional discounts have been applied. + When calculating taxes on a cart or order, you can choose from the + following methods for calculating taxes: + + - Simple calculation method: Taxes are calculated at the unit level and are rounded to the nearest penny for the unit. + - Line calculation method: Default. Taxes are calculated at the line level and are rounded to the nearest penny for the line. + For more information about calculation methods, see [Calculate cart and order totals](/guides/How-To/Carts/calculate-totals). + + :::note + + Tax items can be added and removed using [client credentials + tokens](/docs/authentication/Tokens/client-credential-token). Only + administrators with `client-credentials` are able to manage tax items. + + ::: + x-displayName: Tax Items +paths: + /catalog: + get: + operationId: getByContextRelease + summary: Get the catalog release as shoppers + description: Returns a list of all published releases of the specified catalog. + parameters: + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + responses: + '200': + description: The catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/release-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Releases + security: + - bearerAuth: [] + /catalog/hierarchies: + get: + operationId: getByContextAllHierarchies + summary: Get all Hierarchies + description: > + Returns all hierarchies from a catalog. + + + If you have multiple catalog rules defined, the rule that best matches + the shoppers context is used to determine which catalog is retrieved. + For information about how rules are matched, see [Resolving Catalog + Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + + ### Filtering + + + This endpoint supports filtering. For general syntax, see + [Filtering](/guides/Getting-Started/filtering). + + + | Operator | Description | Supported Attributes | Example | + + |:--- |:--- |:--- |:--- | + + | `Eq` | Checks if the values of two operands are equal. If they are, + the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | + + | `In` | Checks if the values are included in the specified string. If + they are, the condition is true. | `id` | `filter=in(id,some-id)` | + + + ### Building breadcrumbs in a storefront + + + In a catalog, you can use a filter to return a list of nodes in a + hierarchy structure that a product belongs to. You can use this to build + breadcrumbs in your storefront. An example is shown below. + + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + + - Specify the node Ids in the filter expression. + + - You can have as many node Ids as you want. + + - It does not matter what order you specify the node Ids. The nodes are + returned in the order they were last updated. + parameters: + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - $ref: '#/components/parameters/filter-hierarchy' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The hierarchies of the catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/hierarchy-list-data' + default: + description: An unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Shopper Catalog API + security: + - bearerAuth: [] + /catalog/hierarchies/{hierarchy_id}: + get: + operationId: getByContextHierarchy + summary: Get a Hierarchy + description: > + Returns a hierarchy from the catalog. + + + If you have multiple catalog rules defined, the rule that best matches + the shoppers context is used to determine which catalog to retrieve. For + information about how catalog rules are matched, see [Resolving Catalog + Rules](/docs/api/pxm/catalog/rules). + parameters: + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - name: hierarchy_id + in: path + description: The catalog hierarchy ID. + required: true + schema: + type: string + responses: + '200': + description: The catalog hierarchy. + content: + application/json: + schema: + $ref: '#/components/schemas/hierarchy-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Shopper Catalog API + security: + - bearerAuth: [] + /catalog/hierarchies/{hierarchy_id}/nodes: + get: + operationId: getByContextHierarchyNodes + summary: Get a Hierarchy's Nodes + description: > + Returns all the nodes for the specified hierarchy. + + + If you have multiple catalog rules defined, the rule that best matches + the shoppers context is used to determine which catalog is retrieved. + For information about how rules are matched, see [Resolving Catalog + Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + + In the `bread_crumb` metadata, you can identify the parent nodes that a + node is associated with. This is useful if you want to improve how your + shoppers search your store, for example. See [Product and Node + Associations in Breadcrumb + Metadata](/guides/How-To/Catalogs/breadcrumbs). + + ### Filtering + + + This endpoint supports filtering. For general syntax, see + [Filtering](/guides/Getting-Started/filtering). + + + | Operator | Description | Supported Attributes | Example | + + |:--- |:--- |:--- |:--- | + + | `Eq` | Checks if the values of two operands are equal. If they are, + the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | + + | `In` | Checks if the values are included in the specified string. If + they are, the condition is true. | `id` | `filter=in(id,some-id)` | + + ### Building breadcrumbs in a storefront + + + In a catalog, you can use a filter to return a list of nodes in a + hierarchy structure that a product belongs to. You can use this to build + breadcrumbs in your storefront. An example is shown below. + + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + + - Specify the node Ids in the filter expression. + + - You can have as many node Ids as you want. + + - It does not matter what order you specify the node Ids. The nodes are + returned in the order they were last updated. + parameters: + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-node' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + - name: hierarchy_id + in: path + description: The catalog hierarchy ID. + required: true + schema: + type: string + responses: + '200': + description: The child nodes of a catalog hierarchy. + content: + application/json: + schema: + $ref: '#/components/schemas/node-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Shopper Catalog API + security: + - bearerAuth: [] + /catalog/hierarchies/{hierarchy_id}/children: + get: + operationId: getByContextHierarchyChildNodes + summary: Get a Hierarchy's Children + description: > + Returns the parent nodes for the specified hierarchy. + + ![Parent Nodes](/assets/rootnodes.PNG) + + If you have multiple catalog rules defined, the rule that best matches + the shopperʼs context is used to determine which catalog is retrieved. + For information about how rules are matched, see [Resolving Catalog + Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + + In the `bread_crumb` metadata, you can identify the parent nodes that a + node is associated with. This is useful if you want to improve how your + shoppers search your store, for example. See [Product and Node + Associations in Breadcrumb + Metadata](/guides/How-To/Catalogs/breadcrumbs). + + ### Filtering + + + The following operators and attributes are available when filtering on + this endpoint. + + + | Operator | Description | Supported Attributes | Example | + + |:--- |:--- |:--- |:--- | + + | `Eq` | Checks if the values of two operands are equal. If they are, + the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | + + | `In` | Checks if the values are included in the specified string. If + they are, the condition is true. | `id` | `filter=in(id,some-id)` | + + + For more information, see + [Filtering](/guides/Getting-Started/filtering). + + + ### Building breadcrumbs in a storefront + + + In a catalog, you can use a filter to return a list of nodes in a + hierarchy structure that a product belongs to. You can use this to build + breadcrumbs in your storefront. An example is shown below. + + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + + - Specify the node Ids in the filter expression. + + - You can have as many node Ids as you want. + + - It does not matter what order you specify the node Ids. The nodes are + returned in the order they were last updated. + parameters: + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-node' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + - name: hierarchy_id + in: path + description: The catalog hierarchy ID. + required: true + schema: + type: string + responses: + '200': + description: The child nodes of a catalog hierarchy. + content: + application/json: + schema: + $ref: '#/components/schemas/node-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Shopper Catalog API + security: + - bearerAuth: [] + /catalog/nodes: + get: + operationId: getByContextAllNodes + summary: Get all Nodes + description: > + Returns all nodes in the catalog. + + + If you have multiple catalog rules defined, the rule that best matches + the shoppers context is used to determine which catalog is retrieved. + For information about how rules are matched, see [Resolving Catalog + Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + + You can see the parent nodes a node is associated with in the + `bread_crumb` metadata for each node. This is useful if you want to + improve how your shoppers search your store, for example. See [Product + and Node Associations in Breadcrumb + Metadata](/guides/How-To/Catalogs/breadcrumbs). + + + In a catalog, you can use a filter to return a list of nodes in a + hierarchy structure that a product belongs to. You can use this to build + breadcrumbs in your storefront. For more information, see [Building + breadcrumbs in a storefront](#building-breadcrumbs-in-a-storefront). + + + The response lists the products associated with the nodes. If products + are [curated](/guides/How-To/Products/curating-products), they are + displayed in `curated_products`. Product curation allows you to promote + specific products within each of your hierarchies, enabling you to + create unique product collections in your storefront. + + + - You can only curate 20 products or less. You cannot have more than 20 + curated products. + + - If a curated product is removed from a node, the product is also + removed from the `curated_products` list. + + + ### Filtering + + + This endpoint supports filtering. For general syntax, see + [Filtering](/guides/Getting-Started/filtering). The following operators + and attributes are available. + + + | Operator | Description | Attributes | Example | + + | --- | --- | --- | --- | + + | `Eq` | Checks if the values of two operands are equal. If they are, + the condition is true. | `name`, `slug` | `filter=eq(name,some-name)` | + + | `in` | Checks if the values are included in the specified string. + If they are, the condition is true. + + | `Id` | + `filter=in(id,9214719b-17fe-4ea7-896c-d61e60fc0d05,e104d541-2c52-47fa-8a9a-c4382480d97c,65daaf68-ff2e-4632-8944-370de835967d)` + | + + + ### Building breadcrumbs in a storefront + + + In a catalog, you can use a filter to return a list of nodes in a + hierarchy structure that a product belongs to. You can use this to build + breadcrumbs in your storefront. An example is shown below. + + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + + - Specify the node Ids in the filter expression. + + - You can have as many node Ids as you want. + + - It does not matter what order you specify the node Ids. The nodes are + returned in the order they were last updated. + parameters: + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-node' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The nodes of the catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/node-list-data' + default: + description: An unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Shopper Catalog API + security: + - bearerAuth: [] + /catalog/nodes/{node_id}: + get: + operationId: getByContextNode + summary: Get a Node + description: > + Returns a node from the catalog. + + + If you have multiple catalog rules defined, the rule that best matches + the shoppers context is used to determine which catalog is retrieved. + For information about how rules are matched, see [Resolving Catalog + Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + + You can see the parent nodes a node is associated with in the + `bread_crumb` metadata for each node. This is useful if you want to + improve how your shoppers search your store, for example. See [Product + and Node Associations in Breadcrumb + Metadata](/guides/How-To/Catalogs/breadcrumbs). + + + The response lists the products associated with a node. If products are + [curated](/guides/How-To/Products/curating-products), they are displayed + in `curated_products`. Product curation allows you to promote specific + products within each of your nodes, enabling you to create unique + product collections in your storefront. + + + - If you don't provide any `curated_products`, products are listed by + their `updated_at` time in descending order, with the most recently + updated product first. + + - If you configure `curated_products` for only a few products, the + curated products are displayed first and the other products are + displayed in the order of `updated_at` time. + + - You can only curate 20 products or less. You cannot have more than 20 + curated products. + + - A product that is curated has the `"curated_product": true` attribute + displayed. + + - If a curated product is removed from a node, the product is also + removed from the `curated_products` list. + parameters: + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - $ref: '#/components/parameters/accept-language' + - name: node_id + in: path + description: The catalog node ID. + required: true + schema: + type: string + responses: + '200': + description: The catalog node. + content: + application/json: + schema: + $ref: '#/components/schemas/node-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Shopper Catalog API + security: + - bearerAuth: [] + /catalog/nodes/{node_id}/relationships/children: + get: + operationId: getByContextChildNodes + summary: Get a Node's Children + description: > + Returns the child nodes for a node in the catalog. + + If you have multiple catalog rules defined, the rule that best matches + the shoppers context is used to determine which catalog is retrieved. + For information about how rules are matched, see [Resolving Catalog + Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + + You can see which parent nodes a node is associated with in the + `bread_crumb` metadata for each node. This is useful if you want to + improve how your shoppers search your store, for example. See [Product + and Node Associations in Breadcrumb + Metadata](/guides/How-To/Catalogs/breadcrumbs). + + + The response lists the products associated with the nodes. If products + are [curated](/guides/How-To/Products/curating-products), they are + displayed in `curated_products`. Product curation allows you to promote + specific products within each of your hierarchies, enabling you to + create unique product collections in your storefront. + + - If you don't provide any curated_products, products are listed by + their updated_at time in descending order, with the most recently + updated product first. + + - If you configure curated_products for only a few products, the curated + products are displayed first and the other products are displayed in the + order of updated_at time. + + - You can only curate 20 products or less. You cannot have more than 20 + curated products. + + - A product that is curated has the "curated_product": true attribute + displayed. + + - If a curated product is removed from a node, the product is also + removed from the curated_products list. + + ### Filtering + + This endpoint supports filtering. For general syntax, see + [Filtering](/guides/Getting-Started/filtering). The following operators + and attributes are available. + + | Operator | Description | Attributes | Example | + + | --- | --- | --- | --- | + + | `Eq` | Checks if the values of two operands are equal. If they are, + the condition is true. | `name`, `slug` | `filter=eq(name,some-name)` | + + | `in` | Checks if the values are included in the specified string. + If they are, the condition is true. + + | `Id` | + `filter=in(id,9214719b-17fe-4ea7-896c-d61e60fc0d05,e104d541-2c52-47fa-8a9a-c4382480d97c,65daaf68-ff2e-4632-8944-370de835967d)` + | + + ### Building breadcrumbs in a storefront + + In a catalog, you can use a filter to return a list of nodes in a + hierarchy structure that a product belongs to. You can use this to build + breadcrumbs in your storefront. An example is shown below. + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + - Specify the node Ids in the filter expression. + + - You can have as many node Ids as you want. + + - It does not matter what order you specify the node Ids. The nodes are + returned in the order they were last updated. + parameters: + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-node' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + - name: node_id + in: path + description: The catalog node ID. + required: true + schema: + type: string + responses: + '200': + description: The child nodes of a catalog node. + content: + application/json: + schema: + $ref: '#/components/schemas/node-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Shopper Catalog API + security: + - bearerAuth: [] + /catalog/products: + get: + operationId: getByContextAllProducts + summary: Get all Products + description: > + Retrieves the list of products from the catalog. Only the products in a + live status are retrieved. + + + ### Catalog Rules + + If you have multiple catalog rules defined, the rule that best matches + the shoppers context is used to determine which catalog is retrieved. If + no catalog rules are configured, the first catalog found is returned. + For information about how rules are matched, see [Resolving Catalog + Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + + ### Product and Node Associations + + You can see the parent nodes a product is associated within the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. For example, this is useful if you want to improve how your shoppers search your store. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). + + + ### Including Resources + + + Using the `include` parameter, you can retrieve top-level resources, + such as, files or main image, bundle component products and product + attributes, such as SKU or slug. + + + | Parameter | Required | + Description + | + + | + :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + + | `component_products` | Optional | The component product data and key + attribute data, such as SKU or slug, to return for component products in + a product bundle. | + + | `main_image` | Optional | The main images associated with a + product. | + + | `files` | Optional | Any files associated with a product. + | + + + See [**Including Resources**](/guides/Getting-Started/includes). + + ### Filtering + + This endpoint supports filtering. For general filtering syntax, see + [Filtering](/guides/Getting-Started/filtering). The following operators + and attributes are available when filtering on this endpoint. + + | Operator | + Description + | Supported Attributes | Example | + + |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- + | + + | `Eq` | Checks if the values of two operands are equal. If they are, + the condition is true. For `product_types` and `tags`, you can only + specify one. For example, `filter=eq(product_types,child)`. | + `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, + `product_types`, `tags` | `filter=eq(name,some-name)` | + + | `In` | Checks if the values are included in the specified string. If + they are, the condition is true. For `product_types` and `tags`, you can + specify more than one. For example, + `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, + `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | + `filter=in(id,some-id)` | + + + ### Building breadcrumbs in a storefront + + In a catalog, you can use a filter to return a list of nodes in a + hierarchy structure that a product belongs to. You can use this to build + breadcrumbs in your storefront. An example is shown below. + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + - Specify the node Ids in the filter expression. + + - You can have as many node Ids as you want. + + - It does not matter what order you specify the node Ids. The nodes are + returned in the order they were last updated. + parameters: + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - $ref: '#/components/parameters/filter-product' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The products of a catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/product-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Shopper Catalog API + security: + - bearerAuth: [] + /catalog/products/{product_id}: + get: + operationId: getByContextProduct + summary: Get a Product + description: > + Returns the specified product from the catalog. The product must be in + the `live` status. + + + If you have multiple catalog rules defined, the rule that best matches + the shoppers context is used to determine which catalog is retrieved. + For information about how rules are matched, see [Resolving Catalog + Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + + You can see the parent nodes a product is associated with in the + `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This + is useful if you want to improve how your shoppers search your store, + for example. See [Product and Node Associations in Breadcrumb + Metadata](/guides/How-To/Catalogs/breadcrumbs). + + + Using the `include` parameter, you can retrieve top-level resources, + such as, files or main image, bundle component products and product + attributes, such as SKU or slug. + + + | Parameter | Required | + Description + | + + | + :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + + | `component_products` | Optional | The component product data and key + attribute data, such as SKU or slug, to return for component products in + a product bundle. | + + | `main_image` | Optional | The main images associated with a + product. | + + | `files` | Optional | Any files associated with a product. + | + + + See [**Including Resources**](/guides/Getting-Started/includes). + parameters: + - $ref: '#/components/parameters/include' + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - name: product_id + in: path + description: The product ID. + required: true + schema: + type: string + responses: + '200': + description: The product of a catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/product-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Shopper Catalog API + security: + - bearerAuth: [] + /catalog/products/{product_id}/relationships/component_products: + get: + operationId: getByContextComponentProductIDs + summary: Get a Bundle's Component Products + description: > + With Product Experience Manager, you can + [create](/docs/api/pxm/products/create-product) and manage bundles. A + bundle is a purchasable product, comprising of one or more products that + you want to sell together. + + + You can create multiple components within a bundle. Each component must + have at least one or more options. Each option is a product and a + quantity. + + + This endpoint returns a list of component product IDs for the specified + bundle. + parameters: + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - name: product_id + in: path + description: The product ID. + required: true + schema: + type: string + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: >- + The list of component product IDs of a bundle product from a + catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/product-reference-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Shopper Catalog API + security: + - bearerAuth: [] + /catalog/products/{product_id}/relationships/children: + get: + operationId: getByContextChildProducts + summary: Get a Parent Product's Child Products + description: > + For a specified product and catalog release, retrieves a list of child + products from a parent product. Any product other than a base product + results in a `422 Unprocessable Entity` response. Only the products in a + `live` status are retrieved. + + If you have multiple catalog rules defined, the rule that best matches + the shopperʼs context is used to determine which catalog is retrieved. + If no catalog rules are configured, the first catalog found is returned. + For information about how rules are matched, see [Resolving Catalog + Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + You can see the parent nodes a product is associated within the + `breadcrumbs` metadata for each product. For example, this is useful if + you want to improve how your shoppers search your store. See [Product + and Node Associations in Breadcrumb + Metadata](/guides/How-To/Catalogs/breadcrumbs). + + ### Filtering + + This endpoint supports filtering. For general filtering syntax, see + [Filtering](/guides/Getting-Started/filtering). The following operators + and attributes are available when filtering on this endpoint. + + | Operator | + Description + | Supported Attributes | Example | + + |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- + | + + | `Eq` | Checks if the values of two operands are equal. If they are, + the condition is true. For `product_types` and `tags`, you can only + specify one. For example, `filter=eq(product_types,child)`. | + `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, + `product_types`, `tags` | `filter=eq(name,some-name)` | + + | `In` | Checks if the values are included in the specified string. If + they are, the condition is true. For `product_types` and `tags`, you can + specify more than one. For example, + `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, + `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | + `filter=in(id,some-id)` | + + ### Building breadcrumbs in a storefront + + In a catalog, you can use a filter to return a list of nodes in a + hierarchy structure that a product belongs to. You can use this to build + breadcrumbs in your storefront. An example is shown below. + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + - Specify the node Ids in the filter expression. + + - You can have as many node Ids as you want. + + - It does not matter what order you specify the node Ids. The nodes are + returned in the order they were last updated. + + ### Including Resources + + Using the `include` parameter, you can retrieve top-level resources, + such as, files or main image, bundle component products and product + attributes, such as SKU or slug. + + | Parameter | Required | + Description + | + + | + :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + + | `component_products` | Optional | The component product data and key + attribute data, such as SKU or slug, to return for component products in + a product bundle. | + + | `main_image` | Optional | The main images associated with a + product. | + + | `files` | Optional | Any files associated with a product. + | + + See [**Including Resources**](/guides/Getting-Started/includes). + parameters: + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - name: product_id + in: path + description: The product ID. + required: true + schema: + type: string + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-product' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The list of child products of a parent product from a catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/product-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Shopper Catalog API + security: + - bearerAuth: [] + /catalog/hierarchies/{hierarchy_id}/products: + get: + operationId: getByContextProductsForHierarchy + summary: Get a Hierarchy's Products + description: > + Returns the products associated with the specified hierarchy in the + catalog. The products must be in the live status. + + + If you have multiple catalog rules defined, the rule that best matches + the shoppers context is used to determine which catalog is retrieved. + See [Resolving catalog + rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + + You can see the parent nodes a product is associated with in the + `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This + is useful if you want to improve how your shoppers search your store, + for example. See [Product and Node Associations in Breadcrumb + Metadata](/guides/How-To/Catalogs/breadcrumbs). + + ### Filtering + + + This endpoint supports filtering. For general filtering syntax, see + [Filtering](/guides/Getting-Started/filtering). The following operators + and attributes are available when filtering on this endpoint. + + + | Operator | + Description + | Supported Attributes | Example | + + |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- + | + + | `Eq` | Checks if the values of two operands are equal. If they are, + the condition is true. For `product_types` and `tags`, you can only + specify one. For example, `filter=eq(product_types,child)`. | + `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, + `product_types`, `tags` | `filter=eq(name,some-name)` | + + | `In` | Checks if the values are included in the specified string. If + they are, the condition is true. For `product_types` and `tags`, you can + specify more than one. For example, + `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, + `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | + `filter=in(id,some-id)` | + + + ### Building breadcrumbs in a storefront + + + In a catalog, you can use a filter to return a list of nodes in a + hierarchy structure that a product belongs to. You can use this to build + breadcrumbs in your storefront. An example is shown below. + + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + + - Specify the node Ids in the filter expression. + + - You can have as many node Ids as you want. + + - It does not matter what order you specify the node Ids. The nodes are + returned in the order they were last updated. + + ### Including Resources + + Using the `include` parameter, you can retrieve top-level resources, + such as, files or main image, bundle component products and product + attributes, such as SKU or slug. + + | Parameter | Required | + Description + | + + | + :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + + | `component_products` | Optional | The component product data and key + attribute data, such as SKU or slug, to return for component products in + a product bundle. | + + | `main_image` | Optional | The main images associated with a + product. | + `files` | Optional | Any files associated with a product. | + + + See [**Including Resources**](/guides/Getting-Started/includes). + parameters: + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - $ref: '#/components/parameters/filter-product' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + - name: hierarchy_id + in: path + description: The catalog hierarchy ID. + required: true + schema: + type: string + responses: + '200': + description: The products of a catalog hierarchy. + content: + application/json: + schema: + $ref: '#/components/schemas/product-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Shopper Catalog API + security: + - bearerAuth: [] + /catalog/nodes/{node_id}/relationships/products: + get: + operationId: getByContextProductsForNode + summary: Get a Node's Products + description: > + Returns the products associated with the specified hierarchy node in the + catalog. The products must be in the `live` status. If the products have + been curated then the products are returned in the order specified in + the `curated_products` attribute. A product that is curated has the + `"curated_product": true` attribute displayed. + + + If you have multiple catalog rules defined, the rule that best matches + the shoppers context is used to determine which catalog is retrieved. + See [Resolving catalog + rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + + You can see the parent nodes a product is associated with in the + `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This + is useful if you want to improve how your shoppers search your store, + for example. See [Product and Node Associations in Breadcrumb + Metadata](/guides/How-To/Catalogs/breadcrumbs). + + ### Filtering + + + This endpoint supports filtering. For general filtering syntax, see + [Filtering](/guides/Getting-Started/filtering). The following operators + and attributes are available when filtering on this endpoint. + + + | Operator | + Description + | Supported Attributes | Example | + + |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- + | + + | `Eq` | Checks if the values of two operands are equal. If they are, + the condition is true. For `product_types` and `tags`, you can only + specify one. For example, `filter=eq(product_types,child)`. | + `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, + `product_types`, `tags` | `filter=eq(name,some-name)` | + + | `In` | Checks if the values are included in the specified string. If + they are, the condition is true. For `product_types` and `tags`, you can + specify more than one. For example, + `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, + `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | + `filter=in(id,some-id)` | + + + ### Building breadcrumbs in a storefront + + + In a catalog, you can use a filter to return a list of nodes in a + hierarchy structure that a product belongs to. You can use this to build + breadcrumbs in your storefront. An example is shown below. + + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + + - Specify the node Ids in the filter expression. + + - You can have as many node Ids as you want. + + - It does not matter what order you specify the node Ids. The nodes are + returned in the order they were last updated. + + + ### Including Resources + + + Using the `include` parameter, you can retrieve top-level resources, + such as, files or main image, bundle component products and product + attributes, such as SKU or slug. + + + | Parameter | Required | + Description + | + + | + :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + + | `component_products` | Optional | The component product data and key + attribute data, such as SKU or slug, to return for component products in + a product bundle. | + + | `main_image` | Optional | The main images associated with a + product. | + + | `files` | Optional | Any files associated with a product. + | + + + See [**Including Resources**](/guides/Getting-Started/includes). + parameters: + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - $ref: '#/components/parameters/filter-product' + - name: node_id + in: path + description: The catalog node ID. + required: true + schema: + type: string + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The products of a catalog node. + content: + application/json: + schema: + $ref: '#/components/schemas/product-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Shopper Catalog API + security: + - bearerAuth: [] + /catalog/products/{product_id}/configure: + post: + operationId: configureByContextProduct + summary: Configure a Shopper Bundle + description: > + Once you have configured your product bundles, you can display them in + your storefront in your published catalog. Depending on how you have + configured the minimum and maximum values for the product options in + your components, you can allow your shoppers to choose which products + they want to select. For example, you can enable a shopper to select 1 + or more product options from a list of 10, giving your shoppers greater + flexibility when selecting products in your store front. + + + - Products must be in a `live` status. + + - If you have not specified any minimum or maximum values for the + product options in your components, your shoppers can select any + combination of product options. + + + If you have configured minimum and maximum values using [Create a + Bundle](/docs/api/pxm/products/create-product), this becomes part of the + `bundle_configuration`. You can check how your bundle is configured + using [Get a product in a catalog + release](/docs/api/pxm/catalog/get-product) in `bundle_configuration` + under `meta`. The `bundle_configuration` forms the body of the request. + + + The response updates the `bundle_configuration` with the product options + the shopper selects. The `meta` data is updated with the `meta` data of + the selected product options. In your storefront, you could display this + as a summary of the product options a shopper has selected. + + + ### Including Resources + + + Using the `include` parameter, you can retrieve top-level resources, + such as, files or main image, bundle component products and product + attributes, such as SKU or slug. + + + | Parameter | Required | + Description + | + + | + :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + + | `component_products` | Optional | The component product data and key + attribute data, such as SKU or slug, to return for component products in + a product bundle. | + + | `main_image` | Optional | The main images associated with a + product. | + + | `files` | Optional | Any files associated with a product. + | + + + See [**Including Resources**](/guides/Getting-Started/includes). + parameters: + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/channel' + - $ref: '#/components/parameters/tag' + - name: product_id + in: path + description: The product ID. + required: true + schema: + type: string + requestBody: + $ref: '#/components/requestBodies/bundle-configuration-data' + responses: + '200': + description: The configured product of a catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/product-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Shopper Catalog API + security: + - bearerAuth: [] + /catalogs: + post: + operationId: createCatalog + summary: Creates a new catalog + description: > + Before you create a catalog, you must define the following resources: + + + - Hierarchies - hierarchies and nodes to categorize the products. + + - Products - product information, associated assets, and links to + hierarchy nodes. + + - Price Books - prices for the products associated with the hierarchies. + You can create multiple price books for different scenarios, such as + seasonal sales, business versus retail customer pricing, and reward + programs. When creating a catalog, you can specify up to five price + books. You must configure a priority for your price books. Product + prices are displayed in the catalog according to the priority of the + price books. Priority is a number and the price book with the highest + number has the highest priority. + requestBody: + description: Creates a catalog with the following attributes. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/catalog-create-data' + responses: + '201': + description: The created catalog + content: + application/json: + schema: + $ref: '#/components/schemas/catalog-data' + default: + description: Unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Catalogs + security: + - bearerAuth: [] + get: + operationId: getCatalogs + summary: Gets all authorized catalogs + description: > + Retrieves a list of all the catalogs that you are authorized to view. + Currently, published catalogs are limited to the current release and two + releases prior to the current release. You can see the differences + between the last 2 consecutive catalog releases using the delta link + returned in the response of a [publish a + catalog](/docs/api/pxm/catalog/publish-release) endpoint. + + You can use the `is_full_delta` attribute returned from the `get a + release of a catalog` endpoint to determine if you need to refresh the + data in your company system before publishing a catalog release and + injecting fresh data in a delta link. The `is_full_delta` attribute + tells you if this is a full publish of a catalog release. Using a search + service as an example, if the `is_full_delta` attribute is `true`, you + should remove all data about that catalog from the search service before + publishing a catalog release and injecting fresh data from the delta + file. See [Publish a catalog](/docs/api/pxm/catalog/publish-release). + + + If the `is_full_publish` attribute returned in the response is `false`, + data from the previous catalog release overlaid the existing data in the + delta file. The `is_full_publish` attribute is always `true` the first + time a catalog is published. + responses: + '200': + description: The list of catalogs. + content: + application/json: + schema: + $ref: '#/components/schemas/catalog-list-data' + default: + description: An unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Catalogs + security: + - bearerAuth: [] + /catalogs/{catalog_id}: + get: + operationId: getCatalogByID + summary: Get a catalog by ID + description: Retrieves the specified catalog. + parameters: + - name: catalog_id + in: path + description: The catalog ID. + required: true + schema: + type: string + responses: + '200': + description: The catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/catalog-data' + default: + description: An unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Catalogs + security: + - bearerAuth: [] + put: + operationId: updateCatalog + summary: Updates a catalog + description: >- + Specify whichever attributes you want to change. The values of the other + attributes remain the same. If the attributes section is empty, the + catalog is not updated. + parameters: + - name: catalog_id + in: path + description: The catalog ID. + required: true + schema: + type: string + requestBody: + description: Updated catalog. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/catalog-update-data' + responses: + '200': + description: An updated catalog with the following attributes. + content: + application/json: + schema: + $ref: '#/components/schemas/catalog-data' + default: + description: Unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Catalogs + security: + - bearerAuth: [] + delete: + operationId: deleteCatalogByID + summary: Deletes a catalog + description: >- + Deletes an unpublished catalog. Use [**Delete a + Release**](/docs/api/pxm/catalog/delete-release-by-id) and [**Delete All + Releases**](/docs/api/pxm/catalog/delete-releases) to delete releases of + a catalog. If the catalog is associated with any catalog rules, you must + first update the catalog rules to remove the catalog. + parameters: + - name: catalog_id + in: path + description: The catalog ID. + required: true + schema: + type: string + responses: + '204': + description: A 204 response indicates that the catalog has been deleted. + default: + description: Unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Catalogs + security: + - bearerAuth: [] + /catalogs/{catalog_id}/releases: + post: + operationId: publishRelease + summary: Publishes a catalog + description: > + Publishes a catalog. You must publish a catalog before you can retrieve + that catalog in an organization or store. The hierarchies, live + products, and prices associated with a published catalog are in + read-only mode. If you make a change to these resources, for example, a + change to your price book or hierarchies, you need to republish the + catalog. + + You can get [a catalog release](/docs/api/pxm/catalog/get-release-by-id) + to retrieve a published catalog. Currently, published catalogs are + limited to the current release and two releases prior to the current + release. + + You can see the differences between the last 2 consecutive catalog + releases. This is useful if want to understand how your products have + changed in your catalog, ensuring your site search integration is kept + up-to-date. + + Once a catalog release has completed publishing, the delta relationship + links to the delta document. + + + The `delta` links are signed and only valid for 1 hour. Re-reading a + catalog release, for example, using [Getting a release of a + catalog](/docs/pxm/catalogs/catalog-latest-release/get-a-release-of-a-catalog) + returns a fresh a link. + + You can use the `is_full_delta` attribute returned from the `get a + release of a catalog` endpoint to determine if you need to refresh the + data in your company system before injecting fresh data in a `delta` + link. The `is_full_delta` attribute tells you if this is a full publish + of the catalog. Using a search service as an example, if the + `is_full_delta` attribute is `true`, you should remove all data about + that catalog from the search service before injecting fresh data from + the `delta` file. If the `is_full_delta` attribute is `false`, then data + from the previous catalog overlays the existing data in the `delta` + file. To publish a catalog and inject fresh data in a `delta` link, set + `export_full_delta` to `true`. + + If a previous catalog publish date is greater than 90 days, then a full + catalog publish is automatically performed. If you publish your catalogs + infrequently, Commerce may perform a full publish when you are expecting + a delta publish. + + :::caution + + + Generating a full delta is resource intensive and slows down the + publishing process and so should only be performed in certain + circumstances, for example, when initializing an integration with a + service like Algolia. + + ::: + + The `is_full_delta` attribute is always `true` the first time a catalog + is published. The information is stored in a collection of `json` + documents in a compressed file. You can either manually check the file + or, for example, use them to automatically update another company system + you may have. + + - Delta files are only available for 30 days. + + - Delta files are removed when a catalog release is deleted. + + Each document has a `delta_type` with one of the following values, + depending on whether a product has been deleted, updated or created in a + catalog release. + + - `delete` describes products deleted from this release of a catalog. + + - `createupdate` describes products updated in this release of a + catalog. + + ### Multi-Store Management Solutions + + In a multi-store management solution. + + - You can create organization catalogs. Your organization catalogs are + available for your stores to use. + + - Your stores can create their own catalogs. + + - Your stores can create catalogs that have a combination of + organization products and store products. + + If you are publishing a catalog in a store that contains resources from + an organization, in Commerce Manager, you must enable the **Include + Organization Resources in Catalog Publishes** checkbox. + + 1. Go to **SYSTEM** > **Store Settings**. + + 2. Click **General Settings**. + + 3. Select **PXM** from the list. + + 4. Select the **Include Organization Resources in Catalog Publishes** + checkbox. + parameters: + - name: catalog_id + in: path + description: The catalog ID. + required: true + schema: + type: string + requestBody: + description: Options for catalog release publishing + content: + application/json: + schema: + $ref: '#/components/schemas/catalog-release-create-data' + responses: + '201': + description: Publishes a catalog release with the following attributes. + content: + application/json: + schema: + $ref: '#/components/schemas/release-data' + default: + description: Unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Releases + security: + - bearerAuth: [] + get: + operationId: getReleases + summary: Gets all authorized catalog releases + description: > + Returns a list of all published releases of the specified catalog. + Currently, published catalogs are limited to the current release and two + releases prior to the current release. You can see the differences + between the last 2 consecutive catalog releases using the `delta` link + returned in the response of a `publish a catalog` endpoint. + + + You can use the `is_full_delta` attribute returned from the `get a + release of a catalog` endpoint to determine if you need to refresh the + data in your company system before publishing a catalog release and + injecting fresh data in a delta link. The `is_full_delta` attribute + tells you if this is a full publish of a catalog release. Using a search + service as an example, if the `is_full_delta` attribute is `true`, you + should remove all data about that catalog from the search service before + publishing a catalog release and injecting fresh data from the delta + file. + + + If the `is_full_publish` attribute returned in the response is `false`, + data from the previous catalog release overlaid the existing data in the + delta file. The `is_full_publish` attribute is always `true` the first + time a catalog is published. + parameters: + - $ref: '#/components/parameters/accept-language' + - name: catalog_id + in: path + description: The catalog ID. + required: true + schema: + type: string + responses: + '200': + description: The list of catalogs. + content: + application/json: + schema: + $ref: '#/components/schemas/release-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Releases + security: + - bearerAuth: [] + delete: + operationId: deleteReleases + summary: Deletes all releases + description: Deletes all releases of the specified published catalog. + parameters: + - name: catalog_id + in: path + description: The catalog ID. + required: true + schema: + type: string + responses: + '204': + description: A 204 response indicates that the releases have been deleted. + default: + description: Unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Releases + security: + - bearerAuth: [] + /catalogs/{catalog_id}/releases/{release_id}: + get: + operationId: getReleaseByID + summary: Get a catalog release by ID + description: Retrieves the specified catalog release. + parameters: + - $ref: '#/components/parameters/accept-language' + - name: catalog_id + in: path + description: The catalog ID. + required: true + schema: + type: string + - name: release_id + in: path + description: The catalog release ID. + required: true + schema: + type: string + responses: + '200': + description: The catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/release-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Releases + security: + - bearerAuth: [] + delete: + operationId: deleteReleaseByID + summary: Deletes a release + description: Deletes the specified published catalog release. + parameters: + - name: catalog_id + in: path + description: The catalog ID. + required: true + schema: + type: string + - name: release_id + in: path + description: The catalog release ID. + required: true + schema: + type: string + responses: + '204': + description: A 204 response indicates that the release has been deleted. + default: + description: Unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Releases + security: + - bearerAuth: [] + /catalogs/rules: + post: + operationId: createRule + summary: Creates a new catalog rule + description: > + If you have multiple catalogs, create catalog rule resources. With + catalog rules, you can display different catalogs to different shoppers. + For example, you can display a preferred pricing catalog to a few + special customers. Or you can display one catalog to shoppers using your + website and a different catalog to shoppers using your mobile app. + Finally, you can define custom criteria by creating tags. + + + :::note + + + - If you have one catalog for all customers and channels, you can omit + creating this resource. + + - Due to the way catalogs are cached in Commerce, using catalog rules to + display catalogs sometimes causes a 5-minute time delay before the + catalogs are displayed. + + - You cannot create catalog rules for organization catalogs. + + + ::: + + + For ideas about the kinds of business scenarios you can achieve with + catalog rules, see [Catalog Rules](/docs/api/pxm/catalog/rules). To + understand how catalogs are matched to shoppers by using rules, see + [Resolving Catalog + Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + requestBody: + description: Creates a catalog rule with the following attributes. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/rule-create-data' + responses: + '201': + description: The created catalog rule + content: + application/json: + schema: + $ref: '#/components/schemas/rule-data' + default: + description: Unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Rules + security: + - bearerAuth: [] + get: + operationId: getRules + summary: Gets all authorized catalog rules + description: > + Retrieves all authorized catalog rules. + + + ### Filtering + + + This endpoint supports filtering. For general filtering syntax, see + [Filtering](/guides/Getting-Started/filtering). The following operators + and attributes are supported. + + + | Operator | Description | Supported Attributes | Example | + + |:--- |:--- |:--- |:--- | + + | `In` | Checks if the values are included in the specified string. If + they are, the condition is true. | `id` | `filter=in(id,some-id)` | + parameters: + - $ref: '#/components/parameters/filter-rule' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The list of catalog rules. + content: + application/json: + schema: + $ref: '#/components/schemas/rule-list-data' + default: + description: An unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Rules + security: + - bearerAuth: [] + /catalogs/rules/{catalog_rule_id}: + get: + operationId: getRuleByID + summary: Get a catalog rule by ID + parameters: + - name: catalog_rule_id + in: path + description: The catalog rule ID. + required: true + schema: + type: string + responses: + '200': + description: The catalog rile. + content: + application/json: + schema: + $ref: '#/components/schemas/rule-data' + default: + description: An unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Rules + security: + - bearerAuth: [] + put: + operationId: updateRule + summary: Updates a catalog rule + description: >- + Specify whichever attributes you want to change. The values of the other + attributes remain the same. If the attributes section is empty, the + catalog rule is not updated. + parameters: + - name: catalog_rule_id + in: path + description: The catalog rule ID. + required: true + schema: + type: string + requestBody: + description: An updated catalog rule with the following attributes. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/rule-update-data' + responses: + '200': + description: An Updated catalog rule with the following attributes. + content: + application/json: + schema: + $ref: '#/components/schemas/rule-data' + default: + description: Unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Rules + security: + - bearerAuth: [] + delete: + operationId: deleteRuleByID + summary: Deletes a catalog rule + parameters: + - name: catalog_rule_id + in: path + description: The catalog rule ID. + required: true + schema: + type: string + responses: + '204': + description: A 204 response indicates that the catalog rule has been deleted. + default: + description: Unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Rules + security: + - bearerAuth: [] + /catalogs/{catalog_id}/releases/{release_id}/hierarchies: + get: + operationId: getAllHierarchies + summary: Get all Hierarchies + description: > + Returns the hierarchies from a published catalog. + + :::note + + Currently, published catalogs are limited to the current release and two + releases prior to the current release. + + ::: + + ### Filtering + + This endpoint supports filtering. For general syntax, see + [Filtering](/guides/Getting-Started/filtering). + + + | Operator | Description | Supported Attributes | Example | + + |:--- |:--- |:--- |:--- | + + | `Eq` | Checks if the values of two operands are equal. If they are, + the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | + + | `In` | Checks if the values are included in the specified string. If + they are, the condition is true. | `id` | `filter=in(id,some-id)` | + + ### Building breadcrumbs in a storefront + + + In a catalog, you can use a filter to return a list of nodes in a + hierarchy structure that a product belongs to. You can use this to build + breadcrumbs in your storefront. An example is shown below. + + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + + - Specify the node Ids in the filter expression. + + - You can have as many node Ids as you want. + + - It does not matter what order you specify the node Ids. The nodes are + returned in the order they were last updated. + parameters: + - $ref: '#/components/parameters/accept-language' + - name: catalog_id + in: path + description: The catalog ID. + required: true + schema: + type: string + - name: release_id + in: path + description: >- + The unique identifier of a published release of the catalog or + `latest` for the most recently published version. + required: true + schema: + type: string + - $ref: '#/components/parameters/filter-hierarchy' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The hierarchies of a catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/hierarchy-list-data' + default: + description: An unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Administrator Latest Releases Catalog API + security: + - bearerAuth: [] + /catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}: + get: + operationId: getHierarchy + summary: Get a Hierarchy + description: > + Returns the specified hierarchy from a published catalog. + + + :::note + + + Currently, published catalogs are limited to the current release and two + releases prior to the current release. + + + ::: + parameters: + - $ref: '#/components/parameters/accept-language' + - name: catalog_id + in: path + description: The catalog ID. + required: true + schema: + type: string + - name: release_id + in: path + description: >- + The unique identifier of a published release of the catalog or + `latest` for the most recently published version. + required: true + schema: + type: string + - name: hierarchy_id + in: path + description: The catalog hierarchy ID. + required: true + schema: + type: string + responses: + '200': + description: The catalog hierarchy. + content: + application/json: + schema: + $ref: '#/components/schemas/hierarchy-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Administrator Latest Releases Catalog API + security: + - bearerAuth: [] + /catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/nodes: + get: + operationId: getHierarchyNodes + summary: Get a Hierarchy's Nodes + description: > + Returns all nodes for the specified hierarchy from a published catalog. + + + :::note + + + Currently, published catalogs are limited to the current release and two + releases prior to the current release. + + + ::: + + + In the `bread_crumb` metadata, you can identify the parent nodes that a + node is associated with. This is useful if you want to improve how your + shoppers search your store, for example. See [Product and Node + Associations in Breadcrumb + Metadata](/guides/How-To/Catalogs/breadcrumbs). + + + ### Filtering + + + This endpoint supports filtering. For general syntax, see + [Filtering](/guides/Getting-Started/filtering). + + + | Operator | Description | Supported Attributes | Example | + + |:--- |:--- |:--- |:--- | + + | `Eq` | Checks if the values of two operands are equal. If they are, + the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | + + | `In` | Checks if the values are included in the specified string. If + they are, the condition is true. | `id` | `filter=in(id,some-id)` | + + + ### Building breadcrumbs in a storefront + + + In a catalog, you can use a filter to return a list of nodes in a + hierarchy structure that a product belongs to. You can use this to build + breadcrumbs in your storefront. An example is shown below. + + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + + - Specify the node Ids in the filter expression. + + - You can have as many node Ids as you want. + + - It does not matter what order you specify the node Ids. The nodes are + returned in the order they were last updated. + parameters: + - name: catalog_id + in: path + description: The catalog ID. + required: true + schema: + type: string + - name: release_id + in: path + description: The catalog release ID. + required: true + schema: + type: string + - name: hierarchy_id + in: path + description: The catalog hierarchy ID. + required: true + schema: + type: string + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-node' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The child nodes of a catalog hierarchy. + content: + application/json: + schema: + $ref: '#/components/schemas/node-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Administrator Latest Releases Catalog API + security: + - bearerAuth: [] + /catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/children: + get: + operationId: getHierarchyChildNodes + summary: Get a Hierarchy's Children + description: > + Returns the parent nodes for the specified hierarchy from a published + catalog. + + + ![Parent Nodes](/assets/rootnodes.PNG) + + + :::note + + + Currently, published catalogs are limited to the current release and two + releases prior to the current release. + + + ::: + + + In the `bread_crumb` metadata, you can identify the parent nodes that a + node is associated with. This is useful if you want to improve how your + shoppers search your store, for example. See [Product and Node + Associations in Breadcrumb + Metadata](/guides/How-To/Catalogs/breadcrumbs). + + + ### Filtering + + + This endpoint supports filtering. For general syntax, see + [Filtering](/guides/Getting-Started/filtering). + + + | Operator | Description | Supported Attributes | Example | + + |:--- |:--- |:--- |:--- | + + | `Eq` | Checks if the values of two operands are equal. If they are, + the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | + + | `In` | Checks if the values are included in the specified string. If + they are, the condition is true. | `id` | `filter=in(id,some-id)` | + + + ### Building breadcrumbs in a storefront + + + In a catalog, you can use a filter to return a list of nodes in a + hierarchy structure that a product belongs to. You can use this to build + breadcrumbs in your storefront. An example is shown below. + + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + + - Specify the node Ids in the filter expression. + + - You can have as many node Ids as you want. + + - It does not matter what order you specify the node Ids. The nodes are + returned in the order they were last updated. + parameters: + - name: catalog_id + in: path + description: The catalog ID. + required: true + schema: + type: string + - name: release_id + in: path + description: >- + The unique identifier of a published release of the catalog or + `latest` for the most recently published version. + required: true + schema: + type: string + - name: hierarchy_id + in: path + description: The catalog hierarchy ID. + required: true + schema: + type: string + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-node' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The child nodes of a catalog hierarchy. + content: + application/json: + schema: + $ref: '#/components/schemas/node-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Administrator Latest Releases Catalog API + security: + - bearerAuth: [] + /catalogs/{catalog_id}/releases/{release_id}/nodes: + get: + operationId: getAllNodes + summary: Get all Nodes + description: > + Returns the child nodes from a published catalog. + + :::note + + Currently, published catalogs are limited to the current release and two + releases prior to the current release. + + ::: + + You can see the parent nodes a node is associated with in the + `bread_crumb` metadata for each node. This is useful if you want to + improve how your shoppers search your store, for example. See [Product + and Node Associations in Breadcrumb + Metadata](/guides/How-To/Catalogs/breadcrumbs). + + + In a catalog, you can use a filter to return a list of nodes in a + hierarchy structure that a product belongs to. You can use this to build + breadcrumbs in your storefront. See [Building breadcrumbs in a + storefront](#building-breadcrumbs-in-a-storefront). + + + The response lists the products associated with the nodes. If products + are [curated](/guides/How-To/Products/curating-products), they are + displayed in `curated_products`. Product curation allows you to promote + specific products within each of your hierarchies, enabling you to + create unique product collections in your storefront. + + + - If you don't provide any `curated_products`, products are listed by + their `updated_at` time in descending order, with the most recently + updated product first. + + - If you configure `curated_products` for only a few products, the + curated products are displayed first and the other products are + displayed in the order of `updated_at` time. + + - You can only curate 20 products or less. You cannot have more than 20 + curated products. + + - If a curated product is removed from a node, the product is also + removed from the `curated_products` list. + + - A product that is curated has the `"curated_product": true` attribute + displayed. + + ### Filtering + + This endpoint supports filtering. For general syntax, see + [Filtering](/guides/Getting-Started/filtering). The following operators + and attributes are available. + + + | Operator | Description | Attributes | Example | + + | --- | --- | --- | --- | + + | `Eq` | Checks if the values of two operands are equal. If they are, + the condition is true. | `name`, `slug` | `filter=eq(name,some-name)` | + + | `in` | Checks if the values are included in the specified string. + If they are, the condition is true. + + | `Id` | + `filter=in(id,9214719b-17fe-4ea7-896c-d61e60fc0d05,e104d541-2c52-47fa-8a9a-c4382480d97c,65daaf68-ff2e-4632-8944-370de835967d)` + | + + ### Building breadcrumbs in a storefront + + + In a catalog, you can use a filter to return a list of nodes in a + hierarchy structure that a product belongs to. You can use this to build + breadcrumbs in your storefront. An example is shown below. + + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + + - Specify the node Ids in the filter expression. + + - You can have as many node Ids as you want. + + - It does not matter what order you specify the node Ids. The nodes are + returned in the order they were last updated. + parameters: + - name: catalog_id + in: path + description: The catalog ID. + required: true + schema: + type: string + - name: release_id + in: path + description: >- + The unique identifier of a published release of the catalog or + `latest` for the most recently published version. + required: true + schema: + type: string + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-node' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The nodes of a catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/node-list-data' + default: + description: An unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Administrator Latest Releases Catalog API + security: + - bearerAuth: [] + /catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}: + get: + operationId: getNode + summary: Get a Node + description: > + Returns a node from a published catalog. + + :::note + + Currently, published catalogs are limited to the current release and two + releases prior to the current release. + + ::: + + You can see the parent nodes a node is associated with in the + `bread_crumb` metadata for each node. This is useful if you want to + improve how your shoppers search your store, for example. See [Product + and Node Associations in Breadcrumb + Metadata](/guides/How-To/Catalogs/breadcrumbs). + + The response lists the products associated with the nodes. If products + are [curated](/guides/How-To/Products/curating-products), they are + displayed in `curated_products`. Product curation allows you to promote + specific products within each of your hierarchies, enabling you to + create unique product collections in your storefront. + + - If you don't provide any `curated_products`, products are listed by + their `updated_at` time in descending order, with the most recently + updated product first. + + - If you configure `curated_products` for only a few products, the + curated products are displayed first and the other products are + displayed in the order of `updated_at` time. + + - You can only curate 20 products or less. You cannot have more than 20 + curated products. + + - If a curated product is removed from a node, the product is also + removed from the `curated_products` list. + + - A product that is curated has the `"curated_product": true` attribute + displayed. + parameters: + - $ref: '#/components/parameters/accept-language' + - name: catalog_id + in: path + description: The catalog ID. + required: true + schema: + type: string + - name: release_id + in: path + description: >- + The unique identifier of a published release of the catalog or + `latest` for the most recently published version. + required: true + schema: + type: string + - name: node_id + in: path + description: The catalog node ID. + required: true + schema: + type: string + responses: + '200': + description: The catalog node. + content: + application/json: + schema: + $ref: '#/components/schemas/node-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Administrator Latest Releases Catalog API + security: + - bearerAuth: [] + /catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/children: + get: + operationId: getChildNodes + summary: Get a Node's Children + description: > + Returns the child nodes for a node from a published catalog. + + + :::note + + + Currently, published catalogs are limited to the current release and two + releases prior to the current release. + + + ::: + + + You can see the parent nodes a node is associated with in the + `bread_crumb` metadata for each node. This is useful if you want to + improve how your shoppers search your store, for example. See [Product + and Node Associations in Breadcrumb + Metadata](/guides/How-To/Catalogs/breadcrumbs). + + + In a catalog, you can use a filter to return a list of nodes in a + hierarchy structure that a product belongs to. You can use this to build + breadcrumbs in your storefront. For more information, see [Building + breadcrumbs in a storefront](#building-breadcrumbs-in-a-storefront). + + + The response lists the products associated with the nodes. If products + are [curated](/guides/How-To/Products/curating-products), they are + displayed in `curated_products`. Product curation allows you to promote + specific products within each of your hierarchies, enabling you to + create unique product collections in your storefront. + + + - If you don't provide any `curated_products`, products are listed by + their `updated_at` time in descending order, with the most recently + updated product first. + + - If you configure `curated_products` for only a few products, the + curated products are displayed first and the other products are + displayed in the order of `updated_at` time. + + - You can only curate 20 products or less. You cannot have more than 20 + curated products. + + - If a curated product is removed from a node, the product is also + removed from the `curated_products` list. + + - A product that is curated has the `"curated_product": true` attribute + displayed. + + + ### Filtering + + + This endpoint supports filtering. For general syntax, see + [Filtering](/guides/Getting-Started/filtering). The following operators + and attributes are available. + + + | Operator | Description | Attributes | Example | + + | --- | --- | --- | --- | + + | `Eq` | Checks if the values of two operands are equal. If they are, + the condition is true. | `name`, `slug` | `filter=eq(name,some-name)` | + + | `in` | Checks if the values are included in the specified string. + If they are, the condition is true. + + | `Id` | + `filter=in(id,9214719b-17fe-4ea7-896c-d61e60fc0d05,e104d541-2c52-47fa-8a9a-c4382480d97c,65daaf68-ff2e-4632-8944-370de835967d)` + | + + + ### Building breadcrumbs in a storefront + + + In a catalog, you can use a filter to return a list of nodes in a + hierarchy structure that a product belongs to. You can use this to build + breadcrumbs in your storefront. An example is shown below. + + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + + - Specify the node Ids in the filter expression. + + - You can have as many node Ids as you want. + + - It does not matter what order you specify the node Ids. The nodes are + returned in the order they were last updated. + parameters: + - name: catalog_id + in: path + description: The catalog ID. + required: true + schema: + type: string + - name: release_id + in: path + description: >- + The unique identifier of a published release of the catalog or + `latest` for the most recently published version. + required: true + schema: + type: string + - name: node_id + in: path + description: The catalog node ID. + required: true + schema: + type: string + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-node' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The child nodes of a catalog node. + content: + application/json: + schema: + $ref: '#/components/schemas/node-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Administrator Latest Releases Catalog API + security: + - bearerAuth: [] + /catalogs/{catalog_id}/releases/{release_id}/products: + get: + operationId: getAllProducts + summary: Get all Products + description: > + Returns the products from a published catalog. Only the products in a + `live` status are retrieved. Currently, published catalogs are limited + to the current release and two releases prior to the current release. + + + You can see the parent nodes a product is associated with in the + `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This + is useful if you want to improve how your shoppers search your store, + for example. See [Product and Node Associations in Breadcrumb + Metadata](/guides/How-To/Catalogs/breadcrumbs). + + + The `variations` object lists the variation IDs and variation option IDs + and their corresponding product IDs that are generated when the + variation and variation options are built with a product. The + `variations` object can then be added to your catalogs. By default, + variations and variation options are sorted randomly. You can use the + `sort_order` attribute to sort the order of your variation and variation + options in `variations`. Once a parent product is published in a + catalog, the [Get a List of products in a catalog + release](/docs/api/pxm/catalog/get-all-products) response displays the + sorted variations and variation options. Variations and variation + options are displayed in descending order according to their + `sort_order` values. + + ### Including Resources + + + Using the `include` parameter, you can retrieve top-level resources, + such as, files or main image, bundle component products and product + attributes, such as SKU or slug. + + + | Parameter | Required | + Description + | + + | + :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + + | `component_products` | Optional | The component product data and key + attribute data, such as SKU or slug, to return for component products in + a product bundle. | + + | `main_image` | Optional | The main images associated with a + product. + | + + | `files` | Optional | Any files associated with a + product. + + + See [**Including Resources**](/guides/Getting-Started/includes). + + ### Filtering + + This endpoint supports filtering. For general filtering syntax, see + [Filtering](/guides/Getting-Started/filtering). The following operators + and attributes are available when filtering on this endpoint. + + | Operator | + Description + | Supported Attributes | Example | + + |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- + | + + | `Eq` | Checks if the values of two operands are equal. If they are, + the condition is true. For `product_types`, you can only specify one + product type. For example, `filter=eq(product_types,child)`. + | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, + `product_types`, `tags` | `filter=eq(name,some-name)` | + + | `In` | Checks if the values are included in the specified string. If + they are, the condition is true. For `product_types`, you can specify + more than one product type. For example, + `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, + `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | + `filter=in(id,some-id)` | + + ### Building breadcrumbs in a storefront + + + In a catalog, you can use a filter to return a list of nodes in a + hierarchy structure that a product belongs to. You can use this to build + breadcrumbs in your storefront. An example is shown below. + + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + + - Specify the node Ids in the filter expression. + + - You can have as many node Ids as you want. + + - It does not matter what order you specify the node Ids. The nodes are + returned in the order they were last updated. + parameters: + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-product' + - name: catalog_id + in: path + description: The catalog ID. + required: true + schema: + type: string + - name: release_id + in: path + description: >- + The unique identifier of a published release of the catalog or + `latest` for the most recently published version. + required: true + schema: + type: string + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The products of a catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/product-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Administrator Latest Releases Catalog API + security: + - bearerAuth: [] + /catalogs/{catalog_id}/releases/{release_id}/products/{product_id}: + get: + operationId: getProduct + summary: Get a Product + description: > + Returns a product from a published catalog. The product must be in + `live` status. Currently, published catalogs are limited to the current + release and two releases prior to the current release. + + + ### Product and Node Associations in Breadcrumb Metadata + + + You can see the parent nodes a product is associated with in the + `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This + is useful if you want to improve how your shoppers search your store, + for example. See [Product and Node Associations in Breadcrumb + Metadata](/guides/How-To/Catalogs/breadcrumbs). + + + ### Product Variations + + + The `variations` object lists the variation IDs and variation option IDs + and their corresponding product IDs that are generated when the + variation and variation options are built with a product. The + `variations` object can then be added to your catalogs. By default, + variations and variation options are sorted randomly. You can use the + `sort_order`attribute to sort the order of your variation and variation + options in `variations`. Once a parent product is published in a + catalog, the get a product in a catalog release response displays the + sorted variations and variation options. Variations and variation + options are displayed in descending order according to their + `sort_order` values. + + + ### Including Resources + + + Using the `include` parameter, you can retrieve top-level resources, + such as, files or main image, bundle component products and product + attributes, such as SKU or slug. + + + | Parameter | Required | + Description + | + + | + :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + + | `component_products` | Optional | The component product data and key + attribute data, such as SKU or slug, to return for component products in + a product bundle. | + + | `main_image` | Optional | The main images associated with a + product. + | + + | `files` | Optional | Any files associated with a + product. + + + See [**Including Resources**](/guides/Getting-Started/includes). + parameters: + - $ref: '#/components/parameters/accept-language' + - name: catalog_id + in: path + description: The catalog ID. + required: true + schema: + type: string + - name: release_id + in: path + description: >- + The unique identifier of a published release of the catalog or + `latest` for the most recently published version. + required: true + schema: + type: string + - name: product_id + in: path + description: The product ID. + required: true + schema: + type: string + responses: + '200': + description: The product of a catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/product-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Administrator Latest Releases Catalog API + security: + - bearerAuth: [] + /catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/component_products: + get: + operationId: getComponentProductIDs + summary: Get a Bundle's Component Products + description: > + With Product Experience Manager, you can + [create](/docs/api/pxm/products/create-product) and manage bundles. A + bundle is a purchasable product, comprising of one or more products that + you want to sell together. + + + You can create multiple components within a bundle. Each component must + have at least one or more options. Each option is a product and a + quantity. + + + This endpoint returns a list of component product IDs for the specified + bundle. + + + ### Including Resources + + + Using the `include` parameter, you can retrieve top-level resources, + such as, files or main image, bundle component products and product + attributes, such as SKU or slug. + + + | Parameter | Required | + Description + | + + | + :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + + | `component_products` | Optional | The component product data and key + attribute data, such as SKU or slug, to return for component products in + a product bundle. | + + | `main_image` | Optional | The main images associated with a + product. | + + | `files` | Optional | Any files associated with a product. + | + + + See [**Including Resources**](/guides/Getting-Started/includes). + parameters: + - name: catalog_id + in: path + description: The catalog ID. + required: true + schema: + type: string + - name: release_id + in: path + description: >- + The unique identifier of a published release of the catalog or + `latest` for the most recently published version. + required: true + schema: + type: string + - name: product_id + in: path + description: The product ID. + required: true + schema: + type: string + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: >- + The list of component product IDs of a specific bundle product from + a catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/product-reference-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Administrator Latest Releases Catalog API + security: + - bearerAuth: [] + /catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/children: + get: + operationId: getChildProducts + summary: Get a Parent Product's Child Products + description: > + For a specified product and catalog release, retrieves a list of child + products from a parent product. Any product other than a base product + results in a `422 Unprocessable Entity` response. Only the products in a + `live` status are retrieved. + + If you have multiple catalog rules defined, the rule that best matches + the shoppers context is used to determine which catalog is retrieved. If + no catalog rules are configured, the first catalog found is returned. + For information about how rules are matched, see [Resolving Catalog + Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + You can see the parent nodes a product is associated within the + breadcrumbs metadata for each product. For example, this is useful if + you want to improve how your shoppers search your store. See [Product + and Node Associations in Breadcrumb + Metadata](/guides/How-To/Catalogs/breadcrumbs). + + ### Filtering + + This endpoint supports filtering. For general filtering syntax, see + [Filtering](/guides/Getting-Started/filtering). The following operators + and attributes are available when filtering on this endpoint. + + | Operator | + Description + | Supported Attributes | Example | + + |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- + | + + | `Eq` | Checks if the values of two operands are equal. If they are, + the condition is true. For `product_types`, you can only specify one + product type. For example, `filter=eq(product_types,child)`. + | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, + `product_types`, `tags` | `filter=eq(name,some-name)` | + + | `In` | Checks if the values are included in the specified string. If + they are, the condition is true. For `product_types`, you can specify + more than one product type. For example, + `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, + `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | + `filter=in(id,some-id)` | + + ### Building breadcrumbs in a storefront + + In a catalog, you can use a filter to return a list of nodes in a + hierarchy structure that a product belongs to. You can use this to build + breadcrumbs in your storefront. An example is shown below. + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + - Specify the node Ids in the filter expression. + + - You can have as many node Ids as you want. + + - It does not matter what order you specify the node Ids. The nodes are + returned in the order they were last updated. + + ### Including Resources + + Using the `include` parameter, you can retrieve top-level resources, + such as, files or main image, bundle component products and product + attributes, such as SKU or slug. + + | Parameter | Required | + Description + | + + | + :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + + | `component_products` | Optional | The component product data and key + attribute data, such as SKU or slug, to return for component products in + a product bundle. | + + | `main_image` | Optional | The main images associated with a + product. | + + | `files` | Optional | Any files associated with a product. + | + + See [**Including Resources**](/guides/Getting-Started/includes). + parameters: + - name: catalog_id + in: path + description: The catalog ID. + required: true + schema: + type: string + - name: release_id + in: path + description: >- + The unique identifier of a published release of the catalog or + `latest` for the most recently published version. + required: true + schema: + type: string + - name: product_id + in: path + description: The product ID. + required: true + schema: + type: string + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-product' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: >- + The list of child products of a specific base product from a + catalog. + content: + application/json: + schema: + $ref: '#/components/schemas/product-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Administrator Latest Releases Catalog API + security: + - bearerAuth: [] + /catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/products: + get: + operationId: getProductsForHierarchy + summary: Get a Hierarchy's Products + description: > + Returns the products associated with the specified hierarchy in the + catalog. The products must be in the `live` status. + + + If you have multiple catalog rules defined, the rule that best matches + the shoppers context is used to determine which catalog is retrieved. + See [Resolving catalog + rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + + You can see the parent nodes a product is associated with in the + `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This + is useful if you want to improve how your shoppers search your store, + for example. See [Product and Node Associations in Breadcrumb + Metadata](/guides/How-To/Catalogs/breadcrumbs). + + + The `variations` object lists the variation IDs and variation option IDs + and their corresponding product IDs that are generated when the + variation and variation options are built with a product. The variations + object can then be added to your catalogs. By default, variations and + variation options are sorted randomly. You can use the `sort_order` + attribute to sort the order of your variation and variation options in + variations. Once a parent product is published in a catalog, the [Get a + List of products in a catalog](/docs/api/pxm/catalog/get-all-products) + release response displays the sorted variations and variation options. + Variations and variation options are displayed in descending order + according to their `sort_order` values. + + + ### Filtering + + + This endpoint supports filtering. For general filtering syntax, see + [Filtering](/guides/Getting-Started/filtering). The following operators + and attributes are available when filtering on this endpoint. + + + | Operator | + Description + | Supported Attributes | Example | + + |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- + | + + | `Eq` | Checks if the values of two operands are equal. If they are, + the condition is true. For `product_types`, you can only specify one + product type. For example, `filter=eq(product_types,child)`. | + `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, + `product_types`, `tags` | `filter=eq(name,some-name)` | + + | `In` | Checks if the values are included in the specified string. If + they are, the condition is true. For `product_types`, you can specify + more than one product type. For example, + `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, + `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | + `filter=in(id,some-id)` | + + + ### Building breadcrumbs in a storefront + + + In a catalog, you can use a filter to return a list of nodes in a + hierarchy structure that a product belongs to. You can use this to build + breadcrumbs in your storefront. An example is shown below. + + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + + - Specify the node Ids in the filter expression. + + - You can have as many node Ids as you want. + + - It does not matter what order you specify the node Ids. The nodes are + returned in the order they were last updated. + + + ### Including Resources + + + Using the `include` parameter, you can retrieve top-level resources, + such as, files or main image, bundle component products and product + attributes, such as SKU or slug. + + + | Parameter | Required | + Description + | + + | + :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + + | `component_products` | Optional | The component product data and key + attribute data, such as SKU or slug, to return for component products in + a product bundle. | + + | `main_image` | Optional | The main images associated with a + product. | + + | `files` | Optional | Any files associated with a product. + | + + + See [**Including Resources**](/guides/Getting-Started/includes). + parameters: + - $ref: '#/components/parameters/accept-language' + - name: catalog_id + in: path + description: The catalog ID. + required: true + schema: + type: string + - name: release_id + in: path + description: >- + The unique identifier of a published release of the catalog or + `latest` for the most recently published version. + required: true + schema: + type: string + - name: hierarchy_id + in: path + description: The catalog hierarchy ID. + required: true + schema: + type: string + - $ref: '#/components/parameters/filter-product' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The products of a catalog hierarchy. + content: + application/json: + schema: + $ref: '#/components/schemas/product-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Administrator Latest Releases Catalog API + security: + - bearerAuth: [] + /catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/products: + get: + operationId: getProductsForNode + summary: Get a Node's Products + description: > + Returns the products associated with the specified hierarchy node in the + catalog. The products must be in the `live` status. If the products have + been curated, then the products are returned in the order specified in + the `curated_products` attribute. A product that is curated has the + `"curated_product": true` attribute displayed. + + :::note + + Currently, published catalogs are limited to the current release and two + releases prior to the current release. + + ::: + + + If you have multiple catalog rules defined, the rule that best matches + the shoppers context is used to determine which catalog is retrieved. + See [Resolving catalog + rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + + + You can see the parent nodes a product is associated with in the + `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This + is useful if you want to improve how your shoppers search your store, + for example. See [Product and Node Associations in Breadcrumb + Metadata](/guides/How-To/Catalogs/breadcrumbs). + + The `variations` object lists the variation IDs and variation option IDs + and their corresponding product IDs that are generated when the + variation and variation options are built with a product. The + `variations` object can then be added to your catalogs. By default, + variations and variation options are sorted randomly. You can use the + `sort_order` attribute to sort the order of your variation and variation + options in `variations`. Once a parent product is published in a + catalog, the [Get a List of products in a catalog + release](/docs/api/pxm/catalog/get-all-products) response displays the + sorted variations and variation options. Variations and variation + options are displayed in descending order according to their + `sort_order` values. + + + ### Filtering + + This endpoint supports filtering. For general filtering syntax, see + [Filtering](/guides/Getting-Started/filtering). The following operators + and attributes are available when filtering on this endpoint. + + | Operator | + Description + | Supported Attributes | Example | + + |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- + | + + | `Eq` | Checks if the values of two operands are equal. If they are, + the condition is true. For `product_types` and `tags`, you can only + specify one. For example, `filter=eq(product_types,child)`. | + `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, + `product_types`, `tags` | `filter=eq(name,some-name)` | + + | `In` | Checks if the values are included in the specified string. If + they are, the condition is true. For `product_types` and `tags`, you can + specify more than one. For example, + `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, + `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | + `filter=in(id,some-id)` | + + ### Building breadcrumbs in a storefront + + In a catalog, you can use a filter to return a list of nodes in a + hierarchy structure that a product belongs to. You can use this to build + breadcrumbs in your storefront. An example is shown below. + + `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + + - Specify the node Ids in the filter expression. + + - You can have as many node Ids as you want. + + - It does not matter what order you specify the node Ids. The nodes are + returned in the order they were last updated. + + ### Including Resources + + Using the `include` parameter, you can retrieve top-level resources, + such as, files or main image, bundle component products and product + attributes, such as SKU or slug. + + | Parameter | Required | + Description + | + + | + :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + + | `component_products` | Optional | The component product data and key + attribute data, such as SKU or slug, to return for component products in + a product bundle. | + + | `main_image` | Optional | The main images associated with a + product. | + + | `files` | Optional | Any files associated with a product. + | + + See [**Including Resources**](/guides/Getting-Started/includes). + parameters: + - $ref: '#/components/parameters/accept-language' + - $ref: '#/components/parameters/filter-product' + - name: catalog_id + in: path + description: The catalog ID. + required: true + schema: + type: string + - name: release_id + in: path + description: >- + The unique identifier of a published release of the catalog or + `latest` for the most recently published version. + required: true + schema: + type: string + - name: node_id + in: path + description: The catalog node ID. + required: true + schema: + type: string + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/offset' + responses: + '200': + description: The products of a catalog node. + content: + application/json: + schema: + $ref: '#/components/schemas/product-list-data' + default: + description: The unexpected error. + content: + application/json: + schema: + $ref: '#/components/schemas/error-response' + tags: + - Administrator Latest Releases Catalog API + security: + - bearerAuth: [] + /v2/carts: + get: + tags: + - Cart Management + summary: Get Shopper Carts + description: > + You can retrieve the carts that are associated with an + [account](/docs/api/carts/account-cart-associations) or a + [customer](/docs/api/carts/customer-cart-associations). + + + When a shopper retrieves their latest carts, the carts are sorted in + descending order by the updated_date. For more information, see + [Pagination](/guides/Getting-Started/pagination). + + + :::note + + + Requires an `implicit` token with only one of [Account Management + Authentication + Token](/docs/api/accounts/post-v-2-account-members-tokens) or [customer + token](/docs/customer-management/customer-management-api/customer-tokens). + + + ::: + operationId: getCarts + parameters: + - name: EP-Account-Management-Authentication-Token + in: header + description: >- + An Account Management Authentication token to access a specific + account's carts. + style: simple + schema: + type: string + example: '{{accountToken}}' + - name: x-moltin-customer-token + in: header + description: A customer token to access a specific customer's carts. + style: simple + schema: + type: string + example: '{{customerToken}}' + responses: + '200': + description: '' + headers: {} + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + type: array + items: + $ref: '#/components/schemas/CartResponse' + links: + $ref: '#/components/schemas/Response.PageLinks' + meta: + $ref: '#/components/schemas/Response.Meta.Carts' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + post: + tags: + - Cart Management + summary: Create a Cart + description: > + + Creates a cart. Call this endpoint each time a customer creates a cart. + + + Each shopper can have multiple carts. Use the carts API to create a + cart. The carts are distinct from one another. Shoppers can add + different items to their carts. They can check out one of the carts + without affecting the content or status of their other carts. + + + After the shopper checks out the cart, the cart remains available to the + shopper. The cart is persistent and stays with the shopper after it is + used. + + + You can also create a cart to specify custom discounts. You can enable + custom discounts when the `discount_settings.custom_discounts_enabled` + field is set to `true`. Default is set from cart discount settings for + the store. See [Update Cart + Settings](/docs/api/settings/put-v-2-settings-cart). + + + ### Preview Cart + + + You can set a future date for your shopping cart and view the promotions + that will be available during that time period. This feature enables you + to validate your promotion settings and observe how they will be applied + in the cart. + + + :::caution + + - Once the cart is in preview mode, you cannot revert it to a regular + cart. + + - Carts with `snapshot_date` are same as preview carts. + + - You cannot checkout a cart that includes a `snapshot_date`. + + - To delete a promotion preview cart, use [Delete a + cart](/docs/api/carts/delete-a-cart) endpoint. + + - The promotion preview cart has the same expiration time as a regular + cart based on the store's [cart + settings](/docs/api/settings/put-v-2-settings-cart). + + - Preview cart interactions skip inventory checks and events, allowing + users to preview future carts without impacting related external + systems. + + ::: + + + ### Errors + + + - `400 Bad Request` : This is returned when the submitted request does + not adhere to the expected API contract for the endpoint. + + - For example, in the case of string fields, this error might indicate issues in the length or format of submitted strings. For more information about valid string fields, refer to Safe Characters section. + - In the case of preview carts (those with `snapshot_date`), an error is returned for invalid actions, such as removing the preview date, setting a preview date in the past, or attempting to checkout a cart with a `snapshot_date`. + operationId: createACart + parameters: + - name: x-moltin-customer-token + in: header + description: A customer token to be associated with the cart. + style: simple + schema: + type: string + example: '{{customerToken}}' + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/CartsRequest' + required: false + responses: + '200': + description: '' + headers: {} + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/CartResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + parameters: [] + /v2/carts/{cartID}: + get: + tags: + - Cart Management + summary: Get a Cart + description: > + Use this endpoint to retrieve a specific cart. If a cart ID does not + exist, a new cart will be automatically created. If the cart is + associated with shipping groups, calling this endpoint displays the + associated shipping group IDs in the `relationships` section. + + + You can easily get a new or existing cart by providing the unique cart + reference in the request. If the cart is associated with shipping + groups, calling this endpoint displays the associated shipping group IDs + in the relationships section. + + + :::note + + + - The default cart name is Cart. However, you can update the cart name + as required. Ensure that the string length of the name is greater than + or equal to one. Follow the safe character guidelines for name and + description naming. For more information about cart ID naming + requirements, see the [Safe + Characters](/guides/Getting-Started/safe-characters) section. + + - Outside of the JS-SDK, we don’t handle creating cart references. You + need to create your own. + + + ::: + + + :::caution + + + An empty cart is returned for any carts that don’t currently exist. For + more information about the cart items object, see [Get Cart + Items](/docs/api/carts/get-cart-items). + + + ::: + + + ### Query parameters + + + + | Name | Required | Type | + Description | + + |:----------|:---------|:---------|:-------------------------------------------| + + | `include` | Optional | `string` | Comma-delimited string of entities + that can be included. The information included are `items`,`tax_items`, + `custom_discounts`, or `promotions`. | + operationId: getCart + parameters: + - name: cartID + in: path + description: The unique identifier for this cart that you created. + required: true + style: simple + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/CartResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + put: + tags: + - Cart Management + summary: Update a Cart + description: > + Updates cart properties for the specified cartID. + + + You can also update a cart to specify custom discounts. You can enable + custom discounts when the `discount_settings.custom_discounts_enabled` + field is set to `true`. Default is set from cart discount settings for + the store. See [Cart + Settings](/docs/api/settings/put-v-2-settings-cart). + operationId: updateACart + parameters: + - name: cartID + in: path + description: The unique identifier of a cart created by you. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/CartsRequest' + required: false + responses: + '200': + description: '' + headers: {} + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/CartResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + delete: + tags: + - Cart Management + summary: Delete a Cart + description: > + You can delete a cart, including the items, name, description, and + remove all associations. + + + ### Errors + + + The following error message is received when you attempt to delete a + cart that is associated with a customer. Before deletion, ensure that + the cart is disassociated. + + + ```json + + message: { + errors: [ + { + status: 400, + title: 'Last cart', + detail: 'This is the last cart associated with a customer and it cannot be deleted, try disassociating instead' + } + ] + } + ```` + operationId: deleteACart + parameters: + - name: cartID + in: path + description: The unique identifier of the cart that you want to delete. + required: true + style: simple + schema: + type: string + responses: + '204': + description: No Content + headers: {} + content: {} + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + parameters: [] + /v2/carts/{cartID}/items: + get: + tags: + - Cart Items + summary: Get Cart Items + description: > + + Use this endpoint to retrieve cart items. If the cart is associated with + shipping groups, calling this endpoint displays the associated shipping + group IDs. + + + You can use this endpoint to retrieve the breakdown of cart items by + promotion ID. For example, if you have Promotions Standard item discount + with code *sale2024*, Rule Promotions item discount with code + *sale2024*, and Rule Promotions cart discount with code *sale2024*, the + `discounts.constituents` field in the response example will show the + breakdown of the same promotion code used in both Promotions Standard + and Rule Promotions. + + + ```json + + "data": [ + + { + "id": "98de010d-dd10-4fa5-a070-0b9bcdc72974", + "type": "cart_item", + "product_id": "5a4662d2-9a2b-4f6e-a215-2970db914b0c", + "name": "sku1", + "description": "sku1", + "sku": "sku1", + "slug": "sku1", + "image": { + "mime_type": "", + "file_name": "", + "href": "" + }, + "quantity": 1, + "manage_stock": false, + "unit_price": { + "amount": 10000, + "currency": "USD", + "includes_tax": false + }, + "value": { + "amount": 10000, + "currency": "USD", + "includes_tax": false + }, + "discounts": [ + { + "amount": { + "amount": -2000, + "currency": "USD", + "includes_tax": false + }, + "code": "sale2024", + "id": "e4d929d5-f471-4317-9a86-a84a6c572b44", + "promotion_source": "rule-promotion", + "is_cart_discount": true + }, + { + "amount": { + "amount": -1000, + "currency": "USD", + "includes_tax": false + }, + "code": "sale2024", + "id": "de19a043-a6da-4bde-b896-d17e16b77e25", + "promotion_source": "rule-promotion" + }, + { + "amount": { + "amount": -1000, + "currency": "USD", + "includes_tax": false + }, + "code": "sale2024", + "id": "509295ee-2971-45b6-801e-95df09756989" + }, + { + "amount": { + "amount": -1000, + "currency": "USD", + "includes_tax": false + }, + "code": "sale2024", + "id": "ca79e606-7ecd-41ac-9478-af4c8c28c546", + "promotion_source": "rule-promotion", + "is_cart_discount": true + } + ], + "links": { + "product": "https://useast.api.elasticpath.com/v2/products/5a4662d2-9a2b-4f6e-a215-2970db914b0c" + }, + "meta": { + "display_price": { + "with_tax": { + "unit": { + "amount": 5000, + "currency": "USD", + "formatted": "$50.00" + }, + "value": { + "amount": 5000, + "currency": "USD", + "formatted": "$50.00" + } + }, + "without_tax": { + "unit": { + "amount": 5000, + "currency": "USD", + "formatted": "$50.00" + }, + "value": { + "amount": 5000, + "currency": "USD", + "formatted": "$50.00" + } + }, + "tax": { + "unit": { + "amount": 0, + "currency": "USD", + "formatted": "$0.00" + }, + "value": { + "amount": 0, + "currency": "USD", + "formatted": "$0.00" + } + }, + "discount": { + "unit": { + "amount": -5000, + "currency": "USD", + "formatted": "-$50.00" + }, + "value": { + "amount": -5000, + "currency": "USD", + "formatted": "-$50.00" + } + }, + "without_discount": { + "unit": { + "amount": 10000, + "currency": "USD", + "formatted": "$100.00" + }, + "value": { + "amount": 10000, + "currency": "USD", + "formatted": "$100.00" + } + }, + "discounts": { + "sale2024": { + "amount": -5000, + "currency": "USD", + "formatted": "-$50.00", + "constituents": { + "509295ee-2971-45b6-801e-95df09756989": { + "amount": -1000, + "currency": "USD", + "formatted": "-$10.00" + }, + "ca79e606-7ecd-41ac-9478-af4c8c28c546": { + "amount": -1000, + "currency": "USD", + "formatted": "-$10.00" + }, + "de19a043-a6da-4bde-b896-d17e16b77e25": { + "amount": -1000, + "currency": "USD", + "formatted": "-$10.00" + }, + "e4d929d5-f471-4317-9a86-a84a6c572b44": { + "amount": -2000, + "currency": "USD", + "formatted": "-$20.00" + } + } + } + } + }, + "timestamps": { + "created_at": "2024-05-24T18:00:58Z", + "updated_at": "2024-05-24T18:00:58Z" + } + }, + "catalog_id": "09b9359f-897f-407f-89a2-702e167fe781", + "catalog_source": "pim" + } + + ``` + operationId: getCartItems + parameters: + - name: cartID + in: path + description: The unique identifier of the cart that you created. + required: true + style: simple + schema: + type: string + responses: + '200': + description: '' + headers: {} + content: + application/json: + schema: + $ref: '#/components/schemas/CartsResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + put: + tags: + - Cart Items + summary: Bulk Update Items in Cart + description: > + The bulk update feature allows shoppers to update an array of items to + their cart in one action, rather than updating each item one at a time. + Shoppers can update quantity and shipping group details in bulk + requests. This minimizes the time for shoppers while updating items to + their cart. Shoppers can even update multiple items with the same or + different shipping groups to their cart. + + + When you update multiple items that qualify for free gifts in the cart, + the corresponding free gifts for all eligible products are also + automatically updated in the cart. + operationId: bulkUpdateItemsInCart + parameters: + - name: cartID + in: path + description: The unique identifier of the cart that you created. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/BulkUpdateCartsItems' + required: false + responses: + '200': + description: '' + headers: {} + content: {} + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + post: + tags: + - Cart Items + summary: Manage Carts + description: > + + ### Add Product to Cart + + + Adding a Product to Cart is the most common Cart action. If you want to + add any custom products or promotions, you need to do that as a separate + action. + + + #### Dynamic Bundles + + + A bundle is a purchasable product that is composed of a combination of + two or more products that you want to sell together. You can create + multiple components within a bundle. Each component can have one or more + options. Each option is a product and a quantity. You can configure + minimum and/or maximum values for the number of product options in a + component that your shoppers can select. For example, you can enable a + shopper to select 1 or more product options from a list of 10. These are + called [dynamic + bundles](/docs/api/pxm/products/products#dynamic-bundles). + + + Your dynamic bundles are displayed in your published catalogs. + + + 1. Use the configure a shopper endpoint to allow shoppers to make their + selections from a bundle. + + 2. In the response of the configure a shopper, the + `bundle_configuration` object contains the bundle selections a shopper + has made. + + 3. In the add a product to cart request, use the `bundle_configuration` + object to add the customers selections to a cart. + + + ```json + "bundle_configuration": { + "selected_options": { + "games": { + "d7b79eb8-19d8-45ea-86ed-2324a604dd9c": 1 + }, + "toys": { + "0192ccdd-6d33-4898-87d7-c4d87f2bf8ea": 1, + "1aea6f97-f0d9-452c-b3c1-7fb5629ead82": 1 + } + } + } + + ``` + + + When a cart is checked out, the options a shopper selected are added to + the order. See [order items](/docs/api/carts/get-order-items). + + + #### Personalized Products + + + You can allow shoppers to personalize their goods by adding custom text + inputs to products directly. This feature is particularly useful for + customizable items, such as personalized T-shirts or greeting cards. You + can use this functionality by leveraging the `custom_inputs` attribute, + and defining the details and validation rules for the custom text. + + + First, you must configure a `custom_inputs` attribute when creating a + new product or updating an existing product. Once you have defined your + custom inputs on a product, you must configure the custom inputs in your + orders. + + + For example, you may sell T-shirts that can have personalized text on + the front and back of the shirt. + + + ```json + { + "data": { + "type": "product", + "attributes": { + "custom_inputs": { + "front": { + "name": "T-Shirt Front", + "validation_rules": [ + { + "type": "string", + "options": { + "max_length": 50 + } + } + ], + "required": false + }, + "back": { + "name": "T-Shirt Back", + "validation_rules": [ + { + "type": "string", + "options": { + "max_length": 50 + } + } + ], + "required": false + } + } + } + } + } + + ``` + + + If the same product has different `custom_inputs` attributes, then these + are added as separate items in a cart. + + + The `custom_inputs` attribute is stored in the cart item and the text + for `custom_input` must not exceed 255 characters in length. When a cart + is checked out, the `custom_inputs` attribute becomes part of the order. + + + #### Limitations on Usage of `custom_inputs` with Specific Promotion + Types + + + When you add products to a cart with `custom_inputs`, there are certain + limitations on usage of the `custom_inputs` with the following promotion + types: + + - For [Free Gift Promotions](/docs/api/promotions/create-a-promotion), you can add `custom_inputs` to gift items. + - For [Fixed Bundle Discount Promotions](/docs/api/promotions/create-a-promotion), the promotion applies as long as the cart contains the bundle SKUs even when there are different `custom_inputs`. + - For [X for Y Discount Promotion and X for amount discount promotion](/docs/api/promotions/create-a-promotion), the promotion applies when there are two SKUs with the same `custom_inputs`. The promotion does not apply when there are different `custom_inputs` and the SKUs are in different line items. + + :::note + + + - Any requests to add a product to cart returns the collection of cart + items. + + - [Tax items](/docs/api/carts/tax-items) may optionally be added with + the product. Only administrators with [client + credentials](/docs/authentication/Tokens/client-credential-token) are + able to do this. If included, they replace any existing taxes on the + product. + + - The cart currency is set when the first item is added to the cart. + + - The product being added to the cart requires a price in the same + currency as the other items in the cart. The API returns a 400 error if + a price is not defined in the correct currency. + + - A cart can contain a maximum of 100 unique items. Items include + products, custom items, tax items, and promotions. + + - There are a number of actions that happen to your inventory when + checking out and paying for an order. For more information, see the + [Inventory](/docs/api/pxm/inventory/inventories-introduction) + documentation. + + + ::: + + + ### Add Custom Item to Cart + + + You can add a custom item to the cart when you don't manage things like + shipping, taxes and inventory in Commerce. + + + For [Shipping Groups](/docs/ship-groups/shipping-groups), once you have + created a [cart shipping + group](/docs/ship-groups/shipping-groups/shipping-groups-api/create-cart-shipping-group), + you need to link it to the cart items. This is important, because it is + necessary to associate items with shipping groups in order to include + shipping groups in the corresponding cart, order, and totals. + + + :::note + + + - Custom Cart Items are available through [implicit + authentication](/docs/authentication/Tokens/implicit-token). Ensure that + you always check each order has the correct details for each item, most + importantly, price. + + + ::: + + + ### Add Promotion to Cart + + + You can use the Promotions API to apply discounts to your cart as a + special cart item type. Any requests to add a product to cart will + return a collection of cart items. + + There are certain limitations on usage of the `custom_inputs` attribute with some promotion types. See [Limitations on Usage of `custom_inputs` with Specific Promotion Types](/docs/api/carts/manage-carts#limitations-on-usage-of-custom_inputs-with-specific-promotion-types). + + To remove promotion from the cart via the promotion code, see [Delete + Promotion Code from + Cart](/docs/api/carts/delete-a-promotion-via-promotion-code). + + + ### Re-order + + + From a shopper’s order history, they can add the items from a previous + order into their carts. Shoppers can add items regardless of past order + status, such as incomplete or not paid. For more information, see + [Orders](/docs/api/carts/orders). + + + :::note + - Any requests to add an item to cart return a collection of [cart items](/docs/api/carts/cart-items). + - A cart can contain a maximum of 100 unique items. Items include products, custom items, and promotions. + - When a shopper creates a cart and re-orders items from an order with properties such as custom attributes, custom discounts, and payment intent ID, these properties will remain unchanged in the original cart. + - Custom items do not exist in catalogs, and therefore cannot be reordered. + ::: + + + ### Merging Carts + + + A shopper can have multiple carts, and the system may automatically + merge items from an anonymous cart into the shopper's registered cart + when they sign in. For example, if a shopper has an existing cart with + items `A`, `B` and `C`, and later adds items `D` and `E` while not + signed in, the system can merge these carts when the shopper signs in. + After the carts merge, the cart contains items `A`, `B`, `C`, `D` and + `E`. + + + If any items are duplicated from the anonymous cart to the registered + cart, their quantities are incremented accordingly. For example, if a + shopper's existing cart with items `A`, `B` and `C`, and they later add + two more `A` items and one `B` item while not signed in, the system will + merge the carts when the shopper signs in. The existing cart will now + contain three `A` items, two `B` items, and one `C` item. + + + :::note + + + When the system merges items from one cart into another cart, properties + such as custom attributes, custom discounts, and payment intent ID will + remain unchanged in the original cart. + + + ::: + + + ### Best Practices + + + We recommend to include a unique `sku` code within the request body + while adding custom items to carts. If the same `sku` is used for + multiple products, they are merged into a single line item. + + + For example, if a cart consists of the following items: + + + - `product-1` with quantity 1 and sku code as `sku-1` + + - `product-2` with quantity 1 and sku code as `sku-1` + + - `product-3` with quantity 1 and sku code as `sku-2`. + + + The following response is returned where it combines all products with + the same sku codes into a single line item, while products with a unique + sku codes are represented as separate items: + + + ```json + + { + "data": [ + { + "id": "c58760f4-8889-4719-b34d-be1f1d11ae59", + "type": "custom_item", + "name": "product-1", + "description": "My first custom item!", + "sku": "sku-1", + "slug": "", + "image": { + "mime_type": "", + "file_name": "", + "href": "" + }, + "quantity": 2, + "manage_stock": false, + "unit_price": { + "amount": 20000, + "currency": "USD", + "includes_tax": true + }, + "value": { + "amount": 40000, + "currency": "USD", + "includes_tax": true + }, + "links": {}, + "meta": { + "display_price": { + "with_tax": { + "unit": { + "amount": 20000, + "currency": "USD", + "formatted": "$200.00" + }, + "value": { + "amount": 40000, + "currency": "USD", + "formatted": "$400.00" + } + }, + "without_tax": { + "unit": { + "amount": 20000, + "currency": "USD", + "formatted": "$200.00" + }, + "value": { + "amount": 40000, + "currency": "USD", + "formatted": "$400.00" + } + }, + "tax": { + "unit": { + "amount": 0, + "currency": "USD", + "formatted": "$0.00" + }, + "value": { + "amount": 0, + "currency": "USD", + "formatted": "$0.00" + } + }, + "discount": { + "unit": { + "amount": 0, + "currency": "USD", + "formatted": "$0.00" + }, + "value": { + "amount": 0, + "currency": "USD", + "formatted": "$0.00" + } + }, + "without_discount": { + "unit": { + "amount": 20000, + "currency": "USD", + "formatted": "$200.00" + }, + "value": { + "amount": 40000, + "currency": "USD", + "formatted": "$400.00" + } + } + }, + "timestamps": { + "created_at": "2023-05-02T16:28:11Z", + "updated_at": "2023-05-02T16:28:18Z" + } + } + } + ``` + operationId: manageCarts + parameters: + - name: cartID + in: path + description: The unique identifier of the cart that you created. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/CartItemsObjectRequest' + - $ref: '#/components/schemas/CartMergeObjectRequest' + - $ref: '#/components/schemas/CustomItemObject' + - $ref: '#/components/schemas/ReOrderObjectRequest' + - $ref: '#/components/schemas/PromotionItemObject' + - $ref: '#/components/schemas/BulkAddItemsRequest' + responses: + '200': + description: '' + headers: {} + content: + application/json: + schema: + $ref: '#/components/schemas/CartsResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + delete: + tags: + - Cart Items + summary: Delete all Cart Items + description: > + A shopper can clean up their cart, deleting custom items, promotions, + and so on, while the empty cart remains available. The cart id, name, + description, and any account or customer associations persist. The + shopper can continue to add items to the cart. + operationId: deleteAllCartItems + parameters: + - name: cartID + in: path + description: The unique identifier of the cart created by you. + required: true + style: simple + schema: + type: string + responses: + '204': + description: No Content + headers: {} + content: {} + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + parameters: [] + /v2/carts/{cartID}/items/{cartitemID}: + put: + tags: + - Cart Items + summary: Update a Cart Item + description: >- + You can easily update a cart item. A successful update returns the cart + items. + operationId: updateACartItem + parameters: + - name: cartID + in: path + description: A unique identifier of the cart that you created. + required: true + style: simple + schema: + type: string + - name: cartitemID + in: path + description: A unique identifier of the cart item. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/UpdateCartsItems' + required: false + responses: + '200': + description: '' + headers: {} + content: + application/json: + schema: + $ref: '#/components/schemas/CartsResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + delete: + tags: + - Cart Items + summary: Delete a Cart Item + description: Use this endpoint to delete a cart item. + operationId: deleteACartItem + parameters: + - name: cartID + in: path + description: The unique identifier of the cart created by you. + required: true + style: simple + schema: + type: string + - name: cartitemID + in: path + description: The unique identifier of the cart that you want to delete. + required: true + style: simple + schema: + type: string + responses: + '204': + description: No Content + headers: {} + content: {} + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + parameters: [] + /v2/carts/{cartID}/relationships/accounts: + post: + tags: + - Account Cart Associations + summary: Create an Account Cart Association + description: >- + You can create associations between an account and one or more carts. + After cart associations exist for an account, the account can access + those carts across any device. + operationId: createAccountCartAssociation + parameters: + - name: cartID + in: path + description: >- + The ID for the cart created by the account. Ensure that you follow + the guidelines for [Safe + Characters](/guides/Getting-Started/safe-characters). + required: true + style: simple + schema: + type: string + - name: EP-Account-Management-Authentication-Token + in: header + description: >- + An Account Management Authentication token to access a specific + account's carts. + style: simple + schema: + type: string + example: '{{accountToken}}' + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/CartsRelationshipsAccountsData' + required: false + responses: + '200': + description: OK + headers: {} + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/CartsRelationshipsAccountsData' + '204': + description: >- + No Content is sent back in case the account has already been + associated to the cart. + headers: {} + content: {} + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + delete: + tags: + - Account Cart Associations + summary: Delete Account Cart Association + description: You can delete an association between an account and a cart. + operationId: deleteAccountCartAssociation + parameters: + - name: cartID + in: path + description: The ID for the cart created by the account. + required: true + style: simple + schema: + type: string + - name: EP-Account-Management-Authentication-Token + in: header + description: >- + An Account Management Authentication token to access a specific + account's carts. + style: simple + schema: + type: string + example: '{{accountToken}}' + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/CartsRelationshipsAccountsData' + required: false + responses: + '204': + description: No Content + headers: {} + content: {} + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + parameters: [] + /v2/carts/{cartID}/relationships/customers: + post: + tags: + - Customer Cart Associations + summary: Create a Customer Cart Association + description: >- + You can create associations between a customer and one or more carts. + After cart associations exist for a customer, the customer can access + those carts across any device. + operationId: createCustomerCartAssociation + parameters: + - name: cartID + in: path + description: >- + The ID for the cart created by the customer. Ensure that you follow + the guidelines for [Safe + Characters](/guides/Getting-Started/safe-characters). + required: true + style: simple + schema: + type: string + - name: x-moltin-customer-token + in: header + description: A customer token to access a specific customer's carts. + style: simple + schema: + type: string + example: '{{customerToken}}' + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/CartsRelationshipsCustomersData' + required: false + responses: + '200': + description: OK + headers: {} + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/CartsRelationshipsCustomersData' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + delete: + tags: + - Customer Cart Associations + summary: Delete Customer Cart Association + description: You can delete an association between a customer and a cart. + operationId: deleteCustomerCartAssociation + parameters: + - name: cartID + in: path + description: The ID for the cart created by the customer. + required: true + style: simple + schema: + type: string + - name: x-moltin-customer-token + in: header + description: A customer token to access a specific customer's carts. + style: simple + schema: + type: string + example: '{{customerToken}}' + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/CartsRelationshipsCustomersData' + required: false + responses: + '204': + description: No Content + headers: {} + content: {} + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + parameters: [] + /v2/carts/{cartID}/discounts/{promoCode}: + delete: + tags: + - Cart Items + summary: Delete a Promotion via Promotion Code + description: >- + You can remove promotion code from a cart if it was applied manually. + This endpoint does not work if the promotion is applied automatically. + operationId: deleteAPromotionViaPromotionCode + parameters: + - name: cartID + in: path + description: Specifies the unique identifier of a cart created by you. + required: true + style: simple + schema: + type: string + - name: promoCode + in: path + description: Specifies the promotion code to be deleted. + required: true + style: simple + schema: + type: string + responses: + '204': + description: No Content + headers: {} + content: {} + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + parameters: [] + /v2/carts/{cartID}/items/{cartitemID}/taxes: + post: + tags: + - Tax Items + summary: Add Tax Item to Cart + description: > + + Use this endpoint to add a tax item to a cart. + + + :::note + + + There is a soft limit of 5 unique tax items per cart item at any one + time. + + + ::: + operationId: addTaxItemToCart + parameters: + - name: cartID + in: path + description: The unique identifier of the cart. + required: true + style: simple + schema: + type: string + - name: cartitemID + in: path + description: The unique identifier of the cart item. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/CartsItemsTaxesObject' + required: false + responses: + '200': + description: '' + headers: {} + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/CartsItemsTaxesObject' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + '422': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 422 + title: Unprocessable Entity + deprecated: false + security: + - bearerAuth: [] + parameters: [] + /v2/carts/{cartID}/taxes: + post: + tags: + - Tax Items + summary: Bulk Add Tax Items to Cart + description: > + :::note + + + A cart item can only have a maximum of five tax items. + + + ::: + + + ### Errors + + + `422 Unprocessable Entity` + + + In this example, when `options.add_all_or_nothing` is set to `true` and + if one of cart items is not found or or has reached its maximum tax item + limit, the following error response is returned: + + + ```json + + { + "status": 422, + "title": "Add all or nothing.", + "detail": "Add all or nothing set to (true). Could not bulk add tax items to cart." + } + + ``` + + + In this example, if you add more than five tax items to the same cart + item, the following error response is returned: + + + ```json + + { + "status": 422, + "title": "Tax item not added to cart item.", + "detail": "Cannot exceed tax item limit of (5) on cart item.", + "meta": { + "id": "f88e6370-cb35-40b2-a998-c759f31dec0a" + } + } + ``` + + + `404` + + + In this example, if there is a mismatch between + `cart_item`/`custom_item` and the `relationships.item.data.type` + specified in the bulk add tax item, the following error response is + returned: + + + ```json + + { + "data": [], + "errors": [ + { + "status": 404, + "title": "Tax item not added to cart item.", + "detail": "Mismatch between bulk tax item type(cart_item) and cart item type(custom_item).", + "meta": { + "id": "56aab5d1-1dd4-45ed-88ed-4d0cc396b62d" + } + }, + { + "status": 404, + "title": "Tax item not added to cart item.", + "detail": "Mismatch between bulk tax item type(cart_item) and cart item type(custom_item).", + "meta": { + "id": "56aab5d1-1dd4-45ed-88ed-4d0cc396b62d" + } + } + ] + } + + ``` + operationId: bulkAddTaxItemsToCart + parameters: + - name: cartID + in: path + description: The unique identifier of the cart. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/CartsBulkTaxes' + required: false + responses: + '200': + description: '' + headers: {} + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/CartsBulkTaxes' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + delete: + tags: + - Tax Items + summary: Bulk Delete Tax Items from Cart + description: Use this endpoint to bulk delete tax items from cart. + operationId: bulkDeleteTaxItemsFromCart + parameters: + - name: cartID + in: path + description: The unique identifier of the cart. + required: true + style: simple + schema: + type: string + responses: + '204': + description: No Content + headers: {} + content: {} + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + parameters: [] + /v2/carts/{cartID}/items/{cartitemID}/taxes/{taxitemID}: + put: + tags: + - Tax Items + summary: Update a TaxItem + description: Use this endpoint to update a tax item. + operationId: updateATaxItem + parameters: + - name: cartID + in: path + description: The unique identifier of the cart. + required: true + style: simple + schema: + type: string + - name: cartitemID + in: path + description: The unique identifier of the cart item. + required: true + style: simple + schema: + type: string + - name: taxitemID + in: path + description: The unique identifier of the tax item. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/CartsItemsTaxesObject' + required: false + responses: + '200': + description: '' + headers: {} + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/CartsItemsTaxesObject' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + delete: + tags: + - Tax Items + summary: Delete a Tax Item + description: Use this endpoint to delete a tax item. + operationId: deleteATaxItem + parameters: + - name: cartID + in: path + description: The unique identifier of the cart. + required: true + style: simple + schema: + type: string + - name: cartitemID + in: path + description: The unique identifier of the cart item. + required: true + style: simple + schema: + type: string + - name: taxitemID + in: path + description: The unique identifier of the tax item. + required: true + style: simple + schema: + type: string + responses: + '204': + description: No Content + headers: {} + content: {} + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + parameters: [] + /v2/carts/{cartID}/custom-discounts: + post: + tags: + - Custom Discounts + summary: Bulk Add Custom Discounts to Cart + description: > + The default value for custom discounts on both the cart and cart items + is set to 5 if this parameter is not configured in the store. To verify + the custom discount limit value, call [Get all + settings](/docs/api/settings/get-v-2-settings) endpoint. + + + To increase the custom discount value, contact [Elastic Path Support + team](https://support.elasticpath.com/hc/en-us). + operationId: bulkAddCustomDiscountsToCart + parameters: + - name: cartID + in: path + description: >- + Specifies the system generated ID for the cart that the shopper + created. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/CartsBulkCustomDiscounts' + required: false + responses: + '200': + description: '' + headers: {} + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/CartsBulkCustomDiscountsResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + delete: + tags: + - Custom Discounts + summary: Bulk Delete Custom Discounts From Cart + description: Use this endpoint to bulk delete custom discounts from cart. + operationId: bulkDeleteCustomDiscountsFromCart + parameters: + - name: cartID + in: path + description: Specifies the unique ID for the cart. + required: true + style: simple + schema: + type: string + responses: + '204': + description: No Content + headers: {} + content: {} + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + parameters: [] + /v2/carts/{cartID}/custom-discounts/{customdiscountID}: + put: + tags: + - Custom Discounts + summary: Update Custom Discount For Cart + description: Use this endpoint to update a custom discount in your cart. + operationId: updateCustomDiscountForCart + parameters: + - name: cartID + in: path + description: Specifies the unique ID for the cart. + required: true + style: simple + schema: + type: string + - name: customdiscountID + in: path + description: Specifies the ID for the custom discount to be updated. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/CartsCustomDiscountsObject' + required: false + responses: + '200': + description: '' + headers: {} + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/CartsCustomDiscountsResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + delete: + tags: + - Custom Discounts + summary: Delete Custom Discount From Cart + description: Use this endpoint to delete custom discount from cart. + operationId: deleteCustomDiscountFromCart + parameters: + - name: cartID + in: path + description: Specifies the unique ID for the cart. + required: true + style: simple + schema: + type: string + - name: customdiscountID + in: path + description: Specifies the ID for the custom discount to be deleted. + required: true + style: simple + schema: + type: string + responses: + '204': + description: No Content + headers: {} + content: {} + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + parameters: [] + /v2/carts/{cartID}/items/{cartitemID}/custom-discounts: + post: + tags: + - Custom Discounts + summary: Add Custom Discount To Cart Item + description: Use this endpoint to add a custom discount to cart item. + operationId: addCustomDiscountToCartItem + parameters: + - name: cartID + in: path + description: Specifies the ID for the cart. + required: true + style: simple + schema: + type: string + - name: cartitemID + in: path + description: Specifies the unique identifier for the cart item. + required: true + style: simple + schema: + type: string + requestBody: + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/CartsCustomDiscountsObject' + required: false + responses: + '200': + description: '' + headers: {} + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/CartsCustomDiscountsResponse' + deprecated: false + security: + - bearerAuth: [] + parameters: [] + /v2/carts/{cartID}/items/{cartitemID}/custom-discounts/{customdiscountID}: + put: + tags: + - Custom Discounts + summary: Update Custom Discount For Cart Item + description: Use this endpoint to update a custom discount in your cart item. + operationId: updateCustomDiscountForCartItem + parameters: + - name: cartID + in: path + description: Specifies the ID for the cart. + required: true + style: simple + schema: + type: string + - name: cartitemID + in: path + description: Specifies the ID for the cart item. + required: true + style: simple + schema: + type: string + - name: customdiscountID + in: path + description: Specifies the ID for the custom discount to be updated. + required: true + style: simple + schema: + type: string + requestBody: + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/CartsCustomDiscountsObject' + required: false + responses: + '200': + description: '' + headers: {} + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/CartsCustomDiscountsResponse' + deprecated: false + security: + - bearerAuth: [] + delete: + tags: + - Custom Discounts + summary: Delete Custom Discount From Cart Item + description: Use this endpoint to delete custom discount from cart item. + operationId: deleteCustomDiscountFromCartItem + parameters: + - name: cartID + in: path + description: Specifies the ID for the cart. + required: true + style: simple + schema: + type: string + - name: cartitemID + in: path + description: Specifies the ID for the cart item. + required: true + style: simple + schema: + type: string + - name: customdiscountID + in: path + description: Specifies the ID for the custom discount to be deleted. + required: true + style: simple + schema: + type: string + responses: + '204': + description: No Content + headers: {} + content: {} + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + parameters: [] + /v2/carts/{cartID}/payments: + post: + tags: + - Payments + summary: Create Stripe Payment Intent for a Cart + description: > + The Cart Payment Intent feature enables the creation of a Stripe Payment + Intent specifically tied to a shopping cart and its subsequent order. + This allows Payment Intent users to track payment details from the cart + stage and seamlessly maintain consistency in payment information + throughout the order stage. Using these features, you can create Payment + Intents for their carts, update Payment Intents with final cart details, + and synchronize Payment Intents from Stripe to Commerce. + + + :::note + + + - Typically, in Commerce, inventory is allocated at the time of payment + initiation after an order is created. However, in the case of Cart + Payment Intent, information about the payment is received only upon + synchronizing the order from Stripe to Commerce. This may happen after + the payment is completed. Therefore, there might be a delay between the + payment made and allocation, increasing the chance of paying for items + that are not in stock. + + - There are certain fields you can choose to set up when [creating a + payment intent](https://stripe.com/docs/api/payment_intents/create). + However, if you decide to update a payment intent, the available options + may not be the same as those allowed while creating a payment intent. + See [updating a payment + intent](https://stripe.com/docs/api/payment_intents/update). + + + ::: + + + The following steps outline the workflow associated with the Payment + Intent: + + + 1. [Add items to + cart](/docs/api/carts/manage-carts#add-custom-item-to-cart). + + 1. [Create a Payment Intent for the + cart](/docs/api/carts/create-cart-payment-intent). The Payment Intent is + created in Stripe, reflecting the cart and transaction details, + including currency, amounts, payment type, and any optional Stripe + details. The Payment Intent ID is generated and linked to the cart. + + 1. [Update a Payment + Intent](/docs/carts-orders/update-cart-payment-intent). This step is + optional but becomes necessary when there are changes in the cart + details at the time of payment. It ensures the Payment Intent accurately + reflects the current cart details when processing the payments on the + front end. + + 1. [Checkout the cart](/docs/api/carts/checkout). An unpaid order is + created, and the Payment Intent ID is linked to the order. + + 1. [Confirm the order](/docs/carts-orders/confirm-an-order). This is + important because after checkout, it is essential to confirm the Payment + Intent and synchronize it with Commerce. This results in a corresponding + transaction and change in order statuses in Commerce. Additionally, the + Payment Intent ID is removed from the order once it is linked via the + transaction. + + + ### Best Practices + + + We recommend you follow these practices to maintain consistency and + accuracy when using Cart Payment Intent. + + + - After checkout, we recommend clearing the shopping cart. You can + achieve this using a [Delete a cart](/docs/api/carts/delete-a-cart) + endpoint or [Update a cart](/docs/api/carts/update-a-cart) to remove the + Payment Intent ID. This helps to avoid potential issues where subsequent + checkouts for the same cart might unintentionally use the previous + Stripe Payment Intent ID. + + - If it is not reasonable to clear the cart immediately after checkout + due to several subsequent, duplicate checkouts to the same cart, ensure + that you only synchronize the Payment Intent when finalizing the order. + Each order confirmation is unaware of the others, and syncing Payment + Intent IDs for each confirmation can lead to duplicate transactions in + Commerce. In other words, if you synchronize Payment Intents for earlier + versions of a repeated checkout, you'll end up with multiple orders from + the same cart, each having transactions linked to the same Payment + Intent. + + - To pay the entire amount at once, use the [Update Cart Payment + Intent](/docs/carts-orders/update-cart-payment-intent) endpoint to + update the Stripe Payment Intent with the final cart details when + preparing to take the payment. Doing so, ensures that the Payment Intent + accurately reflects the current cart details when processing payments on + the front end. We do not recommend calling the [Update Cart Payment + Intent](/docs/carts-orders/update-cart-payment-intent) for each + individual change in the cart, as this can lead to more requests and may + slow down the front-end performance. + operationId: createCartPaymentIntent + parameters: + - name: cartID + in: path + required: true + style: simple + schema: + type: string + description: >- + The universally unique identifier of the cart for which you want to + create a payment intent. + requestBody: + required: false + content: + application/json: + schema: + $ref: '#/components/schemas/ElasticPathPaymentsPoweredByStripePayment' + responses: + '201': + description: Payment Intent created successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/CartResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + parameters: [] + /v2/carts/{cartID}/checkout: + post: + tags: + - Checkout + summary: Checkout API + description: > + When a Cart is ready for checkout, you can convert the cart to an order. + The cart remains and can be modified and checked out again if required. + + + A cart can be checked out with a customer ID, customer object, or with + an account by authenticating with the `Client Credentials Token`. + + + After a successful checkout, a response that contains the order is + returned. If the cart is linked to a shipping group, the shipping group + is also associated with the order after checkout. + + + You can checkout using one of the following methods: + + - Customer ID. You can checkout a cart with an existing customer ID. + + - Guest Checkout (Checkout with Customer Object). You can checkout a + cart with an associated customer name and email. + + - Checkout with Account. The shopper authenticates with the `Client + Credentials` Token. + + - Checkout with Account Management Authentication Token. The shopper + authenticates with the `Implicit Token` and the + `EP-Account-Management-Authentication-Token`. + + + :::note + + + - The cart currency is set when the first item is added to the cart. + + - The product being added to the cart requires a price in the same + currency as the other items in the cart. The API returns a 400 error if + a price is not defined in the correct currency. + + - To ensure that a free gift is automatically applied to an order, set + the promotion to automatic. The checkout process will not be successful + if free gift items are out of stock. See [Errors](#errors) section. + + + ::: + + + :::caution + + + - By default, carts are automatically deleted 7 days after the last + update. You can change this setting by [updating cart + settings](/docs/api/settings/put-v-2-settings-cart). + + - Your inventory is modified during checkout and payment of an order. + For more information about the changes in the inventory, see the + [Inventory](/docs/api/pxm/inventory/inventories-introduction) section. + + + ::: + + + ### Next Steps + + + After a cart has been converted to an Order using either of the previous + methods, you most likely want to capture payment for order. See [Paying + for an Order](/docs/api/carts/payments). + + + ### Errors + + + The following error response is returned during checkout when an + eligible item is added to the cart, and the free gift is out of stock. + + + ```json + + { + "errors": [ + { + "status": 400, + "title": "Insufficient stock", + "detail": "There is not enough stock to add gift2 to your cart", + "meta": { + "id": "f2b68648-9621-45a3-aed6-1b526b0f5beb", + "sku": "gift2" + } + } + ] + } + + ``` + operationId: checkoutAPI + parameters: + - name: cartID + in: path + description: The ID of the cart that you want to checkout. + required: true + style: simple + schema: + type: string + - name: EP-Account-Management-Authentication-Token + in: header + description: >- + An account management authentication token that identifies the + authenticated account member. + style: simple + schema: + type: string + example: '{{accountToken}}' + requestBody: + description: '' + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/CustomerCheckout' + - $ref: '#/components/schemas/AccountCheckout' + required: false + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/OrderResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + parameters: [] + /v2/orders: + get: + tags: + - Orders + summary: Get All Orders + description: > + This endpoint returns all orders with custom flow fields. The pagination + offset is set to fetch a maximum of 10,000 orders. If the store has + 10,000 orders and you fetch the orders without using filters, an error + is returned. Use a filter to view orders when the order is beyond the + 10,000 mark. + + + :::note + + + - Pass the `X-Moltin-Customer-Token` header to limit orders to a + specific customer. See [Customer + Tokens](/docs/customer-management/customer-management-api/customer-tokens). + + - Pass the `EP-Account-Management-Authentication-Token` header to limit + orders to a specific account. See [Account Management + Token](/docs/api/accounts/post-v-2-account-members-tokens). + + - You can use pagination with this resource. For more information, see + [pagination](/guides/Getting-Started/pagination). + + + ::: + + + ### Filtering + + + The following operators and attributes are available for filtering + orders. + + + | Attribute | Type | Operator | Example | + + | :--- | :--- | :--- | :--- | + + | `status` | `string` | `eq` | `eq(status,complete)` | + + | `payment` | `string` | `eq` | `eq(payment,paid)` | + + | `shipping` | `string` | `eq` | `eq(shipping,unfulfilled)` | + + | `name` (`customer.name`) | `string` | `eq` / `like` | + `like(name,Brad*)` | + + | `email` (`customer.email`) | `string` | `eq` / `like` | + `like(email,*@elasticpath.com)` | + + | `customer_id` | `string` | `eq` / `like` | `eq(customer_id, + e5a0d684-a4af-4919-a348-f66b0b4955e0)` | + + | `account_id` | `string` | `eq` / `like` | + `eq(account_id,3d7200c9-a9bc-4085-9822-63e80fd94a09)` | + + | `account_member_id` | `string` | `eq` / `like` | + `eq(account_member_id,2a8a3a92-2ccd-4b2b-a7af-52d3896eaecb)` | + + | `contact.name` | `string` | `eq` / `like` | `eq(name,John Doe)` | + + | `contact.email` | `string` | `eq` / `like` | `eq(email,John Doe)` | + + | `shipping_postcode` | `string` | `eq` / `like` | + `like(shipping_postcode,117*)` | + + | `billing_postcode` | `string` | `eq` / `like` | + `like(billing_postcode,117*)` | + + | `with_tax` | `integer` | `gt`/`ge`/`lt`/`le` | `ge(with_tax,10000)` | + + | `without_tax` | `integer` | `gt`/`ge`/`lt`/`le` | + `ge(without_tax,10000)` | + + | `currency` | `string` | `eq` | `eq(currency,USD)` | + + | `product_id` | `string` | `eq` | + `eq(product_id,6837058c-ae42-46db-b3c6-7f01e0c34b40)` | + + | `product_sku` | `string` | `eq` | `eq(product_sku,deck-shoe-001)` | + + | `created_at` | `date` | `eq` / `gt` / `ge`/ `le` / `lt` | + `gt(created_at,YYYY-MM-DD)` | + + | `updated_at` | `date` | `eq` / `gt` / `ge`/ `le`/ `lt` | + `lt(updated_at,YYYY-MM-DD)` | + + | `external_ref` | `string` | `eq` / `like` | `like(external_ref, + 16be*)` | + operationId: getCustomerOrders + parameters: + - name: x-moltin-customer-token + in: header + description: A customer token to access a specific customer's orders. + style: simple + schema: + type: string + example: '{{customerToken}}' + responses: + '200': + description: '' + headers: {} + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + type: array + items: + $ref: '#/components/schemas/OrderResponse' + links: + $ref: '#/components/schemas/Response.PageLinks' + meta: + $ref: '#/components/schemas/Response.Meta.Orders' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + parameters: [] + /v2/orders/{orderID}: + get: + tags: + - Orders + summary: Get an Order + description: Use this endpoint to retrieve a specific order. + operationId: getAnOrder + parameters: + - name: orderID + in: path + description: The ID of the order. + required: true + style: simple + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/OrderResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + put: + tags: + - Orders + summary: Update an Order + description: > + You can only update custom data, `shipping`, `shipping_address`, and + status on orders. All other settings in the order object are immutable. + + + :::caution + + + You can update `shipping`, `shipping_address`, and status of an order + only if the order is not fulfilled. You can use the refund API to refund + an order only if the payment status is `paid`. Canceling an order does + not automatically refund a payment. You must refund the orders manually. + + + ::: + + + :::note + + + - This request is only accessible to client credentials token users with + Seller Admin role. + + - Non client credentials token users cannot access this endpoint. See + [Permissions](/docs/authentication/Tokens/permissions). + + + ::: + operationId: updateAnOrder + parameters: + - name: orderID + in: path + description: The unique identifier of the order. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/OrdersUpdateRequest' + required: false + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/OrderResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + parameters: [] + /v2/orders/{orderID}/items: + get: + tags: + - Orders + summary: Get Order Items + description: Use this endpoint to retrieve order items. + operationId: getOrderItems + parameters: + - name: orderID + in: path + description: The ID of the order. + required: true + style: simple + schema: + type: string + responses: + '200': + description: '' + headers: {} + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + type: array + items: + $ref: '#/components/schemas/OrderItemResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + parameters: [] + /v2/orders/anonymize: + post: + tags: + - Orders + summary: Anonymize Orders + description: > + You can anonymize an order when it is fulfilled, canceled, or fully + refunded. + + + When anonymization is successful, Personal Identifiable Information such + as customer details, `shipping_address`, and `billing_address` are + replaced with *. + operationId: anonymizeOrders + parameters: [] + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/OrdersAnonymizeRequest' + contentMediaType: application/json + required: false + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/OrderResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + '422': + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + detail: >- + Order has status: order:incomplete, payment:unpaid, + shipping:unfulfilled; only fulfilled or refunded or + cancelled orders may be anonymized + status: 422 + title: Could not anonymize orders + meta: + order_id: 496c29a1-6e7a-4ab6-a4e7-d1ec9a08b85e + deprecated: false + security: + - bearerAuth: [] + parameters: [] + /v2/orders/{orderID}/payments: + post: + tags: + - Payments + summary: Authorize Setup + description: Authorize setup + operationId: authorizeSetup + parameters: + - name: orderID + in: path + description: >- + The Universally Unique Identifier (UUID) of the order you want to + pay for. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/PaymentsRequest' + required: false + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/TransactionResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + parameters: [] + /v2/orders/{orderID}/transactions/{transactionID}/confirm: + post: + tags: + - Payments + summary: Confirm Setup + description: Confirm setup + operationId: confirmSetup + parameters: + - name: orderID + in: path + description: The unique identifier of the order. + required: true + style: simple + schema: + type: string + - name: transactionID + in: path + description: The unique identifier of the transaction. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/OrdersTransactionsConfirmRequest' + responses: + '200': + description: '' + headers: {} + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/TransactionResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + parameters: [] + /v2/orders/{orderID}/transactions/{transactionID}/capture: + post: + tags: + - Transactions + summary: Capture a Transaction + description: >- + Use this endpoint to capture a previously authorized payment. In this + step, you can also pass in a custom reference, such as the payment + reference from your chosen gateway. + operationId: captureATransaction + parameters: + - name: orderID + in: path + description: The UUID of the order. + required: true + style: simple + schema: + type: string + - name: transactionID + in: path + description: The UUID of the transaction to capture. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/OrdersTransactionsCaptureRequest' + required: false + responses: + '200': + description: '' + headers: {} + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/TransactionResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + parameters: [] + /v2/orders/{orderID}/transactions/{transactionID}/refund: + post: + tags: + - Transactions + summary: Refund a Transaction + description: > + There are two ways to refund; through your payment gateway and mark it + refunded in Commerce Manager, or directly through Commerce Manager or + API. + + + * Mark as Refunded: You can manually mark a transaction as refunded. + Before you can mark the order as refunded, you need to handle the actual + refund on your side with your payment provider. Mark as Refunded is a + full refund made to the transaction. + + * Refund through Composable Commerce: You can process a full or partial + refund to a supported payment provider directly from Commerce Manager or + API by providing the refund amount. When you start the refund process, + the request is directly sent to the payment gateway. + + + :::caution + + + If you use manual gateway for partial or full refund, you need to handle + the actual refund on your side with your payment provider. + + + ::: + operationId: refundATransaction + parameters: + - name: orderID + in: path + description: The UUID of the order. + required: true + style: simple + schema: + type: string + - name: transactionID + in: path + description: The UUID of the transaction you want to refund. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/OrdersTransactionsRefundRequest' + required: false + responses: + '200': + description: '' + headers: {} + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/TransactionResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + parameters: [] + /v2/orders/{orderID}/transactions: + get: + tags: + - Transactions + summary: Get Order Transactions + description: Get order transactions + operationId: getOrderTransactions + parameters: + - name: orderID + in: path + description: The unique identifier of the order. + required: true + style: simple + schema: + type: string + responses: + '200': + description: '' + headers: {} + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + type: array + items: + $ref: '#/components/schemas/TransactionResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + parameters: [] + /v2/orders/{orderID}/transactions/{transactionID}: + get: + tags: + - Transactions + summary: Get a Transaction + description: Retrieves a transaction + operationId: getATransaction + parameters: + - name: orderID + in: path + description: >- + The unique identifier of the order that you require transactions + for. + required: true + style: simple + schema: + type: string + - name: transactionID + in: path + description: The unique identifier of the transaction. + required: true + style: simple + schema: + type: string + responses: + '200': + description: '' + headers: {} + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/TransactionResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + parameters: [] + /v2/orders/{orderID}/transactions/{transactionID}/cancel: + post: + tags: + - Transactions + summary: Cancel a Transaction + description: > + Use this endpoint to cancel or void a pending or authorized transaction. + The transaction can be canceled or voided when it is in `pending` and + `completed` statuses. + + + :::caution + + + This endpoint works only for Stripe and PayPal and does not work for + manual gateway. + + + ::: + operationId: cancelATransaction + parameters: + - name: orderID + in: path + description: The unique identifier of the order. + required: true + style: simple + schema: + type: string + - name: transactionID + in: path + description: The unique identifier of the transaction to be canceled or voided. + required: true + style: simple + schema: + type: string + requestBody: + description: '' + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/OrdersTransactionsCancelRequest' + required: false + responses: + '200': + description: '' + headers: {} + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Response.Data' + - properties: + data: + $ref: '#/components/schemas/TransactionResponse' + '401': + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/Response.Error' + example: + errors: + status: 401 + title: Unauthorized + deprecated: false + security: + - bearerAuth: [] + parameters: [] +components: + parameters: + accept-language: + description: >- + The language and locale your storefront prefers. See + [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + in: header + name: accept-language + required: false + schema: + type: string + channel: + description: >- + The list of channels in which this catalog can be displayed. A channel + is the shopping experience, such as a mobile app or web storefront. If + empty, the catalog rule matches all channels. The channel will + eventually be included in the bearer token that is used for + authorization, but currently, you must set the `EP-Channel` header in + your requests. + in: header + name: EP-Channel + required: false + schema: + type: string + filter-hierarchy: + name: filter + in: query + description: | + This endpoints supports filtering. See [Filtering](#filtering). + required: false + schema: + type: string + filter-node: + name: filter + in: query + description: | + This endpoint supports filtering, see [Filtering](#filtering). + required: false + schema: + type: string + filter-product: + name: filter + in: query + description: | + This endpoints support filtering. See [Filtering](#filtering). + required: false + schema: + type: string + filter-rule: + name: filter + in: query + description: | + This endpoint supports filtering. See [Filtering](#filtering). + required: false + schema: + type: string + include: + name: include + in: query + description: > + Using the `include` parameter, you can retrieve top-level resources, + such as, files or main image, bundle component products. + required: false + schema: + type: array + items: + type: string + enum: + - main_images + - files + - component_products + include-component-products: + name: include + in: query + description: > + Using the `include=component_products` parameter, you can retrieve key + attribute data for the bundle component products in the product bundle, + such as SKU or slug . + required: false + schema: + type: string + limit: + description: >- + The maximum number of records per page for this response. You can set + this value up to 100. If no page size is set, the [page + length](/docs/api/settings/settings-introduction#page-length) store + setting is used. + name: page[limit] + in: query + required: false + schema: + type: integer + format: int64 + minimum: 1 + offset: + description: >- + The current offset by number of records, not pages. Offset is + zero-based. The maximum records you can offset is 10,000. If no page + size is set, the [page + length](/docs/api/settings/settings-introduction#page-length) store + setting is used. + name: page[offset] + in: query + required: false + schema: + type: integer + format: int64 + maximum: 10000 + minimum: 0 + tag: + description: >- + Product tags are used to store or assign a key word against a product. + The product tag can then be used to describe or label that product. + Using product tags means that you can group your products together, for + example, by brand, category, subcategory, colors, types, industries, and + so on. You can enhance your product list using tags, enabling you to + refine your product list and run targeted promotions. Tags are used to + refine the eligibility criteria for a rule. Requests populate the + catalog rule tag using the `EP-Context-Tag` header. + in: header + name: EP-Context-Tag + required: false + schema: + type: string + schemas: + amount: + description: The three-letter ISO code for the currency associated with this price. + type: object + properties: + amount: + description: >- + The price in the lowest denomination for the specified currency. + This is a product's list price. + type: integer + format: int64 + examples: + - 100 + x-go-name: Amount + x-omitempty: false + includes_tax: + description: Whether this price includes tax. + type: boolean + examples: + - false + default: false + x-go-name: IncludesTax + title: Amount + x-go-name: PriceAmount + prioritized-pricebooks: + description: >- + If you want multiple price books for different scenarios, such as + seasonal sales, business versus retail pricing, and reward programs, + when creating a catalog, you can specify up to five price books. You + must configure a priority for your price books. Product prices are + displayed in the catalog according to the priority of the price books. + type: array + items: + type: object + properties: + id: + description: A unique identifier of a price book. + type: string + format: uuid + priority: + description: >- + Priority is a number and the price book with the highest number + has the highest priority. + type: integer + required: + - priority + - id + x-go-name: PrioritizedPricebook + maxItems: 5 + catalog: + description: Creates a catalog with the following attributes. + type: object + properties: + id: + description: A unique identifier of a catalog. + type: string + examples: + - 8dbb35b2-ef04-477e-974d-e5f3abe6faae + attributes: + type: object + properties: + name: + description: The name of a catalog. + type: string + examples: + - catalog-123 + description: + description: >- + A brief description of the catalog, such as the purpose of the + catalog. + type: string + examples: + - Catalog for Store 123 + default: '' + hierarchy_ids: + description: >- + The unique identifiers of the hierarchies associated with a + catalog. + type: array + items: + type: string + pricebook_id: + description: >- + The unique identifier of a price book associated with a catalog. + If no price book is selected, the catalog is displayed without + prices. + type: string + pricebook_ids: + $ref: '#/components/schemas/prioritized-pricebooks' + locales: + description: >- + Product Experience Manager supports localization of products and + hierarchies. If you store supports multiple languages, you can + localize product names and descriptions. + type: object + additionalProperties: + description: >- + A [three-letter language + code](https://www.iso.org/iso-639-language-code) that + represents the name of language you have used. + type: object + additionalProperties: + description: >- + A [three-letter language + code](https://www.iso.org/iso-639-language-code) that + represents the name of language you have used. + type: string + created_at: + description: The date and time a catalog is created. + type: string + format: date-time + examples: + - '2020-09-22T09:00:00' + updated_at: + description: The date and time a catalog was updated. + type: string + format: date-time + examples: + - '2020-09-22T09:00:00' + owner: + description: >- + The owner of this resource, can be either `organization` or + `store`. + type: + - string + - 'null' + default: store + enum: + - store + - organization + x-go-name: Owner + required: + - name + - hierarchy_ids + - created_at + - updated_at + relationships: + description: >- + Relationships are established between different catalog entities. + For example, a catalog rule and a price book are related to a + catalog, as both are associated with it. + type: object + properties: + rules: + description: The catalog rules related to a catalog. + type: object + properties: + links: + $ref: '#/components/schemas/related-link' + releases: + description: >- + When a catalog is published, a catalog release is created. This + is a URL to all catalog published releases available for this + catalog. + type: object + properties: + links: + $ref: '#/components/schemas/related-link' + meta: + type: object + properties: + count: + description: The number releases available for a catalog. + type: integer + title: CatalogRelationships + type: + type: string + examples: + - catalog + const: catalog + required: + - id + - type + - attributes + title: Catalog + catalog-create-data: + description: Creates a catalog with the following attributes. + type: object + properties: + data: + type: object + properties: + attributes: + type: object + properties: + name: + description: The name of the catalog. + type: string + examples: + - catalog-123 + minLength: 1 + description: + description: A brief description of the catalog. + type: + - string + - 'null' + examples: + - Catalog for Store 123 + hierarchy_ids: + description: >- + The unique identifiers of the hierarchies to associate with + a catalog. + type: array + items: + type: string + pricebook_id: + description: > + The unique identifier of the price book to associate with + this catalog. You can specify either a `pricebook_id` or + `pricebook_ids` but not both. If you specify both a + `pricebook_id` and `pricebook_ids`, a `422 Unprocessable + Entity` error is displayed. + type: string + pricebook_ids: + $ref: '#/components/schemas/prioritized-pricebooks' + locales: + description: >- + Product Experience Manager supports localization of products + and hierarchies. If you store supports multiple languages, + you can localize product names and descriptions. + type: object + additionalProperties: + description: >- + A [three-letter language + code](https://www.iso.org/iso-639-language-code) that + represents the name of language you have used. + type: object + additionalProperties: + description: >- + A [three-letter language + code](https://www.iso.org/iso-639-language-code) that + represents the name of language you have used. + type: string + required: + - name + - hierarchy_ids + type: + description: Represents the type of object being returned. Always `Catalog`. + type: string + examples: + - catalog + const: catalog + required: + - type + - attributes + required: + - data + title: CatalogCreateData + catalog-data: + description: Container for a single catalog. + type: object + properties: + data: + $ref: '#/components/schemas/catalog' + links: + $ref: '#/components/schemas/links' + required: + - data + title: CatalogData + catalog-list-data: + description: Container for a list of catalogs. + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/catalog' + links: + $ref: '#/components/schemas/links' + required: + - data + title: CatalogListData + catalog-update-data: + description: A catalog combines price books, product lists, and hierarchies. + type: object + properties: + data: + type: object + properties: + attributes: + type: object + properties: + name: + description: The name of the catalog. + type: + - string + - 'null' + examples: + - catalog-123 + minLength: 1 + description: + description: A brief description of the catalog. + type: + - string + - 'null' + examples: + - Catalog for Store 123 + hierarchy_ids: + description: >- + The unique identifiers of the hierarchies to associate with + a catalog. + type: + - array + - 'null' + items: + type: string + pricebook_id: + description: >- + The unique identifier of a price book to associate with a + catalog. You can specify a `pricebook_id` or a + `pricebook_ids` but not both. If you specify both, a `422 + unprocessable entity` error is displayed. + type: + - string + - 'null' + pricebook_ids: + $ref: '#/components/schemas/prioritized-pricebooks' + locales: + description: >- + Product Experience Manager supports localization of products + and hierarchies. If you store supports multiple languages, + you can localize product names and descriptions. + type: object + additionalProperties: + description: >- + A [three-letter language + code](https://www.loc.gov/standards/iso639-2/) that + represents the name of language you have used. + type: object + additionalProperties: + description: >- + A [three-letter language + code](https://www.loc.gov/standards/iso639-2/) that + represents the name of language you have used. + type: string + id: + description: The unique identifier of the catalog to be updated. + type: string + examples: + - 8dbb35b2-ef04-477e-974d-e5f3abe6faae + x-go-name: ID + type: + description: >- + This represents the type of object being returned. Always + `catalog`. + type: string + examples: + - catalog + const: catalog + required: + - type + - id + - attributes + required: + - data + title: CatalogUpdateData + component-product: + description: The unique identifier of the component, for example, `games`. + type: object + properties: + name: + description: The component name is the name that is displayed in your storefront. + type: string + x-go-name: Name + min: + description: >- + The minimum number of product options a shopper can select from this + component. + type: + - integer + - 'null' + x-go-name: Min + max: + description: >- + The maximum number of product options a shopper can select from this + component. + type: + - integer + - 'null' + x-go-name: Max + sort_order: + description: >- + The sort order of the components. The `create a bundle` and `update + a bundle` endpoints do not sort the components. You can use the + `sort_order` attribute when programming your storefront to display + the components in the order that you want. + type: + - integer + - 'null' + x-go-name: Sort Order + options: + description: >- + The product options included in a component. This can be the ID of + another bundle. + type: array + items: + $ref: '#/components/schemas/component-product-option' + x-go-name: Options + title: Component Product + component-product-option: + description: >- + The product options included in a component. This can be the ID of + another bundle. + type: object + properties: + id: + description: A unique identifier of the product you want to add to a component. + type: string + format: uuid + x-go-name: ID + type: + description: This represents the type of object being returned. Always `product`. + type: string + examples: + - product + default: product + const: product + x-go-name: Type + quantity: + description: The number of this product option that a shopper must purchase. + type: integer + examples: + - 2 + x-go-name: Quantity + sort_order: + description: >- + The sort order of the options. The `create a bundle` and `update a + bundle` endpoints do not sort the options. You can use the + `sort_order` attribute when programming your storefront to display + the options in the order that you want. + type: + - integer + - 'null' + examples: + - 15 + x-go-name: Sort Order + default: + description: >- + The boolean indicates whether the current option is a default option + for the component. + type: + - boolean + - 'null' + examples: + - true + default: false + x-go-name: Default + title: Component Product Option + components: + additionalProperties: + $ref: '#/components/schemas/component-product' + description: >- + A bundle is a purchasable product, comprising of one or more products + that you want to sell together. You can create multiple components + within a bundle. Each component must have at least one or more options. + Each option is a product and a quantity. + title: Components + type: object + custom-input-validation-rule-options: + description: The length of the custom input text field. + type: object + properties: + max_length: + description: >- + The number of characters the custom text field can be. You can + specify a maximum length up to 255 characters, as the limit is 255 + characters. + type: integer + examples: + - 255 + x-go-name: MaxLength + x-go-name: CustomInputValidationRuleOptions + custom-input-validation-rule: + description: The validation rules for the custom text. + type: object + properties: + type: + description: This represents the type of object being returned. Must be `string`. + type: string + examples: + - string + default: string + const: string + x-go-name: Type + options: + $ref: '#/components/schemas/custom-input-validation-rule-options' + title: Custom Input Validation Rule + x-go-name: CustomInputValidationRule + custom-input: + description: >- + The name of the custom input. You can rename the input to something more + representative of the input that shoppers are adding, for example, + `message` or `front`. + type: object + properties: + name: + description: >- + The name for the custom text field that is displayed in your + storefront. + type: string + examples: + - Message + x-go-name: Name + validation_rules: + description: The validation rules for the custom text. + type: array + items: + $ref: '#/components/schemas/custom-input-validation-rule' + x-go-name: ValidationRules + required: + description: >- + This is `true` or `false` depending on whether the custom text is + required. + type: + - boolean + - 'null' + examples: + - false + default: false + x-go-name: Required + title: Custom Input + custom_inputs: + description: > + You can allow your shoppers to add custom text to a product when adding + product items to their carts. This is useful, for example, if you have a + product like a T-shirt that can be personalized or you sell greetings + cards that can be printed with your shoppers personalized messages. You + can do this using the `custom_inputs` attribute. + + - You can rename input to something more representative of the input that shoppers are adding, for example, `message` or `front`. + - `name` is the name that is displayed in your storefront. + - You can add validation rules. For example, the input field must be a string and/or up to 255 characters in length. The limit is 255 characters. + type: object + additionalProperties: + $ref: '#/components/schemas/custom-input' + title: Custom Inputs + currencies: + description: >- + A collection of one or more currencies objects that consists of the + [**three-letter ISO + code**](https://www.iso.org/iso-3166-country-codes.html) of the + currencies associated with this price and the amount. This is the + product's price. + type: object + additionalProperties: + $ref: '#/components/schemas/amount' + title: Currencies + shopper_attributes: + description: >- + The optional price extension with values in string format, viewable by + shoppers. + type: object + additionalProperties: + type: string + title: ShopperAttributes + diff-list-data: + description: A list of differences between two releases. + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/product-diff' + links: + $ref: '#/components/schemas/links' + title: DiffListData + display-price: + description: A price formatted for display. + type: object + properties: + with_tax: + $ref: '#/components/schemas/formatted-price' + without_tax: + $ref: '#/components/schemas/formatted-price' + x-omitempty: true + error: + description: APIError is a json-api style part of an error response. + type: object + properties: + detail: + type: string + examples: + - not processable + x-go-name: Detail + status: + type: string + examples: + - '422' + x-go-name: Status + title: + type: string + examples: + - There was a problem processing your request. + x-go-name: Title + title: APIError + x-go-name: APIError + error-response: + description: ErrorResponse is a json-api style Error response. + type: object + properties: + errors: + type: array + items: + $ref: '#/components/schemas/error' + x-go-name: Errors + title: ErrorResponse + x-go-name: ErrorResponse + extension: + description: The name of the product template. + type: object + additionalProperties: + description: The product attributes available for this template. + type: object + title: Extension + extensions: + description: >- + With extension templates, you can attach a specific set of custom fields + to your products in Product Experience Manager. For example, a **Book** + template might contain the attributes, such as **ISBN**, **Author**, + **Number of pages**, **Year Published**, or **Condition (New/Used)**. + type: object + additionalProperties: + $ref: '#/components/schemas/extension' + title: Extensions + file-reference: + description: >- + In Product Experience Manager, products can have associated rich media + assets, such as product images or a file containing additional product + details. + type: object + properties: + type: + description: This represents the type of object being returned. Always `file`. + type: string + examples: + - file + const: file + id: + description: A unique identifier for a file. + type: string + format: uuid + created_at: + description: The date and time a file is created. + type: string + format: date-time + examples: + - '1970-01-01T00:00:00.000' + x-go-name: CreatedAt + x-go-name: FileRelationship + files-relationship: + description: >- + In Product Experience Manager, products can have associated rich media + assets, such as product images or a file containing additional product + details. + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/file-reference' + x-omitempty: true + component-products-relationship: + description: >- + A bundle is a purchasable product, comprising of one or more products + that you want to sell together. You can create multiple components + within a bundle. Each component must have at least one or more options. + Each option is a product and a quantity. You can link to the products + that make up your bundle components. + type: object + properties: + data: + $ref: '#/components/schemas/product-references' + links: + $ref: '#/components/schemas/self-link' + x-omitempty: true + formatted-price: + description: A price formatted for display. + type: object + properties: + amount: + description: >- + The price in the lowest denomination for the specified currency. + This is a product's list price. + type: integer + examples: + - '47500' + x-omitempty: false + currency: + description: >- + The three-letter ISO code of the currencies associated with this + price and the amount. + type: string + examples: + - USD + formatted: + description: The format of the price for display. + type: string + examples: + - $475.00 + title: FormattedPrice + x-omitempty: true + hierarchy: + description: >- + A category hierarchy in a catalog. Hierarchies can have parent nodes and + child nodes, as well as a list of attached products. + type: object + properties: + attributes: + $ref: '#/components/schemas/hierarchy-attributes' + id: + description: A unique identifier of a hierarchy. + type: string + examples: + - e871df93-c769-49a9-9394-a6fd555b8e8a + x-go-name: ID + relationships: + $ref: '#/components/schemas/hierarchy-relationships' + type: + description: >- + This represents the type of object being returned. Always + `hierarchy`. + type: string + examples: + - hierarchy + x-go-name: Type + meta: + $ref: '#/components/schemas/hierarchy-meta' + title: Hierarchy + x-go-name: Hierarchy + hierarchy-meta: + description: A hierarchy's metadata. + type: object + properties: + language: + description: >- + Product Experience Manager supports localization of hierarchies. If + your store supports multiple languages, you can localize hierarchy + names and descriptions. This is [**three-letter language + code**](https://www.iso.org/iso-639-language-code) that represents + the name of the language you have used. + type: string + examples: + - en-GB + title: HierarchyMeta + x-go-name: HierarchyMeta + x-omitempty: true + hierarchy-attributes: + description: Resource attributes of a catalog hierarchy. + type: object + properties: + created_at: + description: The date and time a hierarchy is created. + type: string + format: date-time + examples: + - '1970-01-01T00:00:00.000' + x-go-name: CreatedAt + published_at: + description: The date and time a hierarchy is published in a catalog. + type: + - string + - 'null' + format: date-time + examples: + - '1970-01-01T00:00:00.000' + description: + description: A description of a hierarchy. + type: string + examples: + - Formal dresswear + x-go-name: Description + name: + description: The name of a hierarchy. + type: string + examples: + - Formal dresswear + x-go-name: Name + slug: + description: A unique slug for a hierarchy. + type: string + examples: + - formal + x-go-name: Slug + updated_at: + description: The date and time a hierarchy was updated. + type: string + format: date-time + examples: + - '1970-01-01T00:00:00.000' + x-go-name: UpdatedAt + title: HierarchyAttributes + x-go-name: HierarchyAttributes + hierarchy-data: + description: Container for hierarchies. + type: object + properties: + data: + $ref: '#/components/schemas/hierarchy' + links: + $ref: '#/components/schemas/links' + title: HierarchyData + hierarchy-list-data: + description: Container for a list of hierarchies. + type: object + properties: + meta: + $ref: '#/components/schemas/page-meta' + data: + type: array + items: + $ref: '#/components/schemas/hierarchy' + links: + $ref: '#/components/schemas/links' + title: HierarchyListData + hierarchy-relationships: + description: Relationships to child nodes, and products. + type: object + properties: + products: + description: A URL to all the products associated with a hierarchy. + type: object + properties: + links: + $ref: '#/components/schemas/related-link' + children: + description: A URL to all the child products associated with a hierarchy. + type: object + properties: + links: + $ref: '#/components/schemas/related-link' + required: + - links + nodes: + description: A URL to all the nodes associated with a hierarchy. + type: object + properties: + links: + $ref: '#/components/schemas/related-link' + required: + - links + title: HierarchyRelationships + x-go-name: HierarchyRelationships + links: + description: Links allow you to move between requests. + type: object + properties: + self: + description: >- + Single entities use a `self` parameter with a link the specific + resource. + type: + - string + - 'null' + format: uri + first: + description: Always the first page. + type: + - string + - 'null' + format: uri + last: + description: This is `null` if there is only one page. + type: + - string + - 'null' + format: uri + prev: + description: This is `null` if there is only one page. + type: + - string + - 'null' + format: uri + next: + description: This is `null` if there is only one page. + type: + - string + - 'null' + format: uri + main-image-relationship: + description: >- + In Product Experience Manager, products can also have associated product + images. + type: object + properties: + data: + description: The images associated with a product. + type: object + properties: + type: + description: >- + This represents the type of object being returned. Always + `main_image`. + type: string + examples: + - main_image + const: main_image + id: + description: A unique identifier for an image. + type: string + format: uuid + x-nullable: 'true' + x-omitempty: true + node: + description: >- + A category node in a catalog. Nodes can have child nodes, as well as a + list of attached products. + type: object + properties: + attributes: + $ref: '#/components/schemas/node-attributes' + id: + description: The unique identifier of a node. + type: string + examples: + - e871df93-c769-49a9-9394-a6fd555b8e8a + x-go-name: ID + relationships: + $ref: '#/components/schemas/node-relationships' + type: + description: This represents the type of object being returned. Always `node`. + type: string + examples: + - node + x-go-name: Type + meta: + $ref: '#/components/schemas/node-meta' + title: Node + x-go-name: Node + node-attributes: + description: Resource attributes of a catalog node. + type: object + properties: + created_at: + description: The date and time a node was created. + type: string + format: date-time + examples: + - '1970-01-01T00:00:00.000' + x-go-name: CreatedAt + published_at: + description: The date and time a node was published in a catalog. + type: + - string + - 'null' + format: date-time + examples: + - '1970-01-01T00:00:00.000' + description: + description: A description of a node. + type: string + examples: + - Formal dresswear + x-go-name: Description + label: + type: string + examples: + - category + x-go-name: Label + name: + description: >- + The name of a node. Names must be unique among sibling nodes in a + hierarchy. Otherwise, a name can be non-unique within the hierarchy + and across multiple hierarchies. + type: string + examples: + - Formal dresswear + x-go-name: Name + slug: + description: >- + A slug for the node. Slugs must be unique among sibling nodes in the + hierarchy. Otherwise, a slug can be non-unique within the hierarchy + and across multiple hierarchies. + type: string + examples: + - formal + x-go-name: Slug + curated_products: + description: >- + A list of curated products for a node. You can curate your products + in your nodes product lists. Product curation allows you to promote + specific products within each node in a hierarchy, enabling you to + create unique product collections in your storefront. + type: array + items: + type: string + examples: + - 8dbb35b2-ef04-477e-974d-e5f3abe6faae + x-omitempty: true + status: + type: string + examples: + - live + x-go-name: Status + updated_at: + description: The date and time a node was updated. + type: string + format: date-time + examples: + - '1970-01-01T00:00:00.000' + x-go-name: UpdatedAt + title: NodeAttributes + x-go-name: NodeAttributes + node-create-data: + description: Container for nodes. + type: object + properties: + data: + description: >- + A node in a catalog (e.g. a category node). Nodes can have child + nodes, as well as a list of attached products + type: object + properties: + attributes: + description: Resource attributes of a catalog node. + type: object + properties: + description: + type: string + examples: + - Formal dresswear + x-go-name: Description + hierarchy_id: + description: hierarchy id of the node + type: string + examples: + - ddd401ac-db06-4d9e-af60-cf5206abb9bc + label: + type: string + examples: + - category + x-go-name: Label + name: + type: string + examples: + - Formal dresswear + x-go-name: Name + slug: + type: string + examples: + - formal + x-go-name: Slug + status: + type: string + examples: + - Live + x-go-name: Status + locales: + type: object + additionalProperties: + type: object + additionalProperties: + type: string + required: + - name + title: NodeCreateAttributes + relationships: + $ref: '#/components/schemas/node-relationships' + id: + type: string + examples: + - 8fccaa19-dba9-4621-8d11-31a222a68c7c + x-go-name: ID + type: + type: string + examples: + - node + x-go-name: Type + required: + - type + - attributes + title: NodeCreateArgs + links: + $ref: '#/components/schemas/links' + required: + - data + title: NodeCreateData + node-data: + description: Container for nodes. + type: object + properties: + data: + $ref: '#/components/schemas/node' + links: + $ref: '#/components/schemas/links' + title: NodeData + node-list-data: + description: Container for a list of nodes. + type: object + properties: + meta: + $ref: '#/components/schemas/page-meta' + data: + type: array + items: + $ref: '#/components/schemas/node' + links: + $ref: '#/components/schemas/links' + title: NodeListData + node-meta: + description: A node's metadata. + type: object + properties: + language: + description: The node details localized in the supported languages. + type: string + examples: + - en-GB + bread_crumb: + description: >- + Helps you understand the association of products with nodes. It + explains how products are associated with parent nodes and the + relationship among the array of nodes. This is useful if you want to + improve how your shoppers search within you store. + type: array + items: + type: string + examples: + - 8dbb35b2-ef04-477e-974d-e5f3abe6faae + x-omitempty: true + title: NodeMeta + x-go-name: NodeMeta + x-omitempty: true + node-reference: + description: Minimum set of information to identify a catalog node. + type: object + properties: + id: + description: The unique identifier of a hierarchy. + type: string + examples: + - 65477ce0-fcb8-436b-a120-3d57979421dd + x-go-name: ID + label: + description: A label for a hierarchy. + type: string + examples: + - category + x-go-name: Label + name: + description: The name of a hierarchy. + type: string + examples: + - Formal dresswear + x-go-name: Name + title: NodeReference + x-go-name: NodeReference + node-relationships: + description: Relationships to parent and child nodes, and products. + type: object + properties: + products: + description: A URL to all products associated with a node. + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/product-reference' + x-omitempty: true + links: + $ref: '#/components/schemas/related-link' + children: + description: A URL to all child nodes associated with a node. + type: object + properties: + links: + $ref: '#/components/schemas/related-link' + required: + - links + parent: + description: A URL to all parent nodes associated with a node. + type: object + properties: + data: + type: object + properties: + type: + type: string + examples: + - node + const: node + id: + type: string + examples: + - 8fccaa19-dba9-4621-8d11-31a222a68c7c + x-go-name: ID + required: + - id + - type + links: + $ref: '#/components/schemas/related-link' + required: + - data + hierarchy: + description: A URL to the hierarchies associated with a node. + type: object + properties: + data: + type: object + properties: + type: + type: string + examples: + - hierarchy + const: hierarchy + id: + type: string + examples: + - 8fccaa19-dba9-4621-8d11-31a222a68c7c + x-go-name: ID + required: + - id + - type + links: + $ref: '#/components/schemas/related-link' + required: + - data + title: NodeRelationships + x-go-name: NodeRelationships + node-relationships-data: + description: Container for node relationships. + type: object + properties: + data: + $ref: '#/components/schemas/node-relationships' + links: + $ref: '#/components/schemas/links' + title: NodeRelationshipsData + page-meta: + description: Contains the results for the entire collection. + type: object + properties: + results: + description: Total number of results for the entire collection. + type: object + properties: + total: + description: Total number of results for the entire collection. + type: integer + format: int64 + page: + type: object + properties: + limit: + description: The maximum number of records for all pages. + type: integer + format: int64 + offset: + description: The current offset by number of pages. + type: integer + format: int64 + current: + description: The current number of pages. + type: integer + format: int64 + total: + description: The total number of records for the entire collection. + type: integer + format: int64 + title: PageMeta + pricebook: + description: >- + Top level entity in the pricebooks domain model. It contains a list of + product prices. + type: object + properties: + id: + description: The unique identifier of a price book. + type: string + examples: + - 4c45e4ec-26e0-4043-86e4-c15b9cf985a7 + x-go-name: ID + type: + description: >- + This represents the type of object being returned. Always + `pricebook`. + type: string + examples: + - pricebook + default: pricebook + const: pricebook + x-go-name: Type + attributes: + type: object + properties: + created_at: + type: string + format: date-time + examples: + - '2020-09-22T09:00:00' + x-go-name: CreatedAt + description: + type: + - string + - 'null' + examples: + - This is a pricebook + x-go-name: Description + name: + type: + - string + - 'null' + examples: + - pricebook-store-abc + x-go-name: Name + updated_at: + type: string + format: date-time + examples: + - '2020-09-22T09:00:00' + x-go-name: UpdatedAt + required: + - name + additionalProperties: false + required: + - type + - attributes + title: Pricebook + x-go-name: Pricebook + pricebook-create-data: + description: Container for pricebooks. + type: object + properties: + data: + description: New top level pricebook. + type: object + additionalProperties: false + properties: + type: + type: string + examples: + - pricebook + default: pricebook + const: pricebook + x-go-name: Type + attributes: + type: object + properties: + description: + type: + - string + - 'null' + examples: + - This is a pricebook + x-go-name: Description + name: + type: + - string + - 'null' + examples: + - pricebook-store-abc + x-go-name: Name + required: + - name + required: + - type + - attributes + title: PricebookCreateArgs + links: + $ref: '#/components/schemas/links' + required: + - data + title: PricebookData + pricebook-data: + description: Container for pricebooks. + type: object + properties: + data: + $ref: '#/components/schemas/pricebook' + links: + $ref: '#/components/schemas/links' + required: + - data + title: PricebookData + pricebook-price: + description: >- + ProductPrice associates a collection of locale specific prices with a + product ID. + type: object + properties: + type: + type: string + examples: + - product-price + default: product-price + const: product-price + attributes: + type: object + properties: + currencies: + $ref: '#/components/schemas/tiered-currencies' + sales: + $ref: '#/components/schemas/sales' + sku: + type: string + examples: + - 4c45e4ec-sku + required: + - currencies + - sku + id: + type: string + examples: + - 4c45e4ec-26e0-4043-86e4-c15b9cf985a7 + x-go-name: ID + additionalProperties: false + required: + - type + - id + - attributes + title: PricebookPrice + pricebook-price-create-data: + description: Container for pricebook prices. + type: object + properties: + data: + description: >- + ProductPrice associates a collection of locale specific prices with + a product ID. + type: object + properties: + type: + type: string + examples: + - product-price + default: product-price + const: product-price + attributes: + type: object + properties: + currencies: + $ref: '#/components/schemas/tiered-currencies' + sales: + $ref: '#/components/schemas/sales' + sku: + type: string + examples: + - 4c45e4ec-sku + required: + - currencies + - sku + required: + - type + - attributes + title: PricebookPriceCreateArgs + links: + $ref: '#/components/schemas/links' + required: + - data + title: PricebookPriceCreateData + pricebook-price-data: + description: Container for pricebook prices. + type: object + properties: + data: + $ref: '#/components/schemas/pricebook-price' + links: + $ref: '#/components/schemas/links' + required: + - data + title: PricebookPriceData + product: + description: A product in a catalog with the following attributes. + type: object + properties: + attributes: + $ref: '#/components/schemas/product-attributes' + id: + description: A unique identifier for a product. + type: string + examples: + - 8fccaa19-dba9-4621-8d11-31a222a68c7c + x-go-name: ID + relationships: + $ref: '#/components/schemas/product-relationships' + type: + description: This represents the type of object being returned. Always `product`. + type: string + examples: + - product + x-go-name: Type + meta: + $ref: '#/components/schemas/product-meta' + title: Product + x-go-name: Product + product-attributes: + description: A product's attributes. + type: object + properties: + published_at: + description: The date and time a product was published in a catalog. + type: + - string + - 'null' + format: date-time + examples: + - '1970-01-01T00:00:00.000' + base_product: + description: >- + If this product is a `parent` product. A `parent` product is a + product that has child products that have been built using the + `build child products` endpoint. + type: boolean + examples: + - false + default: false + x-go-name: BaseProduct + base_product_id: + description: The unique identifier of a `parent` product. + type: string + examples: + - cdf574bc-e36e-48fc-9eac-01c87839b285 + x-go-name: BaseProductID + commodity_type: + description: The commodity type, either `physical` or `digital`. + type: string + examples: + - physical + x-go-name: CommodityType + curated_product: + description: >- + If a product is curated, then the `curated_product` attribute with a + value of `true` is displayed. If a product is not curated, the + `curated_product` attribute is not displayed. + type: boolean + examples: + - true + x-go-name: CuratedProduct + x-omitempty: true + upc_ean: + description: >- + The universal product code or european article number of the + product. + type: string + examples: + - '0123456' + x-go-name: UpcEan + manufacturer_part_num: + description: The manufacturer part number of the product. + type: string + examples: + - mfn1 + x-go-name: ManufacturerPartNum + tags: + description: >- + A list of tags associated with the product. A tag must be HTML + compatible characters excluding commas and will be stored in + lowercase letters. + type: array + items: + description: A tag associated with the product. + type: string + examples: + - tag-a + x-go-name: Tags + x-omitempty: true + price_modifiers: + description: A list of price modifier names. + type: array + items: + description: A list of price modifier names. + type: string + examples: + - modifier-1 + x-go-name: PriceModifiers + x-omitempty: true + created_at: + description: The date and time a product was created. + type: string + format: date-time + examples: + - '1970-01-01T00:00:00.000' + x-go-name: CreatedAt + description: + description: A description of the product. + type: string + examples: + - This is a product + x-go-name: Description + name: + description: A name of a product. + type: string + examples: + - Blue shirt + x-go-name: Name + price: + $ref: '#/components/schemas/currencies' + shopper_attributes: + $ref: '#/components/schemas/shopper_attributes' + tiers: + $ref: '#/components/schemas/tiers' + components: + $ref: '#/components/schemas/components' + custom_inputs: + $ref: '#/components/schemas/custom_inputs' + sku: + description: The unique stock keeping unit of the product. + type: string + examples: + - blue-shirt + x-go-name: Sku + slug: + description: >- + A label for the product that is used in the URL paths. A slug can + contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. + Spaces or other special characters like ^, [], *, and $ are not + allowed. By default, the product name is used as the slug. + type: string + examples: + - blue-shirt + x-go-name: Slug + status: + description: The status of the product, either `live` or `draft`. + type: string + examples: + - live + x-go-name: Status + external_ref: + description: >- + The unique attribute associated with the product. This could be an + external reference from a separate company system, for example. + type: + - string + - 'null' + x-go-name: ExternalRef + updated_at: + description: The date and time a product was updated. + type: string + format: date-time + examples: + - '1970-01-01T00:00:00.000' + x-go-name: UpdatedAt + extensions: + $ref: '#/components/schemas/extensions' + title: ProductAttributes + x-go-name: ProductAttributes + product-create-data: + description: Container for products. + type: object + properties: + data: + description: A new product in a catalog. + type: object + properties: + attributes: + description: A product's attributes. + type: object + properties: + description: + type: string + examples: + - This is a product + name: + type: string + examples: + - Blue shirt + sku: + type: string + examples: + - blue-shirt + slug: + type: string + examples: + - blue-shirt + status: + type: string + examples: + - live + locales: + type: object + additionalProperties: + type: object + additionalProperties: + type: string + required: + - name + - status + title: ProductCreateAttributes + id: + type: string + examples: + - 8fccaa19-dba9-4621-8d11-31a222a68c7c + x-go-name: ID + type: + type: string + examples: + - product + x-go-name: Type + required: + - attributes + - type + title: ProductCreateArgs + links: + $ref: '#/components/schemas/links' + title: ProductData + product-data: + description: Container for products. + type: object + properties: + data: + $ref: '#/components/schemas/product' + links: + $ref: '#/components/schemas/links' + included: + $ref: '#/components/schemas/included' + title: ProductData + product-diff: + type: object + properties: + id: + type: string + examples: + - e871df93-c769-49a9-9394-a6fd555b8e8a + x-go-name: ID + type: + type: string + examples: + - product_diff + x-go-name: Type + attributes: + type: object + properties: + sku: + type: string + this_release_id: + type: string + other_release_id: + type: string + diff_created_at: + type: string + format: date-time + examples: + - '1970-01-01T00:00:00.000' + exists: + type: object + properties: + this: + type: boolean + other: + type: boolean + required: + - this + - other + x-go-name: ProductDiffExists + updated_at: + type: object + properties: + this: + type: + - string + - 'null' + format: date-time + examples: + - '1970-01-01T00:00:00.000' + x-omitempty: true + other: + type: + - string + - 'null' + format: date-time + examples: + - '1970-01-01T00:00:00.000' + x-omitempty: true + x-go-name: ProductDiffUpdatedAt + x-go-name: ProductDiff + product-list-data: + description: Container for a list of products. + type: object + properties: + meta: + $ref: '#/components/schemas/page-meta' + data: + type: array + items: + $ref: '#/components/schemas/product' + x-go-name: Data + links: + $ref: '#/components/schemas/links' + included: + $ref: '#/components/schemas/included' + title: ProductListData + product-meta: + description: >- + A product's metadata contains information about products, for example, + the nodes a product is associated with, any child products, bundle + configurations, and so on. + type: object + properties: + bread_crumbs: + description: >- + The relationship among the array of nodes a product is associated + with, demonstrating the linking of the children nodes with the + parent nodes. Up to 10 levels of parent nodes are displayed, + depending on the number of levels of parent nodes you have. + type: object + additionalProperties: + type: array + items: + type: string + examples: + - 8dbb35b2-ef04-477e-974d-e5f3abe6faae + x-omitempty: true + bread_crumb_nodes: + description: >- + An array of parent node IDs that a product is associated with. Up to + 10 levels of parent nodes are displayed, depending on the number of + levels of parent nodes you have. + type: array + items: + type: string + examples: + - 8dbb35b2-ef04-477e-974d-e5f3abe6faae + x-omitempty: true + catalog_id: + description: A unique identifier of the catalog a product is associated with. + type: string + examples: + - 362a16dc-f7c6-4280-83d6-4fcc152af091 + x-go-name: CatalogID + pricebook_id: + description: >- + The unique identifier of the price book a product is associated + with. + type: + - string + - 'null' + examples: + - f5466169-0037-460c-b181-b02682b6f4de + x-go-name: PricebookID + display_price: + $ref: '#/components/schemas/display-price' + catalog_source: + description: The source of a catalog. Always `pim`. + type: string + examples: + - pim + const: pim + x-go-name: CatalogSource + sale_id: + description: >- + With sales pricing, a store can optionally add a sale price to a + product price. For example, a store can schedule seasonal pricing on + products without creating a new price book and catalog ruleset. + Optionally, a store can schedule the date ranges for the sale + products. This is the unique identifier of a sale. + type: string + x-go-name: SaleID + sale_expires: + description: The date and time a sale expires. + type: + - string + - 'null' + format: date-time + examples: + - '1970-01-01T00:00:00.000' + x-go-name: SaleExpires + original_price: + $ref: '#/components/schemas/currencies' + original_display_price: + $ref: '#/components/schemas/display-price' + bundle_configuration: + $ref: '#/components/schemas/bundle-configuration' + component_products: + description: >- + A bundle is a purchasable product, comprising of one or more + products that you want to sell together. You can create multiple + components within a bundle. Each component must have at least one or + more options. Each option is a product and a quantity. + type: object + additionalProperties: + type: object + properties: + sale_id: + description: >- + With sales pricing, a store can optionally add a sale price to + a product price. For example, a store can schedule seasonal + pricing on products without creating a new price book and + catalog ruleset. Optionally, a store can schedule the date + ranges for the sale products. This is the unique identifier of + a sale. + type: string + x-go-name: SaleID + sale_expires: + description: The date and time a sale expires. + type: + - string + - 'null' + format: date-time + examples: + - '1970-01-01T00:00:00.000' + x-go-name: SaleExpires + price: + $ref: '#/components/schemas/currencies' + display_price: + $ref: '#/components/schemas/display-price' + original_price: + $ref: '#/components/schemas/currencies' + original_display_price: + $ref: '#/components/schemas/display-price' + pricebook_id: + type: + - string + - 'null' + examples: + - f5466169-0037-460c-b181-b02682b6f4de + x-go-name: PricebookID + x-go-name: ComponentProductMeta + price_modifiers: + description: >- + You can use price modifiers to change the price property of child + products. By default, child products inherit the same price as their + base products. Using price modifiers, you can enable child products + to inherit a different price. + type: object + additionalProperties: + description: >- + A name for the modifier. The name must be unique and is + case-sensitive. + type: object + properties: + modifier_type: + description: | + There are three modifier types. + + - The `price_increment` type increases the prices of a product. + - The `price_decrement` type decreases the price of a product. + - The `price_equals` type sets the price of a product to an amount you specify. + type: string + examples: + - price_equals + currencies: + $ref: '#/components/schemas/currencies' + x-go-name: PriceModifierMeta + tiers: + description: >- + You can use tiers to allow your store to offer different pricing for + minimum quantities of items that your shoppers purchase. + type: object + additionalProperties: + description: The name of the tier, such as `Pencils`. + type: object + properties: + sale_id: + description: The unique identifier of a sale. + type: string + x-go-name: SaleID + sale_expires: + description: The date and time a sale expires. + type: + - string + - 'null' + format: date-time + examples: + - '1970-01-01T00:00:00.000' + x-go-name: SaleExpires + display_price: + $ref: '#/components/schemas/display-price' + original_price: + $ref: '#/components/schemas/currencies' + original_display_price: + $ref: '#/components/schemas/display-price' + x-go-name: ProductMetaTier + x-go-name: ProductMetaTiers + variation_matrix: + description: >- + The `variation_matrix` object lists the variation IDs and variation + option IDs and their corresponding product IDs that are generated + when the variation and variation options are built with a product. + If no variations are available, the `variation_matrix` is empty. + type: object + variations: + description: >- + If you specified `build_rules` for a product, the `variations` + object lists the variation option IDs that you specified to include + when building your child products. If no `build_rules` are + specified, all the variation and variation options available for a + product are displayed. If a product does not have any variations, + then the `variations` object is not displayed. + type: array + items: + $ref: '#/components/schemas/variation' + x-omitempty: true + child_option_ids: + description: An array of variation options IDs that a child product has. + type: + - array + - 'null' + items: + type: string + examples: + - - 8dbb35b2-ef04-477e-974d-e5f3abe6faae + - 6ddf2a66-d805-449c-a0e1-8e81335e31a6 + x-omitempty: true + child_variations: + description: >- + If this is a child product, the `child_variations` object lists the + variation option IDs that define this child product. + type: + - array + - 'null' + items: + $ref: '#/components/schemas/variation' + x-omitempty: true + product_types: + description: > + Commerce automatically assigns types to the products you create. In + Commerce Manager, you can see at a glance the product types in a + list of a products. In addition, you can filter on product types in + both the API and Commerce Manager. + + Product types can also be used in catalogs. For example, in your catalog, you can filter on parent so that only your parent products are displayed in your storefront. + + Products have one of the following types: + + - **standard** - Standard products are a standalone products. + - **parent** - A parent product is a product that has child products that have been built using the `Build Child Products` endpoint. + - **child** - When you configure product variations and variation options for parent products, the child products derived from the parent products are automatically created in Commerce. + - **bundle** - A bundle is a purchasable product, comprising two or more standalone products (in other words, components) to be sold together. + type: array + items: + type: string + x-go-name: ProductTypes + x-omitempty: true + language: + description: >- + If you storefront supports multiple languages, your storefront's + preferred language and locale. + type: string + examples: + - en-GB + title: ProductMeta + x-go-name: ProductMeta + x-omitempty: true + variation_option: + description: The options available for a variation. + type: object + properties: + id: + description: A unique identifier for an option. + type: string + format: uuid + x-go-name: ID + name: + description: The name of the option. + type: string + sort_order: + description: >- + If you specified a `sort_order` when creating your variations and + variation options, then use the `sort_order` value to program your + storefront to display the variations and variation options in the + order that you want. + type: + - integer + - 'null' + x-go-name: Sort Order + description: + description: The option description to display to customers. + type: string + x-go-name: ProductVariationOption + variation: + type: object + properties: + id: + description: A unique identifier of a variation. + type: string + format: uuid + x-go-name: ID + name: + description: The name of a variation. + type: string + sort_order: + description: >- + If you specified a `sort_order` when creating your variations and + variation options, then use the `sort_order` value to program your + storefront to display the variations and variation options in the + order that you want. + type: + - integer + - 'null' + x-go-name: Sort Order + option: + $ref: '#/components/schemas/variation_option' + options: + description: The options available for this variation. + type: array + items: + $ref: '#/components/schemas/variation_option' + x-omitempty: true + x-go-name: ProductVariation + bundle-configuration-data: + description: Container for a bundle configuration. + type: object + properties: + data: + $ref: '#/components/schemas/bundle-configuration' + required: + - data + title: BundleConfigurationData + bundle-configuration: + description: >- + A bundle is a purchasable product, comprising of one or more products + that you want to sell together. You can create multiple components + within a bundle. Each component must have at least one or more options. + Each option is a product and a quantity. + type: object + properties: + selected_options: + description: >- + The product options included in a component. This can be the ID of + another bundle. + type: object + additionalProperties: + description: The unique identifier of the component, for example, `games`. + type: object + additionalProperties: + description: The number of this product option that a shopper must purchase. + type: integer + format: int64 + required: + - selected_options + title: BundleConfiguration + x-go-name: ProductBundleConfiguration + product-reference: + description: A product identifier. + type: object + properties: + id: + description: A unique identifier for a product. + type: string + format: uuid + x-go-name: ID + type: + description: This represents the type of object being returned. Always `product`. + type: string + examples: + - product + const: product + x-go-name: Type + title: ProductReference + x-go-name: ProductReference + x-nullable: 'true' + product-reference-list-data: + description: Container for a list of product references. + type: object + properties: + meta: + $ref: '#/components/schemas/page-meta' + data: + $ref: '#/components/schemas/product-references' + links: + $ref: '#/components/schemas/links' + title: ProductReferenceListData + product-references: + description: A list of product identifiers. + type: array + items: + $ref: '#/components/schemas/product-reference' + title: ProductReferences + x-go-name: ProductReferences + product-relationships: + description: >- + Relationships allow you to move between requests. Includes links to the + parent and child products, bundle component products, files, and main + images associated with a product. + type: object + properties: + parent: + description: >- + The details of a `parent` product. A `parent` product is a product + that has child products that have been built using the `Build Child + Products` endpoint. + type: object + properties: + data: + $ref: '#/components/schemas/product-reference' + x-go-name: Parent + x-omitempty: true + children: + description: >- + The details of a `child` product. When you configure product + variations and variation options for parent products, the child + products derived from the parent products are automatically created + in Commerce. + type: object + properties: + data: + $ref: '#/components/schemas/product-references' + links: + $ref: '#/components/schemas/self-link' + x-go-name: Children + x-omitempty: true + files: + $ref: '#/components/schemas/files-relationship' + main_image: + $ref: '#/components/schemas/main-image-relationship' + component_products: + $ref: '#/components/schemas/component-products-relationship' + title: ProductRelationships + x-go-name: ProductRelationships + x-omitempty: true + product-relationships-data: + description: Container for product relationships. + type: object + properties: + data: + $ref: '#/components/schemas/product-relationships' + links: + $ref: '#/components/schemas/links' + title: ProductRelationshipsData + products-for-cart: + description: >- + A list of products to be added to cart. Can be type product-data or + error-response. + type: object + properties: + data: + type: array + items: {} + x-go-name: Data + included: + type: + - object + - 'null' + properties: + component_products: + type: array + items: + $ref: '#/components/schemas/product' + x-go-name: ComponentProducts + x-go-name: Included + required: + - data + title: ProductsForCart + x-go-name: ProductsForCart + products-for-cart-configuration: + description: A list of product id or sku and bundle configuration for cart. + type: object + properties: + data: + type: array + items: + type: object + properties: + id: + type: + - string + - 'null' + format: uuid + x-go-name: ID + sku: + type: + - string + - 'null' + x-go-name: SKU + bundle_configuration: + $ref: '#/components/schemas/bundle-configuration' + minItems: 1 + x-go-name: Data + required: + - data + title: ProductsForCartConfiguration + x-go-name: ProductsForCartConfiguration + related-link: + description: >- + A URL to a related object, for example, catalog rules, hierarchies, + price books, products and deltas. + type: object + properties: + related: + description: >- + A URL to a related object, for example, catalog rules, hierarchies, + price books, products and deltas. + type: string + required: + - related + self-link: + description: Links are used to allow you to move between requests. + type: object + properties: + self: + description: >- + Single entities use a self parameter with a link to that specific + resource. + type: string + required: + - self + release: + description: >- + A catalog release represents a collection of hierarchical product data, + price books and catalogs rules. + type: object + properties: + id: + description: A unique identifier for the catalog release. + type: string + examples: + - 8dbb35b2-ef04-477e-974d-e5f3abe6faae + x-go-name: ID + attributes: + type: object + properties: + name: + description: The name of a release. + type: string + examples: + - Clothing + published_at: + description: The date and time a release was published. + type: + - string + - 'null' + format: date-time + examples: + - '1970-01-01T00:00:00.000' + catalog_id: + description: A unique identifier for the catalog. + type: string + examples: + - 0194f54d-f2a1-4e33-9a6e-9ec366152490 + description: + description: A description of the catalog release. + type: string + examples: + - Catalog for Store 123 + default: '' + hierarchies: + description: An array of hierarchy IDs associated with the release. + type: array + items: + $ref: '#/components/schemas/node-reference' + x-go-name: RootNodes + relationships: + $ref: '#/components/schemas/release-relationships' + type: + description: >- + This represents the type of object being returned. Always + `catalog-release`. + type: string + x-go-name: Type + meta: + $ref: '#/components/schemas/release-meta' + title: Release + x-go-name: Release + release-data: + description: Container for a catalog release. + type: object + properties: + data: + $ref: '#/components/schemas/release' + links: + $ref: '#/components/schemas/links' + title: Release Data + release-list-data: + description: Container for a list of catalog releases. + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/release' + links: + $ref: '#/components/schemas/links' + title: ReleaseListData + release-meta: + description: A release's metadata. + type: object + properties: + created_at: + description: The date and time a release is created. + type: string + format: date-time + examples: + - '1970-01-01T00:00:00.000' + started_at: + description: >- + The date and time a release is available for use. In other words, + the date and time the status of a catalog release changes to + PUBLISHED, rather than IN PROGRESS. + type: + - string + - 'null' + format: date-time + examples: + - '1970-01-01T00:00:00.000' + updated_at: + description: The date and time a release is updated. + type: + - string + - 'null' + format: date-time + examples: + - '1970-01-01T00:00:00.000' + release_status: + description: The status of the current release. + type: string + enum: + - PENDING + - IN_PROGRESS + - FAILED + - PUBLISHED + language: + description: Your storefront's preferred language code and locale. + type: string + examples: + - en-GB + is_full_publish: + description: > + Indicates that a full publish was performed (either because this is + the first time a catalog has been published or because of a change + that occurred, for example, adding/removing a price book or + hierarchy). When determining whether delta data needs to be + refreshed, ignore this attribute and always use the `is_full_delta` + attribute. + type: boolean + examples: + - false + default: false + x-go-name: IsFullPublish + is_full_delta: + description: > + Indicates whether the release delta file contains the full content + of a catalog release. Using a search service as an example, if the + `is_full_delta` attribute is `true`, you should remove all data + about that catalog release from the search service before injecting + fresh data from the delta file. If the `is_full_delta` attribute is + `false`, then data from the previous catalog release overlays the + existing data in the delta file. The `is_full_delta` attribute is + always `true` the first time a catalog is published. + type: boolean + examples: + - false + default: false + x-go-name: IsFullDelta + total_products: + description: The total number of products displayed in a catalog release. + type: + - integer + - 'null' + format: int64 + x-go-name: TotalProducts + total_nodes: + description: The total number of hierarchy nodes displayed in a catalog release. + type: + - integer + - 'null' + format: int64 + x-go-name: TotalNodes + percent_completed: + description: >- + An integer that represents the progress of a catalog publish. The + attribute starts at `0` and reaches `100` when publishing is + complete. + type: + - integer + - 'null' + format: int32 + x-go-name: PercentCompleted + owner: + description: The owner of the resource, can be either `organization` or `store`. + type: + - string + - 'null' + enum: + - store + - organization + x-go-name: Owner + title: ReleaseMeta + x-go-name: ReleaseMeta + x-omitempty: true + release-relationships: + description: >- + Relationships are established between different catalog entities. For + example, products, hierarchies, price books, and catalog rules are + related to a catalog, as they are associated with it. + type: object + properties: + delta: + description: >- + A URL to a delta document that describes the changes between catalog + releases. + type: object + properties: + links: + $ref: '#/components/schemas/related-link' + products: + description: A URL to all products included in a catalog release. + type: object + properties: + links: + $ref: '#/components/schemas/related-link' + hierarchies: + description: A URL to all hierarchies included in a catalog release. + type: object + properties: + links: + $ref: '#/components/schemas/related-link' + required: + - links + title: ReleaseRelationships + x-go-name: ReleaseRelationships + rule: + description: >- + A catalog rule specifies which catalog to use for a given shopper + context. + type: object + properties: + id: + description: >- + The catalog rule ID. Use this to get, modify, or delete the catalog + rule. + type: string + examples: + - 8dbb35b2-ef04-477e-974d-e5f3abe6faae + attributes: + type: object + properties: + name: + description: >- + The name of a catalog rule. The name must not contain any + spaces. + type: string + examples: + - rule-123 + description: + description: A brief description of the purpose of a catalog rule. + type: string + examples: + - Catalog Rule for most favored customers + default: '' + x-omitempty: true + account_ids: + description: >- + The list of accounts who are eligible to see this catalog. If + this field is empty, the rule matches all accounts. + type: array + items: + type: string + x-omitempty: true + customer_ids: + description: >- + The list of customers who are eligible to see this catalog. If + empty, the rule matches all customers. + type: array + items: + type: string + x-omitempty: true + channels: + description: >- + The list of channels in which this catalog can be displayed. A + channel is the shopping experience, such as a mobile app or web + storefront. If empty, the catalog rule matches all channels. The + channel will eventually be included in the bearer token that is + used for authorization, but currently, you must set the + `EP-Channel` header in your requests. + type: array + items: + type: string + x-omitempty: true + tags: + description: >- + A list of user-defined tags that can be used to further restrict + the eligibility criteria for this rule. Requests populate the + catalog rule tag using the `EP-Context-Tag` header. + type: array + items: + type: string + x-omitempty: true + schedules: + description: > + Specifies a time period when a catalog is displayed, such as on + a specific date or during summer. Requests populate the rule tag + using the `EP-Context-Tag` header. + + + The schedules attribute must include the following. + + + - `valid_from` matches the date and time that the catalog is + displayed from. + + - `valid_to` matches the date and time the catalog is displayed + to. + + + Commerce runs on UTC time. + + + You can offset the timezone by adding the offset to the end of + the date and time. For example, a catalog which contains a sale + hierarchy that should appear for a set timeframe may be + scheduled to publish on a given date and time within a given + timezone. For instance, a sale that should begin on 1st of June + 2022 05:00 ET and end on the 15th of June 2022 at 23:50 PT would + have a valid schedule of `"valid_from": + "2022-06-01T05:00:00.000-05:00"`, `"valid_to": + "2022-06-15T11:59:99.000-08:00"`. + type: array + items: + $ref: '#/components/schemas/rule-schedule' + x-omitempty: true + catalog_id: + description: The unique identifier of a catalog. + type: string + examples: + - d09b4e16-08a5-4f42-817c-6e0d98acbb63 + created_at: + description: The date and time a catalog rule was created. + type: string + format: date-time + examples: + - '2020-09-22T09:00:00' + updated_at: + description: The date and time a catalog release is updated. + type: string + format: date-time + examples: + - '2020-09-22T09:00:00' + required: + - name + - catalog_id + - created_at + - updated_at + type: + description: >- + This represents the type of object being returned. Always + `catalog_rule`. + type: string + examples: + - catalog_rule + const: catalog_rule + required: + - id + - type + - attributes + title: Catalog Rule + rule-create-data: + description: >- + A catalog rule specifies which catalog to use for a given shopper + context. + type: object + properties: + data: + type: object + properties: + attributes: + type: object + properties: + name: + description: >- + The name of a catalog rule. The name must not contain + spaces. + type: string + examples: + - rule-123 + minLength: 1 + description: + description: A brief description of the purpose of a catalog rule. + type: + - string + - 'null' + examples: + - Catalog Rule for most favored customers + default: '' + account_ids: + description: >- + The list of accounts who are eligible to see this catalog. + If this field is empty, the rule matches all accounts. + type: + - array + - 'null' + items: + type: string + customer_ids: + description: >- + The list of customers who are eligible to see this catalog. + If empty, the rule matches all customers. + type: + - array + - 'null' + items: + type: string + channels: + description: >- + The list of channels in which this catalog can be displayed. + A channel is the shopping experience, such as a mobile app + or web storefront. If empty, the catalog rule matches all + channels. The channel will eventually be included in the + bearer token that is used for authorization, but currently, + you must set the `EP-Channel` header in your requests. + type: + - array + - 'null' + items: + type: string + tags: + description: >- + A list of user-defined tags that can be used to further + restrict the eligibility criteria for this rule. Requests + populate the catalog rule tag using the `EP-Context-Tag` + header. + type: + - array + - 'null' + items: + type: string + schedules: + description: > + Specifies a time period when a catalog is displayed, such as + on a specific date or during summer. Requests populate the + rule tag using the `EP-Context-Tag` header. + + + The schedules attribute must include the following. + + + - `valid_from` matches the date and time that the catalog is + displayed from. + + - `valid_to` matches the date and time the catalog is + displayed to. + + + Commerce runs on UTC time. + + + You can offset the timezone by adding the offset to the end + of the date and time. For example, a catalog which contains + a sale hierarchy that should appear for a set timeframe may + be scheduled to publish on a given date and time within a + given timezone. For instance, a sale that should begin on + 1st of June 2022 05:00 ET and end on the 15th of June 2022 + at 23:50 PT would have a valid schedule of `"valid_from": + "2022-06-01T05:00:00.000-05:00"`, `"valid_to": + "2022-06-15T11:59:99.000-08:00"`. + type: + - array + - 'null' + items: + $ref: '#/components/schemas/rule-schedule' + catalog_id: + description: The unique identifier of a catalog. + type: string + examples: + - d09b4e16-08a5-4f42-817c-6e0d98acbb63 + required: + - name + - catalog_id + type: + description: >- + This represents the type of object being returned. Always + `catalog_rule`. + type: string + examples: + - catalog_rule + const: catalog_rule + required: + - type + - attributes + required: + - data + title: CatalogRuleCreateData + rule-data: + description: Container for a single catalog rule. + type: object + properties: + data: + $ref: '#/components/schemas/rule' + links: + $ref: '#/components/schemas/links' + required: + - data + title: CatalogRuleData + rule-list-data: + description: Container for a list of catalog rules. + type: object + properties: + meta: + $ref: '#/components/schemas/page-meta' + data: + type: array + items: + $ref: '#/components/schemas/rule' + links: + $ref: '#/components/schemas/links' + required: + - data + title: CatalogRuleListData + rule-schedule: + description: A period of time during which a catalog is valid + type: object + properties: + valid_from: + description: Matches the date and time that the catalog is displayed from. + type: + - string + - 'null' + format: date-time + examples: + - '2020-09-22T09:00:00' + x-go-name: ValidFrom + valid_to: + description: Matches the date and time the catalog is displayed to. + type: + - string + - 'null' + format: date-time + examples: + - '2020-09-22T09:00:00' + x-go-name: ValidTo + title: Catalog Schedule + x-go-name: RuleSchedule + rule-update-data: + description: >- + A catalog rule specifies which catalog to use for a given shopper + context. + type: object + properties: + data: + type: object + properties: + id: + description: >- + The catalog rule ID. Use this to get, modify, or delete the + catalog rule. + type: string + examples: + - 8dbb35b2-ef04-477e-974d-e5f3abe6faae + attributes: + type: object + properties: + name: + description: >- + The name of a catalog rule. The name must not contain + spaces. + type: + - string + - 'null' + examples: + - rule-123 + minLength: 1 + description: + description: A description of the purpose of a catalog rule. + type: + - string + - 'null' + examples: + - Catalog Rule for most favored customers + default: '' + account_ids: + description: >- + Specifies the list of accounts who are eligible to see this + catalog. If this field is empty, the rule matches all + accounts. + type: + - array + - 'null' + items: + type: string + customer_ids: + description: >- + The list of customers who are eligible to see this catalog. + If empty, the rule matches all customers. + type: + - array + - 'null' + items: + type: string + channels: + description: >- + The list of channels in which this catalog can be displayed. + A channel is the shopping experience, such as a mobile app + or web storefront. If empty, the catalog rule matches all + channels. The channel will eventually be included in the + bearer token that is used for authorization, but currently, + you must set the `EP-Channel` header in your requests. + type: + - array + - 'null' + items: + type: string + schedules: + description: > + Specifies a time period when a catalog is displayed, such as + on a specific date or during summer. Requests populate the + rule tag using the `EP-Context-Tag` header. + + + The schedules attribute must include the following. + + + - `valid_from` matches the date and time that the catalog is + displayed from. + + - `valid_to` matches the date and time the catalog is + displayed to. + + + Commerce runs on UTC time. + + + You can offset the timezone by adding the offset to the end + of the date and time. For example, a catalog which contains + a sale hierarchy that should appear for a set timeframe may + be scheduled to publish on a given date and time within a + given timezone. For instance, a sale that should begin on + 1st of June 2022 05:00 ET and end on the 15th of June 2022 + at 23:50 PT would have a valid schedule of `"valid_from": + "2022-06-01T05:00:00.000-05:00"`, `"valid_to": + "2022-06-15T11:59:99.000-08:00"`. + type: + - array + - 'null' + items: + $ref: '#/components/schemas/rule-schedule' + tags: + description: >- + A list of user-defined tags that can be used to further + restrict the eligibility criteria for this rule. Requests + populate the catalog rule tag using the `EP-Context-Tag` + header. + type: + - array + - 'null' + items: + type: string + catalog_id: + description: The unique identifier of a catalog rule. + type: + - string + - 'null' + examples: + - d09b4e16-08a5-4f42-817c-6e0d98acbb63 + type: + description: >- + This represents the type of object being returned. Always + `catalog_rule`. + type: string + examples: + - catalog_rule + const: catalog_rule + required: + - id + - type + required: + - data + title: CatalogRuleUpdateData + sale: + description: A set of sale prices and a validity period. + type: object + properties: + schedule: + $ref: '#/components/schemas/schedule' + currencies: + $ref: '#/components/schemas/tiered-currencies' + sales: + description: A set of sale specifications + type: object + additionalProperties: + $ref: '#/components/schemas/sale' + title: Sales + schedule: + description: A definition of the times at which a sale is valid + type: object + properties: + valid_from: + type: + - string + - 'null' + format: date-time + examples: + - '2020-09-22T09:00:00' + x-go-name: ValidFrom + valid_to: + type: + - string + - 'null' + format: date-time + examples: + - '2020-09-22T09:00:00' + x-go-name: ValidTo + x-go-name: Schedule + tier: + description: The name of the tier, for example, `Pencils`. + type: object + properties: + minimum_quantity: + description: >- + The minimum quantity of 1 or more defined for the specified price. + If a minimum quantity is not specified, an error is returned. + type: integer + examples: + - '5' + price: + $ref: '#/components/schemas/currencies' + title: Tier + tiered-amount: + description: The three-letter ISO code for the currency associated with this price. + type: object + properties: + amount: + description: >- + The price in the lowest denomination for the specified currency. + This is a product's list price. + type: integer + format: int64 + examples: + - 100 + x-go-name: Amount + x-omitempty: false + includes_tax: + description: Whether this price includes tax. + type: boolean + examples: + - false + default: false + x-go-name: IncludesTax + tiers: + description: >- + The price tier that an item is eligible for based on the quantity + purchased. You cannot have conflicting tiers within the same + currencies block. + type: object + additionalProperties: + description: The name of the tier, for example, `Pencils`. + type: object + properties: + minimum_quantity: + description: >- + The minimum quantity of 1 or more defined for the specified + price. If a minimum quantity is not specified, an error is + returned. + type: integer + examples: + - 5 + x-go-name: MinimumQuantity + amount: + description: The price for each quantity. + type: integer + format: int64 + examples: + - 100 + x-go-name: Amount + x-omitempty: false + x-go-name: TierAmount + x-go-name: Tiers + title: TieredAmount + x-go-name: TieredAmount + tiered-currencies: + description: Collection of currency specific prices for a product. + type: object + additionalProperties: + $ref: '#/components/schemas/tiered-amount' + title: TieredCurrencies + tiers: + description: >- + The price tier that an item is eligible for based on the quantity + purchased. You cannot have conflicting tiers within the same currencies + block. + type: object + additionalProperties: + $ref: '#/components/schemas/tier' + title: Tiers + catalog-release-create-data: + description: Creates a catalog release with the following attributes. + type: object + properties: + data: + type: object + properties: + export_full_delta: + description: > + Set to `true` if you want to export all the data from a catalog + release in a delta link. The `is_full_delta` attribute is + returned from the `get a release of a catalog` endpoint. The + `is_full_delta` attribute tells you if the delta file contains + the full content of a catalog release. You can use the + `is_full_delta` to determine if you need to refresh the data in + your company system before publishing a catalog release with + fresh data in a delta link. Using a search service as an + example, if the `is_full_delta` attribute is true, you should + remove all data about that catalog from the search service + before publishing a catalog release and injecting fresh data + from the delta file. If the `is_full_delta` attribute is false, + then data from the previous catalog overlays the existing data + in the delta file. The `is_full_delta` attribute is always + `true` the first time a catalog is published. + type: boolean + x-go-name: ExportFullDelta + include_organization_resources: + description: >- + If you are publishing a catalog in a store that contains + resources from an organization, you must set this to true and + you must enable the **Include Organization Resources in Catalog + Publishes** checkbox in Commerce Manager. See [**Multi-Store + Management Solutions**](/docs/api/pxm/catalog/publish-release). + type: + - boolean + - 'null' + x-go-name: IncludeOrganizationResources + title: CatalogReleaseCreateData + included: + description: Included is an array of resources that are included in the response. + type: object + properties: + main_images: + description: The main images associated with a product. + type: array + items: + $ref: '#/components/schemas/elastic-path-file' + component_products: + description: The component products associated with a product. + type: array + items: + $ref: '#/components/schemas/product' + files: + description: The files associated with a product. + type: array + items: + $ref: '#/components/schemas/elastic-path-file' + elastic-path-file: + type: object + properties: + id: + description: The unique identifier for this file. + type: string + format: uuid + type: + description: The type represents the object being returned. + type: string + examples: + - file + file_name: + description: The name of the file. + type: string + examples: + - file_name.jpg + mime_type: + description: The mime type of the file. + type: string + examples: + - image/jpeg + file_size: + description: The size of the file. Required when uploading files. + type: integer + examples: + - 36000 + public: + description: >- + DEPRECATED Whether the file public or not. Required when uploading + files. + type: boolean + examples: + - true + meta: + $ref: '#/components/schemas/file-meta' + links: + $ref: '#/components/schemas/links' + link: + $ref: '#/components/schemas/file-link' + title: ElasticPathFile + file-meta: + properties: + timestamps: + description: The date and time the file was created. + type: object + properties: + created_at: + description: The date and time the file was created. + type: string + examples: + - '2023-10-11T13:02:25.293Z' + dimensions: + description: The file dimensions. + type: object + properties: + width: + description: The width of the file. + type: integer + examples: + - 1800 + height: + description: The height of the file. + type: integer + examples: + - 1000 + file-link: + description: The publicly available URL for this file. + type: object + properties: + href: + description: The publicly available URL for this file. + type: string + examples: + - >- + https://files-eu.epusercontent.com/e8c53cb0-120d-4ea5-8941-ce74dec06038/f8cf26b3-6d38-4275-937a-624a83994702.png + CartsRequest: + title: CartsRequest + type: object + properties: + description: + type: string + description: The cart description. + example: cart description + discount_settings: + $ref: '#/components/schemas/DiscountSettings' + name: + description: >- + The cart name provided by the shopper. A cart name must contain 1 to + 255 characters. You cannot use whitespace characters, but special + characters are permitted. For more information, see the [Safe + Characters](/guides/Getting-Started/safe-characters) section. + type: string + example: my cart name + snapshot_date: + description: >- + This optional parameter sets a reference date for the cart. If this + parameter is set, it allows the cart to act as one that might occur + on that specified date. For example, such future carts might acquire + future-enabled discounts, allowing users to test and validate future + interactions with carts. The snapshot_date must be in the format + 2026-02-21T15:07:25Z. By default, this parameter is left empty. + type: string + example: '2026-09-10T00:12:00Z' + custom_attributes: + $ref: '#/components/schemas/CustomAttributes' + payment_intent_id: + description: >- + To remove the Stripe payment intent from a cart, pass the empty + value in the `payment_intent_id` field. You must use an empty value + for this field. You cannot use this endpoint to directly update the + cart to use an existing Payment Intent. + type: string + example: '' + DiscountSettings: + title: DiscountSettings + type: object + properties: + custom_discounts_enabled: + description: >- + This parameter enables custom discounts for a cart. When set to + true, Elastic Path promotions will not be applied to the new carts. + Default is set from cart discount settings for the store. See [Cart + Settings](/docs/api/settings/put-v-2-settings-cart). + type: boolean + example: false + use_rule_promotions: + description: >- + When set to true, this parameter allows the cart to use rule + promotions. + type: boolean + example: false + CustomAttributes: + title: CustomAttributes + type: object + properties: + custom_attributes: + description: >- + Specifies the custom attributes for the cart object. The attribute + can be any string, numerical, and underscore. A cart can have + maximum of 20 custom attributes. + type: object + properties: + attribute: + description: Specifies the attribute `type` and `value`. + type: object + properties: + type: + description: >- + Specifies the type of the attribute such as string, integer, + boolean, and float. + type: string + value: + description: Specifies the value of the attribute. + oneOf: + - type: string + - type: number + - type: boolean + CartResponse: + title: CartResponse + type: object + properties: + id: + description: The unique identifier for the cart. Use SDK or create it yourself. + type: string + type: + description: The type of object being returned. + type: string + example: cart + name: + description: The name of this cart. + type: string + example: cart name + description: + description: A description of the cart. + type: string + example: cart description + discount_settings: + $ref: '#/components/schemas/DiscountSettings' + payment_intent_id: + description: Stripe-assigned unique identifier for the linked Payment Intent + type: string + links: + type: object + properties: + self: + description: A link to that specific resource. + type: string + example: https://useast.api.elasticpath.com/v2/carts/1 + meta: + type: object + properties: + display_price: + type: object + properties: + with_tax: + $ref: '#/components/schemas/FormattedPriceData' + without_tax: + $ref: '#/components/schemas/FormattedPriceData' + tax: + $ref: '#/components/schemas/FormattedPriceData' + discount: + $ref: '#/components/schemas/FormattedPriceData' + without_discount: + $ref: '#/components/schemas/FormattedPriceData' + shipping: + $ref: '#/components/schemas/FormattedPriceData' + timestamps: + $ref: '#/components/schemas/Timestamps' + relationships: + type: object + properties: + customers: + type: object + properties: + data: + type: object + properties: + type: + description: The type of related object. + type: string + example: customers + id: + description: The ID of the customer. + type: string + format: uuid + readOnly: true + example: 662461ad-ddcb-4dbd-8ed7-ade9aa63b5f9 + items: + type: object + properties: + data: + type: object + properties: + type: + description: The type of related object. + type: string + example: cart_item + id: + description: The unique identifier for the cart item + type: string + format: uuid + readOnly: true + example: 1cf8b15b-4f12-43c5-837c-dbbc09aefa55 + CartItemsObjectRequest: + title: Cart Items Object Request + oneOf: + - $ref: '#/components/schemas/CartItemObject' + - $ref: '#/components/schemas/CartMergeObjectRequest' + - $ref: '#/components/schemas/CustomItemObject' + - $ref: '#/components/schemas/ReOrderObjectRequest' + - $ref: '#/components/schemas/PromotionItemObject' + CartItemObject: + title: Cart Item Object + type: object + properties: + data: + allOf: + - $ref: '#/components/schemas/CartItemObjectData' + - $ref: '#/components/schemas/CartItemResponse' + CartItemObjectData: + title: Cart Item Object Data + type: object + required: + - type + - quantity + properties: + type: + description: The type of object being returned. + type: string + enum: + - cart_item + quantity: + description: The number of items added to the cart. + type: number + example: 2 + id: + type: string + format: uuid + description: >- + Specifies the ID of the product you want to add to cart. (use this + OR sku) + example: 78d7b5c2-c852-40ad-87bb-beb161f61f37 + sku: + type: string + description: >- + Specifies the item SKU that you want to add to cart. (use this OR + id) + example: my-item + custom_inputs: + description: The custom text to be added to a product. + type: object + bundle_configuration: + description: Object used to describe the bundle options selected. + type: object + properties: + selected_options: + description: Specifies selected options. + type: object + shipping_group_id: + description: Identifier for a created Cart Shipping Group + type: string + CartMergeObjectRequest: + title: Cart Merge Object Request + type: object + properties: + data: + type: array + items: + allOf: + - $ref: '#/components/schemas/CartMergeObject' + description: '' + options: + $ref: '#/components/schemas/AddAllOrNothingOptionsObject' + CartMergeObject: + title: Cart Merge Object + type: object + required: + - type + - cart_id + properties: + type: + description: The type of object being returned. Must be `cart_items`. + type: string + enum: + - cart_items + cart_id: + description: The original cart to be merged from. + type: string + format: uuid + example: 78d7b5c2-c852-40ad-87bb-beb161f61f37 + CustomItemObject: + title: Custom Item Object + type: object + properties: + data: + allOf: + - $ref: '#/components/schemas/CustomItemObjectData' + description: '' + CustomItemObjectData: + title: Custom Item Object Data + type: object + required: + - type + - name + - quantity + - price + properties: + type: + description: The type of object being returned. Must be `custom_item`. + type: string + enum: + - custom_item + quantity: + description: The number of custom items to add to cart. + type: number + example: 2 + price: + type: object + required: + - amount + properties: + amount: + description: The unit price of the custom item. + type: number + example: 10000 + includes_tax: + description: >- + Set to`true` if relevant taxes have been included in the price, + `false` if not. Defaults to `true`. + type: boolean + description: + description: A description of the custom item. + type: string + example: My first custom item! + sku: + type: string + description: >- + The `SKU` code to use for the custom item. See [best + practices](https://elasticpath.dev/docs/commerce-cloud/carts/cart-items/add-custom-item-to-cart#best-practices) + to use the `SKU` code. + example: my-custom-item + name: + type: string + description: The name of the custom item. + example: My Custom Item + custom_inputs: + description: The custom text to be added to a product. + type: object + shipping_group_id: + description: Identifier for a created Cart Shipping Group + type: string + ReOrderObjectRequest: + title: Re-Order Object Request + type: object + properties: + data: + allOf: + - $ref: '#/components/schemas/ReOrderObject' + options: + $ref: '#/components/schemas/AddAllOrNothingOptionsObject' + ReOrderObject: + title: Re Order Object + type: object + required: + - type + - order_id + properties: + type: + description: The type of resource being returned. Use `order_items`. + type: string + enum: + - order_items + order_id: + description: The unique identifier of the order. + type: string + format: uuid + example: 78d7b5c2-c852-40ad-87bb-beb161f61f37 + BulkAddItemsRequest: + title: Bulk Add Items Request + type: object + properties: + data: + anyOf: + - $ref: '#/components/schemas/CartItemsObjectRequest' + - $ref: '#/components/schemas/CartMergeObjectRequest' + - $ref: '#/components/schemas/CustomItemObject' + - $ref: '#/components/schemas/ReOrderObjectRequest' + - $ref: '#/components/schemas/PromotionItemObject' + PromotionItemObject: + title: Promotion Item Object + type: object + properties: + data: + allOf: + - $ref: '#/components/schemas/PromotionItemObjectData' + PromotionItemObjectData: + title: Promotion Item Object Data + type: object + required: + - type + - code + properties: + type: + description: Specifies the type of resource, which is `promotion_item`. + type: string + enum: + - promotion_item + code: + description: >- + Specifies the promotion code. For more information about + codes[].user[], see the [Create Promotion + codes](/docs/api/promotions/create-promotion-codes) section. + type: string + example: PROMO_CODE + BulkUpdateCartsItems: + title: Bulk Update Carts Items + type: object + required: + - id + - quantity + properties: + data: + type: array + items: + type: object + properties: + id: + description: >- + Specifies the ID of the cart item that you want to update in + cart. + type: string + example: '{{cartitemID}}' + quantity: + description: Specifies the amount of items to update in the cart. + type: number + example: 2 + custom_inputs: + description: >- + Specifies the custom text to be added to a product. See + [custom + inputs](https://elasticpath.dev/docs/pxm/products/ep-pxm-products-api/update-a-product#using-custom-inputs-attribute). + type: object + options: + $ref: '#/components/schemas/UpdateAllOrNothingOptionsObject' + UpdateCartsItems: + title: Update Carts Items + type: object + required: + - quantity + properties: + data: + type: object + properties: + id: + description: The unique identifier of the cart item. + type: string + format: uuid + example: '{{cartitemID}}' + quantity: + description: The amount of products to add to cart. + type: number + example: 2 + custom_inputs: + description: The custom text to be added to a product. + type: object + shipping_group_id: + description: >- + The unique identifier of the shipping group to be added to the + cart. + type: string + format: uuid + example: 900ab9c1-4b39-43fe-b080-0dc2806065d9 + AddAllOrNothingOptionsObject: + title: Add All Or Nothing Options Object + type: object + properties: + add_all_or_nothing: + description: >- + When `true`, if an error occurs for any item, no items are added to + the cart. When `false`, valid items are added to the cart and the + items with errors are reported in the response. Default is `false`. + type: boolean + example: false + UpdateAllOrNothingOptionsObject: + title: Update All Or Nothing Options Object + type: object + properties: + update_all_or_nothing: + description: >- + When set to`true`, if an error occurs for any item, no items are + updated in the cart. When set to `false`, valid items are updated in + the cart and the items with errors are reported in the response. + Default is `true`. + type: boolean + example: false + CartItemResponse: + title: Cart Item Relationship + type: object + properties: + product_id: + description: The unique ID of the product. + type: string + format: uuid + readOnly: true + example: 55cda543-f9d7-42a4-b40a-665f2e4ff7c5 + name: + description: The name of this item + type: string + readOnly: true + example: shirt + description: + description: A description of the cart item. + type: string + readOnly: true + example: T-shirt. + catalog_id: + description: >- + The unique identifier of the catalog associated with the product is + shown if catalog_source=pim is set. + type: string + readOnly: true + format: uuid + example: 11d3f9d2-c99b-472c-96c3-51842333daea + catalog_source: + description: The catalog source. Always `pim` or `legacy`. + type: string + readOnly: true + example: pim + image: + type: object + readOnly: true + properties: + mime_type: + description: The MIME type for the uploaded file. + type: string + readOnly: true + example: image/png + file_name: + description: The name of the image file that was uploaded. + type: string + readOnly: true + example: shirt-trans.png + href: + description: The link to the image. + type: string + readOnly: true + example: >- + https://files-eu.epusercontent.com/e8c53cb0-120d-4ea5-8941-ce74dec06038/7cc08cbb-256e-4271-9b01-d03a9fac9f0a.png + manage_stock: + description: null + type: boolean + readOnly: true + example: true + unit_price: + readOnly: true + $ref: '#/components/schemas/ItemPriceData' + value: + readOnly: true + $ref: '#/components/schemas/ItemPriceData' + links: + type: object + readOnly: true + properties: + product: + description: A URL related to the resource. + type: string + example: >- + https://useast.api.elasticpath.com/products/9eda5ba0-4f4a-4074-8547-ccb05d1b5981 + meta: + type: object + readOnly: true + properties: + display_price: + type: object + properties: + with_tax: + $ref: '#/components/schemas/FormattedPriceData' + without_tax: + $ref: '#/components/schemas/FormattedPriceData' + tax: + $ref: '#/components/schemas/FormattedPriceData' + discount: + $ref: '#/components/schemas/FormattedPriceData' + without_discount: + $ref: '#/components/schemas/FormattedPriceData' + timestamps: + $ref: '#/components/schemas/Timestamps' + CartsResponse: + title: Carts Response + type: object + properties: + data: + type: array + items: + type: object + anyOf: + - $ref: '#/components/schemas/CartItemObject' + meta: + type: object + properties: + display_price: + type: object + properties: + with_tax: + $ref: '#/components/schemas/FormattedPriceData' + without_tax: + $ref: '#/components/schemas/FormattedPriceData' + tax: + $ref: '#/components/schemas/FormattedPriceData' + discount: + $ref: '#/components/schemas/FormattedPriceData' + without_discount: + $ref: '#/components/schemas/FormattedPriceData' + discounts: + type: object + additionalProperties: + type: object + properties: + amount: + type: number + example: -1000 + currency: + type: string + example: USD + formatted: + type: string + example: '-$1.00' + timestamps: + $ref: '#/components/schemas/CartTimestamps' + ItemPriceData: + title: Order Price Data + type: object + properties: + amount: + description: The amount for this item as an integer. + type: number + readOnly: true + example: 10000 + currency: + description: The currency this item was added to the cart as. + type: string + readOnly: true + example: USD + includes_tax: + description: Whether or not this price is tax inclusive. + type: boolean + readOnly: true + example: false + CartsRelationshipsAccountsData: + title: Carts Relationships Accounts Data + type: object + properties: + data: + type: array + items: + properties: + id: + description: The ID of the account. + type: string + example: '{{accountID}}' + type: + description: The type of related object. Ensure that it is account. + type: string + example: account + CartsRelationshipsCustomersData: + title: Carts Relationships Customers Data + type: object + properties: + data: + type: array + items: + properties: + id: + description: The ID of the customer. + type: string + example: '{{customerID}}' + type: + description: The type of related object. Ensure that it is customer. + type: string + example: customer + CartsItemsTaxesObject: + title: Carts Items Taxes Object + type: object + required: + - type + - rate + properties: + code: + description: A unique tax code in this jurisdiction. + type: string + example: TAX01 + jurisdiction: + description: The relevant tax jurisdiction. + type: string + example: UK + name: + description: The name of the tax item. + type: string + example: Tax name + rate: + description: The tax rate represented as a decimal (12.5% -> 0.125). + type: number + example: 0.2 + type: + description: The type of object being returned. Use `tax_item`. + type: string + example: tax_item + id: + description: The unique identifier for this tax item. + type: string + format: uuid + readOnly: true + example: 662461ad-ddcb-4dbd-8ed7-ade9aa63b5f9 + CartsBulkCustomDiscounts: + title: CartsBulkCustomDiscounts + type: object + properties: + data: + type: array + items: + allOf: + - $ref: '#/components/schemas/CartsCustomDiscountsObject' + - $ref: '#/components/schemas/CartItemBulkCustomDiscountObject' + options: + $ref: '#/components/schemas/AddAllOrNothingOptionsObject' + CartsBulkCustomDiscountsResponse: + title: CartsBulkCustomDiscountsResponse + type: object + properties: + data: + type: array + items: + allOf: + - $ref: '#/components/schemas/CartsCustomDiscountsResponse' + - $ref: '#/components/schemas/artItemBulkCustomDiscountResponse' + options: + $ref: '#/components/schemas/AddAllOrNothingOptionsObject' + CartItemBulkCustomDiscountObject: + title: CartItemBulkCustomDiscountObject + type: object + allOf: + - $ref: '#/components/schemas/CartsCustomDiscountsObject' + - $ref: '#/components/schemas/CustomDiscountRelationshipsCartItemRequest' + artItemBulkCustomDiscountResponse: + title: artItemBulkCustomDiscountResponse + type: object + allOf: + - $ref: '#/components/schemas/CartsCustomDiscountsResponse' + - $ref: '#/components/schemas/CustomDiscountRelationshipsCartItemRequest' + CartsCustomDiscountsObject: + title: CartsCustomDiscountsObject + type: object + required: + - amount + - description + - discount_code + - discount_engine + - external_id + - type + properties: + amount: + description: >- + Specifies an amount to be applied for the custom discount. It must + be less than zero. + type: number + example: -1000 + description: + description: Specifies a description for the custom discount. + type: string + example: Custom discount description + discount_code: + description: Specifies the discount code used for the custom discount. + type: string + example: cart-custom-promo-code + discount_engine: + description: >- + Specifies from where the custom discount is applied. For example, + Talon.one. + type: string + example: Custom Discount Engine + external_id: + description: Specifies an external id for the custom discount. + type: string + example: custom-discount-external-id + type: + description: Specifies the type of the resource. Always `custom_discount`. + type: string + example: custom_discount + CartsCustomDiscountsResponse: + title: CartsCustomDiscountsResponse + type: object + properties: + amount: + type: object + properties: + amount: + description: >- + Specifies an amount to be applied for the custom discount. It + must be less than zero. + type: number + example: -1000 + currency: + description: The currency set for the custom discount. + type: string + example: USD + formatted: + description: The formatted value for the custom discount. + type: string + example: '-$10.00' + description: + description: Specifies a description for the custom discount. + type: string + example: Custom discount description + discount_code: + description: Specifies the discount code used for the custom discount. + type: string + example: cart-custom-promo-code + discount_engine: + description: >- + Specifies from where the custom discount is applied. For example, + Talon.one. + type: string + example: Custom Discount Engine + external_id: + description: Specifies an external id for the custom discount. + type: string + example: custom-discount-external-id + type: + description: Specifies the type of the resource. Always `custom_discount`. + type: string + example: custom_discount + id: + description: Specifies the UUID of the custom discount. + type: string + format: uuid + readOnly: true + example: 662461ad-ddcb-4dbd-8ed7-ade9aa63b5f9 + CustomDiscountRelationshipsCartItemRequest: + title: CustomDiscountRelationshipsCartItemRequest + type: object + required: + - type + - id + properties: + relationships: + type: object + properties: + item: + type: object + properties: + data: + type: object + properties: + type: + description: >- + Specifies the type of item. For example, `custom_item` + or `cart_item`. + type: string + example: cart_item + id: + description: >- + Specifies the unique identifier of the `cart_item` or + `custom_item` in the cart. + type: string + format: uuid + example: 5601a4b1-9d13-42d3-8fb7-03b35169d1b6 + CartItemRelationship: + title: CartItemRelationship + type: object + required: + - type + - id + properties: + relationships: + type: object + properties: + order: + type: object + properties: + data: + type: object + properties: + type: + description: This specifies the type of item. + type: string + example: order + id: + description: >- + This specifies the ID of the cart_item or custom_item in + the cart. + type: string + format: uuid + example: 5601a4b1-9d13-42d3-8fb7-03b35169d1b6 + CartsBulkTaxes: + title: CartsBulkTaxes + type: object + properties: + data: + type: array + items: + allOf: + - $ref: '#/components/schemas/CartsItemsTaxesObject' + - $ref: '#/components/schemas/CartItemRelationship' + options: + $ref: '#/components/schemas/AddAllOrNothingOptionsObject' + OrdersAnonymizeRequest: + title: OrdersAnonymizeRequest + type: object + properties: + data: + $ref: '#/components/schemas/OrdersAnonymizeData' + OrdersAnonymizeData: + title: OrdersAnonymizeData + type: object + properties: + order_ids: + description: >- + The unique identifiers of the orders to be anonymized. You can + anonymize multiple orders at the same time. + type: array + items: + type: string + example: '{{orderID}}' + OrdersUpdateRequest: + title: OrdersUpdateRequest + type: object + properties: + data: + oneOf: + - $ref: '#/components/schemas/OrdersAddressData' + - $ref: '#/components/schemas/OrdersCancelData' + - $ref: '#/components/schemas/OrdersFulfulledData' + OrdersAddressData: + title: OrdersAddressData + type: object + required: + - type + - shipping_address + properties: + external_ref: + description: >- + Represents an optional external ID reference for an order. It can + contain alphanumeric characters, special characters, and spaces, and + does not required to be unique. The maximum allowed length is 64 + characters. It can be used to include an external reference from a + separate company system. + type: string + example: external_order_123 + shipping_address: + type: object + properties: + first_name: + description: Specifies the first name of the address holder. + type: string + example: James + last_name: + description: Specifies the last name of the address holder. + type: string + example: Doe + phone_number: + description: Specifies the phone number of the address holder. + type: string + example: 5558679305 + company_name: + description: Specifies the company name. + type: string + example: company name + line_1: + description: Specifies the first line of the address. + type: string + example: 1234 Disney Drive + line_2: + description: Specifies the second line of the address. + type: string + example: Disney Resort + city: + description: Specifies the name of the city in the shipping address. + type: string + example: Anaheim + county: + description: Specifies the county of the shipping address. + type: string + example: Orange + region: + description: >- + Specifies the state, province, or region of the shipping + address. + type: string + example: CA + postcode: + description: Specifies the postcode or ZIP code of the address. + type: string + example: 92802 + country: + description: Specifies the country in the shipping address. + type: string + example: US + instructions: + description: Specifies any instructions provided with the shipping address. + type: string + example: Buzzer 10233 + OrdersCancelData: + title: OrdersCancelData + type: object + required: + - type + - status + properties: + status: + description: >- + The status of the order. You can only update the status to + `cancelled`. + type: string + example: cancelled + type: + description: The type of the resource. You must use order. + type: string + example: order + external_ref: + description: >- + Represents an optional external ID reference for an order. It can + contain alphanumeric characters, special characters, and spaces, and + does not required to be unique. The maximum allowed length is 64 + characters. It can be used to include an external reference from a + separate company system. + type: string + example: external_order_123 + OrdersFulfulledData: + title: OrdersFulfulledData + type: object + required: + - type + - shipping + properties: + shipping: + description: >- + The shipping status of the order. You can only update the shipping + status to `fulfilled`. + type: string + example: fulfilled + type: + description: The type of the resource. You must use order. + type: string + example: order + external_ref: + description: >- + Represents an optional external ID reference for an order. It can + contain alphanumeric characters, special characters, and spaces, and + does not required to be unique. The maximum allowed length is 64 + characters. It can be used to include an external reference from a + separate company system. + type: string + example: external_order_123 + PaymentsRequest: + title: PaymentsRequest + type: object + properties: + data: + $ref: '#/components/schemas/Data.PaymentObject' + Data.BasePayments: + title: Data.BasePayments + type: object + required: + - gateway + - method + properties: + gateway: + type: string + enum: + - adyen + - authorize_net + - braintree + - card_connect + - cyber_source + - elastic_path_payments_stripe + - manual + - paypal_express_checkout + - stripe + - stripe_connect + - stripe_payment_intents + method: + description: Specifies the transaction method, such as `purchase` or `authorize`. + type: string + enum: + - authorize + - purchase + - purchase_setup + - authorize_setup + amount: + description: The amount to be paid for the transaction. + type: number + example: 10000 + Data.AdyenPayment: + title: Data.AdyenPayment + required: + - payment + - gateway + allOf: + - $ref: '#/components/schemas/Data.BasePayments' + - type: object + properties: + gateway: + description: Specifies the gateway. You must use `adyen`. + type: string + enum: + - adyen + options: + type: object + properties: + shopper_reference: + description: >- + The shopper reference token associated with the saved + payment method. + type: string + recurring_processing_model: + description: Enter CardOnFile for a one-time purchase. + type: string + payment: + description: The Adyen recurringDetailReference payment method identifier. + type: string + Data.AuthorizeNetPayment: + title: Data.AuthorizeNetPayment + required: + - payment + - gateway + allOf: + - $ref: '#/components/schemas/Data.BasePayments' + - type: object + properties: + gateway: + description: Specifies the gateway. You must use `authorize_net`. + type: string + enum: + - authorize_net + options: + type: object + properties: + customer_payment_profile_id: + description: The Authorize.net customer payment profile ID. + type: string + payment: + description: The Authorize.net customer profile ID. + type: string + Data.BraintreePayment: + title: Data.BraintreePayment + required: + - payment + - gateway + allOf: + - $ref: '#/components/schemas/Data.BasePayments' + - type: object + properties: + gateway: + description: Specifies the gateway. You must use `braintree`. + type: string + enum: + - braintree + payment: + description: The Braintree Customer ID that you want to bill. + type: string + Data.CardConnectPayment: + title: Data.CardConnectPayment + required: + - payment + - gateway + allOf: + - $ref: '#/components/schemas/Data.BasePayments' + - type: object + properties: + gateway: + description: Specifies the gateway. You must use `card_connect`. + type: string + enum: + - card_connect + payment: + description: >- + Enter account_id, profile_id from CardPointe API. For example, + 1|16178397535388255208. + type: string + Data.CyberSourcePayment: + title: Data.CyberSourcePayment + required: + - payment + - gateway + allOf: + - $ref: '#/components/schemas/Data.BasePayments' + - type: object + properties: + gateway: + description: Specifies the gateway. You must use `cyber_source`. + type: string + enum: + - cyber_source + payment: + description: The CyberSource token. + type: string + ElasticPathPaymentsPoweredByStripePayment: + title: Elastic Path Payments Powered By Stripe + required: + - gateway + allOf: + - $ref: '#/components/schemas/Data.BasePayments' + - type: object + properties: + gateway: + description: >- + Specifies the gateway. You must use + `elastic_path_payments_stripe`. + type: string + enum: + - elastic_path_payments_stripe + options: + type: object + properties: + receipt_email: + description: >- + Provides the email address to which you want to send the + Stripe receipts for the transactions within the store. This + feature is available only in the live mode. + type: string + automatic_payment_methods: + type: object + description: >- + Parent object determining whether to use Stripe's + `automatic_payment_methods` setting. + properties: + enabled: + type: boolean + description: >- + When set to true, it displays all enabled payment + methods from the Stripe dashboard. When set to false, + the Stripe default, which is card, is used. + payment_method_types: + type: array + items: + type: string + description: >- + Specifies the Stripe payment method types configured for the + store. See [Stripe + Documentation](https://docs.stripe.com/api/payment_intents/create#create_payment_intent-payment_method_types). + example: card + payment: + description: Specifies the Stripe token or source. + type: string + Data.ManualPayment: + title: Data.ManualPayment + required: + - gateway + allOf: + - $ref: '#/components/schemas/Data.BasePayments' + - type: object + properties: + gateway: + description: Specifies the type of payment gateway. You must use `manual`. + type: string + enum: + - manual + paymentmethod_meta: + type: object + properties: + custom_reference: + description: >- + A reference associated with the payment method. This might + include loyalty points or gift card identifiers. We + recommend not to include personal information in this field. + type: string + name: + description: A custom name associated with the payment method. + type: string + Data.PayPalExpressCheckoutPayment: + title: Data.PayPalExpressCheckoutPayment + required: + - gateway + allOf: + - $ref: '#/components/schemas/Data.BasePayments' + - type: object + properties: + gateway: + description: >- + Specifies the type of payment gateway. You must use + `paypal_express_checkout`. + type: string + enum: + - paypal_express_checkout + options: + type: object + properties: + description: + description: The description for the payment. + type: string + soft_descriptor: + description: >- + The descriptor appended to PayPal generated descriptor that + is visible on the card statement of the payer. + type: string + application_context: + type: object + properties: + brand_name: + description: >- + The label that overrides the business name in the PayPal + account on the payPal site. + type: string + locale: + description: >- + The locale pages that appear based on language and + country code. PayPal supports a five-character code. For + example, ja-JP. + type: string + landing_page: + description: >- + The type of landing page to show on the PayPal site for + customer checkout. Use values LOGIN, BILLING, or + NO_PREFERENCE. + type: string + shipping_preference: + description: >- + The shipping preference. Use SET_PROVIDED_ADDRESS value. + This parameter does allow the user to change their + address on PayPal site. + type: string + user_action: + description: >- + If you set `useraction=commit` in the query string, the + flow redirects the buyer to the PayPal payment page and + displays a Pay Now button. When the shopper clicks **Pay + Now**, call `DoExpressCheckoutPayment` to complete the + payment without additional interaction from the shopper. + Choose this flow when you know the final payment amount + when you initiate the checkout flow. + type: string + return_url: + description: >- + The callback URL for PayPal to redirect the user in the + case of approved payment. + type: string + cancel_url: + description: >- + The callback URL for PayPal to redirect user in the case + a cancelled payment. + type: string + Data.StripePayment: + title: Data.StripePayment + required: + - gateway + allOf: + - $ref: '#/components/schemas/Data.BasePayments' + - type: object + properties: + gateway: + description: Specifies the type of payment gateway. You must use `stripe`. + type: string + enum: + - stripe + options: + type: object + properties: + receipt_email: + description: >- + The option to provide an email for Stripe receipts. Specify + live mode to access this feature. + type: string + payment: + description: The Stripe token or source. + type: string + Data.StripeConnectPayment: + title: Data.StripeConnectPayment + required: + - gateway + allOf: + - $ref: '#/components/schemas/Data.BasePayments' + - type: object + properties: + gateway: + description: >- + Specifies the type of payment gateway. You must use + `stripe_connect`. + type: string + enum: + - stripe_connect + options: + type: object + properties: + receipt_email: + description: >- + Provides the email address to which you want to send the + Stripe receipts for the transactions within the store. This + feature is available only in the live mode. + type: string + payment: + description: Specifies the Stripe token or source. + type: string + Data.StripePaymentIntentsPayment: + title: Data.StripePaymentIntentsPayment + required: + - gateway + allOf: + - $ref: '#/components/schemas/Data.BasePayments' + - type: object + properties: + gateway: + description: >- + Specifies the type of payment gateway. You must use + `stripe_payment_intents`. + type: string + enum: + - stripe_payment_intents + options: + type: object + properties: + receipt_email: + description: >- + Provides the email address to which you want to send the + Stripe receipts for the transactions within the store. This + feature is available only in the live mode. + type: string + payment: + description: Specifies the Stripe token or source. + type: string + Data.PaymentObject: + oneOf: + - $ref: '#/components/schemas/Data.AdyenPayment' + - $ref: '#/components/schemas/Data.AuthorizeNetPayment' + - $ref: '#/components/schemas/Data.BraintreePayment' + - $ref: '#/components/schemas/Data.CardConnectPayment' + - $ref: '#/components/schemas/Data.CyberSourcePayment' + - $ref: '#/components/schemas/ElasticPathPaymentsPoweredByStripePayment' + - $ref: '#/components/schemas/Data.ManualPayment' + - $ref: '#/components/schemas/Data.PayPalExpressCheckoutPayment' + - $ref: '#/components/schemas/Data.StripePayment' + - $ref: '#/components/schemas/Data.StripeConnectPayment' + - $ref: '#/components/schemas/Data.StripePaymentIntentsPayment' + TransactionResponse: + title: TransactionResponse + type: object + properties: + id: + description: The ID of the transaction. + type: string + format: uuid + readOnly: true + reference: + description: The payment gateway reference. + type: string + example: manual + name: + description: A custom name associated with the payment method. + type: string + example: payment method name + custom_reference: + description: >- + A reference associated with the payment method. This might include + loyalty points or gift card identifiers. We recommend you not to + include personal information in this field. + type: string + example: custom reference + gateway: + description: The name of the payment gateway used. + type: string + enum: + - adyen + - authorize_net + - braintree + - card_connect + - cyber_source + - elastic_path_payments_stripe + - manual + - paypal_express_checkout + - stripe + - stripe_connect + - stripe_payment_intents + amount: + description: The amount for this transaction. + type: number + example: 10000 + refunded_amount: + description: The refunded amount. + type: number + example: 0 + currency: + description: The transaction currency. + type: string + example: USD + transaction-type: + description: >- + The type of transaction, such as `purchase`, `capture`, `authorize` + or `refund`. + type: string + example: capture + status: + description: >- + The status provided by the gateway for this transaction, such as + `complete` or `failed`. + type: string + example: complete + relationships: + type: object + properties: + order: + type: object + properties: + data: + type: object + properties: + type: + description: >- + Represents the type of the object being returned. It is + always `order`. + type: string + example: order + id: + description: The ID of the order. + type: string + format: uuid + example: 5601a4b1-9d13-42d3-8fb7-03b35169d1b6 + meta: + type: object + properties: + display_price: + $ref: '#/components/schemas/FormattedPriceData' + display_refunded_amount: + $ref: '#/components/schemas/FormattedPriceData' + timestamps: + $ref: '#/components/schemas/Timestamps' + OrdersTransactionsConfirmRequest: + title: OrdersTransactionsConfirmRequest + type: object + properties: + data: + type: object + OrdersTransactionsCaptureRequest: + title: OrdersTransactionsCaptureRequest + type: object + properties: + data: + type: object + properties: + options: + type: object + properties: + soft_descriptor: + type: string + note_to_payer: + type: string + OrdersTransactionsRefundRequest: + title: OrdersTransactionsRefundRequest + type: object + properties: + data: + type: object + properties: + amount: + description: >- + The amount value to be refunded. If this field is not provided, + it will be considered as manual refund (Mark as Refunded) and + the refund process must be manually handled via payment + provider. If the amount value is same as payment value, then it + will be treated as a full refund and sent to the payment + provider to process refund automatically. + type: number + example: 1000 + options: + type: object + properties: + note: + description: >- + Provides comments about the refund. It is used by PayPal + Express. + type: string + OrdersTransactionsCancelRequest: + title: OrdersTransactionsCancelRequest + type: object + properties: + data: + type: object + properties: + options: + type: object + reason: + description: >- + Specifies the reason for canceling the transaction. The reason + may include `duplicate`, `fraudulent`, `requested_by_customer`, + or `abandoned`. + type: string + example: requested_by_customer + OrderPriceData: + title: OrderPriceData + type: object + properties: + amount: + description: The amount for this item. + type: number + example: 10000 + currency: + description: The currency this item. + type: string + example: USD + includes_tax: + description: Whether or not this price is tax inclusive. + type: boolean + example: false + FormattedPriceData: + title: FormattedPriceData + type: object + properties: + amount: + description: The raw total of this cart. + type: number + example: 10000 + currency: + description: The currency set for this cart. + type: string + example: USD + formatted: + description: The tax inclusive formatted total based on the currency. + type: string + example: $10.00 + OrderItemFormattedUnitPriceData: + title: OrderItemFormattedUnitPriceData + type: object + properties: + unit: + $ref: '#/components/schemas/FormattedPriceData' + value: + $ref: '#/components/schemas/FormattedPriceData' + DiscountData: + title: DiscountData + type: object + properties: + amount: + $ref: '#/components/schemas/OrderPriceData' + code: + type: string + example: 10_off + id: + type: string + format: uuid + readOnly: true + example: a01cf221-751b-46e4-b612-57ad3c645ee6 + OrderItemResponse: + title: OrderItemResponse + type: object + properties: + type: + description: The type represents the object being returned. + type: string + example: order_item + id: + description: The unique identifier for this order item. + type: string + format: uuid + readOnly: true + example: 68bf8510-bebf-47b1-96ba-8a9930c7d928 + quantity: + description: The quantity of this item were ordered. + type: number + example: 1 + product_id: + description: The unique identifier for this order item. + type: string + format: uuid + readOnly: true + example: 4e9c6098-9701-4839-a69c-54d8256d9012 + name: + description: The name of this order item. + type: string + example: Product 123 + sku: + description: The SKU code for the order item. + type: string + example: IFD-1 + unit_price: + $ref: '#/components/schemas/OrderPriceData' + value: + $ref: '#/components/schemas/OrderPriceData' + discounts: + type: array + items: + $ref: '#/components/schemas/DiscountData' + links: + type: object + meta: + type: object + properties: + display_price: + type: object + properties: + with_tax: + $ref: '#/components/schemas/OrderItemFormattedUnitPriceData' + without_tax: + $ref: '#/components/schemas/OrderItemFormattedUnitPriceData' + tax: + $ref: '#/components/schemas/OrderItemFormattedUnitPriceData' + discount: + $ref: '#/components/schemas/OrderItemFormattedUnitPriceData' + without_discount: + $ref: '#/components/schemas/OrderItemFormattedUnitPriceData' + discounts: + type: object + additionalProperties: + type: object + properties: + amount: + type: number + example: -1000 + currency: + type: string + example: USD + formatted: + type: string + example: '-$1.00' + timestamps: + $ref: '#/components/schemas/Timestamps' + relationships: + type: object + properties: + cart_item: + type: object + properties: + data: + type: object + properties: + type: + description: The type represents the object being returned. + type: string + example: order_item + id: + description: The unique identifier for this item. + type: string + format: uuid + readOnly: true + example: 5601a4b1-9d13-42d3-8fb7-03b35169d1b6 + catalog_id: + description: >- + The unique identifier of the catalog associated with the product is + shown if `catalog_source=pim` is set. + type: string + example: default + catalog_source: + description: The catalog source. Always `pim` or `legacy`. + type: string + example: pim - legacy + OrderResponse: + title: OrderResponse + type: object + properties: + type: + description: Specifies the type of object being returned. You must use `order`. + type: string + example: order + id: + description: Specifies the unique identifier of the order. + type: string + format: uuid + readOnly: true + example: aa854b8f-5930-476d-951a-e9b9cfbdefb1 + status: + description: >- + Specifies the status of the order, such as `incomplete`, `complete`, + `processing`, or `cancelled`. + type: string + example: complete - incomplete - cancelled + payment: + description: >- + Specifies the status of the payment, such as `unpaid`, `authorized`, + `paid`, or `refunded`. + type: string + example: authorized - paid - unpaid - refunded + shipping: + description: >- + Specifies the status of the shipment, such as `fulfilled` or + `unfulfilled`. + type: string + example: unfulfilled - fulfilled + anonymized: + description: Specifies if the order is anonymized. + type: boolean + example: false + meta: + $ref: '#/components/schemas/OrderMeta' + billing_address: + $ref: '#/components/schemas/BillingAddress' + contact: + $ref: '#/components/schemas/Contact' + shipping_address: + $ref: '#/components/schemas/ShippingAddress' + OrderMeta: + title: OrderMeta + type: object + properties: + timestamps: + $ref: '#/components/schemas/Timestamps' + with_tax: + $ref: '#/components/schemas/FormattedPriceData' + without_tax: + $ref: '#/components/schemas/FormattedPriceData' + tax: + $ref: '#/components/schemas/FormattedPriceData' + discount: + $ref: '#/components/schemas/FormattedPriceData' + paid: + $ref: '#/components/schemas/FormattedPriceData' + authorized: + $ref: '#/components/schemas/FormattedPriceData' + without_discount: + $ref: '#/components/schemas/FormattedPriceData' + CustomerCheckout: + title: Customer Checkout + type: object + properties: + data: + type: object + properties: + customer: + type: object + properties: + id: + description: The ID of the customer. + type: string + billing_address: + $ref: '#/components/schemas/BillingAddress' + shipping_address: + $ref: '#/components/schemas/ShippingAddress' + AccountCheckout: + title: Account Checkout + type: object + properties: + data: + type: object + properties: + account: + type: object + properties: + id: + description: The account ID. + type: string + member_id: + description: The account member ID. + type: string + contact: + type: object + properties: + name: + description: The name of the account member. + type: string + email: + description: The email address of the account member. + type: string + format: email + billing_address: + $ref: '#/components/schemas/BillingAddress' + shipping_address: + $ref: '#/components/schemas/ShippingAddress' + BillingAddress: + title: BillingAddress + type: object + required: + - first_name + - last_name + - line_1 + - region + - postcode + - country + properties: + company_name: + description: Company name of the billing recipient. + type: string + example: John Doe Enterprises + country: + description: Specifies the country of the billing address. + type: string + example: US + county: + description: Specifies the county of the billing address. + type: string + example: Orange + first_name: + description: First name of the billing recipient. + type: string + example: John + last_name: + description: Last name of the billing recipient. + type: string + example: Doe + line_1: + description: First line of the billing address. + type: string + example: 1 Sunny Street + line_2: + description: Second line of the billing address. + type: string + postcode: + description: Postcode of the billing address. + type: string + example: '92802' + region: + description: Specifies state, province, or region of the billing address. + type: string + example: CA + Contact: + title: Contact + type: object + properties: + email: + description: The email address of the contact. + type: string + example: johndoe@email.com + name: + description: The name of the contact. + type: string + example: John Doe + ShippingAddress: + title: ShippingAddress + type: object + required: + - first_name + - last_name + - line_1 + - region + - postcode + - country + properties: + company_name: + description: Company of the shipping recipient. + type: string + example: John Doe Enterprises + country: + description: Specifies the country of the shipping address. + type: string + example: US + county: + description: Specifies the county of the shipping address. + type: string + example: Orange + first_name: + description: First name of the shipping recipient. + type: string + example: John + last_name: + description: Last name of the shipping recipient. + type: string + example: Doe + line_1: + description: First line of the shipping address. + type: string + example: 1 Sunny Street + line_2: + description: Second line of the shipping address. + type: string + postcode: + description: Post code of the shipping address. + type: string + example: '92802' + region: + description: Specifies the state, province, or region of the shipping address. + type: string + example: CA + Response.Meta.Carts: + type: object + properties: + page: + $ref: '#/components/schemas/Response.PaginationPage' + results: + $ref: '#/components/schemas/Response.PaginationResults' + Response.Meta.Orders: + type: object + properties: + page: + $ref: '#/components/schemas/Response.PaginationPage' + results: + $ref: '#/components/schemas/Response.PaginationResults' + Response.PaginationPage: + type: object + properties: + current: + description: The current page. + type: integer + limit: + description: >- + The maximum number of records per page for this response. You can + set this value up to 100. + type: integer + offset: + description: >- + The current offset by number of records, not pages. Offset is + zero-based. + type: integer + total: + description: The total page count. + type: integer + Response.PaginationResults: + type: object + properties: + total: + description: The total page count. + type: integer + Response.PageLinks: + type: object + properties: + current: + description: Always the current page. + type: string + first: + description: Always the first page. + type: string + last: + description: If there is only one page, it is `null`. + type: string + next: + description: If there is only one page, it is `null`. + type: string + prev: + description: if the user is on the first page, it is `null`. + type: string + Response.Data: + type: object + properties: + data: {} + Response.Error: + type: array + properties: + detail: + type: string + status: + type: string + title: + type: string + Timestamps: + type: object + properties: + created_at: + description: The date this was created. + type: string + example: '2023-11-07T23:04:18.845Z' + updated_at: + description: The date this was last updated. + example: '2023-11-07T23:04:18.845Z' + CartTimestamps: + type: object + properties: + created_at: + type: string + example: '2023-11-07T23:04:18.845Z' + updated_at: + example: '2023-11-07T23:04:18.845Z' + expires_at: + example: '2023-11-12T23:04:18.845Z' + requestBodies: + bundle-configuration-data: + content: + application/json: + schema: + $ref: '#/components/schemas/bundle-configuration-data' + description: The bundle configuration. + required: true + products-for-cart-configuration: + content: + application/json: + schema: + $ref: '#/components/schemas/products-for-cart-configuration' + description: A list of product id or sku and bundle configuration for cart. + required: true + securitySchemes: + bearerAuth: + type: http + scheme: bearer + name: Authorization + in: header +x-tagGroups: + - name: Catalogs Introduction + tags: + - Catalogs + - Releases + - Rules + - Administrator Latest Releases Catalog API + - Shopper Catalog API + - name: Carts, Checkout, Orders Introduction + tags: + - Cart Management + - Account Cart Associations + - Customer Cart Associations + - Cart Items + - Checkout + - Orders + - Payments + - Transactions + - Custom Discounts + - Tax Items diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0f4719a8..32a62b04 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1290,6 +1290,15 @@ importers: '@hey-api/openapi-ts': specifier: ^0.48.2 version: 0.48.3(typescript@5.5.4) + '@redocly/cli': + specifier: ^1.21.0 + version: 1.21.0(enzyme@3.11.0) + '@redocly/openapi-core': + specifier: ^1.21.0 + version: 1.21.0 + lodash: + specifier: ^4.17.21 + version: 4.17.21 typescript: specifier: ^5.5.3 version: 5.5.4 @@ -1905,7 +1914,7 @@ packages: '@babel/core': 7.23.2 '@babel/helper-compilation-targets': 7.22.15 '@babel/helper-plugin-utils': 7.22.5 - debug: 4.3.4 + debug: 4.3.6 lodash.debounce: 4.0.8 resolve: 1.22.8 transitivePeerDependencies: @@ -1919,7 +1928,7 @@ packages: '@babel/core': 7.23.3 '@babel/helper-compilation-targets': 7.22.15 '@babel/helper-plugin-utils': 7.22.5 - debug: 4.3.4 + debug: 4.3.6 lodash.debounce: 4.0.8 resolve: 1.22.8 transitivePeerDependencies: @@ -1933,7 +1942,7 @@ packages: '@babel/core': 7.25.2 '@babel/helper-compilation-targets': 7.22.15 '@babel/helper-plugin-utils': 7.22.5 - debug: 4.3.4 + debug: 4.3.6 lodash.debounce: 4.0.8 resolve: 1.22.8 transitivePeerDependencies: @@ -5118,7 +5127,7 @@ packages: '@babel/helper-split-export-declaration': 7.22.6 '@babel/parser': 7.23.4 '@babel/types': 7.23.4 - debug: 4.3.4 + debug: 4.3.6 globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -5181,6 +5190,23 @@ packages: resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} dev: true + /@cfaester/enzyme-adapter-react-18@0.8.0(enzyme@3.11.0)(react-dom@18.3.1)(react@18.3.1): + resolution: {integrity: sha512-3Z3ThTUouHwz8oIyhTYQljEMNRFtlVyc3VOOHCbxs47U6cnXs8K9ygi/c1tv49s7MBlTXeIcuN+Ttd9aPtILFQ==} + peerDependencies: + enzyme: ^3.11.0 + react: '>=18' + react-dom: '>=18' + dependencies: + enzyme: 3.11.0 + enzyme-shallow-equal: 1.0.7 + function.prototype.name: 1.1.6 + has: 1.0.4 + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) + react-is: 18.2.0 + react-shallow-renderer: 16.15.0(react@18.3.1) + dev: true + /@changesets/apply-release-plan@6.1.4: resolution: {integrity: sha512-FMpKF1fRlJyCZVYHr3CbinpZZ+6MwvOtWUuO8uo+svcATEoc1zRDcj23pAurJ2TZ/uVz1wFHH6K3NlACy0PLew==} dependencies: @@ -6193,6 +6219,20 @@ packages: transitivePeerDependencies: - encoding + /@emotion/is-prop-valid@1.2.2: + resolution: {integrity: sha512-uNsoYd37AFmaCdXlg6EYD1KaPOaRWRByMCYzbKUX4+hhMfrxdVSelShywL4JVaAeM/eHUOSprYBQls+/neX3pw==} + dependencies: + '@emotion/memoize': 0.8.1 + dev: true + + /@emotion/memoize@0.8.1: + resolution: {integrity: sha512-W2P2c/VRW1/1tLox0mVUalvnWXxavmv/Oum2aPsRcoDJuob75FC3Y8FbpfLwUegRcxINtGUMPq0tFCvYNTBXNA==} + dev: true + + /@emotion/unitless@0.8.1: + resolution: {integrity: sha512-KOEGMu6dmJZtpadb476IsZBclKvILjopjUii3V+7MnXIQCYh8W3NgNcgwo21n9LXZX6EDIKvqfjYxXebDwxKmQ==} + dev: true + /@emotion/use-insertion-effect-with-fallbacks@1.0.1(react@18.3.1): resolution: {integrity: sha512-jT/qyKZ9rzLErtrjGgdkMBn2OP8wl0G3sQlBb3YPryvKHsjvINUhVaPFfP+fpBcOkmrVOVEEHQFJ7nbj2TH2gw==} peerDependencies: @@ -6901,6 +6941,10 @@ packages: resolution: {integrity: sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + /@exodus/schemasafe@1.3.0: + resolution: {integrity: sha512-5Aap/GaRupgNx/feGBwLLTVv8OQFfv3pq2lPRzPg9R+IOBnDgghTGW7l7EuVXOvg5cc/xSAlRW8rBrjIC3Nvqw==} + dev: true + /@fal-works/esbuild-plugin-global-externals@2.1.2: resolution: {integrity: sha512-cEee/Z+I12mZcFJshKcCqC8tuX5hG3s+d+9nZ3LabqKF1vKdF41B92pJVCBggjAGORAeOzyyDDKrZwIkLffeOQ==} dev: true @@ -9608,6 +9652,72 @@ packages: dependencies: '@babel/runtime': 7.23.8 + /@redocly/ajv@8.11.0: + resolution: {integrity: sha512-9GWx27t7xWhDIR02PA18nzBdLcKQRgc46xNQvjFkrYk4UOmvKhJ/dawwiX0cCOeetN5LcaaiqQbVOWYK62SGHw==} + dependencies: + fast-deep-equal: 3.1.3 + json-schema-traverse: 1.0.0 + require-from-string: 2.0.2 + uri-js: 4.4.1 + dev: true + + /@redocly/cli@1.21.0(enzyme@3.11.0): + resolution: {integrity: sha512-KPCHWrTXnIV01rgpgwnyQuwKhSol5pnNor20f6/szVrUcZ+vRCqKeZDR1CSMBYIXEsi0AknLV7WR8BCYyfYbog==} + engines: {node: '>=14.19.0', npm: '>=7.0.0'} + hasBin: true + dependencies: + '@redocly/openapi-core': 1.21.0 + abort-controller: 3.0.0 + chokidar: 3.6.0 + colorette: 1.4.0 + core-js: 3.33.1 + form-data: 4.0.0 + get-port-please: 3.1.2 + glob: 7.2.3 + handlebars: 4.7.8 + mobx: 6.13.1 + node-fetch: 2.7.0 + pluralize: 8.0.0 + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) + redoc: 2.1.5(core-js@3.33.1)(enzyme@3.11.0)(mobx@6.13.1)(react-dom@18.3.1)(react@18.3.1)(styled-components@6.1.12) + semver: 7.5.4 + simple-websocket: 9.1.0 + styled-components: 6.1.12(react-dom@18.3.1)(react@18.3.1) + yargs: 17.0.1 + transitivePeerDependencies: + - bufferutil + - encoding + - enzyme + - react-native + - supports-color + - utf-8-validate + dev: true + + /@redocly/config@0.9.0: + resolution: {integrity: sha512-rRd0pSiPC68AQGud2VbrHqUov1VHospfcYE2pFYmGYfZhzZfHBSiVaeiTY+CZmrhf5RB9aVdOHRCm25Vb6GFkQ==} + dev: true + + /@redocly/openapi-core@1.21.0: + resolution: {integrity: sha512-8KwL/0jiQBSJMNp1lSMLM1UeV2FW9DdqcjO0J9s5w7yL7ZN+SNh11MTp0zU4om/pGYExQ64hxLM/+7VdjznHRQ==} + engines: {node: '>=14.19.0', npm: '>=7.0.0'} + dependencies: + '@redocly/ajv': 8.11.0 + '@redocly/config': 0.9.0 + colorette: 1.4.0 + https-proxy-agent: 7.0.5 + js-levenshtein: 1.1.6 + js-yaml: 4.1.0 + lodash.isequal: 4.5.0 + minimatch: 5.1.6 + node-fetch: 2.7.0 + pluralize: 8.0.0 + yaml-ast-parser: 0.0.43 + transitivePeerDependencies: + - encoding + - supports-color + dev: true + /@repeaterjs/repeater@3.0.4: resolution: {integrity: sha512-AW8PKd6iX3vAZ0vA43nOUOnbq/X5ihgU+mSXXqunMkeQADGiqw/PY0JNeYtD5sr0PAy51YPgAPbDoeapv9r8WA==} dev: true @@ -11462,6 +11572,10 @@ packages: resolution: {integrity: sha512-g7CK9nHdwjK2n0ymT2CW698FuWJRIx+RP6embAzZ2Qi8/ilIrA1Imt2LVSeHUzKvpoi7BhmmQcXz95eS0f2JXw==} dev: true + /@types/stylis@4.2.5: + resolution: {integrity: sha512-1Xve+NMN7FWjY14vLoY5tL3BVEQ/n42YLwaqJIPYhotZ9uBHt87VceMwWQpzmdEt2TNXIorIFG+YeCUUW7RInw==} + dev: true + /@types/through@0.0.32: resolution: {integrity: sha512-7XsfXIsjdfJM2wFDRAtEWp3zb2aVPk5QeyZxGlVK57q4u26DczMHhJmlhr0Jqv0THwxam/L8REXkj8M2I/lcvw==} dependencies: @@ -12128,6 +12242,13 @@ packages: resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==} dev: false + /abort-controller@3.0.0: + resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==} + engines: {node: '>=6.5'} + dependencies: + event-target-shim: 5.0.1 + dev: true + /accepts@1.3.8: resolution: {integrity: sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==} engines: {node: '>= 0.6'} @@ -12158,20 +12279,12 @@ packages: acorn: 7.4.1 dev: true - /acorn-jsx@5.3.2(acorn@8.10.0): - resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} - peerDependencies: - acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 - dependencies: - acorn: 8.10.0 - /acorn-jsx@5.3.2(acorn@8.12.1): resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: acorn: 8.12.1 - dev: false /acorn-walk@7.2.0: resolution: {integrity: sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==} @@ -12192,6 +12305,7 @@ packages: resolution: {integrity: sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==} engines: {node: '>=0.4.0'} hasBin: true + dev: true /acorn@8.11.2: resolution: {integrity: sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==} @@ -12216,7 +12330,7 @@ packages: resolution: {integrity: sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==} engines: {node: '>= 14'} dependencies: - debug: 4.3.4 + debug: 4.3.6 transitivePeerDependencies: - supports-color dev: true @@ -12461,6 +12575,14 @@ packages: is-array-buffer: 3.0.2 dev: true + /array-buffer-byte-length@1.0.1: + resolution: {integrity: sha512-ahC5W1xgou+KTXix4sAO8Ki12Q+jf4i0+tmk3sC+zgcynshkHxzpXdImBehiUYKKKDwvfFiJl1tZt6ewscS1Mg==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + is-array-buffer: 3.0.4 + dev: true + /array-flatten@1.1.1: resolution: {integrity: sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==} @@ -12483,6 +12605,18 @@ packages: resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} engines: {node: '>=8'} + /array.prototype.filter@1.0.4: + resolution: {integrity: sha512-r+mCJ7zXgXElgR4IRC+fkvNCeoaavWBs6EdCso5Tbcf+iEMKzBU/His60lt34WEZ9vlb8wDkZvQGcVI5GwkfoQ==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + define-properties: 1.2.1 + es-abstract: 1.23.3 + es-array-method-boxes-properly: 1.0.0 + es-object-atoms: 1.0.0 + is-string: 1.0.7 + dev: true + /array.prototype.findlastindex@1.2.3: resolution: {integrity: sha512-LzLoiOMAxvy+Gd3BAq3B7VeIgPdo+Q8hthvKtXybMvRV0jrXfJM/t8mw7nNlpEcVlVUnCnM2KSX4XU5HmpodOA==} engines: {node: '>= 0.4'} @@ -12498,9 +12632,9 @@ packages: resolution: {integrity: sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.5 + call-bind: 1.0.7 define-properties: 1.2.1 - es-abstract: 1.22.3 + es-abstract: 1.23.3 es-shim-unscopables: 1.0.2 dev: true @@ -12537,6 +12671,20 @@ packages: is-shared-array-buffer: 1.0.2 dev: true + /arraybuffer.prototype.slice@1.0.3: + resolution: {integrity: sha512-bMxMKAjg13EBSVscxTaYA4mRc5t1UAXa2kXiGTNfZ079HIWXEkKmkgFrh/nJqamaLSrXO5H4WFFkPEaLJWbs3A==} + engines: {node: '>= 0.4'} + dependencies: + array-buffer-byte-length: 1.0.1 + call-bind: 1.0.7 + define-properties: 1.2.1 + es-abstract: 1.23.3 + es-errors: 1.3.0 + get-intrinsic: 1.2.4 + is-array-buffer: 3.0.4 + is-shared-array-buffer: 1.0.3 + dev: true + /arrify@1.0.1: resolution: {integrity: sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==} engines: {node: '>=0.10.0'} @@ -12662,6 +12810,13 @@ packages: engines: {node: '>= 0.4'} dev: true + /available-typed-arrays@1.0.7: + resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==} + engines: {node: '>= 0.4'} + dependencies: + possible-typed-array-names: 1.0.0 + dev: true + /axe-core@4.8.2: resolution: {integrity: sha512-/dlp0fxyM3R8YW7MFzaHWXrf4zzbr0vaYb23VBFCl83R7nWNPg/yaQw2Dc8jzCMmDVLhSdzH8MjrsuIUuvX+6g==} engines: {node: '>=4'} @@ -13270,6 +13425,17 @@ packages: get-intrinsic: 1.2.2 set-function-length: 1.1.1 + /call-bind@1.0.7: + resolution: {integrity: sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==} + engines: {node: '>= 0.4'} + dependencies: + es-define-property: 1.0.0 + es-errors: 1.3.0 + function-bind: 1.1.2 + get-intrinsic: 1.2.4 + set-function-length: 1.2.2 + dev: true + /call-me-maybe@1.0.2: resolution: {integrity: sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==} dev: true @@ -13327,6 +13493,10 @@ packages: engines: {node: '>=16'} dev: true + /camelize@1.0.1: + resolution: {integrity: sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ==} + dev: true + /caniuse-api@3.0.0: resolution: {integrity: sha512-bsTwuIg/BZZK/vreVTYYbSWoe2F+71P7K5QGEX+pT250DZbfU1MQ5prOKpPR+LL6uWKK3KMwMCAS74QB3Um1uw==} dependencies: @@ -13482,7 +13652,6 @@ packages: domelementtype: 2.3.0 domhandler: 5.0.3 domutils: 3.1.0 - dev: false /cheerio@1.0.0-rc.12: resolution: {integrity: sha512-VqR8m68vM46BNnuZ5NtnGBKIE/DfN0cRIzg9n40EIq9NOv90ayxLBXA8fXC5gquFRGJSTRqBq25Jt2ECLR431Q==} @@ -13495,7 +13664,6 @@ packages: htmlparser2: 8.0.2 parse5: 7.1.2 parse5-htmlparser2-tree-adapter: 7.0.0 - dev: false /chokidar@3.5.3: resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} @@ -13574,7 +13742,6 @@ packages: /classnames@2.5.1: resolution: {integrity: sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==} - dev: false /clean-css@5.3.2: resolution: {integrity: sha512-JVJbM+f3d3Q704rF4bqQ5UUyTtuJ0JRKNbTKVEeujCCBoMdkEi+V+e8oktO9qGQNSvHrFTM6JZRXrUvGR1czww==} @@ -13682,6 +13849,14 @@ packages: wrap-ansi: 6.2.0 dev: true + /cliui@7.0.4: + resolution: {integrity: sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==} + dependencies: + string-width: 4.2.3 + strip-ansi: 6.0.1 + wrap-ansi: 7.0.0 + dev: true + /cliui@8.0.1: resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} engines: {node: '>=12'} @@ -13710,7 +13885,6 @@ packages: /clsx@2.0.0: resolution: {integrity: sha512-rQ1+kcj+ttHG0MKVGBUXwayCCF1oh39BF5COIpRzuCEv8Mwjv0XucrI2ExNTOn9IlLifGClWQcU9BrZORvtw6Q==} engines: {node: '>=6'} - dev: false /co@4.6.0: resolution: {integrity: sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==} @@ -13772,6 +13946,10 @@ packages: resolution: {integrity: sha512-jeC1axXpnb0/2nn/Y1LPuLdgXBLH7aDcHu4KEKfqw3CUhX7ZpfBSlPKyqXE6btIgEzfWtrX3/tyBCaCvXvMkOw==} dev: false + /colorette@1.4.0: + resolution: {integrity: sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==} + dev: true + /colorette@2.0.20: resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} @@ -14163,6 +14341,11 @@ packages: type-fest: 1.4.0 dev: false + /css-color-keywords@1.0.0: + resolution: {integrity: sha512-FyyrDHZKEjXDpNJYvVsV960FiqQyXc/LlYmsxl2BcdMb2WPx0OGRVgTg55rPSyLSNMqP52R9r8geSp7apN3Ofg==} + engines: {node: '>=4'} + dev: true + /css-declaration-sorter@6.4.1(postcss@8.4.31): resolution: {integrity: sha512-rtdthzxKuyq6IzqX6jEcIzQF/YqccluefyCYheovBOLhFT/drQA9zj/UbRAa9J7C0o6EG6u3E6g+vKkay7/k3g==} engines: {node: ^10 || ^12 || >=14} @@ -14241,7 +14424,14 @@ packages: domhandler: 5.0.3 domutils: 3.1.0 nth-check: 2.1.1 - dev: false + + /css-to-react-native@3.2.0: + resolution: {integrity: sha512-e8RKaLXMOFii+02mOlqwjbD00KSEKqblnpO9e++1aXS1fPQOpS1YoqdVHBqPjHNoxeF2mimzVqawm2KCbEdtHQ==} + dependencies: + camelize: 1.0.1 + css-color-keywords: 1.0.0 + postcss-value-parser: 4.2.0 + dev: true /css-tree@1.1.3: resolution: {integrity: sha512-tRpdppF7TRazZrjJ6v3stzv93qxRcSsFmW6cX0Zm2NVKpxE1WV1HblnghVv9TreireHkqI/VDEsfolRF1p6y7Q==} @@ -14346,6 +14536,10 @@ packages: /csstype@3.1.2: resolution: {integrity: sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==} + /csstype@3.1.3: + resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} + dev: true + /csv-generate@3.4.3: resolution: {integrity: sha512-w/T+rqR0vwvHqWs/1ZyMDWtHHSJaN06klRqJXBEpDJaM/+dZkso0OKh1VcuuYvK3XM53KysVNq8Ko/epCK8wOw==} dev: true @@ -14388,6 +14582,33 @@ packages: engines: {node: '>= 12'} dev: true + /data-view-buffer@1.0.1: + resolution: {integrity: sha512-0lht7OugA5x3iJLOWFhWK/5ehONdprk0ISXqVFn/NFrDu+cuc8iADFrGQz5BnRK7LLU3JmkbXSxaqX+/mXYtUA==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + es-errors: 1.3.0 + is-data-view: 1.0.1 + dev: true + + /data-view-byte-length@1.0.1: + resolution: {integrity: sha512-4J7wRJD3ABAzr8wP+OcIcqq2dlUKp4DVflx++hs5h5ZKydWMI6/D/fAot+yh6g2tHh8fLFTvNOaVN357NvSrOQ==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + es-errors: 1.3.0 + is-data-view: 1.0.1 + dev: true + + /data-view-byte-offset@1.0.0: + resolution: {integrity: sha512-t/Ygsytq+R995EJ5PZlD4Cu56sWa8InXySaViRzw9apusqsOO2bQP+SbYzAhR0pFKoB+43lYy8rWban9JSuXnA==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + es-errors: 1.3.0 + is-data-view: 1.0.1 + dev: true + /dataloader@2.2.2: resolution: {integrity: sha512-8YnDaaf7N3k/q5HnTJVuzSyLETjoZjVmHc4AeKAzOvKHEFQKcn64OKBfzHYtE9zGjctNM7V9I0MfnUVLpi7M5g==} dev: true @@ -14472,6 +14693,10 @@ packages: engines: {node: '>=0.10.0'} dev: true + /decko@1.2.0: + resolution: {integrity: sha512-m8FnyHXV1QX+S1cl+KPFDIl6NMkxtKsy6+U/aYyjrOqWMuwAwYWu7ePqrsUHtDR5Y8Yk2pi/KIDSgF+vT4cPOQ==} + dev: true + /decode-named-character-reference@1.0.2: resolution: {integrity: sha512-O8x12RzrUF8xyVcY0KJowWsmaJxQbmy0/EtnNtHRpsOcT7dFk5W598coHqBVpmWo1oQQfsCqfCmkZN5DJrZVdg==} dependencies: @@ -14578,6 +14803,15 @@ packages: gopd: 1.0.1 has-property-descriptors: 1.0.1 + /define-data-property@1.1.4: + resolution: {integrity: sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==} + engines: {node: '>= 0.4'} + dependencies: + es-define-property: 1.0.0 + es-errors: 1.3.0 + gopd: 1.0.1 + dev: true + /define-lazy-prop@2.0.0: resolution: {integrity: sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==} engines: {node: '>=8'} @@ -14728,6 +14962,10 @@ packages: dependencies: path-type: 4.0.0 + /discontinuous-range@1.0.0: + resolution: {integrity: sha512-c68LpLbO+7kP/b1Hr1qs8/BJ09F5khZGTxqxZuhzxpmwJKOgRFHJWIb9/KmqnqHhLdO55aOxFH/EGBvUQbL/RQ==} + dev: true + /dlv@1.1.3: resolution: {integrity: sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==} dev: true @@ -14779,7 +15017,6 @@ packages: domelementtype: 2.3.0 domhandler: 5.0.3 entities: 4.5.0 - dev: false /domelementtype@2.3.0: resolution: {integrity: sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==} @@ -14795,7 +15032,10 @@ packages: engines: {node: '>= 4'} dependencies: domelementtype: 2.3.0 - dev: false + + /dompurify@3.1.6: + resolution: {integrity: sha512-cTOAhc36AalkjtBpfG6O8JimdTMWNXjiePT2xQH/ppBGi/4uIpmj8eKyIkMJErXWARyINV/sB38yf8JCLF5pbQ==} + dev: true /domutils@2.8.0: resolution: {integrity: sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==} @@ -14810,7 +15050,6 @@ packages: dom-serializer: 2.0.0 domelementtype: 2.3.0 domhandler: 5.0.3 - dev: false /dot-case@3.0.4: resolution: {integrity: sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==} @@ -14981,6 +15220,40 @@ packages: hasBin: true dev: true + /enzyme-shallow-equal@1.0.7: + resolution: {integrity: sha512-/um0GFqUXnpM9SvKtje+9Tjoz3f1fpBC3eXRFrNs8kpYn69JljciYP7KZTqM/YQbUY9KUjvKB4jo/q+L6WGGvg==} + dependencies: + hasown: 2.0.0 + object-is: 1.1.5 + dev: true + + /enzyme@3.11.0: + resolution: {integrity: sha512-Dw8/Gs4vRjxY6/6i9wU0V+utmQO9kvh9XLnz3LIudviOnVYDEe2ec+0k+NQoMamn1VrjKgCUOWj5jG/5M5M0Qw==} + dependencies: + array.prototype.flat: 1.3.2 + cheerio: 1.0.0-rc.12 + enzyme-shallow-equal: 1.0.7 + function.prototype.name: 1.1.6 + has: 1.0.4 + html-element-map: 1.3.1 + is-boolean-object: 1.1.2 + is-callable: 1.2.7 + is-number-object: 1.0.7 + is-regex: 1.1.4 + is-string: 1.0.7 + is-subset: 0.1.1 + lodash.escape: 4.0.1 + lodash.isequal: 4.5.0 + object-inspect: 1.13.1 + object-is: 1.1.5 + object.assign: 4.1.5 + object.entries: 1.1.7 + object.values: 1.1.7 + raf: 3.4.1 + rst-selector-parser: 2.2.3 + string.prototype.trim: 1.2.9 + dev: true + /equals@1.0.5: resolution: {integrity: sha512-wI15a6ZoaaXPv+55+Vh2Kqn3+efKRv8QPtcGTjW5xmanMnQzESdAt566jevtMZyt3W/jwLDTzXpMph5ECDJ2zg==} dependencies: @@ -15037,6 +15310,74 @@ packages: which-typed-array: 1.1.13 dev: true + /es-abstract@1.23.3: + resolution: {integrity: sha512-e+HfNH61Bj1X9/jLc5v1owaLYuHdeHHSQlkhCBiTK8rBvKaULl/beGMxwrMXjpYrv4pz22BlY570vVePA2ho4A==} + engines: {node: '>= 0.4'} + dependencies: + array-buffer-byte-length: 1.0.1 + arraybuffer.prototype.slice: 1.0.3 + available-typed-arrays: 1.0.7 + call-bind: 1.0.7 + data-view-buffer: 1.0.1 + data-view-byte-length: 1.0.1 + data-view-byte-offset: 1.0.0 + es-define-property: 1.0.0 + es-errors: 1.3.0 + es-object-atoms: 1.0.0 + es-set-tostringtag: 2.0.3 + es-to-primitive: 1.2.1 + function.prototype.name: 1.1.6 + get-intrinsic: 1.2.4 + get-symbol-description: 1.0.2 + globalthis: 1.0.3 + gopd: 1.0.1 + has-property-descriptors: 1.0.2 + has-proto: 1.0.3 + has-symbols: 1.0.3 + hasown: 2.0.2 + internal-slot: 1.0.7 + is-array-buffer: 3.0.4 + is-callable: 1.2.7 + is-data-view: 1.0.1 + is-negative-zero: 2.0.3 + is-regex: 1.1.4 + is-shared-array-buffer: 1.0.3 + is-string: 1.0.7 + is-typed-array: 1.1.13 + is-weakref: 1.0.2 + object-inspect: 1.13.1 + object-keys: 1.1.1 + object.assign: 4.1.5 + regexp.prototype.flags: 1.5.2 + safe-array-concat: 1.1.2 + safe-regex-test: 1.0.3 + string.prototype.trim: 1.2.9 + string.prototype.trimend: 1.0.8 + string.prototype.trimstart: 1.0.8 + typed-array-buffer: 1.0.2 + typed-array-byte-length: 1.0.1 + typed-array-byte-offset: 1.0.2 + typed-array-length: 1.0.6 + unbox-primitive: 1.0.2 + which-typed-array: 1.1.15 + dev: true + + /es-array-method-boxes-properly@1.0.0: + resolution: {integrity: sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==} + dev: true + + /es-define-property@1.0.0: + resolution: {integrity: sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==} + engines: {node: '>= 0.4'} + dependencies: + get-intrinsic: 1.2.4 + dev: true + + /es-errors@1.3.0: + resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} + engines: {node: '>= 0.4'} + dev: true + /es-get-iterator@1.1.3: resolution: {integrity: sha512-sPZmqHBe6JIiTfN5q2pEi//TwxmAFHwj/XEuYjTuse78i8KxaqMTTzxPoFKuzRpDpTJ+0NAbpfenkmH2rePtuw==} dependencies: @@ -15081,6 +15422,13 @@ packages: resolution: {integrity: sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw==} dev: true + /es-object-atoms@1.0.0: + resolution: {integrity: sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==} + engines: {node: '>= 0.4'} + dependencies: + es-errors: 1.3.0 + dev: true + /es-set-tostringtag@2.0.2: resolution: {integrity: sha512-BuDyupZt65P9D2D2vA/zqcI3G5xRsklm5N3xCwuiy+/vKy8i0ifdsQP1sLgO4tZDSCaQUSnmC48khknGMV3D2Q==} engines: {node: '>= 0.4'} @@ -15090,10 +15438,19 @@ packages: hasown: 2.0.0 dev: true + /es-set-tostringtag@2.0.3: + resolution: {integrity: sha512-3T8uNMC3OQTHkFUsFq8r/BwAXLHvU/9O9mE0fBc/MY5iq/8H7ncvO947LmYA6ldWw9Uh8Yhf25zu6n7nML5QWQ==} + engines: {node: '>= 0.4'} + dependencies: + get-intrinsic: 1.2.4 + has-tostringtag: 1.0.2 + hasown: 2.0.2 + dev: true + /es-shim-unscopables@1.0.2: resolution: {integrity: sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==} dependencies: - hasown: 2.0.0 + hasown: 2.0.2 dev: true /es-to-primitive@1.2.1: @@ -15123,6 +15480,10 @@ packages: es6-symbol: 3.1.3 dev: true + /es6-promise@3.3.1: + resolution: {integrity: sha512-SOp9Phqvqn7jtEUxPWdWfWoLmyt2VaJ6MpvP9Comy1MceMXqE6bxvaTu4iaxpYYPzhny28Lc+M87/c2cPK6lDg==} + dev: true + /es6-promise@4.2.8: resolution: {integrity: sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==} @@ -15312,7 +15673,7 @@ packages: peerDependencies: esbuild: '>=0.12 <1' dependencies: - debug: 4.3.4 + debug: 4.3.6 esbuild: 0.18.20 transitivePeerDependencies: - supports-color @@ -16095,8 +16456,8 @@ packages: resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - acorn: 8.10.0 - acorn-jsx: 5.3.2(acorn@8.10.0) + acorn: 8.12.1 + acorn-jsx: 5.3.2(acorn@8.12.1) eslint-visitor-keys: 3.4.3 /esprima@3.1.3: @@ -16217,6 +16578,11 @@ packages: es5-ext: 0.10.62 dev: true + /event-target-shim@5.0.1: + resolution: {integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==} + engines: {node: '>=6'} + dev: true + /eventemitter3@4.0.7: resolution: {integrity: sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==} dev: false @@ -16416,6 +16782,10 @@ packages: fast-decode-uri-component: 1.0.1 dev: true + /fast-safe-stringify@2.1.1: + resolution: {integrity: sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==} + dev: true + /fast-url-parser@1.1.3: resolution: {integrity: sha512-5jOCVXADYNuRkKFzNJ0dCCewsZiYo0dz8QNYljkOpFC6r2U4OBmKtvm/Tsuh4w1YYdDqDb31a8TVhBJ2OJKdqQ==} dependencies: @@ -16685,6 +17055,10 @@ packages: is-callable: 1.2.7 dev: true + /foreach@2.0.6: + resolution: {integrity: sha512-k6GAGDyqLe9JaebCsFCoudPPWfihKu8pylYXRlqP1J7ms39iPoTtk2fviNglIeQEwdh0bQeKJ01ZPyuyQvKzwg==} + dev: true + /foreground-child@3.1.1: resolution: {integrity: sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==} engines: {node: '>=14'} @@ -16897,6 +17271,17 @@ packages: has-symbols: 1.0.3 hasown: 2.0.0 + /get-intrinsic@1.2.4: + resolution: {integrity: sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==} + engines: {node: '>= 0.4'} + dependencies: + es-errors: 1.3.0 + function-bind: 1.1.2 + has-proto: 1.0.3 + has-symbols: 1.0.3 + hasown: 2.0.2 + dev: true + /get-nonce@1.0.1: resolution: {integrity: sha512-FJhYRoDaiatfEkUK8HKlicmu/3SGFD51q3itKDGoSTysQJBnfOcxU5GxnhE1E6soB76MbT0MBtnKJuXyAx+96Q==} engines: {node: '>=6'} @@ -16915,6 +17300,10 @@ packages: engines: {node: '>=8.0.0'} dev: true + /get-port-please@3.1.2: + resolution: {integrity: sha512-Gxc29eLs1fbn6LQ4jSU4vXjlwyZhF5HsGuMAa7gqBP4Rw4yxxltyDUuF5MBclFzDTXO+ACchGQoeela4DSfzdQ==} + dev: true + /get-port@5.1.1: resolution: {integrity: sha512-g/Q1aTSDOxFpchXC4i8ZWvxA1lnPqx/JHqcpIw0/LX9T8x/GBbi6YnlN5nhaKIFkT8oFsscUKgDJYxfwfS6QsQ==} engines: {node: '>=8'} @@ -16949,6 +17338,15 @@ packages: get-intrinsic: 1.2.2 dev: true + /get-symbol-description@1.0.2: + resolution: {integrity: sha512-g0QYk1dZBxGwk+Ngc+ltRH2IBp2f7zBkBMBJZCDerh6EhlhSR6+9irMCuT/09zD6qkarHUSn529sK/yL4S27mg==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + es-errors: 1.3.0 + get-intrinsic: 1.2.4 + dev: true + /get-tsconfig@4.7.2: resolution: {integrity: sha512-wuMsz4leaj5hbGgg4IvDU0bqJagpftG5l5cXIAvo8uZrqn0NJqwtfupTN00VnkQJPcIRrxYrm1Ue24btpCha2A==} dependencies: @@ -16961,7 +17359,7 @@ packages: dependencies: colorette: 2.0.20 defu: 6.1.3 - https-proxy-agent: 7.0.2 + https-proxy-agent: 7.0.5 mri: 1.2.0 node-fetch-native: 1.4.1 pathe: 1.1.2 @@ -17318,10 +17716,21 @@ packages: dependencies: get-intrinsic: 1.2.2 + /has-property-descriptors@1.0.2: + resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==} + dependencies: + es-define-property: 1.0.0 + dev: true + /has-proto@1.0.1: resolution: {integrity: sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==} engines: {node: '>= 0.4'} + /has-proto@1.0.3: + resolution: {integrity: sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==} + engines: {node: '>= 0.4'} + dev: true + /has-symbols@1.0.3: resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==} engines: {node: '>= 0.4'} @@ -17333,6 +17742,13 @@ packages: has-symbols: 1.0.3 dev: true + /has-tostringtag@1.0.2: + resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==} + engines: {node: '>= 0.4'} + dependencies: + has-symbols: 1.0.3 + dev: true + /has-yarn@3.0.0: resolution: {integrity: sha512-IrsVwUHhEULx3R8f/aA8AHuEzAorplsab/v8HBzEiIukwq5i/EC+xmOW+HfP1OaDP+2JkgT1yILHN2O3UFIbcA==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -17349,6 +17765,13 @@ packages: dependencies: function-bind: 1.1.2 + /hasown@2.0.2: + resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} + engines: {node: '>= 0.4'} + dependencies: + function-bind: 1.1.2 + dev: true + /hast-util-from-parse5@8.0.1: resolution: {integrity: sha512-Er/Iixbc7IEa7r/XLtuG52zoqn/b3Xng/w6aZQ0xGVxzhw5xUFxcRqdPzP6yFi/4HBYRaifaI5fQ1RH8n0ZeOQ==} dependencies: @@ -17508,6 +17931,13 @@ packages: resolution: {integrity: sha512-983Vyg8NwUE7JkZ6NmOqpCZ+sh1bKv2iYTlUkzlWmA5JD2acKoxd4KVxbMmxX/85mtfdnDmTFoNKcg5DGAvxNQ==} dev: false + /html-element-map@1.3.1: + resolution: {integrity: sha512-6XMlxrAFX4UEEGxctfFnmrFaaZFNf9i5fNuV5wZ3WWQ4FVaNP1aX1LkX9j2mfEx1NpjeE/rL3nmgEn23GdFmrg==} + dependencies: + array.prototype.filter: 1.0.4 + call-bind: 1.0.7 + dev: true + /html-entities@2.4.0: resolution: {integrity: sha512-igBTJcNNNhvZFRtm8uA6xMY6xYleeDwn3PeBCkDz7tHttv4F2hsDI2aPgNERWzvRcNYHNT3ymRaQzllmXj4YsQ==} dev: false @@ -17581,7 +18011,6 @@ packages: domhandler: 5.0.3 domutils: 3.1.0 entities: 4.5.0 - dev: false /http-cache-semantics@4.1.1: resolution: {integrity: sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==} @@ -17620,7 +18049,7 @@ packages: engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 - debug: 4.3.4 + debug: 4.3.6 transitivePeerDependencies: - supports-color dev: true @@ -17655,6 +18084,10 @@ packages: - debug dev: false + /http2-client@1.3.5: + resolution: {integrity: sha512-EC2utToWl4RKfs5zd36Mxq7nzHHBuomZboI0yYL6Y0RmBgT7Sgkq4rQ0ezFTYoIsSs7Tm9SJe+o2FcAg6GBhGA==} + dev: true + /http2-wrapper@2.2.0: resolution: {integrity: sha512-kZB0wxMo0sh1PehyjJUWRFEd99KC5TLjZ2cULC4f9iqJBAmKQQXEICjxl5iPJRwP40dpeHFqqhm7tYCvODpqpQ==} engines: {node: '>=10.19.0'} @@ -17668,7 +18101,7 @@ packages: engines: {node: '>= 6.0.0'} dependencies: agent-base: 5.1.1 - debug: 4.3.4 + debug: 4.3.6 transitivePeerDependencies: - supports-color dev: true @@ -17678,17 +18111,17 @@ packages: engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 - debug: 4.3.4 + debug: 4.3.6 transitivePeerDependencies: - supports-color dev: true - /https-proxy-agent@7.0.2: - resolution: {integrity: sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==} + /https-proxy-agent@7.0.5: + resolution: {integrity: sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==} engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 - debug: 4.3.4 + debug: 4.3.6 transitivePeerDependencies: - supports-color dev: true @@ -18039,6 +18472,15 @@ packages: side-channel: 1.0.4 dev: true + /internal-slot@1.0.7: + resolution: {integrity: sha512-NGnrKwXzSms2qUUih/ILZ5JBqNTSa1+ZmP6flaIp6KmSElgE9qdndzS3cqjrDovwFdmwsGsLdeFgB6suw+1e9g==} + engines: {node: '>= 0.4'} + dependencies: + es-errors: 1.3.0 + hasown: 2.0.2 + side-channel: 1.0.4 + dev: true + /interpret@1.4.0: resolution: {integrity: sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==} engines: {node: '>= 0.10'} @@ -18109,6 +18551,14 @@ packages: is-typed-array: 1.1.12 dev: true + /is-array-buffer@3.0.4: + resolution: {integrity: sha512-wcjaerHw0ydZwfhiKbXJWLDY8A7yV7KhjQOpb83hGgGfId/aQa4TOvwyzn2PuswW2gPCYEL/nEAiSVpdOj1lXw==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + get-intrinsic: 1.2.4 + dev: true + /is-arrayish@0.2.1: resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} @@ -18173,6 +18623,13 @@ packages: kind-of: 6.0.3 dev: false + /is-data-view@1.0.1: + resolution: {integrity: sha512-AHkaJrsUVW6wq6JS8y3JnM/GJF/9cf+k20+iDzlSaJrinEo5+7vRiteOSwBhHRiAyQATN1AmY4hwzxJKPmYf+w==} + engines: {node: '>= 0.4'} + dependencies: + is-typed-array: 1.1.13 + dev: true + /is-date-object@1.0.5: resolution: {integrity: sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==} engines: {node: '>= 0.4'} @@ -18298,6 +18755,11 @@ packages: engines: {node: '>= 0.4'} dev: true + /is-negative-zero@2.0.3: + resolution: {integrity: sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==} + engines: {node: '>= 0.4'} + dev: true + /is-node-process@1.2.0: resolution: {integrity: sha512-Vg4o6/fqPxIjtxgUH5QLJhwZ7gW5diGCVlXpuUfELC62CuxM1iHcRe51f2W1FDy04Ai4KJkagKjx3XaqyfRKXw==} dev: true @@ -18413,6 +18875,13 @@ packages: call-bind: 1.0.5 dev: true + /is-shared-array-buffer@1.0.3: + resolution: {integrity: sha512-nA2hv5XIhLR3uVzDDfCIknerhx8XUKnstuOERPNNIinXG7v9u+ohXF67vxm4TPTEPU6lm61ZkwP3c9PCB97rhg==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + dev: true + /is-stream@1.1.0: resolution: {integrity: sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==} engines: {node: '>=0.10.0'} @@ -18441,6 +18910,10 @@ packages: better-path-resolve: 1.0.0 dev: true + /is-subset@0.1.1: + resolution: {integrity: sha512-6Ybun0IkarhmEqxXCNw/C0bna6Zb/TkfUX9UbwJtK6ObwAVCxmAP308WWTHviM/zAqXk05cdhYsUsZeGQh99iw==} + dev: true + /is-symbol@1.0.4: resolution: {integrity: sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==} engines: {node: '>= 0.4'} @@ -18455,6 +18928,13 @@ packages: which-typed-array: 1.1.13 dev: true + /is-typed-array@1.1.13: + resolution: {integrity: sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==} + engines: {node: '>= 0.4'} + dependencies: + which-typed-array: 1.1.15 + dev: true + /is-typedarray@1.0.0: resolution: {integrity: sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==} dev: false @@ -19200,6 +19680,12 @@ packages: /json-parse-even-better-errors@2.3.1: resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} + /json-pointer@0.6.2: + resolution: {integrity: sha512-vLWcKbOaXlO+jvRy4qNd+TI1QUPZzfJj1tpJ3vAXDych5XJf93ftpUKe5pKCrzyIIwgBJcOcCVRUfqQP25afBw==} + dependencies: + foreach: 2.0.6 + dev: true + /json-schema-to-typescript@11.0.5: resolution: {integrity: sha512-ZNlvngzlPzjYYECbR+uJ9aUWo25Gw/VuwUytvcuKiwc6NaiZhMyf7qBsxZE2eixmj8AoQEQJhSRG7btln0sUDw==} engines: {node: '>=12.0.0'} @@ -19528,6 +20014,14 @@ packages: /lodash.debounce@4.0.8: resolution: {integrity: sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==} + /lodash.escape@4.0.1: + resolution: {integrity: sha512-nXEOnb/jK9g0DYMr1/Xvq6l5xMD7GDG55+GSYIYmS0G4tBk/hURD4JR9WCavs04t33WmJx9kCyp9vJ+mr4BOUw==} + dev: true + + /lodash.flattendeep@4.4.0: + resolution: {integrity: sha512-uHaJFihxmJcEX3kT4I23ABqKKalJ/zDrDg0lsFtc1h+3uw49SIJ5beyhx5ExVRti3AvKoOJngIj7xz3oylPdWQ==} + dev: true + /lodash.flow@3.5.0: resolution: {integrity: sha512-ff3BX/tSioo+XojX4MOsOMhJw0nZoUEF011LX8g8d3gvjVbxd89cCio4BCXronjxcTUIJUoqKEUA+n4CqvvRPw==} @@ -19672,6 +20166,10 @@ packages: es5-ext: 0.10.62 dev: true + /lunr@2.3.9: + resolution: {integrity: sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==} + dev: true + /lz-string@1.5.0: resolution: {integrity: sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==} hasBin: true @@ -19766,6 +20264,10 @@ packages: resolution: {integrity: sha512-0aF7ZmVon1igznGI4VS30yugpduQW3y3GkcgGJOp7d8x8QrizhigUxjI/m2UojsXXto+jLAH3KSz+xOJTiORjg==} dev: true + /mark.js@8.11.1: + resolution: {integrity: sha512-1I+1qpDt4idfgLQG+BNWmrqku+7/2bi5nLf4YwF8y8zXvmfiTBY3PV3ZibfrjBueCByROpuBjLLFCajqkgYoLQ==} + dev: true + /markdown-extensions@2.0.0: resolution: {integrity: sha512-o5vL7aDWatOTX8LzaS1WMoaoxIiLRQJuIKKe2wAw6IeULDHaqbiqiggmx+pKvZDb1Sj+pE46Sn1T7lCqfFtg1Q==} engines: {node: '>=16'} @@ -19784,6 +20286,12 @@ packages: react: 18.3.1 dev: true + /marked@4.3.0: + resolution: {integrity: sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==} + engines: {node: '>= 12'} + hasBin: true + dev: true + /md5-hex@3.0.1: resolution: {integrity: sha512-BUiRtTtV39LIJwinWBjqVsU9xhdnz7/i889V859IBFpuqGAj6LuOvHv5XLbgZ2R7ptJoJaEcxkv88/h25T7Ciw==} engines: {node: '>=8'} @@ -20462,7 +20970,7 @@ packages: resolution: {integrity: sha512-o/sd0nMof8kYff+TqcDx3VSrgBTcZpSvYcAHIfHhv5VAuNmisCxjhx6YmxS8PFEpb9z5WKWKPdzf0jM23ro3RQ==} dependencies: '@types/debug': 4.1.10 - debug: 4.3.4 + debug: 4.3.6 decode-named-character-reference: 1.0.2 devlop: 1.1.0 micromark-core-commonmark: 2.0.0 @@ -20678,6 +21186,48 @@ packages: ufo: 1.5.4 dev: true + /mobx-react-lite@4.0.7(mobx@6.13.1)(react-dom@18.3.1)(react@18.3.1): + resolution: {integrity: sha512-RjwdseshK9Mg8On5tyJZHtGD+J78ZnCnRaxeQDSiciKVQDUbfZcXhmld0VMxAwvcTnPEHZySGGewm467Fcpreg==} + peerDependencies: + mobx: ^6.9.0 + react: ^16.8.0 || ^17 || ^18 + react-dom: '*' + react-native: '*' + peerDependenciesMeta: + react-dom: + optional: true + react-native: + optional: true + dependencies: + mobx: 6.13.1 + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) + use-sync-external-store: 1.2.0(react@18.3.1) + dev: true + + /mobx-react@9.1.1(mobx@6.13.1)(react-dom@18.3.1)(react@18.3.1): + resolution: {integrity: sha512-gVV7AdSrAAxqXOJ2bAbGa5TkPqvITSzaPiiEkzpW4rRsMhSec7C2NBCJYILADHKp2tzOAIETGRsIY0UaCV5aEw==} + peerDependencies: + mobx: ^6.9.0 + react: ^16.8.0 || ^17 || ^18 + react-dom: '*' + react-native: '*' + peerDependenciesMeta: + react-dom: + optional: true + react-native: + optional: true + dependencies: + mobx: 6.13.1 + mobx-react-lite: 4.0.7(mobx@6.13.1)(react-dom@18.3.1)(react@18.3.1) + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) + dev: true + + /mobx@6.13.1: + resolution: {integrity: sha512-ekLRxgjWJr8hVxj9ZKuClPwM/iHckx3euIJ3Np7zLVNtqJvfbbq7l370W/98C8EabdQ1pB5Jd3BbDWxJPNnaOg==} + dev: true + /moo@0.5.2: resolution: {integrity: sha512-iSAJLHYKnX41mKcJKjqvnAN9sf0LMDTXDEvFv+ffuRR9a1MIuXLjMNL6EsnDHSkKLTWNqQQ5uo61P4EbU4NU+Q==} dev: true @@ -20810,6 +21360,12 @@ packages: engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true + /nanoid@3.3.7: + resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + dev: true + /natural-compare-lite@1.4.0: resolution: {integrity: sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==} dev: true @@ -20817,6 +21373,16 @@ packages: /natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} + /nearley@2.20.1: + resolution: {integrity: sha512-+Mc8UaAebFzgV+KpI5n7DasuuQCHA89dmwm7JXw3TV43ukfNQ9DnBH3Mdb2g/I4Fdxc26pwimBWvjIw0UAILSQ==} + hasBin: true + dependencies: + commander: 2.20.3 + moo: 0.5.2 + railroad-diagrams: 1.0.0 + randexp: 0.4.6 + dev: true + /negotiator@0.6.3: resolution: {integrity: sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==} engines: {node: '>= 0.6'} @@ -20898,6 +21464,13 @@ packages: skin-tone: 2.0.0 dev: false + /node-fetch-h2@2.3.0: + resolution: {integrity: sha512-ofRW94Ab0T4AOh5Fk8t0h8OBWrmjb0SSB20xh1H8YnPV9EJ+f5AMoYSUQ2zgJ4Iq2HAK0I2l5/Nequ8YzFS3Hg==} + engines: {node: 4.x || >=6.0.0} + dependencies: + http2-client: 1.3.5 + dev: true + /node-fetch-native@1.4.1: resolution: {integrity: sha512-NsXBU0UgBxo2rQLOeWNZqS3fvflWePMECr8CoSWoSTqCqGbVVsvl9vZu1HfQicYN0g5piV9Gh8RTEvo/uP752w==} dev: true @@ -20913,6 +21486,18 @@ packages: is-stream: 1.1.0 dev: true + /node-fetch@2.7.0: + resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} + engines: {node: 4.x || >=6.0.0} + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + dependencies: + whatwg-url: 5.0.0 + dev: true + /node-fetch@2.7.0(encoding@0.1.13): resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} engines: {node: 4.x || >=6.0.0} @@ -20949,6 +21534,12 @@ packages: dependencies: write-file-atomic: 1.3.4 + /node-readfiles@0.2.0: + resolution: {integrity: sha512-SU00ZarexNlE4Rjdm83vglt5Y9yiQ+XI1XpflWlb7q7UTN1JUItm69xMeiQCTxtTfnzt+83T8Cx+vI2ED++VDA==} + dependencies: + es6-promise: 3.3.1 + dev: true + /node-releases@2.0.13: resolution: {integrity: sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==} @@ -21036,6 +21627,48 @@ packages: ufo: 1.5.4 dev: true + /oas-kit-common@1.0.8: + resolution: {integrity: sha512-pJTS2+T0oGIwgjGpw7sIRU8RQMcUoKCDWFLdBqKB2BNmGpbBMH2sdqAaOXUg8OzonZHU0L7vfJu1mJFEiYDWOQ==} + dependencies: + fast-safe-stringify: 2.1.1 + dev: true + + /oas-linter@3.2.2: + resolution: {integrity: sha512-KEGjPDVoU5K6swgo9hJVA/qYGlwfbFx+Kg2QB/kd7rzV5N8N5Mg6PlsoCMohVnQmo+pzJap/F610qTodKzecGQ==} + dependencies: + '@exodus/schemasafe': 1.3.0 + should: 13.2.3 + yaml: 1.10.2 + dev: true + + /oas-resolver@2.5.6: + resolution: {integrity: sha512-Yx5PWQNZomfEhPPOphFbZKi9W93CocQj18NlD2Pa4GWZzdZpSJvYwoiuurRI7m3SpcChrnO08hkuQDL3FGsVFQ==} + hasBin: true + dependencies: + node-fetch-h2: 2.3.0 + oas-kit-common: 1.0.8 + reftools: 1.1.9 + yaml: 1.10.2 + yargs: 17.7.2 + dev: true + + /oas-schema-walker@1.1.5: + resolution: {integrity: sha512-2yucenq1a9YPmeNExoUa9Qwrt9RFkjqaMAA1X+U7sbb0AqBeTIdMHky9SQQ6iN94bO5NW0W4TRYXerG+BdAvAQ==} + dev: true + + /oas-validator@5.0.8: + resolution: {integrity: sha512-cu20/HE5N5HKqVygs3dt94eYJfBi0TsZvPVXDhbXQHiEityDN+RROTleefoKRKKJ9dFAF2JBkDHgvWj0sjKGmw==} + dependencies: + call-me-maybe: 1.0.2 + oas-kit-common: 1.0.8 + oas-linter: 3.2.2 + oas-resolver: 2.5.6 + oas-schema-walker: 1.1.5 + reftools: 1.1.9 + should: 13.2.3 + yaml: 1.10.2 + dev: true + /object-assign@4.1.1: resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} engines: {node: '>=0.10.0'} @@ -21078,13 +21711,23 @@ packages: has-symbols: 1.0.3 object-keys: 1.1.1 + /object.assign@4.1.5: + resolution: {integrity: sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + define-properties: 1.2.1 + has-symbols: 1.0.3 + object-keys: 1.1.1 + dev: true + /object.entries@1.1.7: resolution: {integrity: sha512-jCBs/0plmPsOnrKAfFQXRG2NFjlhZgjjcBLSmTnEhU8U6vVTsVe8ANeQJCHTl3gSsI4J+0emOoCgoKlmQPMgmA==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.5 + call-bind: 1.0.7 define-properties: 1.2.1 - es-abstract: 1.22.3 + es-abstract: 1.23.3 dev: true /object.fromentries@2.0.7: @@ -21116,9 +21759,9 @@ packages: resolution: {integrity: sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.5 + call-bind: 1.0.7 define-properties: 1.2.1 - es-abstract: 1.22.3 + es-abstract: 1.23.3 dev: true /obuf@1.1.2: @@ -21165,6 +21808,13 @@ packages: is-docker: 2.2.1 is-wsl: 2.2.0 + /openapi-sampler@1.5.1: + resolution: {integrity: sha512-tIWIrZUKNAsbqf3bd9U1oH6JEXo8LNYuDlXw26By67EygpjT+ArFnsxxyTMjFWRfbqo5ozkvgSQDK69Gd8CddA==} + dependencies: + '@types/json-schema': 7.0.15 + json-pointer: 0.6.2 + dev: true + /opener@1.5.2: resolution: {integrity: sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==} hasBin: true @@ -21379,13 +22029,11 @@ packages: dependencies: domhandler: 5.0.3 parse5: 7.1.2 - dev: false /parse5@7.1.2: resolution: {integrity: sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==} dependencies: entities: 4.5.0 - dev: false /parseurl@1.3.3: resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==} @@ -21518,6 +22166,14 @@ packages: resolution: {integrity: sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==} dev: true + /perfect-scrollbar@1.5.5: + resolution: {integrity: sha512-dzalfutyP3e/FOpdlhVryN4AJ5XDVauVWxybSkLZmakFE2sS3y3pc4JnSprw8tGmHvkaG5Edr5T7LBTZ+WWU2g==} + dev: true + + /performance-now@2.1.0: + resolution: {integrity: sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==} + dev: true + /periscopic@3.1.0: resolution: {integrity: sha512-vKiQ8RRtkl9P+r/+oefh25C3fhybptkHKCZSPlcXiJux2tJF55GnEj3BVn4A5gKfq9NWWXXrxkHBwVPUfH0opw==} dependencies: @@ -21629,6 +22285,11 @@ packages: engines: {node: '>=4'} dev: true + /pluralize@8.0.0: + resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==} + engines: {node: '>=4'} + dev: true + /polished@4.2.2: resolution: {integrity: sha512-Sz2Lkdxz6F2Pgnpi9U5Ng/WdWAUZxmHrNPoVlm3aAemxoy2Qy7LGjQg4uf8qKelDAUW94F4np3iH2YPf2qefcQ==} engines: {node: '>=10'} @@ -21636,6 +22297,11 @@ packages: '@babel/runtime': 7.23.8 dev: true + /possible-typed-array-names@1.0.0: + resolution: {integrity: sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==} + engines: {node: '>= 0.4'} + dev: true + /postcss-calc@8.2.4(postcss@8.4.31): resolution: {integrity: sha512-SmWMSJmB8MRnnULldx0lQIyhSNvuDl9HfrZkaqqE/WHAhToYsAvDq+yAsA/kIyINDszOp3Rh0GFoNuH5Ypsm3Q==} peerDependencies: @@ -22127,6 +22793,15 @@ packages: picocolors: 1.0.0 source-map-js: 1.0.2 + /postcss@8.4.38: + resolution: {integrity: sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==} + engines: {node: ^10 || ^12 || >=14} + dependencies: + nanoid: 3.3.7 + picocolors: 1.0.1 + source-map-js: 1.2.0 + dev: true + /posthog-node@3.1.2: resolution: {integrity: sha512-atPGYjiK+QvtseKKsrUxMrzN84sIVs9jTa7nx5hl999gJly1S3J5r0DApwZ69NKfJkVIeLTCJyT0kyS+7WqDSw==} engines: {node: '>=15.0.0'} @@ -22347,7 +23022,6 @@ packages: /prismjs@1.29.0: resolution: {integrity: sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==} engines: {node: '>=6'} - dev: false /process-nextick-args@1.0.7: resolution: {integrity: sha512-yN0WQmuCX63LP/TMvAg31nvT6m4vDqJEiiv2CAZqWOGNWutc9DfDk1NPYYmKUFmaVM2UwDowH4u5AHWYP/jxKw==} @@ -22448,7 +23122,7 @@ packages: engines: {node: '>=8.16.0'} dependencies: '@types/mime-types': 2.1.4 - debug: 4.3.4 + debug: 4.3.6 extract-zip: 1.7.0 https-proxy-agent: 4.0.0 mime: 2.6.0 @@ -22558,10 +23232,28 @@ packages: through2: 2.0.5 dev: true + /raf@3.4.1: + resolution: {integrity: sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==} + dependencies: + performance-now: 2.1.0 + dev: true + + /railroad-diagrams@1.0.0: + resolution: {integrity: sha512-cz93DjNeLY0idrCNOH6PviZGRN9GJhsdm9hpn1YCS879fj4W+x5IFJhhkRZcwVgMmFF7R82UA/7Oh+R8lLZg6A==} + dev: true + /ramda@0.29.0: resolution: {integrity: sha512-BBea6L67bYLtdbOqfp8f58fPMqEwx0doL+pAi8TZyp2YWz8R9G8z9x75CZI8W+ftqhFHCpEX2cRnUUXK130iKA==} dev: true + /randexp@0.4.6: + resolution: {integrity: sha512-80WNmd9DA0tmZrw9qQa62GPPWfuXJknrmVmLcxvq4uZBdYqb1wYoKTmnlGUchvVWe0XiLupYkBoXVOxz3C8DYQ==} + engines: {node: '>=0.12'} + dependencies: + discontinuous-range: 1.0.0 + ret: 0.1.15 + dev: true + /randombytes@2.1.0: resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} dependencies: @@ -23042,6 +23734,16 @@ packages: tiny-warning: 1.0.3 dev: false + /react-shallow-renderer@16.15.0(react@18.3.1): + resolution: {integrity: sha512-oScf2FqQ9LFVQgA73vr86xl2NaOIX73rh+YFqcOp68CWj56tSfgtGKrEbyhCj0rSijyG9M1CYprTh39fBi5hzA==} + peerDependencies: + react: ^16.0.0 || ^17.0.0 || ^18.0.0 + dependencies: + object-assign: 4.1.1 + react: 18.3.1 + react-is: 18.2.0 + dev: true + /react-style-singleton@2.2.1(@types/react@18.3.3)(react@18.3.1): resolution: {integrity: sha512-ZWj0fHEMyWkHzKYUr2Bs/4zU6XLmq9HsgBURm7g5pAVfyn49DgUiNgY2d4lXRlYSiCif9YBGpQleewkcqddc7g==} engines: {node: '>=10'} @@ -23058,6 +23760,16 @@ packages: react: 18.3.1 tslib: 2.6.2 + /react-tabs@6.0.2(react@18.3.1): + resolution: {integrity: sha512-aQXTKolnM28k3KguGDBSAbJvcowOQr23A+CUJdzJtOSDOtTwzEaJA+1U4KwhNL9+Obe+jFS7geuvA7ICQPXOnQ==} + peerDependencies: + react: ^18.0.0 + dependencies: + clsx: 2.0.0 + prop-types: 15.8.1 + react: 18.3.1 + dev: true + /react-textarea-autosize@8.3.4(@types/react@18.3.3)(react@18.2.0): resolution: {integrity: sha512-CdtmP8Dc19xL8/R6sWvtknD/eCXkQr30dtvC4VmGInhRsfF8X/ihXCq6+9l9qbxmKRiq407/7z5fxE7cVWQNgQ==} engines: {node: '>=10'} @@ -23228,6 +23940,50 @@ packages: strip-indent: 3.0.0 dev: true + /redoc@2.1.5(core-js@3.33.1)(enzyme@3.11.0)(mobx@6.13.1)(react-dom@18.3.1)(react@18.3.1)(styled-components@6.1.12): + resolution: {integrity: sha512-POSbVg+7WLf+/5/c6GWLxL7+9t2D+1WlZdLN0a6qaCQc+ih3XYzteRBkXEN5kjrYrRNjdspfxTZkDLN5WV3Tzg==} + engines: {node: '>=6.9', npm: '>=3.0.0'} + peerDependencies: + core-js: ^3.1.4 + mobx: ^6.0.4 + react: ^16.8.4 || ^17.0.0 || ^18.0.0 + react-dom: ^16.8.4 || ^17.0.0 || ^18.0.0 + styled-components: ^4.1.1 || ^5.1.1 || ^6.0.5 + dependencies: + '@cfaester/enzyme-adapter-react-18': 0.8.0(enzyme@3.11.0)(react-dom@18.3.1)(react@18.3.1) + '@redocly/openapi-core': 1.21.0 + classnames: 2.5.1 + core-js: 3.33.1 + decko: 1.2.0 + dompurify: 3.1.6 + eventemitter3: 5.0.1 + json-pointer: 0.6.2 + lunr: 2.3.9 + mark.js: 8.11.1 + marked: 4.3.0 + mobx: 6.13.1 + mobx-react: 9.1.1(mobx@6.13.1)(react-dom@18.3.1)(react@18.3.1) + openapi-sampler: 1.5.1 + path-browserify: 1.0.1 + perfect-scrollbar: 1.5.5 + polished: 4.2.2 + prismjs: 1.29.0 + prop-types: 15.8.1 + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) + react-tabs: 6.0.2(react@18.3.1) + slugify: 1.4.7 + stickyfill: 1.1.1 + styled-components: 6.1.12(react-dom@18.3.1)(react@18.3.1) + swagger2openapi: 7.0.8 + url-template: 2.0.8 + transitivePeerDependencies: + - encoding + - enzyme + - react-native + - supports-color + dev: true + /reflect.getprototypeof@1.0.4: resolution: {integrity: sha512-ECkTw8TmJwW60lOTR+ZkODISW6RQ8+2CL3COqtiJKLd6MmB45hN51HprHFziKLGkAuTGQhBb91V8cy+KHlaCjw==} engines: {node: '>= 0.4'} @@ -23240,6 +23996,10 @@ packages: which-builtin-type: 1.1.3 dev: true + /reftools@1.1.9: + resolution: {integrity: sha512-OVede/NQE13xBQ+ob5CKd5KyeJYU2YInb1bmV4nRoOfquZPkAkxuOXicSe1PvqIuZZ4kD13sPKBbR7UFDmli6w==} + dev: true + /regenerate-unicode-properties@10.1.1: resolution: {integrity: sha512-X007RyZLsCJVVrjgEFVpLUTZwyOZk3oiL75ZcuYjlIWd6rNJtOjkBwQc5AsRrpbKVkxN6sklw/k/9m2jJYOf8Q==} engines: {node: '>=4'} @@ -23270,6 +24030,16 @@ packages: set-function-name: 2.0.1 dev: true + /regexp.prototype.flags@1.5.2: + resolution: {integrity: sha512-NcDiDkTLuPR+++OCKB0nWafEmhg/Da8aUPLPMQbK+bxKKCm1/S5he+AqYa4PlMCVBalb4/yxIRub6qkEx5yJbw==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + define-properties: 1.2.1 + es-errors: 1.3.0 + set-function-name: 2.0.1 + dev: true + /regexpu-core@5.3.2: resolution: {integrity: sha512-RAM5FlZz+Lhmo7db9L298p2vHP5ZywrVXmVXpmAD9GuL5MPH6t9ROw1iA/wfHkQ76Qe7AaPF0nGuim96/IrQMQ==} engines: {node: '>=4'} @@ -23550,6 +24320,11 @@ packages: onetime: 5.1.2 signal-exit: 3.0.7 + /ret@0.1.15: + resolution: {integrity: sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==} + engines: {node: '>=0.12'} + dev: true + /retry@0.13.1: resolution: {integrity: sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==} engines: {node: '>= 4'} @@ -23578,6 +24353,7 @@ packages: /rimraf@3.0.2: resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} + deprecated: Rimraf versions prior to v4 are no longer supported hasBin: true dependencies: glob: 7.2.3 @@ -23606,6 +24382,13 @@ packages: fsevents: 2.3.3 dev: true + /rst-selector-parser@2.2.3: + resolution: {integrity: sha512-nDG1rZeP6oFTLN6yNDV/uiAvs1+FS/KlrEwh7+y7dpuApDBy6bI2HTBcc0/V8lv9OTqfyD34eF7au2pm8aBbhA==} + dependencies: + lodash.flattendeep: 4.4.0 + nearley: 2.20.1 + dev: true + /rtl-detect@1.1.2: resolution: {integrity: sha512-PGMBq03+TTG/p/cRB7HCLKJ1MgDIi07+QU1faSjiYRfmY5UsAttV9Hs08jDAHVwcOwmVLcSJkpwyfXszVjWfIQ==} dev: false @@ -23660,6 +24443,16 @@ packages: isarray: 2.0.5 dev: true + /safe-array-concat@1.1.2: + resolution: {integrity: sha512-vj6RsCsWBCf19jIeHEfkRMw8DPiBb+DMXklQ/1SGDHOMlHdPUkZXFQ2YdplS23zESTijAcurb1aSgJA3AgMu1Q==} + engines: {node: '>=0.4'} + dependencies: + call-bind: 1.0.7 + get-intrinsic: 1.2.4 + has-symbols: 1.0.3 + isarray: 2.0.5 + dev: true + /safe-buffer@5.1.2: resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==} @@ -23678,6 +24471,15 @@ packages: is-regex: 1.1.4 dev: true + /safe-regex-test@1.0.3: + resolution: {integrity: sha512-CdASjNJPvRa7roO6Ra/gLYBTzYzzPyyBXxIMdGW3USQLyjWEls2RgW5UBTXaQVp+OrpeCK3bLem8smtmheoRuw==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + es-errors: 1.3.0 + is-regex: 1.1.4 + dev: true + /safer-buffer@2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} @@ -23891,6 +24693,18 @@ packages: gopd: 1.0.1 has-property-descriptors: 1.0.1 + /set-function-length@1.2.2: + resolution: {integrity: sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==} + engines: {node: '>= 0.4'} + dependencies: + define-data-property: 1.1.4 + es-errors: 1.3.0 + function-bind: 1.1.2 + get-intrinsic: 1.2.4 + gopd: 1.0.1 + has-property-descriptors: 1.0.2 + dev: true + /set-function-name@2.0.1: resolution: {integrity: sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==} engines: {node: '>= 0.4'} @@ -23958,6 +24772,44 @@ packages: rechoir: 0.6.2 dev: false + /should-equal@2.0.0: + resolution: {integrity: sha512-ZP36TMrK9euEuWQYBig9W55WPC7uo37qzAEmbjHz4gfyuXrEUgF8cUvQVO+w+d3OMfPvSRQJ22lSm8MQJ43LTA==} + dependencies: + should-type: 1.4.0 + dev: true + + /should-format@3.0.3: + resolution: {integrity: sha512-hZ58adtulAk0gKtua7QxevgUaXTTXxIi8t41L3zo9AHvjXO1/7sdLECuHeIN2SRtYXpNkmhoUP2pdeWgricQ+Q==} + dependencies: + should-type: 1.4.0 + should-type-adaptors: 1.1.0 + dev: true + + /should-type-adaptors@1.1.0: + resolution: {integrity: sha512-JA4hdoLnN+kebEp2Vs8eBe9g7uy0zbRo+RMcU0EsNy+R+k049Ki+N5tT5Jagst2g7EAja+euFuoXFCa8vIklfA==} + dependencies: + should-type: 1.4.0 + should-util: 1.0.1 + dev: true + + /should-type@1.4.0: + resolution: {integrity: sha512-MdAsTu3n25yDbIe1NeN69G4n6mUnJGtSJHygX3+oN0ZbO3DTiATnf7XnYJdGT42JCXurTb1JI0qOBR65shvhPQ==} + dev: true + + /should-util@1.0.1: + resolution: {integrity: sha512-oXF8tfxx5cDk8r2kYqlkUJzZpDBqVY/II2WhvU0n9Y3XYvAYRmeaf1PvvIvTgPnv4KJ+ES5M0PyDq5Jp+Ygy2g==} + dev: true + + /should@13.2.3: + resolution: {integrity: sha512-ggLesLtu2xp+ZxI+ysJTmNjh2U0TsC+rQ/pfED9bUZZ4DKefP27D+7YJVVTvKsmjLpIi9jAa7itwDGkDDmt1GQ==} + dependencies: + should-equal: 2.0.0 + should-format: 3.0.3 + should-type: 1.4.0 + should-type-adaptors: 1.1.0 + should-util: 1.0.1 + dev: true + /side-channel@1.0.4: resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==} dependencies: @@ -23997,6 +24849,20 @@ packages: semver: 7.5.4 dev: true + /simple-websocket@9.1.0: + resolution: {integrity: sha512-8MJPnjRN6A8UCp1I+H/dSFyjwJhp6wta4hsVRhjf8w9qBHRzxYt14RaOcjvQnhD1N4yKOddEjflwMnQM4VtXjQ==} + dependencies: + debug: 4.3.6 + queue-microtask: 1.2.3 + randombytes: 2.1.0 + readable-stream: 3.6.2 + ws: 7.5.9 + transitivePeerDependencies: + - bufferutil + - supports-color + - utf-8-validate + dev: true + /sirv@1.0.19: resolution: {integrity: sha512-JuLThK3TnZG1TAKDwNIqNq6QA2afLOCcm+iE8D1Kj3GA40pSPsxQjjJl0J8X3tsR7T+CP1GavpzLwYkgVLWrZQ==} engines: {node: '>= 10'} @@ -24088,6 +24954,11 @@ packages: /slide@1.1.6: resolution: {integrity: sha512-NwrtjCg+lZoqhFU8fOwl4ay2ei8PaqCBOUV3/ektPY9trO1yQ1oXEfmHAhKArUVUr/hOHvy5f6AdP17dCM0zMw==} + /slugify@1.4.7: + resolution: {integrity: sha512-tf+h5W1IrjNm/9rKKj0JU2MDMruiopx0jjVA5zCdBtcGjfp0+c5rHw/zADLC3IeKlGHtVbHtpfzvYA0OYT+HKg==} + engines: {node: '>=8.0.0'} + dev: true + /smartwrap@2.0.2: resolution: {integrity: sha512-vCsKNQxb7PnCNd2wY1WClWifAc2lwqsG8OaswpJkVJsvMGcnEntdTCDajZCkk93Ay1U3t/9puJmb525Rg5MZBA==} engines: {node: '>=6'} @@ -24124,6 +24995,11 @@ packages: resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==} engines: {node: '>=0.10.0'} + /source-map-js@1.2.0: + resolution: {integrity: sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==} + engines: {node: '>=0.10.0'} + dev: true + /source-map-support@0.5.13: resolution: {integrity: sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==} dependencies: @@ -24145,6 +25021,7 @@ packages: /source-map@0.6.1: resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} engines: {node: '>=0.10.0'} + requiresBuild: true /source-map@0.7.4: resolution: {integrity: sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==} @@ -24206,7 +25083,7 @@ packages: /spdy-transport@3.0.0: resolution: {integrity: sha512-hsLVFE5SjA6TCisWeJXFKniGGOpBgMLmerfO2aCyCU5s7nJ/rpAepqmFifv/GCbSbueEeAJJnmSQ2rKC/g8Fcw==} dependencies: - debug: 4.3.4 + debug: 4.3.6 detect-node: 2.1.0 hpack.js: 2.1.6 obuf: 1.1.2 @@ -24220,7 +25097,7 @@ packages: resolution: {integrity: sha512-r46gZQZQV+Kl9oItvl1JZZqJKGr+oEkB08A6BzkiR7593/7IbtuncXHd2YoYeTsG4157ZssMu9KYvUHLcjcDoA==} engines: {node: '>=6.0.0'} dependencies: - debug: 4.3.4 + debug: 4.3.6 handle-thing: 2.0.1 http-deceiver: 1.2.7 select-hose: 2.0.0 @@ -24301,6 +25178,10 @@ packages: /std-env@3.4.3: resolution: {integrity: sha512-f9aPhy8fYBuMN+sNfakZV18U39PbalgjXG3lLB9WkaYTxijru61wb57V9wxxNthXM5Sd88ETBWi29qLAsHO52Q==} + /stickyfill@1.1.1: + resolution: {integrity: sha512-GCp7vHAfpao+Qh/3Flh9DXEJ/qSi0KJwJw6zYlZOtRYXWUIpMM6mC2rIep/dK8RQqwW0KxGJIllmjPIBOGN8AA==} + dev: true + /stop-iteration-iterator@1.0.0: resolution: {integrity: sha512-iCGQj+0l0HOdZ2AEeBADlsRC+vsnDsZsbdSiH1yNSjcfKM7fdpCMfqAL/dwF5BLiw/XhRft/Wax6zQbhq2BcjQ==} engines: {node: '>= 0.4'} @@ -24422,6 +25303,16 @@ packages: es-abstract: 1.22.3 dev: true + /string.prototype.trim@1.2.9: + resolution: {integrity: sha512-klHuCNxiMZ8MlsOihJhJEBJAiMVqU3Z2nEXWfWnIqjN0gEFS9J9+IxKozWWtQGcgoa1WUZzLjKPTr4ZHNFTFxw==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + define-properties: 1.2.1 + es-abstract: 1.23.3 + es-object-atoms: 1.0.0 + dev: true + /string.prototype.trimend@1.0.7: resolution: {integrity: sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA==} dependencies: @@ -24430,6 +25321,14 @@ packages: es-abstract: 1.22.3 dev: true + /string.prototype.trimend@1.0.8: + resolution: {integrity: sha512-p73uL5VCHCO2BZZ6krwwQE3kCzM7NKmis8S//xEC6fQonchbum4eP6kR4DLEjQFO3Wnj3Fuo8NM0kOSjVdHjZQ==} + dependencies: + call-bind: 1.0.7 + define-properties: 1.2.1 + es-object-atoms: 1.0.0 + dev: true + /string.prototype.trimstart@1.0.7: resolution: {integrity: sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg==} dependencies: @@ -24438,6 +25337,15 @@ packages: es-abstract: 1.22.3 dev: true + /string.prototype.trimstart@1.0.8: + resolution: {integrity: sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + define-properties: 1.2.1 + es-object-atoms: 1.0.0 + dev: true + /string_decoder@1.0.3: resolution: {integrity: sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==} dependencies: @@ -24555,6 +25463,26 @@ packages: inline-style-parser: 0.1.1 dev: false + /styled-components@6.1.12(react-dom@18.3.1)(react@18.3.1): + resolution: {integrity: sha512-n/O4PzRPhbYI0k1vKKayfti3C/IGcPf+DqcrOB7O/ab9x4u/zjqraneT5N45+sIe87cxrCApXM8Bna7NYxwoTA==} + engines: {node: '>= 16'} + peerDependencies: + react: '>= 16.8.0' + react-dom: '>= 16.8.0' + dependencies: + '@emotion/is-prop-valid': 1.2.2 + '@emotion/unitless': 0.8.1 + '@types/stylis': 4.2.5 + css-to-react-native: 3.2.0 + csstype: 3.1.3 + postcss: 8.4.38 + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) + shallowequal: 1.1.0 + stylis: 4.3.2 + tslib: 2.6.2 + dev: true + /styled-jsx@5.1.1(@babel/core@7.23.2)(react@18.3.1): resolution: {integrity: sha512-pW7uC1l4mBZ8ugbiZrcIsiIvVx1UmTfw7UkC3Um2tmfUq9Bhk8IiyEIPl6F8agHgjzku6j0xQEZbfA5uSgSaCw==} engines: {node: '>= 12.0.0'} @@ -24583,6 +25511,10 @@ packages: postcss-selector-parser: 6.0.13 dev: false + /stylis@4.3.2: + resolution: {integrity: sha512-bhtUjWd/z6ltJiQwg0dUfxEJ+W+jdqQd8TbWLWyeIJHlnsqmGLRFFd8e5mA0AZi/zx90smXRlN66YMTcaSFifg==} + dev: true + /sucrase@3.34.0: resolution: {integrity: sha512-70/LQEZ07TEcxiU2dz51FKaE6hCTWC6vr7FOk3Gr0U60C3shtAN+H+BFr9XlYe5xqf3RA8nrc+VIwzCfnxuXJw==} engines: {node: '>=8'} @@ -24656,6 +25588,25 @@ packages: picocolors: 1.0.0 stable: 0.1.8 + /swagger2openapi@7.0.8: + resolution: {integrity: sha512-upi/0ZGkYgEcLeGieoz8gT74oWHA0E7JivX7aN9mAf+Tc7BQoRBvnIGHoPDw+f9TXTW4s6kGYCZJtauP6OYp7g==} + hasBin: true + dependencies: + call-me-maybe: 1.0.2 + node-fetch: 2.7.0 + node-fetch-h2: 2.3.0 + node-readfiles: 0.2.0 + oas-kit-common: 1.0.8 + oas-resolver: 2.5.6 + oas-schema-walker: 1.1.5 + oas-validator: 5.0.8 + reftools: 1.1.9 + yaml: 1.10.2 + yargs: 17.7.2 + transitivePeerDependencies: + - encoding + dev: true + /swap-case@2.0.2: resolution: {integrity: sha512-kc6S2YS/2yXbtkSMunBtKdah4VFETZ8Oh6ONSmSd9bRxhqTrtARUCBUiWXH3xVPpvR7tz2CSnkuXVE42EcGnMw==} dependencies: @@ -25488,6 +26439,15 @@ packages: is-typed-array: 1.1.12 dev: true + /typed-array-buffer@1.0.2: + resolution: {integrity: sha512-gEymJYKZtKXzzBzM4jqa9w6Q1Jjm7x2d+sh19AdsD4wqnMPDYyvwpsIc2Q/835kHuo3BEQ7CjelGhfTsoBb2MQ==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + es-errors: 1.3.0 + is-typed-array: 1.1.13 + dev: true + /typed-array-byte-length@1.0.0: resolution: {integrity: sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==} engines: {node: '>= 0.4'} @@ -25498,6 +26458,17 @@ packages: is-typed-array: 1.1.12 dev: true + /typed-array-byte-length@1.0.1: + resolution: {integrity: sha512-3iMJ9q0ao7WE9tWcaYKIptkNBuOIcZCCT0d4MRvuuH88fEoEH62IuQe0OtraD3ebQEoTRk8XCBoknUNc1Y67pw==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + for-each: 0.3.3 + gopd: 1.0.1 + has-proto: 1.0.3 + is-typed-array: 1.1.13 + dev: true + /typed-array-byte-offset@1.0.0: resolution: {integrity: sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==} engines: {node: '>= 0.4'} @@ -25509,6 +26480,18 @@ packages: is-typed-array: 1.1.12 dev: true + /typed-array-byte-offset@1.0.2: + resolution: {integrity: sha512-Ous0vodHa56FviZucS2E63zkgtgrACj7omjwd/8lTEMEPFFyjfixMZ1ZXenpgCFBBt4EC1J2XsyVS2gkG0eTFA==} + engines: {node: '>= 0.4'} + dependencies: + available-typed-arrays: 1.0.7 + call-bind: 1.0.7 + for-each: 0.3.3 + gopd: 1.0.1 + has-proto: 1.0.3 + is-typed-array: 1.1.13 + dev: true + /typed-array-length@1.0.4: resolution: {integrity: sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==} dependencies: @@ -25517,6 +26500,18 @@ packages: is-typed-array: 1.1.12 dev: true + /typed-array-length@1.0.6: + resolution: {integrity: sha512-/OxDN6OtAk5KBpGb28T+HZc2M+ADtvRxXrKKbUwtsLgdoxgX13hyy7ek6bFRl5+aBs2yZzB0c4CnQfAtVypW/g==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + for-each: 0.3.3 + gopd: 1.0.1 + has-proto: 1.0.3 + is-typed-array: 1.1.13 + possible-typed-array-names: 1.0.0 + dev: true + /typedarray-to-buffer@3.1.5: resolution: {integrity: sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==} dependencies: @@ -25825,6 +26820,10 @@ packages: webpack: 5.89.0 dev: false + /url-template@2.0.8: + resolution: {integrity: sha512-XdVKMF4SJ0nP/O7XIPB0JwAEuT9lDIYnNsK8yGVe43y0AWoKeJNdv3ZNWh7ksJ6KqQFjOO6ox/VEitLnaVNufw==} + dev: true + /urlpattern-polyfill@8.0.2: resolution: {integrity: sha512-Qp95D4TPJl1kC9SKigDcqgyM2VDVO4RiJc2d4qe5GrYm+zbIQCWWKAFaJNQ4BhdFeDGwBmAxqJBwWSJDb9T3BQ==} dev: true @@ -25945,7 +26944,6 @@ packages: react: ^16.8.0 || ^17.0.0 || ^18.0.0 dependencies: react: 18.3.1 - dev: false /util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} @@ -26808,6 +27806,17 @@ packages: has-tostringtag: 1.0.0 dev: true + /which-typed-array@1.1.15: + resolution: {integrity: sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA==} + engines: {node: '>= 0.4'} + dependencies: + available-typed-arrays: 1.0.7 + call-bind: 1.0.7 + for-each: 0.3.3 + gopd: 1.0.1 + has-tostringtag: 1.0.2 + dev: true + /which@1.3.1: resolution: {integrity: sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==} hasBin: true @@ -27063,6 +28072,11 @@ packages: decamelize: 1.2.0 dev: true + /yargs-parser@20.2.9: + resolution: {integrity: sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==} + engines: {node: '>=10'} + dev: true + /yargs-parser@21.0.1: resolution: {integrity: sha512-9BK1jFpLzJROCI5TzwZL/TU4gqjK5xiHV/RfWLOahrjAko/e4DJkRDZQXfvqAsiZzzYhgAzbgz6lg48jcm4GLg==} engines: {node: '>=12'} @@ -27104,6 +28118,19 @@ packages: yargs-parser: 18.1.3 dev: true + /yargs@17.0.1: + resolution: {integrity: sha512-xBBulfCc8Y6gLFcrPvtqKz9hz8SO0l1Ni8GgDekvBX2ro0HRQImDGnikfc33cgzcYUSncapnNcZDjVFIH3f6KQ==} + engines: {node: '>=12'} + dependencies: + cliui: 7.0.4 + escalade: 3.1.2 + get-caller-file: 2.0.5 + require-directory: 2.1.1 + string-width: 4.2.3 + y18n: 5.0.8 + yargs-parser: 20.2.9 + dev: true + /yargs@17.7.2: resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} engines: {node: '>=12'} From d4f404371602bba95989642aa89c799923c21a53 Mon Sep 17 00:00:00 2001 From: Robert Field Date: Mon, 26 Aug 2024 17:52:49 +0100 Subject: [PATCH 13/30] feat: latest spec --- .../openapi-ts-error-1723637319210.log | 12 - packages/sdks/shopper/openapi-ts.config.ts | 2 +- .../sdks/shopper/src/client/schemas.gen.ts | 3775 ++++++++++-- .../sdks/shopper/src/client/services.gen.ts | 3216 +++++++--- packages/sdks/shopper/src/client/types.gen.ts | 5469 +++++++++++++---- 5 files changed, 9717 insertions(+), 2757 deletions(-) delete mode 100644 packages/sdks/shopper/openapi-ts-error-1723637319210.log diff --git a/packages/sdks/shopper/openapi-ts-error-1723637319210.log b/packages/sdks/shopper/openapi-ts-error-1723637319210.log deleted file mode 100644 index 8b63ef4a..00000000 --- a/packages/sdks/shopper/openapi-ts-error-1723637319210.log +++ /dev/null @@ -1,12 +0,0 @@ -Token "UUID" does not exist. -JSONParserError: Token "UUID" does not exist. - at Pointer.resolve (/Users/robert.field/Documents/Projects/EP/muse/composable-frontend/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.6.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/pointer.js:103:23) - at $Ref.resolve (/Users/robert.field/Documents/Projects/EP/muse/composable-frontend/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.6.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/ref.js:81:28) - at $Refs._resolve (/Users/robert.field/Documents/Projects/EP/muse/composable-frontend/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.6.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/refs.js:158:21) - at inventory$Ref (/Users/robert.field/Documents/Projects/EP/muse/composable-frontend/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.6.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/bundle.js:116:27) - at crawl (/Users/robert.field/Documents/Projects/EP/muse/composable-frontend/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.6.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/bundle.js:91:21) - at crawl (/Users/robert.field/Documents/Projects/EP/muse/composable-frontend/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.6.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/bundle.js:94:21) - at inventory$Ref (/Users/robert.field/Documents/Projects/EP/muse/composable-frontend/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.6.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/bundle.js:153:9) - at crawl (/Users/robert.field/Documents/Projects/EP/muse/composable-frontend/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.6.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/bundle.js:91:21) - at crawl (/Users/robert.field/Documents/Projects/EP/muse/composable-frontend/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.6.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/bundle.js:94:21) - at crawl (/Users/robert.field/Documents/Projects/EP/muse/composable-frontend/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@11.6.4/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/bundle.js:94:21) \ No newline at end of file diff --git a/packages/sdks/shopper/openapi-ts.config.ts b/packages/sdks/shopper/openapi-ts.config.ts index 5a41f819..e9987bd7 100644 --- a/packages/sdks/shopper/openapi-ts.config.ts +++ b/packages/sdks/shopper/openapi-ts.config.ts @@ -2,7 +2,7 @@ import { defineConfig } from "@hey-api/openapi-ts" export default defineConfig({ client: "@hey-api/client-fetch", - input: "../specs/catalog_view.yaml", + input: "../specs/shopper.yaml", output: { path: "src/client", format: "prettier" }, types: { name: "PascalCase", diff --git a/packages/sdks/shopper/src/client/schemas.gen.ts b/packages/sdks/shopper/src/client/schemas.gen.ts index 2321df55..8c4b982d 100644 --- a/packages/sdks/shopper/src/client/schemas.gen.ts +++ b/packages/sdks/shopper/src/client/schemas.gen.ts @@ -1,28 +1,28 @@ // This file is auto-generated by @hey-api/openapi-ts export const $amount = { - type: "object", description: "The three-letter ISO code for the currency associated with this price.", - title: "Amount", + type: "object", properties: { amount: { description: "The price in the lowest denomination for the specified currency. This is a product's list price.", type: "integer", - example: 100, format: "int64", - "x-omitempty": false, + examples: [100], "x-go-name": "Amount", + "x-omitempty": false, }, includes_tax: { description: "Whether this price includes tax.", type: "boolean", - example: false, + examples: [false], default: false, "x-go-name": "IncludesTax", }, }, + title: "Amount", "x-go-name": "PriceAmount", } as const @@ -30,7 +30,6 @@ export const $prioritized_pricebooks = { description: "If you want multiple price books for different scenarios, such as seasonal sales, business versus retail pricing, and reward programs, when creating a catalog, you can specify up to five price books. You must configure a priority for your price books. Product prices are displayed in the catalog according to the priority of the price books.", type: "array", - maxItems: 5, items: { type: "object", properties: { @@ -48,17 +47,17 @@ export const $prioritized_pricebooks = { required: ["priority", "id"], "x-go-name": "PrioritizedPricebook", }, + maxItems: 5, } as const export const $catalog = { - type: "object", - title: "Catalog", description: "Creates a catalog with the following attributes.", + type: "object", properties: { id: { - type: "string", description: "A unique identifier of a catalog.", - example: "8dbb35b2-ef04-477e-974d-e5f3abe6faae", + type: "string", + examples: ["8dbb35b2-ef04-477e-974d-e5f3abe6faae"], }, attributes: { type: "object", @@ -66,13 +65,13 @@ export const $catalog = { name: { description: "The name of a catalog.", type: "string", - example: "catalog-123", + examples: ["catalog-123"], }, description: { description: "A brief description of the catalog, such as the purpose of the catalog.", type: "string", - example: "Catalog for Store 123", + examples: ["Catalog for Store 123"], default: "", }, hierarchy_ids: { @@ -109,23 +108,22 @@ export const $catalog = { created_at: { description: "The date and time a catalog is created.", type: "string", - example: "2020-09-22T09:00:00", format: "date-time", + examples: ["2020-09-22T09:00:00"], }, updated_at: { description: "The date and time a catalog was updated.", type: "string", - example: "2020-09-22T09:00:00", format: "date-time", + examples: ["2020-09-22T09:00:00"], }, owner: { description: "The owner of this resource, can be either `organization` or `store`.", - type: "string", + type: ["string", "null"], + default: "store", enum: ["store", "organization"], "x-go-name": "Owner", - default: "store", - nullable: true, }, }, required: ["name", "hierarchy_ids", "created_at", "updated_at"], @@ -134,7 +132,6 @@ export const $catalog = { description: "Relationships are established between different catalog entities. For example, a catalog rule and a price book are related to a catalog, as both are associated with it.", type: "object", - title: "CatalogRelationships", properties: { rules: { description: "The catalog rules related to a catalog.", @@ -165,20 +162,21 @@ export const $catalog = { }, }, }, + title: "CatalogRelationships", }, type: { type: "string", - example: "catalog", - enum: ["catalog"], + examples: ["catalog"], + const: "catalog", }, }, required: ["id", "type", "attributes"], + title: "Catalog", } as const export const $catalog_create_data = { - type: "object", - title: "CatalogCreateData", description: "Creates a catalog with the following attributes.", + type: "object", properties: { data: { type: "object", @@ -189,14 +187,13 @@ export const $catalog_create_data = { name: { description: "The name of the catalog.", type: "string", + examples: ["catalog-123"], minLength: 1, - example: "catalog-123", }, description: { description: "A brief description of the catalog.", - type: "string", - example: "Catalog for Store 123", - nullable: true, + type: ["string", "null"], + examples: ["Catalog for Store 123"], }, hierarchy_ids: { description: @@ -236,20 +233,20 @@ export const $catalog_create_data = { description: "Represents the type of object being returned. Always `Catalog`.", type: "string", - example: "catalog", - enum: ["catalog"], + examples: ["catalog"], + const: "catalog", }, }, required: ["type", "attributes"], }, }, required: ["data"], + title: "CatalogCreateData", } as const export const $catalog_data = { - type: "object", - title: "CatalogData", description: "Container for a single catalog.", + type: "object", properties: { data: { $ref: "#/components/schemas/catalog", @@ -259,12 +256,12 @@ export const $catalog_data = { }, }, required: ["data"], + title: "CatalogData", } as const export const $catalog_list_data = { - type: "object", - title: "CatalogListData", description: "Container for a list of catalogs.", + type: "object", properties: { data: { type: "array", @@ -277,13 +274,13 @@ export const $catalog_list_data = { }, }, required: ["data"], + title: "CatalogListData", } as const export const $catalog_update_data = { - type: "object", - title: "CatalogUpdateData", description: "A catalog combines price books, product lists, and hierarchies.", + type: "object", properties: { data: { type: "object", @@ -293,31 +290,27 @@ export const $catalog_update_data = { properties: { name: { description: "The name of the catalog.", - type: "string", + type: ["string", "null"], + examples: ["catalog-123"], minLength: 1, - example: "catalog-123", - nullable: true, }, description: { description: "A brief description of the catalog.", - type: "string", - example: "Catalog for Store 123", - nullable: true, + type: ["string", "null"], + examples: ["Catalog for Store 123"], }, hierarchy_ids: { description: "The unique identifiers of the hierarchies to associate with a catalog.", - type: "array", + type: ["array", "null"], items: { type: "string", }, - nullable: true, }, pricebook_id: { description: "The unique identifier of a price book to associate with a catalog. You can specify a `pricebook_id` or a `pricebook_ids` but not both. If you specify both, a `422 unprocessable entity` error is displayed.", - type: "string", - nullable: true, + type: ["string", "null"], }, pricebook_ids: { $ref: "#/components/schemas/prioritized-pricebooks", @@ -342,27 +335,27 @@ export const $catalog_update_data = { id: { description: "The unique identifier of the catalog to be updated.", type: "string", + examples: ["8dbb35b2-ef04-477e-974d-e5f3abe6faae"], "x-go-name": "ID", - example: "8dbb35b2-ef04-477e-974d-e5f3abe6faae", }, type: { description: "This represents the type of object being returned. Always `catalog`.", type: "string", - example: "catalog", - enum: ["catalog"], + examples: ["catalog"], + const: "catalog", }, }, required: ["type", "id", "attributes"], }, }, required: ["data"], + title: "CatalogUpdateData", } as const export const $component_product = { - type: "object", - title: "Component Product", description: "The unique identifier of the component, for example, `games`.", + type: "object", properties: { name: { description: @@ -373,23 +366,20 @@ export const $component_product = { min: { description: "The minimum number of product options a shopper can select from this component.", - type: "integer", + type: ["integer", "null"], "x-go-name": "Min", - nullable: true, }, max: { description: "The maximum number of product options a shopper can select from this component.", - type: "integer", + type: ["integer", "null"], "x-go-name": "Max", - nullable: true, }, sort_order: { description: "The sort order of the components. The `create a bundle` and `update a bundle` endpoints do not sort the components. You can use the `sort_order` attribute when programming your storefront to display the components in the order that you want.", - type: "integer", + type: ["integer", "null"], "x-go-name": "Sort Order", - nullable: true, }, options: { description: @@ -401,13 +391,13 @@ export const $component_product = { "x-go-name": "Options", }, }, + title: "Component Product", } as const export const $component_product_option = { - type: "object", - title: "Component Product Option", description: "The product options included in a component. This can be the ID of another bundle.", + type: "object", properties: { id: { description: @@ -420,155 +410,152 @@ export const $component_product_option = { description: "This represents the type of object being returned. Always `product`.", type: "string", - "x-go-name": "Type", + examples: ["product"], default: "product", - example: "product", - enum: ["product"], + const: "product", + "x-go-name": "Type", }, quantity: { description: "The number of this product option that a shopper must purchase.", type: "integer", - example: 2, + examples: [2], "x-go-name": "Quantity", }, sort_order: { description: "The sort order of the options. The `create a bundle` and `update a bundle` endpoints do not sort the options. You can use the `sort_order` attribute when programming your storefront to display the options in the order that you want.", - type: "integer", - example: 15, + type: ["integer", "null"], + examples: [15], "x-go-name": "Sort Order", - nullable: true, }, default: { description: "The boolean indicates whether the current option is a default option for the component.", - type: "boolean", - example: true, + type: ["boolean", "null"], + examples: [true], default: false, "x-go-name": "Default", - nullable: true, }, }, + title: "Component Product Option", } as const export const $components = { - type: "object", - title: "Components", - description: - "A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity.", additionalProperties: { $ref: "#/components/schemas/component-product", }, + description: + "A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity.", + title: "Components", + type: "object", } as const export const $custom_input_validation_rule_options = { - type: "object", description: "The length of the custom input text field.", - "x-go-name": "CustomInputValidationRuleOptions", + type: "object", properties: { max_length: { description: "The number of characters the custom text field can be. You can specify a maximum length up to 255 characters, as the limit is 255 characters.", type: "integer", + examples: [255], "x-go-name": "MaxLength", - example: 255, }, }, + "x-go-name": "CustomInputValidationRuleOptions", } as const export const $custom_input_validation_rule = { - type: "object", - title: "Custom Input Validation Rule", description: "The validation rules for the custom text.", - "x-go-name": "CustomInputValidationRule", + type: "object", properties: { type: { description: "This represents the type of object being returned. Must be `string`.", type: "string", - "x-go-name": "Type", + examples: ["string"], default: "string", - example: "string", - enum: ["string"], + const: "string", + "x-go-name": "Type", }, options: { $ref: "#/components/schemas/custom-input-validation-rule-options", }, }, + title: "Custom Input Validation Rule", + "x-go-name": "CustomInputValidationRule", } as const export const $custom_input = { - type: "object", - title: "Custom Input", description: "The name of the custom input. You can rename the input to something more representative of the input that shoppers are adding, for example, `message` or `front`.", + type: "object", properties: { name: { description: "The name for the custom text field that is displayed in your storefront.", type: "string", + examples: ["Message"], "x-go-name": "Name", - example: "Message", }, validation_rules: { description: "The validation rules for the custom text.", type: "array", - "x-go-name": "ValidationRules", items: { $ref: "#/components/schemas/custom-input-validation-rule", }, + "x-go-name": "ValidationRules", }, required: { description: "This is `true` or `false` depending on whether the custom text is required.", - type: "boolean", - "x-go-name": "Required", - example: false, + type: ["boolean", "null"], + examples: [false], default: false, - nullable: true, + "x-go-name": "Required", }, }, + title: "Custom Input", } as const export const $custom_inputs = { - type: "object", - title: "Custom Inputs", description: `You can allow your shoppers to add custom text to a product when adding product items to their carts. This is useful, for example, if you have a product like a T-shirt that can be personalized or you sell greetings cards that can be printed with your shoppers personalized messages. You can do this using the \`custom_inputs\` attribute. - You can rename input to something more representative of the input that shoppers are adding, for example, \`message\` or \`front\`. - \`name\` is the name that is displayed in your storefront. - You can add validation rules. For example, the input field must be a string and/or up to 255 characters in length. The limit is 255 characters. `, + type: "object", additionalProperties: { $ref: "#/components/schemas/custom-input", }, + title: "Custom Inputs", } as const export const $currencies = { - type: "object", description: "A collection of one or more currencies objects that consists of the [**three-letter ISO code**](https://www.iso.org/iso-3166-country-codes.html) of the currencies associated with this price and the amount. This is the product's price.", - title: "Currencies", + type: "object", additionalProperties: { $ref: "#/components/schemas/amount", }, + title: "Currencies", } as const export const $shopper_attributes = { - type: "object", description: "The optional price extension with values in string format, viewable by shoppers.", - title: "ShopperAttributes", + type: "object", additionalProperties: { type: "string", }, + title: "ShopperAttributes", } as const export const $diff_list_data = { - type: "object", - title: "DiffListData", description: "A list of differences between two releases.", + type: "object", properties: { data: { type: "array", @@ -580,12 +567,12 @@ export const $diff_list_data = { $ref: "#/components/schemas/links", }, }, + title: "DiffListData", } as const export const $display_price = { - type: "object", description: "A price formatted for display.", - "x-omitempty": true, + type: "object", properties: { with_tax: { $ref: "#/components/schemas/formatted-price", @@ -594,36 +581,36 @@ export const $display_price = { $ref: "#/components/schemas/formatted-price", }, }, + "x-omitempty": true, } as const export const $error = { - type: "object", - title: "APIError", description: "APIError is a json-api style part of an error response.", + type: "object", properties: { detail: { type: "string", - example: "not processable", + examples: ["not processable"], "x-go-name": "Detail", }, status: { type: "string", - example: "422", + examples: ["422"], "x-go-name": "Status", }, title: { type: "string", - example: "There was a problem processing your request.", + examples: ["There was a problem processing your request."], "x-go-name": "Title", }, }, + title: "APIError", "x-go-name": "APIError", } as const export const $error_response = { - type: "object", - title: "ErrorResponse", description: "ErrorResponse is a json-api style Error response.", + type: "object", properties: { errors: { type: "array", @@ -633,27 +620,28 @@ export const $error_response = { "x-go-name": "Errors", }, }, + title: "ErrorResponse", "x-go-name": "ErrorResponse", } as const export const $extension = { - type: "object", - title: "Extension", description: "The name of the product template.", + type: "object", additionalProperties: { description: "The product attributes available for this template.", type: "object", }, + title: "Extension", } as const export const $extensions = { - type: "object", - title: "Extensions", description: "With extension templates, you can attach a specific set of custom fields to your products in Product Experience Manager. For example, a **Book** template might contain the attributes, such as **ISBN**, **Author**, **Number of pages**, **Year Published**, or **Condition (New/Used)**.", + type: "object", additionalProperties: { $ref: "#/components/schemas/extension", }, + title: "Extensions", } as const export const $file_reference = { @@ -665,8 +653,8 @@ export const $file_reference = { description: "This represents the type of object being returned. Always `file`.", type: "string", - example: "file", - enum: ["file"], + examples: ["file"], + const: "file", }, id: { description: "A unique identifier for a file.", @@ -677,7 +665,7 @@ export const $file_reference = { description: "The date and time a file is created.", type: "string", format: "date-time", - example: "1970-01-01T00:00:00.000", + examples: ["1970-01-01T00:00:00.000"], "x-go-name": "CreatedAt", }, }, @@ -715,37 +703,36 @@ export const $component_products_relationship = { } as const export const $formatted_price = { - type: "object", - title: "FormattedPrice", - "x-omitempty": true, description: "A price formatted for display.", + type: "object", properties: { amount: { description: "The price in the lowest denomination for the specified currency. This is a product's list price.", type: "integer", + examples: ["47500"], "x-omitempty": false, - example: "47500", }, currency: { description: "The three-letter ISO code of the currencies associated with this price and the amount.", type: "string", - example: "USD", + examples: ["USD"], }, formatted: { description: "The format of the price for display.", type: "string", - example: "$475.00", + examples: ["$475.00"], }, }, + title: "FormattedPrice", + "x-omitempty": true, } as const export const $hierarchy = { - type: "object", - title: "Hierarchy", description: "A category hierarchy in a catalog. Hierarchies can have parent nodes and child nodes, as well as a list of attached products.", + type: "object", properties: { attributes: { $ref: "#/components/schemas/hierarchy-attributes", @@ -753,7 +740,7 @@ export const $hierarchy = { id: { description: "A unique identifier of a hierarchy.", type: "string", - example: "e871df93-c769-49a9-9394-a6fd555b8e8a", + examples: ["e871df93-c769-49a9-9394-a6fd555b8e8a"], "x-go-name": "ID", }, relationships: { @@ -763,84 +750,83 @@ export const $hierarchy = { description: "This represents the type of object being returned. Always `hierarchy`.", type: "string", - example: "hierarchy", + examples: ["hierarchy"], "x-go-name": "Type", }, meta: { $ref: "#/components/schemas/hierarchy-meta", }, }, + title: "Hierarchy", "x-go-name": "Hierarchy", } as const export const $hierarchy_meta = { - type: "object", - title: "HierarchyMeta", description: "A hierarchy's metadata.", + type: "object", properties: { language: { description: "Product Experience Manager supports localization of hierarchies. If your store supports multiple languages, you can localize hierarchy names and descriptions. This is [**three-letter language code**](https://www.iso.org/iso-639-language-code) that represents the name of the language you have used.", type: "string", - example: "en-GB", + examples: ["en-GB"], }, }, + title: "HierarchyMeta", "x-go-name": "HierarchyMeta", "x-omitempty": true, } as const export const $hierarchy_attributes = { - type: "object", - title: "HierarchyAttributes", description: "Resource attributes of a catalog hierarchy.", + type: "object", properties: { created_at: { description: "The date and time a hierarchy is created.", type: "string", format: "date-time", - example: "1970-01-01T00:00:00.000", + examples: ["1970-01-01T00:00:00.000"], "x-go-name": "CreatedAt", }, published_at: { description: "The date and time a hierarchy is published in a catalog.", - type: "string", + type: ["string", "null"], format: "date-time", - example: "1970-01-01T00:00:00.000", - nullable: true, + examples: ["1970-01-01T00:00:00.000"], }, description: { description: "A description of a hierarchy.", type: "string", - example: "Formal dresswear", + examples: ["Formal dresswear"], "x-go-name": "Description", }, name: { description: "The name of a hierarchy.", type: "string", - example: "Formal dresswear", + examples: ["Formal dresswear"], "x-go-name": "Name", }, slug: { description: "A unique slug for a hierarchy.", type: "string", - example: "formal", + examples: ["formal"], "x-go-name": "Slug", }, updated_at: { description: "The date and time a hierarchy was updated.", type: "string", format: "date-time", - example: "1970-01-01T00:00:00.000", + examples: ["1970-01-01T00:00:00.000"], "x-go-name": "UpdatedAt", }, }, + title: "HierarchyAttributes", "x-go-name": "HierarchyAttributes", } as const export const $hierarchy_data = { - type: "object", - title: "HierarchyData", description: "Container for hierarchies.", + type: "object", properties: { data: { $ref: "#/components/schemas/hierarchy", @@ -849,12 +835,12 @@ export const $hierarchy_data = { $ref: "#/components/schemas/links", }, }, + title: "HierarchyData", } as const export const $hierarchy_list_data = { - type: "object", - title: "HierarchyListData", description: "Container for a list of hierarchies.", + type: "object", properties: { meta: { $ref: "#/components/schemas/page-meta", @@ -869,12 +855,12 @@ export const $hierarchy_list_data = { $ref: "#/components/schemas/links", }, }, + title: "HierarchyListData", } as const export const $hierarchy_relationships = { - type: "object", - title: "HierarchyRelationships", description: "Relationships to child nodes, and products.", + type: "object", properties: { products: { description: "A URL to all the products associated with a hierarchy.", @@ -907,6 +893,7 @@ export const $hierarchy_relationships = { required: ["links"], }, }, + title: "HierarchyRelationships", "x-go-name": "HierarchyRelationships", } as const @@ -917,82 +904,47 @@ export const $links = { self: { description: "Single entities use a `self` parameter with a link the specific resource.", - type: "string", + type: ["string", "null"], format: "uri", - nullable: true, }, first: { description: "Always the first page.", - type: "string", + type: ["string", "null"], format: "uri", - nullable: true, }, last: { description: "This is `null` if there is only one page.", - type: "string", + type: ["string", "null"], format: "uri", - nullable: true, }, prev: { description: "This is `null` if there is only one page.", - type: "string", + type: ["string", "null"], format: "uri", - nullable: true, }, next: { description: "This is `null` if there is only one page.", - type: "string", + type: ["string", "null"], format: "uri", - nullable: true, - }, - }, -} as const - -export const $included = { - description: - "Included is an array of resources that are included in the response.", - type: "object", - properties: { - main_images: { - description: "The main images associated with a product.", - type: "array", - items: { - $ref: "#/components/schemas/elastic-path-file", - }, - }, - component_products: { - description: "The component products associated with a product.", - type: "array", - items: { - $ref: "#/components/schemas/product", - }, - }, - files: { - description: "The files associated with a product.", - type: "array", - items: { - $ref: "#/components/schemas/elastic-path-file", - }, }, }, } as const export const $main_image_relationship = { - type: "object", description: "In Product Experience Manager, products can also have associated product images.", + type: "object", properties: { data: { description: "The images associated with a product.", type: "object", - "x-nullable": "true", properties: { type: { description: "This represents the type of object being returned. Always `main_image`.", type: "string", - example: "main_image", - enum: ["main_image"], + examples: ["main_image"], + const: "main_image", }, id: { description: "A unique identifier for an image.", @@ -1000,16 +952,16 @@ export const $main_image_relationship = { format: "uuid", }, }, + "x-nullable": "true", }, }, "x-omitempty": true, } as const export const $node = { - type: "object", - title: "Node", description: "A category node in a catalog. Nodes can have child nodes, as well as a list of attached products.", + type: "object", properties: { attributes: { $ref: "#/components/schemas/node-attributes", @@ -1017,7 +969,7 @@ export const $node = { id: { description: "The unique identifier of a node.", type: "string", - example: "e871df93-c769-49a9-9394-a6fd555b8e8a", + examples: ["e871df93-c769-49a9-9394-a6fd555b8e8a"], "x-go-name": "ID", }, relationships: { @@ -1027,58 +979,57 @@ export const $node = { description: "This represents the type of object being returned. Always `node`.", type: "string", - example: "node", + examples: ["node"], "x-go-name": "Type", }, meta: { $ref: "#/components/schemas/node-meta", }, }, + title: "Node", "x-go-name": "Node", } as const export const $node_attributes = { - type: "object", - title: "NodeAttributes", description: "Resource attributes of a catalog node.", + type: "object", properties: { created_at: { description: "The date and time a node was created.", type: "string", format: "date-time", - example: "1970-01-01T00:00:00.000", + examples: ["1970-01-01T00:00:00.000"], "x-go-name": "CreatedAt", }, published_at: { description: "The date and time a node was published in a catalog.", - type: "string", + type: ["string", "null"], format: "date-time", - example: "1970-01-01T00:00:00.000", - nullable: true, + examples: ["1970-01-01T00:00:00.000"], }, description: { - type: "string", description: "A description of a node.", - example: "Formal dresswear", + type: "string", + examples: ["Formal dresswear"], "x-go-name": "Description", }, label: { type: "string", - example: "category", + examples: ["category"], "x-go-name": "Label", }, name: { description: "The name of a node. Names must be unique among sibling nodes in a hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies.", type: "string", - example: "Formal dresswear", + examples: ["Formal dresswear"], "x-go-name": "Name", }, slug: { description: "A slug for the node. Slugs must be unique among sibling nodes in the hierarchy. Otherwise, a slug can be non-unique within the hierarchy and across multiple hierarchies.", type: "string", - example: "formal", + examples: ["formal"], "x-go-name": "Slug", }, curated_products: { @@ -1087,70 +1038,68 @@ export const $node_attributes = { type: "array", items: { type: "string", - example: "8dbb35b2-ef04-477e-974d-e5f3abe6faae", + examples: ["8dbb35b2-ef04-477e-974d-e5f3abe6faae"], }, "x-omitempty": true, }, status: { type: "string", - example: "live", + examples: ["live"], "x-go-name": "Status", }, updated_at: { description: "The date and time a node was updated.", type: "string", format: "date-time", - example: "1970-01-01T00:00:00.000", + examples: ["1970-01-01T00:00:00.000"], "x-go-name": "UpdatedAt", }, }, + title: "NodeAttributes", "x-go-name": "NodeAttributes", } as const export const $node_create_data = { - type: "object", - title: "NodeCreateData", description: "Container for nodes.", + type: "object", properties: { data: { - type: "object", - title: "NodeCreateArgs", description: "A node in a catalog (e.g. a category node). Nodes can have child nodes, as well as a list of attached products", + type: "object", properties: { attributes: { - type: "object", - title: "NodeCreateAttributes", description: "Resource attributes of a catalog node.", + type: "object", properties: { description: { type: "string", - example: "Formal dresswear", + examples: ["Formal dresswear"], "x-go-name": "Description", }, hierarchy_id: { - type: "string", description: "hierarchy id of the node", - example: "ddd401ac-db06-4d9e-af60-cf5206abb9bc", + type: "string", + examples: ["ddd401ac-db06-4d9e-af60-cf5206abb9bc"], }, label: { type: "string", - example: "category", + examples: ["category"], "x-go-name": "Label", }, name: { type: "string", - example: "Formal dresswear", + examples: ["Formal dresswear"], "x-go-name": "Name", }, slug: { type: "string", - example: "formal", + examples: ["formal"], "x-go-name": "Slug", }, status: { type: "string", - example: "Live", + examples: ["Live"], "x-go-name": "Status", }, locales: { @@ -1164,34 +1113,36 @@ export const $node_create_data = { }, }, required: ["name"], + title: "NodeCreateAttributes", }, relationships: { $ref: "#/components/schemas/node-relationships", }, id: { type: "string", - example: "8fccaa19-dba9-4621-8d11-31a222a68c7c", + examples: ["8fccaa19-dba9-4621-8d11-31a222a68c7c"], "x-go-name": "ID", }, type: { type: "string", - example: "node", + examples: ["node"], "x-go-name": "Type", }, }, required: ["type", "attributes"], + title: "NodeCreateArgs", }, links: { $ref: "#/components/schemas/links", }, }, required: ["data"], + title: "NodeCreateData", } as const export const $node_data = { - type: "object", - title: "NodeData", description: "Container for nodes.", + type: "object", properties: { data: { $ref: "#/components/schemas/node", @@ -1200,12 +1151,12 @@ export const $node_data = { $ref: "#/components/schemas/links", }, }, + title: "NodeData", } as const export const $node_list_data = { - type: "object", - title: "NodeListData", description: "Container for a list of nodes.", + type: "object", properties: { meta: { $ref: "#/components/schemas/page-meta", @@ -1220,17 +1171,17 @@ export const $node_list_data = { $ref: "#/components/schemas/links", }, }, + title: "NodeListData", } as const export const $node_meta = { - type: "object", - title: "NodeMeta", description: "A node's metadata.", + type: "object", properties: { language: { description: "The node details localized in the supported languages.", type: "string", - example: "en-GB", + examples: ["en-GB"], }, bread_crumb: { description: @@ -1238,46 +1189,46 @@ export const $node_meta = { type: "array", items: { type: "string", - example: "8dbb35b2-ef04-477e-974d-e5f3abe6faae", + examples: ["8dbb35b2-ef04-477e-974d-e5f3abe6faae"], }, "x-omitempty": true, }, }, + title: "NodeMeta", "x-go-name": "NodeMeta", "x-omitempty": true, } as const export const $node_reference = { - type: "object", - title: "NodeReference", description: "Minimum set of information to identify a catalog node.", + type: "object", properties: { id: { description: "The unique identifier of a hierarchy.", type: "string", - example: "65477ce0-fcb8-436b-a120-3d57979421dd", + examples: ["65477ce0-fcb8-436b-a120-3d57979421dd"], "x-go-name": "ID", }, label: { description: "A label for a hierarchy.", type: "string", - example: "category", + examples: ["category"], "x-go-name": "Label", }, name: { description: "The name of a hierarchy.", type: "string", - example: "Formal dresswear", + examples: ["Formal dresswear"], "x-go-name": "Name", }, }, + title: "NodeReference", "x-go-name": "NodeReference", } as const export const $node_relationships = { - type: "object", - title: "NodeRelationships", description: "Relationships to parent and child nodes, and products.", + type: "object", properties: { products: { description: "A URL to all products associated with a node.", @@ -1285,10 +1236,10 @@ export const $node_relationships = { properties: { data: { type: "array", - "x-omitempty": true, items: { $ref: "#/components/schemas/product-reference", }, + "x-omitempty": true, }, links: { $ref: "#/components/schemas/related-link", @@ -1314,12 +1265,12 @@ export const $node_relationships = { properties: { type: { type: "string", - example: "node", - enum: ["node"], + examples: ["node"], + const: "node", }, id: { type: "string", - example: "8fccaa19-dba9-4621-8d11-31a222a68c7c", + examples: ["8fccaa19-dba9-4621-8d11-31a222a68c7c"], "x-go-name": "ID", }, }, @@ -1340,12 +1291,12 @@ export const $node_relationships = { properties: { type: { type: "string", - example: "hierarchy", - enum: ["hierarchy"], + examples: ["hierarchy"], + const: "hierarchy", }, id: { type: "string", - example: "8fccaa19-dba9-4621-8d11-31a222a68c7c", + examples: ["8fccaa19-dba9-4621-8d11-31a222a68c7c"], "x-go-name": "ID", }, }, @@ -1358,13 +1309,13 @@ export const $node_relationships = { required: ["data"], }, }, + title: "NodeRelationships", "x-go-name": "NodeRelationships", } as const export const $node_relationships_data = { - type: "object", - title: "NodeRelationshipsData", description: "Container for node relationships.", + type: "object", properties: { data: { $ref: "#/components/schemas/node-relationships", @@ -1373,12 +1324,12 @@ export const $node_relationships_data = { $ref: "#/components/schemas/links", }, }, + title: "NodeRelationshipsData", } as const export const $page_meta = { - type: "object", description: "Contains the results for the entire collection.", - title: "PageMeta", + type: "object", properties: { results: { description: "Total number of results for the entire collection.", @@ -1417,28 +1368,28 @@ export const $page_meta = { }, }, }, + title: "PageMeta", } as const export const $pricebook = { - type: "object", - title: "Pricebook", description: "Top level entity in the pricebooks domain model. It contains a list of product prices.", + type: "object", properties: { id: { description: "The unique identifier of a price book.", type: "string", - example: "4c45e4ec-26e0-4043-86e4-c15b9cf985a7", + examples: ["4c45e4ec-26e0-4043-86e4-c15b9cf985a7"], "x-go-name": "ID", }, type: { description: "This represents the type of object being returned. Always `pricebook`.", type: "string", - "x-go-name": "Type", + examples: ["pricebook"], default: "pricebook", - example: "pricebook", - enum: ["pricebook"], + const: "pricebook", + "x-go-name": "Type", }, attributes: { type: "object", @@ -1446,86 +1397,82 @@ export const $pricebook = { created_at: { type: "string", format: "date-time", - example: "2020-09-22T09:00:00", + examples: ["2020-09-22T09:00:00"], "x-go-name": "CreatedAt", }, description: { - type: "string", - example: "This is a pricebook", + type: ["string", "null"], + examples: ["This is a pricebook"], "x-go-name": "Description", - nullable: true, }, name: { - type: "string", - example: "pricebook-store-abc", + type: ["string", "null"], + examples: ["pricebook-store-abc"], "x-go-name": "Name", - nullable: true, }, updated_at: { type: "string", - example: "2020-09-22T09:00:00", format: "date-time", + examples: ["2020-09-22T09:00:00"], "x-go-name": "UpdatedAt", }, }, required: ["name"], }, }, - required: ["type", "attributes"], additionalProperties: false, + required: ["type", "attributes"], + title: "Pricebook", "x-go-name": "Pricebook", } as const export const $pricebook_create_data = { - type: "object", - title: "PricebookData", description: "Container for pricebooks.", + type: "object", properties: { data: { - type: "object", description: "New top level pricebook.", - title: "PricebookCreateArgs", + type: "object", + additionalProperties: false, properties: { type: { type: "string", - "x-go-name": "Type", + examples: ["pricebook"], default: "pricebook", - example: "pricebook", - enum: ["pricebook"], + const: "pricebook", + "x-go-name": "Type", }, attributes: { type: "object", properties: { description: { - type: "string", - example: "This is a pricebook", + type: ["string", "null"], + examples: ["This is a pricebook"], "x-go-name": "Description", - nullable: true, }, name: { - type: "string", - example: "pricebook-store-abc", + type: ["string", "null"], + examples: ["pricebook-store-abc"], "x-go-name": "Name", - nullable: true, }, }, required: ["name"], }, }, required: ["type", "attributes"], - additionalProperties: false, + title: "PricebookCreateArgs", }, links: { $ref: "#/components/schemas/links", }, }, required: ["data"], + title: "PricebookData", } as const export const $pricebook_data = { - type: "object", - title: "PricebookData", description: "Container for pricebooks.", + type: "object", properties: { data: { $ref: "#/components/schemas/pricebook", @@ -1535,19 +1482,19 @@ export const $pricebook_data = { }, }, required: ["data"], + title: "PricebookData", } as const export const $pricebook_price = { - type: "object", - title: "PricebookPrice", description: "ProductPrice associates a collection of locale specific prices with a product ID.", + type: "object", properties: { type: { type: "string", - example: "product-price", + examples: ["product-price"], default: "product-price", - enum: ["product-price"], + const: "product-price", }, attributes: { type: "object", @@ -1560,37 +1507,36 @@ export const $pricebook_price = { }, sku: { type: "string", - example: "4c45e4ec-sku", + examples: ["4c45e4ec-sku"], }, }, required: ["currencies", "sku"], }, id: { type: "string", - example: "4c45e4ec-26e0-4043-86e4-c15b9cf985a7", + examples: ["4c45e4ec-26e0-4043-86e4-c15b9cf985a7"], "x-go-name": "ID", }, }, - required: ["type", "id", "attributes"], additionalProperties: false, + required: ["type", "id", "attributes"], + title: "PricebookPrice", } as const export const $pricebook_price_create_data = { - type: "object", - title: "PricebookPriceCreateData", description: "Container for pricebook prices.", + type: "object", properties: { data: { - type: "object", - title: "PricebookPriceCreateArgs", description: "ProductPrice associates a collection of locale specific prices with a product ID.", + type: "object", properties: { type: { type: "string", - example: "product-price", + examples: ["product-price"], default: "product-price", - enum: ["product-price"], + const: "product-price", }, attributes: { type: "object", @@ -1603,25 +1549,26 @@ export const $pricebook_price_create_data = { }, sku: { type: "string", - example: "4c45e4ec-sku", + examples: ["4c45e4ec-sku"], }, }, required: ["currencies", "sku"], }, }, required: ["type", "attributes"], + title: "PricebookPriceCreateArgs", }, links: { $ref: "#/components/schemas/links", }, }, required: ["data"], + title: "PricebookPriceCreateData", } as const export const $pricebook_price_data = { - type: "object", - title: "PricebookPriceData", description: "Container for pricebook prices.", + type: "object", properties: { data: { $ref: "#/components/schemas/pricebook-price", @@ -1631,12 +1578,12 @@ export const $pricebook_price_data = { }, }, required: ["data"], + title: "PricebookPriceData", } as const export const $product = { - type: "object", - title: "Product", description: "A product in a catalog with the following attributes.", + type: "object", properties: { attributes: { $ref: "#/components/schemas/product-attributes", @@ -1644,7 +1591,7 @@ export const $product = { id: { description: "A unique identifier for a product.", type: "string", - example: "8fccaa19-dba9-4621-8d11-31a222a68c7c", + examples: ["8fccaa19-dba9-4621-8d11-31a222a68c7c"], "x-go-name": "ID", }, relationships: { @@ -1654,88 +1601,87 @@ export const $product = { description: "This represents the type of object being returned. Always `product`.", type: "string", - example: "product", + examples: ["product"], "x-go-name": "Type", }, meta: { $ref: "#/components/schemas/product-meta", }, }, + title: "Product", "x-go-name": "Product", } as const export const $product_attributes = { - type: "object", - title: "ProductAttributes", description: "A product's attributes.", + type: "object", properties: { published_at: { description: "The date and time a product was published in a catalog.", - type: "string", + type: ["string", "null"], format: "date-time", - example: "1970-01-01T00:00:00.000", - nullable: true, + examples: ["1970-01-01T00:00:00.000"], }, base_product: { description: "If this product is a `parent` product. A `parent` product is a product that has child products that have been built using the `build child products` endpoint.", type: "boolean", - example: false, + examples: [false], default: false, "x-go-name": "BaseProduct", }, base_product_id: { description: "The unique identifier of a `parent` product.", type: "string", - example: "cdf574bc-e36e-48fc-9eac-01c87839b285", + examples: ["cdf574bc-e36e-48fc-9eac-01c87839b285"], "x-go-name": "BaseProductID", }, commodity_type: { description: "The commodity type, either `physical` or `digital`.", type: "string", - example: "physical", + examples: ["physical"], "x-go-name": "CommodityType", }, curated_product: { description: "If a product is curated, then the `curated_product` attribute with a value of `true` is displayed. If a product is not curated, the `curated_product` attribute is not displayed.", type: "boolean", - example: true, - "x-omitempty": true, + examples: [true], "x-go-name": "CuratedProduct", + "x-omitempty": true, }, upc_ean: { description: "The universal product code or european article number of the product.", type: "string", - example: "0123456", + examples: ["0123456"], "x-go-name": "UpcEan", }, manufacturer_part_num: { description: "The manufacturer part number of the product.", type: "string", - example: "mfn1", + examples: ["mfn1"], "x-go-name": "ManufacturerPartNum", }, tags: { - type: "array", description: "A list of tags associated with the product. A tag must be HTML compatible characters excluding commas and will be stored in lowercase letters.", + type: "array", items: { description: "A tag associated with the product.", type: "string", - example: "tag-a", + examples: ["tag-a"], }, "x-go-name": "Tags", "x-omitempty": true, }, price_modifiers: { - type: "array", description: "A list of price modifier names.", + type: "array", items: { description: "A list of price modifier names.", type: "string", - example: "modifier-1", + examples: ["modifier-1"], }, "x-go-name": "PriceModifiers", "x-omitempty": true, @@ -1744,19 +1690,19 @@ export const $product_attributes = { description: "The date and time a product was created.", type: "string", format: "date-time", - example: "1970-01-01T00:00:00.000", + examples: ["1970-01-01T00:00:00.000"], "x-go-name": "CreatedAt", }, description: { description: "A description of the product.", type: "string", - example: "This is a product", + examples: ["This is a product"], "x-go-name": "Description", }, name: { description: "A name of a product.", type: "string", - example: "Blue shirt", + examples: ["Blue shirt"], "x-go-name": "Name", }, price: { @@ -1777,77 +1723,74 @@ export const $product_attributes = { sku: { description: "The unique stock keeping unit of the product.", type: "string", - example: "blue-shirt", + examples: ["blue-shirt"], "x-go-name": "Sku", }, slug: { description: "A label for the product that is used in the URL paths. A slug can contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. By default, the product name is used as the slug.", type: "string", - example: "blue-shirt", + examples: ["blue-shirt"], "x-go-name": "Slug", }, status: { description: "The status of the product, either `live` or `draft`.", type: "string", - example: "live", + examples: ["live"], "x-go-name": "Status", }, external_ref: { description: "The unique attribute associated with the product. This could be an external reference from a separate company system, for example.", - type: "string", + type: ["string", "null"], "x-go-name": "ExternalRef", - nullable: true, }, updated_at: { description: "The date and time a product was updated.", type: "string", - example: "1970-01-01T00:00:00.000", format: "date-time", + examples: ["1970-01-01T00:00:00.000"], "x-go-name": "UpdatedAt", }, extensions: { $ref: "#/components/schemas/extensions", }, }, + title: "ProductAttributes", "x-go-name": "ProductAttributes", } as const export const $product_create_data = { - type: "object", - title: "ProductData", description: "Container for products.", + type: "object", properties: { data: { - type: "object", - title: "ProductCreateArgs", description: "A new product in a catalog.", + type: "object", properties: { attributes: { - type: "object", - title: "ProductCreateAttributes", description: "A product's attributes.", + type: "object", properties: { description: { type: "string", - example: "This is a product", + examples: ["This is a product"], }, name: { type: "string", - example: "Blue shirt", + examples: ["Blue shirt"], }, sku: { type: "string", - example: "blue-shirt", + examples: ["blue-shirt"], }, slug: { type: "string", - example: "blue-shirt", + examples: ["blue-shirt"], }, status: { type: "string", - example: "live", + examples: ["live"], }, locales: { type: "object", @@ -1860,30 +1803,32 @@ export const $product_create_data = { }, }, required: ["name", "status"], + title: "ProductCreateAttributes", }, id: { type: "string", - example: "8fccaa19-dba9-4621-8d11-31a222a68c7c", + examples: ["8fccaa19-dba9-4621-8d11-31a222a68c7c"], "x-go-name": "ID", }, type: { type: "string", - example: "product", + examples: ["product"], "x-go-name": "Type", }, }, required: ["attributes", "type"], + title: "ProductCreateArgs", }, links: { $ref: "#/components/schemas/links", }, }, + title: "ProductData", } as const export const $product_data = { - type: "object", - title: "ProductData", description: "Container for products.", + type: "object", properties: { data: { $ref: "#/components/schemas/product", @@ -1895,20 +1840,20 @@ export const $product_data = { $ref: "#/components/schemas/included", }, }, + title: "ProductData", } as const export const $product_diff = { - "x-go-name": "ProductDiff", type: "object", properties: { id: { type: "string", - example: "e871df93-c769-49a9-9394-a6fd555b8e8a", + examples: ["e871df93-c769-49a9-9394-a6fd555b8e8a"], "x-go-name": "ID", }, type: { type: "string", - example: "product_diff", + examples: ["product_diff"], "x-go-name": "Type", }, attributes: { @@ -1926,10 +1871,9 @@ export const $product_diff = { diff_created_at: { type: "string", format: "date-time", - example: "1970-01-01T00:00:00.000", + examples: ["1970-01-01T00:00:00.000"], }, exists: { - "x-go-name": "ProductDiffExists", type: "object", properties: { this: { @@ -1940,36 +1884,35 @@ export const $product_diff = { }, }, required: ["this", "other"], + "x-go-name": "ProductDiffExists", }, updated_at: { - "x-go-name": "ProductDiffUpdatedAt", type: "object", properties: { this: { - type: "string", + type: ["string", "null"], format: "date-time", - example: "1970-01-01T00:00:00.000", + examples: ["1970-01-01T00:00:00.000"], "x-omitempty": true, - nullable: true, }, other: { - type: "string", + type: ["string", "null"], format: "date-time", - example: "1970-01-01T00:00:00.000", + examples: ["1970-01-01T00:00:00.000"], "x-omitempty": true, - nullable: true, }, }, + "x-go-name": "ProductDiffUpdatedAt", }, }, }, }, + "x-go-name": "ProductDiff", } as const export const $product_list_data = { - type: "object", - title: "ProductListData", description: "Container for a list of products.", + type: "object", properties: { meta: { $ref: "#/components/schemas/page-meta", @@ -1988,13 +1931,13 @@ export const $product_list_data = { $ref: "#/components/schemas/included", }, }, + title: "ProductListData", } as const export const $product_meta = { - type: "object", - title: "ProductMeta", description: "A product's metadata contains information about products, for example, the nodes a product is associated with, any child products, bundle configurations, and so on.", + type: "object", properties: { bread_crumbs: { description: @@ -2004,7 +1947,7 @@ export const $product_meta = { type: "array", items: { type: "string", - example: "8dbb35b2-ef04-477e-974d-e5f3abe6faae", + examples: ["8dbb35b2-ef04-477e-974d-e5f3abe6faae"], }, }, "x-omitempty": true, @@ -2015,7 +1958,7 @@ export const $product_meta = { type: "array", items: { type: "string", - example: "8dbb35b2-ef04-477e-974d-e5f3abe6faae", + examples: ["8dbb35b2-ef04-477e-974d-e5f3abe6faae"], }, "x-omitempty": true, }, @@ -2023,16 +1966,15 @@ export const $product_meta = { description: "A unique identifier of the catalog a product is associated with.", type: "string", - example: "362a16dc-f7c6-4280-83d6-4fcc152af091", + examples: ["362a16dc-f7c6-4280-83d6-4fcc152af091"], "x-go-name": "CatalogID", }, pricebook_id: { description: "The unique identifier of the price book a product is associated with.", - type: "string", - example: "f5466169-0037-460c-b181-b02682b6f4de", + type: ["string", "null"], + examples: ["f5466169-0037-460c-b181-b02682b6f4de"], "x-go-name": "PricebookID", - nullable: true, }, display_price: { $ref: "#/components/schemas/display-price", @@ -2040,8 +1982,8 @@ export const $product_meta = { catalog_source: { description: "The source of a catalog. Always `pim`.", type: "string", - example: "pim", - enum: ["pim"], + examples: ["pim"], + const: "pim", "x-go-name": "CatalogSource", }, sale_id: { @@ -2052,11 +1994,10 @@ export const $product_meta = { }, sale_expires: { description: "The date and time a sale expires.", - type: "string", + type: ["string", "null"], format: "date-time", - example: "1970-01-01T00:00:00.000", + examples: ["1970-01-01T00:00:00.000"], "x-go-name": "SaleExpires", - nullable: true, }, original_price: { $ref: "#/components/schemas/currencies", @@ -2082,11 +2023,10 @@ export const $product_meta = { }, sale_expires: { description: "The date and time a sale expires.", - type: "string", + type: ["string", "null"], format: "date-time", - example: "1970-01-01T00:00:00.000", + examples: ["1970-01-01T00:00:00.000"], "x-go-name": "SaleExpires", - nullable: true, }, price: { $ref: "#/components/schemas/currencies", @@ -2101,19 +2041,18 @@ export const $product_meta = { $ref: "#/components/schemas/display-price", }, pricebook_id: { - type: "string", - example: "f5466169-0037-460c-b181-b02682b6f4de", + type: ["string", "null"], + examples: ["f5466169-0037-460c-b181-b02682b6f4de"], "x-go-name": "PricebookID", - nullable: true, }, }, "x-go-name": "ComponentProductMeta", }, }, price_modifiers: { - type: "object", description: "You can use price modifiers to change the price property of child products. By default, child products inherit the same price as their base products. Using price modifiers, you can enable child products to inherit a different price.", + type: "object", additionalProperties: { description: "A name for the modifier. The name must be unique and is case-sensitive.", @@ -2127,7 +2066,7 @@ export const $product_meta = { - The \`price_equals\` type sets the price of a product to an amount you specify. `, type: "string", - example: "price_equals", + examples: ["price_equals"], }, currencies: { $ref: "#/components/schemas/currencies", @@ -2151,11 +2090,10 @@ export const $product_meta = { }, sale_expires: { description: "The date and time a sale expires.", - type: "string", + type: ["string", "null"], format: "date-time", - example: "1970-01-01T00:00:00.000", + examples: ["1970-01-01T00:00:00.000"], "x-go-name": "SaleExpires", - nullable: true, }, display_price: { $ref: "#/components/schemas/display-price", @@ -2188,26 +2126,26 @@ export const $product_meta = { child_option_ids: { description: "An array of variation options IDs that a child product has.", - type: "array", + type: ["array", "null"], items: { type: "string", - example: [ - "8dbb35b2-ef04-477e-974d-e5f3abe6faae", - "6ddf2a66-d805-449c-a0e1-8e81335e31a6", + examples: [ + [ + "8dbb35b2-ef04-477e-974d-e5f3abe6faae", + "6ddf2a66-d805-449c-a0e1-8e81335e31a6", + ], ], }, "x-omitempty": true, - nullable: true, }, child_variations: { description: "If this is a child product, the `child_variations` object lists the variation option IDs that define this child product.", - type: "array", + type: ["array", "null"], items: { $ref: "#/components/schemas/variation", }, "x-omitempty": true, - nullable: true, }, product_types: { description: `Commerce automatically assigns types to the products you create. In Commerce Manager, you can see at a glance the product types in a list of a products. In addition, you can filter on product types in both the API and Commerce Manager. @@ -2225,16 +2163,17 @@ export const $product_meta = { items: { type: "string", }, - "x-omitempty": true, "x-go-name": "ProductTypes", + "x-omitempty": true, }, language: { description: "If you storefront supports multiple languages, your storefront's preferred language and locale.", type: "string", - example: "en-GB", + examples: ["en-GB"], }, }, + title: "ProductMeta", "x-go-name": "ProductMeta", "x-omitempty": true, } as const @@ -2256,9 +2195,8 @@ export const $variation_option = { sort_order: { description: "If you specified a `sort_order` when creating your variations and variation options, then use the `sort_order` value to program your storefront to display the variations and variation options in the order that you want.", - type: "integer", + type: ["integer", "null"], "x-go-name": "Sort Order", - nullable: true, }, description: { description: "The option description to display to customers.", @@ -2284,9 +2222,8 @@ export const $variation = { sort_order: { description: "If you specified a `sort_order` when creating your variations and variation options, then use the `sort_order` value to program your storefront to display the variations and variation options in the order that you want.", - type: "integer", + type: ["integer", "null"], "x-go-name": "Sort Order", - nullable: true, }, option: { $ref: "#/components/schemas/variation_option", @@ -2294,37 +2231,36 @@ export const $variation = { options: { description: "The options available for this variation.", type: "array", - "x-omitempty": true, items: { $ref: "#/components/schemas/variation_option", }, + "x-omitempty": true, }, }, "x-go-name": "ProductVariation", } as const export const $bundle_configuration_data = { - type: "object", - title: "BundleConfigurationData", description: "Container for a bundle configuration.", + type: "object", properties: { data: { $ref: "#/components/schemas/bundle-configuration", }, }, required: ["data"], + title: "BundleConfigurationData", } as const export const $bundle_configuration = { - type: "object", - title: "BundleConfiguration", description: "A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity.", + type: "object", properties: { selected_options: { - type: "object", description: "The product options included in a component. This can be the ID of another bundle.", + type: "object", additionalProperties: { description: "The unique identifier of the component, for example, `games`.", @@ -2339,14 +2275,13 @@ export const $bundle_configuration = { }, }, required: ["selected_options"], + title: "BundleConfiguration", "x-go-name": "ProductBundleConfiguration", } as const export const $product_reference = { - type: "object", - title: "ProductReference", description: "A product identifier.", - "x-nullable": "true", + type: "object", properties: { id: { description: "A unique identifier for a product.", @@ -2358,18 +2293,19 @@ export const $product_reference = { description: "This represents the type of object being returned. Always `product`.", type: "string", + examples: ["product"], + const: "product", "x-go-name": "Type", - example: "product", - enum: ["product"], }, }, + title: "ProductReference", "x-go-name": "ProductReference", + "x-nullable": "true", } as const export const $product_reference_list_data = { - type: "object", - title: "ProductReferenceListData", description: "Container for a list of product references.", + type: "object", properties: { meta: { $ref: "#/components/schemas/page-meta", @@ -2381,23 +2317,23 @@ export const $product_reference_list_data = { $ref: "#/components/schemas/links", }, }, + title: "ProductReferenceListData", } as const export const $product_references = { - type: "array", - title: "ProductReferences", description: "A list of product identifiers.", + type: "array", items: { $ref: "#/components/schemas/product-reference", }, + title: "ProductReferences", "x-go-name": "ProductReferences", } as const export const $product_relationships = { - type: "object", - title: "ProductRelationships", description: "Relationships allow you to move between requests. Includes links to the parent and child products, bundle component products, files, and main images associated with a product.", + type: "object", properties: { parent: { description: @@ -2436,14 +2372,14 @@ export const $product_relationships = { $ref: "#/components/schemas/component-products-relationship", }, }, + title: "ProductRelationships", "x-go-name": "ProductRelationships", "x-omitempty": true, } as const export const $product_relationships_data = { - type: "object", - title: "ProductRelationshipsData", description: "Container for product relationships.", + type: "object", properties: { data: { $ref: "#/components/schemas/product-relationships", @@ -2452,13 +2388,13 @@ export const $product_relationships_data = { $ref: "#/components/schemas/links", }, }, + title: "ProductRelationshipsData", } as const export const $products_for_cart = { - type: "object", - title: "ProductsForCart", description: "A list of products to be added to cart. Can be type product-data or error-response.", + type: "object", properties: { data: { type: "array", @@ -2466,8 +2402,7 @@ export const $products_for_cart = { "x-go-name": "Data", }, included: { - type: "object", - "x-go-name": "Included", + type: ["object", "null"], properties: { component_products: { type: "array", @@ -2477,44 +2412,43 @@ export const $products_for_cart = { "x-go-name": "ComponentProducts", }, }, - nullable: true, + "x-go-name": "Included", }, }, required: ["data"], + title: "ProductsForCart", "x-go-name": "ProductsForCart", } as const export const $products_for_cart_configuration = { - type: "object", - title: "ProductsForCartConfiguration", description: "A list of product id or sku and bundle configuration for cart.", + type: "object", properties: { data: { type: "array", - minItems: 1, items: { type: "object", properties: { id: { - type: "string", + type: ["string", "null"], format: "uuid", "x-go-name": "ID", - nullable: true, }, sku: { - type: "string", + type: ["string", "null"], "x-go-name": "SKU", - nullable: true, }, bundle_configuration: { $ref: "#/components/schemas/bundle-configuration", }, }, }, + minItems: 1, "x-go-name": "Data", }, }, required: ["data"], + title: "ProductsForCartConfiguration", "x-go-name": "ProductsForCartConfiguration", } as const @@ -2546,16 +2480,15 @@ export const $self_link = { } as const export const $release = { - type: "object", - title: "Release", description: "A catalog release represents a collection of hierarchical product data, price books and catalogs rules.", + type: "object", properties: { id: { description: "A unique identifier for the catalog release.", type: "string", + examples: ["8dbb35b2-ef04-477e-974d-e5f3abe6faae"], "x-go-name": "ID", - example: "8dbb35b2-ef04-477e-974d-e5f3abe6faae", }, attributes: { type: "object", @@ -2563,24 +2496,23 @@ export const $release = { name: { description: "The name of a release.", type: "string", - example: "Clothing", + examples: ["Clothing"], }, published_at: { description: "The date and time a release was published.", - type: "string", + type: ["string", "null"], format: "date-time", - example: "1970-01-01T00:00:00.000", - nullable: true, + examples: ["1970-01-01T00:00:00.000"], }, catalog_id: { description: "A unique identifier for the catalog.", type: "string", - example: "0194f54d-f2a1-4e33-9a6e-9ec366152490", + examples: ["0194f54d-f2a1-4e33-9a6e-9ec366152490"], }, description: { description: "A description of the catalog release.", type: "string", - example: "Catalog for Store 123", + examples: ["Catalog for Store 123"], default: "", }, hierarchies: { @@ -2606,13 +2538,13 @@ export const $release = { $ref: "#/components/schemas/release-meta", }, }, + title: "Release", "x-go-name": "Release", } as const export const $release_data = { - type: "object", - title: "Release Data", description: "Container for a catalog release.", + type: "object", properties: { data: { $ref: "#/components/schemas/release", @@ -2621,12 +2553,12 @@ export const $release_data = { $ref: "#/components/schemas/links", }, }, + title: "Release Data", } as const export const $release_list_data = { - type: "object", - title: "ReleaseListData", description: "Container for a list of catalog releases.", + type: "object", properties: { data: { type: "array", @@ -2638,33 +2570,31 @@ export const $release_list_data = { $ref: "#/components/schemas/links", }, }, + title: "ReleaseListData", } as const export const $release_meta = { - type: "object", - title: "ReleaseMeta", description: "A release's metadata.", + type: "object", properties: { created_at: { description: "The date and time a release is created.", type: "string", format: "date-time", - example: "1970-01-01T00:00:00.000", + examples: ["1970-01-01T00:00:00.000"], }, started_at: { description: "The date and time a release is available for use. In other words, the date and time the status of a catalog release changes to PUBLISHED, rather than IN PROGRESS.", - type: "string", + type: ["string", "null"], format: "date-time", - example: "1970-01-01T00:00:00.000", - nullable: true, + examples: ["1970-01-01T00:00:00.000"], }, updated_at: { description: "The date and time a release is updated.", - type: "string", + type: ["string", "null"], format: "date-time", - example: "1970-01-01T00:00:00.000", - nullable: true, + examples: ["1970-01-01T00:00:00.000"], }, release_status: { description: "The status of the current release.", @@ -2674,13 +2604,13 @@ export const $release_meta = { language: { description: "Your storefront's preferred language code and locale.", type: "string", - example: "en-GB", + examples: ["en-GB"], }, is_full_publish: { description: `Indicates that a full publish was performed (either because this is the first time a catalog has been published or because of a change that occurred, for example, adding/removing a price book or hierarchy). When determining whether delta data needs to be refreshed, ignore this attribute and always use the \`is_full_delta\` attribute. `, type: "boolean", - example: false, + examples: [false], default: false, "x-go-name": "IsFullPublish", }, @@ -2688,52 +2618,48 @@ export const $release_meta = { description: `Indicates whether the release delta file contains the full content of a catalog release. Using a search service as an example, if the \`is_full_delta\` attribute is \`true\`, you should remove all data about that catalog release from the search service before injecting fresh data from the delta file. If the \`is_full_delta\` attribute is \`false\`, then data from the previous catalog release overlays the existing data in the delta file. The \`is_full_delta\` attribute is always \`true\` the first time a catalog is published. `, type: "boolean", - example: false, + examples: [false], default: false, "x-go-name": "IsFullDelta", }, total_products: { description: "The total number of products displayed in a catalog release.", - type: "integer", + type: ["integer", "null"], format: "int64", "x-go-name": "TotalProducts", - nullable: true, }, total_nodes: { description: "The total number of hierarchy nodes displayed in a catalog release.", - type: "integer", + type: ["integer", "null"], format: "int64", "x-go-name": "TotalNodes", - nullable: true, }, percent_completed: { description: "An integer that represents the progress of a catalog publish. The attribute starts at `0` and reaches `100` when publishing is complete.", - type: "integer", + type: ["integer", "null"], format: "int32", "x-go-name": "PercentCompleted", - nullable: true, }, owner: { description: "The owner of the resource, can be either `organization` or `store`.", - type: "string", + type: ["string", "null"], enum: ["store", "organization"], "x-go-name": "Owner", - nullable: true, }, }, + title: "ReleaseMeta", "x-go-name": "ReleaseMeta", "x-omitempty": true, } as const export const $release_relationships = { - type: "object", - title: "ReleaseRelationships", description: "Relationships are established between different catalog entities. For example, products, hierarchies, price books, and catalog rules are related to a catalog, as they are associated with it.", + type: "object", properties: { delta: { description: @@ -2765,20 +2691,20 @@ export const $release_relationships = { required: ["links"], }, }, + title: "ReleaseRelationships", "x-go-name": "ReleaseRelationships", } as const export const $rule = { - type: "object", - title: "Catalog Rule", description: "A catalog rule specifies which catalog to use for a given shopper context.", + type: "object", properties: { id: { - type: "string", description: "The catalog rule ID. Use this to get, modify, or delete the catalog rule.", - example: "8dbb35b2-ef04-477e-974d-e5f3abe6faae", + type: "string", + examples: ["8dbb35b2-ef04-477e-974d-e5f3abe6faae"], }, attributes: { type: "object", @@ -2787,12 +2713,12 @@ export const $rule = { description: "The name of a catalog rule. The name must not contain any spaces.", type: "string", - example: "rule-123", + examples: ["rule-123"], }, description: { description: "A brief description of the purpose of a catalog rule.", type: "string", - example: "Catalog Rule for most favored customers", + examples: ["Catalog Rule for most favored customers"], default: "", "x-omitempty": true, }, @@ -2851,21 +2777,21 @@ You can offset the timezone by adding the offset to the end of the date and time "x-omitempty": true, }, catalog_id: { - type: "string", description: "The unique identifier of a catalog.", - example: "d09b4e16-08a5-4f42-817c-6e0d98acbb63", + type: "string", + examples: ["d09b4e16-08a5-4f42-817c-6e0d98acbb63"], }, created_at: { description: "The date and time a catalog rule was created.", type: "string", - example: "2020-09-22T09:00:00", format: "date-time", + examples: ["2020-09-22T09:00:00"], }, updated_at: { description: "The date and time a catalog release is updated.", type: "string", - example: "2020-09-22T09:00:00", format: "date-time", + examples: ["2020-09-22T09:00:00"], }, }, required: ["name", "catalog_id", "created_at", "updated_at"], @@ -2874,18 +2800,18 @@ You can offset the timezone by adding the offset to the end of the date and time description: "This represents the type of object being returned. Always `catalog_rule`.", type: "string", - example: "catalog_rule", - enum: ["catalog_rule"], + examples: ["catalog_rule"], + const: "catalog_rule", }, }, required: ["id", "type", "attributes"], + title: "Catalog Rule", } as const export const $rule_create_data = { - type: "object", - title: "CatalogRuleCreateData", description: "A catalog rule specifies which catalog to use for a given shopper context.", + type: "object", properties: { data: { type: "object", @@ -2897,52 +2823,47 @@ export const $rule_create_data = { description: "The name of a catalog rule. The name must not contain spaces.", type: "string", + examples: ["rule-123"], minLength: 1, - example: "rule-123", }, description: { description: "A brief description of the purpose of a catalog rule.", - type: "string", - example: "Catalog Rule for most favored customers", + type: ["string", "null"], + examples: ["Catalog Rule for most favored customers"], default: "", - nullable: true, }, account_ids: { description: "The list of accounts who are eligible to see this catalog. If this field is empty, the rule matches all accounts.", - type: "array", + type: ["array", "null"], items: { type: "string", }, - nullable: true, }, customer_ids: { description: "The list of customers who are eligible to see this catalog. If empty, the rule matches all customers.", - type: "array", + type: ["array", "null"], items: { type: "string", }, - nullable: true, }, channels: { description: "The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests.", - type: "array", + type: ["array", "null"], items: { type: "string", }, - nullable: true, }, tags: { description: "A list of user-defined tags that can be used to further restrict the eligibility criteria for this rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header.", - type: "array", + type: ["array", "null"], items: { type: "string", }, - nullable: true, }, schedules: { description: `Specifies a time period when a catalog is displayed, such as on a specific date or during summer. Requests populate the rule tag using the \`EP-Context-Tag\` header. @@ -2956,16 +2877,15 @@ Commerce runs on UTC time. You can offset the timezone by adding the offset to the end of the date and time. For example, a catalog which contains a sale hierarchy that should appear for a set timeframe may be scheduled to publish on a given date and time within a given timezone. For instance, a sale that should begin on 1st of June 2022 05:00 ET and end on the 15th of June 2022 at 23:50 PT would have a valid schedule of \`"valid_from": "2022-06-01T05:00:00.000-05:00"\`, \`"valid_to": "2022-06-15T11:59:99.000-08:00"\`. `, - type: "array", + type: ["array", "null"], items: { $ref: "#/components/schemas/rule-schedule", }, - nullable: true, }, catalog_id: { - type: "string", description: "The unique identifier of a catalog.", - example: "d09b4e16-08a5-4f42-817c-6e0d98acbb63", + type: "string", + examples: ["d09b4e16-08a5-4f42-817c-6e0d98acbb63"], }, }, required: ["name", "catalog_id"], @@ -2974,20 +2894,20 @@ You can offset the timezone by adding the offset to the end of the date and time description: "This represents the type of object being returned. Always `catalog_rule`.", type: "string", - example: "catalog_rule", - enum: ["catalog_rule"], + examples: ["catalog_rule"], + const: "catalog_rule", }, }, required: ["type", "attributes"], }, }, required: ["data"], + title: "CatalogRuleCreateData", } as const export const $rule_data = { - type: "object", - title: "CatalogRuleData", description: "Container for a single catalog rule.", + type: "object", properties: { data: { $ref: "#/components/schemas/rule", @@ -2997,12 +2917,12 @@ export const $rule_data = { }, }, required: ["data"], + title: "CatalogRuleData", } as const export const $rule_list_data = { - type: "object", - title: "CatalogRuleListData", description: "Container for a list of catalog rules.", + type: "object", properties: { meta: { $ref: "#/components/schemas/page-meta", @@ -3018,48 +2938,46 @@ export const $rule_list_data = { }, }, required: ["data"], + title: "CatalogRuleListData", } as const export const $rule_schedule = { - type: "object", - title: "Catalog Schedule", description: "A period of time during which a catalog is valid", + type: "object", properties: { valid_from: { description: "Matches the date and time that the catalog is displayed from.", - type: "string", - example: "2020-09-22T09:00:00", + type: ["string", "null"], format: "date-time", + examples: ["2020-09-22T09:00:00"], "x-go-name": "ValidFrom", - nullable: true, }, valid_to: { description: "Matches the date and time the catalog is displayed to.", - type: "string", - example: "2020-09-22T09:00:00", + type: ["string", "null"], format: "date-time", + examples: ["2020-09-22T09:00:00"], "x-go-name": "ValidTo", - nullable: true, }, }, + title: "Catalog Schedule", "x-go-name": "RuleSchedule", } as const export const $rule_update_data = { - type: "object", - title: "CatalogRuleUpdateData", description: "A catalog rule specifies which catalog to use for a given shopper context.", + type: "object", properties: { data: { type: "object", properties: { id: { - type: "string", description: "The catalog rule ID. Use this to get, modify, or delete the catalog rule.", - example: "8dbb35b2-ef04-477e-974d-e5f3abe6faae", + type: "string", + examples: ["8dbb35b2-ef04-477e-974d-e5f3abe6faae"], }, attributes: { type: "object", @@ -3067,44 +2985,39 @@ export const $rule_update_data = { name: { description: "The name of a catalog rule. The name must not contain spaces.", - type: "string", + type: ["string", "null"], + examples: ["rule-123"], minLength: 1, - example: "rule-123", - nullable: true, }, description: { description: "A description of the purpose of a catalog rule.", - type: "string", - example: "Catalog Rule for most favored customers", + type: ["string", "null"], + examples: ["Catalog Rule for most favored customers"], default: "", - nullable: true, }, account_ids: { description: "Specifies the list of accounts who are eligible to see this catalog. If this field is empty, the rule matches all accounts.", - type: "array", + type: ["array", "null"], items: { type: "string", }, - nullable: true, }, customer_ids: { description: "The list of customers who are eligible to see this catalog. If empty, the rule matches all customers.", - type: "array", + type: ["array", "null"], items: { type: "string", }, - nullable: true, }, channels: { description: "The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests.", - type: "array", + type: ["array", "null"], items: { type: "string", }, - nullable: true, }, schedules: { description: `Specifies a time period when a catalog is displayed, such as on a specific date or during summer. Requests populate the rule tag using the \`EP-Context-Tag\` header. @@ -3118,26 +3031,23 @@ Commerce runs on UTC time. You can offset the timezone by adding the offset to the end of the date and time. For example, a catalog which contains a sale hierarchy that should appear for a set timeframe may be scheduled to publish on a given date and time within a given timezone. For instance, a sale that should begin on 1st of June 2022 05:00 ET and end on the 15th of June 2022 at 23:50 PT would have a valid schedule of \`"valid_from": "2022-06-01T05:00:00.000-05:00"\`, \`"valid_to": "2022-06-15T11:59:99.000-08:00"\`. `, - type: "array", + type: ["array", "null"], items: { $ref: "#/components/schemas/rule-schedule", }, - nullable: true, }, tags: { description: "A list of user-defined tags that can be used to further restrict the eligibility criteria for this rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header.", - type: "array", + type: ["array", "null"], items: { type: "string", }, - nullable: true, }, catalog_id: { - type: "string", description: "The unique identifier of a catalog rule.", - example: "d09b4e16-08a5-4f42-817c-6e0d98acbb63", - nullable: true, + type: ["string", "null"], + examples: ["d09b4e16-08a5-4f42-817c-6e0d98acbb63"], }, }, }, @@ -3145,19 +3055,20 @@ You can offset the timezone by adding the offset to the end of the date and time description: "This represents the type of object being returned. Always `catalog_rule`.", type: "string", - example: "catalog_rule", - enum: ["catalog_rule"], + examples: ["catalog_rule"], + const: "catalog_rule", }, }, required: ["id", "type"], }, }, required: ["data"], + title: "CatalogRuleUpdateData", } as const export const $sale = { - type: "object", description: "A set of sale prices and a validity period.", + type: "object", properties: { schedule: { $ref: "#/components/schemas/schedule", @@ -3169,72 +3080,69 @@ export const $sale = { } as const export const $sales = { - type: "object", - title: "Sales", description: "A set of sale specifications", + type: "object", additionalProperties: { $ref: "#/components/schemas/sale", }, + title: "Sales", } as const export const $schedule = { - type: "object", description: "A definition of the times at which a sale is valid", + type: "object", properties: { valid_from: { - type: "string", - example: "2020-09-22T09:00:00", + type: ["string", "null"], format: "date-time", + examples: ["2020-09-22T09:00:00"], "x-go-name": "ValidFrom", - nullable: true, }, valid_to: { - type: "string", - example: "2020-09-22T09:00:00", + type: ["string", "null"], format: "date-time", + examples: ["2020-09-22T09:00:00"], "x-go-name": "ValidTo", - nullable: true, }, }, "x-go-name": "Schedule", } as const export const $tier = { - type: "object", - title: "Tier", description: "The name of the tier, for example, `Pencils`.", + type: "object", properties: { minimum_quantity: { description: "The minimum quantity of 1 or more defined for the specified price. If a minimum quantity is not specified, an error is returned.", type: "integer", - example: "5", + examples: ["5"], }, price: { $ref: "#/components/schemas/currencies", }, }, + title: "Tier", } as const export const $tiered_amount = { - type: "object", - title: "TieredAmount", description: "The three-letter ISO code for the currency associated with this price.", + type: "object", properties: { amount: { description: "The price in the lowest denomination for the specified currency. This is a product's list price.", type: "integer", - example: 100, format: "int64", - "x-omitempty": false, + examples: [100], "x-go-name": "Amount", + "x-omitempty": false, }, includes_tax: { description: "Whether this price includes tax.", type: "boolean", - example: false, + examples: [false], default: false, "x-go-name": "IncludesTax", }, @@ -3250,16 +3158,16 @@ export const $tiered_amount = { description: "The minimum quantity of 1 or more defined for the specified price. If a minimum quantity is not specified, an error is returned.", type: "integer", - example: 5, + examples: [5], "x-go-name": "MinimumQuantity", }, amount: { description: "The price for each quantity.", type: "integer", - example: 100, format: "int64", - "x-omitempty": false, + examples: [100], "x-go-name": "Amount", + "x-omitempty": false, }, }, "x-go-name": "TierAmount", @@ -3267,88 +3175,116 @@ export const $tiered_amount = { "x-go-name": "Tiers", }, }, + title: "TieredAmount", "x-go-name": "TieredAmount", } as const export const $tiered_currencies = { - type: "object", - title: "TieredCurrencies", description: "Collection of currency specific prices for a product.", + type: "object", additionalProperties: { $ref: "#/components/schemas/tiered-amount", }, + title: "TieredCurrencies", } as const export const $tiers = { - type: "object", - title: "Tiers", description: "The price tier that an item is eligible for based on the quantity purchased. You cannot have conflicting tiers within the same currencies block.", + type: "object", additionalProperties: { $ref: "#/components/schemas/tier", }, + title: "Tiers", } as const export const $catalog_release_create_data = { - type: "object", - title: "CatalogReleaseCreateData", description: "Creates a catalog release with the following attributes.", + type: "object", properties: { data: { type: "object", properties: { export_full_delta: { - type: "boolean", description: `Set to \`true\` if you want to export all the data from a catalog release in a delta link. The \`is_full_delta\` attribute is returned from the \`get a release of a catalog\` endpoint. The \`is_full_delta\` attribute tells you if the delta file contains the full content of a catalog release. You can use the \`is_full_delta\` to determine if you need to refresh the data in your company system before publishing a catalog release with fresh data in a delta link. Using a search service as an example, if the \`is_full_delta\` attribute is true, you should remove all data about that catalog from the search service before publishing a catalog release and injecting fresh data from the delta file. If the \`is_full_delta\` attribute is false, then data from the previous catalog overlays the existing data in the delta file. The \`is_full_delta\` attribute is always \`true\` the first time a catalog is published. `, + type: "boolean", "x-go-name": "ExportFullDelta", }, include_organization_resources: { - type: "boolean", description: "If you are publishing a catalog in a store that contains resources from an organization, you must set this to true and you must enable the **Include Organization Resources in Catalog Publishes** checkbox in Commerce Manager. See [**Multi-Store Management Solutions**](/docs/api/pxm/catalog/publish-release).", + type: ["boolean", "null"], "x-go-name": "IncludeOrganizationResources", - nullable: true, }, }, }, }, + title: "CatalogReleaseCreateData", +} as const + +export const $included = { + description: + "Included is an array of resources that are included in the response.", + type: "object", + properties: { + main_images: { + description: "The main images associated with a product.", + type: "array", + items: { + $ref: "#/components/schemas/elastic-path-file", + }, + }, + component_products: { + description: "The component products associated with a product.", + type: "array", + items: { + $ref: "#/components/schemas/product", + }, + }, + files: { + description: "The files associated with a product.", + type: "array", + items: { + $ref: "#/components/schemas/elastic-path-file", + }, + }, + }, } as const export const $elastic_path_file = { type: "object", - title: "ElasticPathFile", properties: { id: { - type: "string", description: "The unique identifier for this file.", + type: "string", format: "uuid", }, type: { description: "The type represents the object being returned.", type: "string", - example: "file", + examples: ["file"], }, file_name: { description: "The name of the file.", type: "string", - example: "file_name.jpg", + examples: ["file_name.jpg"], }, mime_type: { description: "The mime type of the file.", type: "string", - example: "image/jpeg", + examples: ["image/jpeg"], }, file_size: { description: "The size of the file. Required when uploading files.", type: "integer", - example: 36000, + examples: [36000], }, public: { description: "DEPRECATED Whether the file public or not. Required when uploading files.", type: "boolean", - example: true, + examples: [true], }, meta: { $ref: "#/components/schemas/file-meta", @@ -3360,18 +3296,19 @@ export const $elastic_path_file = { $ref: "#/components/schemas/file-link", }, }, + title: "ElasticPathFile", } as const export const $file_meta = { properties: { timestamps: { - type: "object", description: "The date and time the file was created.", + type: "object", properties: { created_at: { description: "The date and time the file was created.", type: "string", - example: "2023-10-11T13:02:25.293Z", + examples: ["2023-10-11T13:02:25.293Z"], }, }, }, @@ -3382,12 +3319,12 @@ export const $file_meta = { width: { description: "The width of the file.", type: "integer", - example: 1800, + examples: [1800], }, height: { description: "The height of the file.", type: "integer", - example: 1000, + examples: [1000], }, }, }, @@ -3395,14 +3332,2726 @@ export const $file_meta = { } as const export const $file_link = { - type: "object", description: "The publicly available URL for this file.", + type: "object", properties: { href: { description: "The publicly available URL for this file.", type: "string", - example: + examples: [ "https://files-eu.epusercontent.com/e8c53cb0-120d-4ea5-8941-ce74dec06038/f8cf26b3-6d38-4275-937a-624a83994702.png", + ], + }, + }, +} as const + +export const $CartsRequest = { + title: "CartsRequest", + type: "object", + properties: { + description: { + type: "string", + description: "The cart description.", + example: "cart description", + }, + discount_settings: { + $ref: "#/components/schemas/DiscountSettings", + }, + name: { + description: + "The cart name provided by the shopper. A cart name must contain 1 to 255 characters. You cannot use whitespace characters, but special characters are permitted. For more information, see the [Safe Characters](/guides/Getting-Started/safe-characters) section.", + type: "string", + example: "my cart name", + }, + snapshot_date: { + description: + "This optional parameter sets a reference date for the cart. If this parameter is set, it allows the cart to act as one that might occur on that specified date. For example, such future carts might acquire future-enabled discounts, allowing users to test and validate future interactions with carts. The snapshot_date must be in the format 2026-02-21T15:07:25Z. By default, this parameter is left empty.", + type: "string", + example: "2026-09-10T00:12:00Z", + }, + custom_attributes: { + $ref: "#/components/schemas/CustomAttributes", + }, + payment_intent_id: { + description: + "To remove the Stripe payment intent from a cart, pass the empty value in the `payment_intent_id` field. You must use an empty value for this field. You cannot use this endpoint to directly update the cart to use an existing Payment Intent.", + type: "string", + example: "", + }, + }, +} as const + +export const $DiscountSettings = { + title: "DiscountSettings", + type: "object", + properties: { + custom_discounts_enabled: { + description: + "This parameter enables custom discounts for a cart. When set to true, Elastic Path promotions will not be applied to the new carts. Default is set from cart discount settings for the store. See [Cart Settings](/docs/api/settings/put-v-2-settings-cart).", + type: "boolean", + example: false, + }, + use_rule_promotions: { + description: + "When set to true, this parameter allows the cart to use rule promotions.", + type: "boolean", + example: false, + }, + }, +} as const + +export const $CustomAttributes = { + title: "CustomAttributes", + type: "object", + properties: { + custom_attributes: { + description: + "Specifies the custom attributes for the cart object. The attribute can be any string, numerical, and underscore. A cart can have maximum of 20 custom attributes.", + type: "object", + properties: { + attribute: { + description: "Specifies the attribute `type` and `value`.", + type: "object", + properties: { + type: { + description: + "Specifies the type of the attribute such as string, integer, boolean, and float.", + type: "string", + }, + value: { + description: "Specifies the value of the attribute.", + oneOf: [ + { + type: "string", + }, + { + type: "number", + }, + { + type: "boolean", + }, + ], + }, + }, + }, + }, + }, + }, +} as const + +export const $CartResponse = { + title: "CartResponse", + type: "object", + properties: { + id: { + description: + "The unique identifier for the cart. Use SDK or create it yourself.", + type: "string", + }, + type: { + description: "The type of object being returned.", + type: "string", + example: "cart", + }, + name: { + description: "The name of this cart.", + type: "string", + example: "cart name", + }, + description: { + description: "A description of the cart.", + type: "string", + example: "cart description", + }, + discount_settings: { + $ref: "#/components/schemas/DiscountSettings", + }, + payment_intent_id: { + description: + "Stripe-assigned unique identifier for the linked Payment Intent", + type: "string", + }, + links: { + type: "object", + properties: { + self: { + description: "A link to that specific resource.", + type: "string", + }, + }, + example: "https://useast.api.elasticpath.com/v2/carts/1", + }, + meta: { + type: "object", + properties: { + display_price: { + type: "object", + properties: { + with_tax: { + $ref: "#/components/schemas/FormattedPriceData", + }, + without_tax: { + $ref: "#/components/schemas/FormattedPriceData", + }, + tax: { + $ref: "#/components/schemas/FormattedPriceData", + }, + discount: { + $ref: "#/components/schemas/FormattedPriceData", + }, + without_discount: { + $ref: "#/components/schemas/FormattedPriceData", + }, + shipping: { + $ref: "#/components/schemas/FormattedPriceData", + }, + }, + }, + timestamps: { + $ref: "#/components/schemas/Timestamps", + }, + }, + }, + relationships: { + type: "object", + properties: { + customers: { + type: "object", + properties: { + data: { + type: "object", + properties: { + type: { + description: "The type of related object.", + type: "string", + example: "customers", + }, + id: { + description: "The ID of the customer.", + type: "string", + format: "uuid", + readOnly: true, + example: "662461ad-ddcb-4dbd-8ed7-ade9aa63b5f9", + }, + }, + }, + }, + }, + items: { + type: "object", + properties: { + data: { + type: "object", + properties: { + type: { + description: "The type of related object.", + type: "string", + example: "cart_item", + }, + id: { + description: "The unique identifier for the cart item", + type: "string", + format: "uuid", + readOnly: true, + example: "1cf8b15b-4f12-43c5-837c-dbbc09aefa55", + }, + }, + }, + }, + }, + }, + }, + }, +} as const + +export const $CartItemsObjectRequest = { + title: "Cart Items Object Request", + oneOf: [ + { + $ref: "#/components/schemas/CartItemObject", + }, + { + $ref: "#/components/schemas/CartMergeObjectRequest", + }, + { + $ref: "#/components/schemas/CustomItemObject", + }, + { + $ref: "#/components/schemas/ReOrderObjectRequest", + }, + { + $ref: "#/components/schemas/PromotionItemObject", + }, + ], +} as const + +export const $CartItemObject = { + title: "Cart Item Object", + type: "object", + properties: { + data: { + allOf: [ + { + $ref: "#/components/schemas/CartItemObjectData", + }, + { + $ref: "#/components/schemas/CartItemResponse", + }, + ], + }, + }, +} as const + +export const $CartItemObjectData = { + title: "Cart Item Object Data", + type: "object", + required: ["type", "quantity"], + properties: { + type: { + description: "The type of object being returned.", + type: "string", + enum: ["cart_item"], + }, + quantity: { + description: "The number of items added to the cart.", + type: "number", + example: 2, + }, + id: { + type: "string", + format: "uuid", + description: + "Specifies the ID of the product you want to add to cart. (use this OR sku)", + example: "78d7b5c2-c852-40ad-87bb-beb161f61f37", + }, + sku: { + type: "string", + description: + "Specifies the item SKU that you want to add to cart. (use this OR id)", + example: "my-item", + }, + custom_inputs: { + description: "The custom text to be added to a product.", + type: "object", + }, + bundle_configuration: { + description: "Object used to describe the bundle options selected.", + type: "object", + properties: { + selected_options: { + description: "Specifies selected options.", + type: "object", + }, + }, + }, + shipping_group_id: { + description: "Identifier for a created Cart Shipping Group", + type: "string", + }, + }, +} as const + +export const $CartMergeObjectRequest = { + title: "Cart Merge Object Request", + type: "object", + properties: { + data: { + type: "array", + items: { + allOf: [ + { + $ref: "#/components/schemas/CartMergeObject", + }, + ], + }, + description: "", + }, + options: { + $ref: "#/components/schemas/AddAllOrNothingOptionsObject", + }, + }, +} as const + +export const $CartMergeObject = { + title: "Cart Merge Object", + type: "object", + required: ["type", "cart_id"], + properties: { + type: { + description: "The type of object being returned. Must be `cart_items`.", + type: "string", + enum: ["cart_items"], + }, + cart_id: { + description: "The original cart to be merged from.", + type: "string", + format: "uuid", + example: "78d7b5c2-c852-40ad-87bb-beb161f61f37", + }, + }, +} as const + +export const $CustomItemObject = { + title: "Custom Item Object", + type: "object", + properties: { + data: { + allOf: [ + { + $ref: "#/components/schemas/CustomItemObjectData", + }, + ], + description: "", + }, + }, +} as const + +export const $CustomItemObjectData = { + title: "Custom Item Object Data", + type: "object", + required: ["type", "name", "quantity", "price"], + properties: { + type: { + description: "The type of object being returned. Must be `custom_item`.", + type: "string", + enum: ["custom_item"], + }, + quantity: { + description: "The number of custom items to add to cart.", + type: "number", + example: 2, + }, + price: { + type: "object", + required: ["amount"], + properties: { + amount: { + description: "The unit price of the custom item.", + type: "number", + example: 10000, + }, + includes_tax: { + description: + "Set to`true` if relevant taxes have been included in the price, `false` if not. Defaults to `true`.", + type: "boolean", + }, + }, + }, + description: { + description: "A description of the custom item.", + type: "string", + example: "My first custom item!", + }, + sku: { + type: "string", + description: + "The `SKU` code to use for the custom item. See [best practices](https://elasticpath.dev/docs/commerce-cloud/carts/cart-items/add-custom-item-to-cart#best-practices) to use the `SKU` code.", + example: "my-custom-item", + }, + name: { + type: "string", + description: "The name of the custom item.", + example: "My Custom Item", + }, + custom_inputs: { + description: "The custom text to be added to a product.", + type: "object", + }, + shipping_group_id: { + description: "Identifier for a created Cart Shipping Group", + type: "string", + }, + }, +} as const + +export const $ReOrderObjectRequest = { + title: "Re-Order Object Request", + type: "object", + properties: { + data: { + allOf: [ + { + $ref: "#/components/schemas/ReOrderObject", + }, + ], + }, + options: { + $ref: "#/components/schemas/AddAllOrNothingOptionsObject", + }, + }, +} as const + +export const $ReOrderObject = { + title: "Re Order Object", + type: "object", + required: ["type", "order_id"], + properties: { + type: { + description: "The type of resource being returned. Use `order_items`.", + type: "string", + enum: ["order_items"], + }, + order_id: { + description: "The unique identifier of the order.", + type: "string", + format: "uuid", + example: "78d7b5c2-c852-40ad-87bb-beb161f61f37", + }, + }, +} as const + +export const $BulkAddItemsRequest = { + title: "Bulk Add Items Request", + type: "object", + properties: { + data: { + anyOf: [ + { + $ref: "#/components/schemas/CartItemsObjectRequest", + }, + { + $ref: "#/components/schemas/CartMergeObjectRequest", + }, + { + $ref: "#/components/schemas/CustomItemObject", + }, + { + $ref: "#/components/schemas/ReOrderObjectRequest", + }, + { + $ref: "#/components/schemas/PromotionItemObject", + }, + ], + }, + }, +} as const + +export const $PromotionItemObject = { + title: "Promotion Item Object", + type: "object", + properties: { + data: { + allOf: [ + { + $ref: "#/components/schemas/PromotionItemObjectData", + }, + ], + }, + }, +} as const + +export const $PromotionItemObjectData = { + title: "Promotion Item Object Data", + type: "object", + required: ["type", "code"], + properties: { + type: { + description: "Specifies the type of resource, which is `promotion_item`.", + type: "string", + enum: ["promotion_item"], + }, + code: { + description: + "Specifies the promotion code. For more information about codes[].user[], see the [Create Promotion codes](/docs/api/promotions/create-promotion-codes) section.", + type: "string", + example: "PROMO_CODE", + }, + }, +} as const + +export const $BulkUpdateCartsItems = { + title: "Bulk Update Carts Items", + type: "object", + required: ["id", "quantity"], + properties: { + data: { + type: "array", + items: { + type: "object", + properties: { + id: { + description: + "Specifies the ID of the cart item that you want to update in cart.", + type: "string", + example: "{{cartitemID}}", + }, + quantity: { + description: "Specifies the amount of items to update in the cart.", + type: "number", + example: 2, + }, + custom_inputs: { + description: + "Specifies the custom text to be added to a product. See [custom inputs](https://elasticpath.dev/docs/pxm/products/ep-pxm-products-api/update-a-product#using-custom-inputs-attribute).", + type: "object", + }, + }, + }, + }, + options: { + $ref: "#/components/schemas/UpdateAllOrNothingOptionsObject", + }, + }, +} as const + +export const $UpdateCartsItems = { + title: "Update Carts Items", + type: "object", + required: ["quantity"], + properties: { + data: { + type: "object", + properties: { + id: { + description: "The unique identifier of the cart item.", + type: "string", + format: "uuid", + example: "{{cartitemID}}", + }, + quantity: { + description: "The amount of products to add to cart.", + type: "number", + example: 2, + }, + custom_inputs: { + description: "The custom text to be added to a product.", + type: "object", + }, + shipping_group_id: { + description: + "The unique identifier of the shipping group to be added to the cart.", + type: "string", + format: "uuid", + example: "900ab9c1-4b39-43fe-b080-0dc2806065d9", + }, + }, + }, + }, +} as const + +export const $AddAllOrNothingOptionsObject = { + title: "Add All Or Nothing Options Object", + type: "object", + properties: { + add_all_or_nothing: { + description: + "When `true`, if an error occurs for any item, no items are added to the cart. When `false`, valid items are added to the cart and the items with errors are reported in the response. Default is `false`.", + type: "boolean", + example: false, + }, + }, +} as const + +export const $UpdateAllOrNothingOptionsObject = { + title: "Update All Or Nothing Options Object", + type: "object", + properties: { + update_all_or_nothing: { + description: + "When set to`true`, if an error occurs for any item, no items are updated in the cart. When set to `false`, valid items are updated in the cart and the items with errors are reported in the response. Default is `true`.", + type: "boolean", + example: false, + }, + }, +} as const + +export const $CartItemResponse = { + title: "Cart Item Relationship", + type: "object", + properties: { + product_id: { + description: "The unique ID of the product.", + type: "string", + format: "uuid", + readOnly: true, + example: "55cda543-f9d7-42a4-b40a-665f2e4ff7c5", + }, + name: { + description: "The name of this item", + type: "string", + readOnly: true, + example: "shirt", + }, + description: { + description: "A description of the cart item.", + type: "string", + readOnly: true, + example: "T-shirt.", + }, + catalog_id: { + description: + "The unique identifier of the catalog associated with the product is shown if catalog_source=pim is set.", + type: "string", + readOnly: true, + format: "uuid", + example: "11d3f9d2-c99b-472c-96c3-51842333daea", + }, + catalog_source: { + description: "The catalog source. Always `pim` or `legacy`.", + type: "string", + readOnly: true, + example: "pim", + }, + image: { + type: "object", + readOnly: true, + properties: { + mime_type: { + description: "The MIME type for the uploaded file.", + type: "string", + readOnly: true, + example: "image/png", + }, + file_name: { + description: "The name of the image file that was uploaded.", + type: "string", + readOnly: true, + example: "shirt-trans.png", + }, + href: { + description: "The link to the image.", + type: "string", + readOnly: true, + example: + "https://files-eu.epusercontent.com/e8c53cb0-120d-4ea5-8941-ce74dec06038/7cc08cbb-256e-4271-9b01-d03a9fac9f0a.png", + }, + }, + }, + manage_stock: { + description: null, + type: "boolean", + readOnly: true, + example: true, + }, + unit_price: { + readOnly: true, + $ref: "#/components/schemas/ItemPriceData", + }, + value: { + readOnly: true, + $ref: "#/components/schemas/ItemPriceData", + }, + links: { + type: "object", + readOnly: true, + properties: { + product: { + description: "A URL related to the resource.", + type: "string", + example: + "https://useast.api.elasticpath.com/products/9eda5ba0-4f4a-4074-8547-ccb05d1b5981", + }, + }, + }, + meta: { + type: "object", + readOnly: true, + properties: { + display_price: { + type: "object", + properties: { + with_tax: { + $ref: "#/components/schemas/FormattedPriceData", + }, + without_tax: { + $ref: "#/components/schemas/FormattedPriceData", + }, + tax: { + $ref: "#/components/schemas/FormattedPriceData", + }, + discount: { + $ref: "#/components/schemas/FormattedPriceData", + }, + without_discount: { + $ref: "#/components/schemas/FormattedPriceData", + }, + }, + }, + timestamps: { + $ref: "#/components/schemas/Timestamps", + }, + }, + }, + }, +} as const + +export const $CartsResponse = { + title: "Carts Response", + type: "object", + properties: { + data: { + type: "array", + items: { + type: "object", + anyOf: [ + { + $ref: "#/components/schemas/CartItemObject", + }, + ], + }, + }, + meta: { + type: "object", + properties: { + display_price: { + type: "object", + properties: { + with_tax: { + $ref: "#/components/schemas/FormattedPriceData", + }, + without_tax: { + $ref: "#/components/schemas/FormattedPriceData", + }, + tax: { + $ref: "#/components/schemas/FormattedPriceData", + }, + discount: { + $ref: "#/components/schemas/FormattedPriceData", + }, + without_discount: { + $ref: "#/components/schemas/FormattedPriceData", + }, + discounts: { + type: "object", + additionalProperties: { + type: "object", + properties: { + amount: { + type: "number", + example: -1000, + }, + currency: { + type: "string", + example: "USD", + }, + formatted: { + type: "string", + example: "-$1.00", + }, + }, + }, + }, + }, + }, + timestamps: { + $ref: "#/components/schemas/CartTimestamps", + }, + }, + }, + }, +} as const + +export const $ItemPriceData = { + title: "Order Price Data", + type: "object", + properties: { + amount: { + description: "The amount for this item as an integer.", + type: "number", + readOnly: true, + example: 10000, + }, + currency: { + description: "The currency this item was added to the cart as.", + type: "string", + readOnly: true, + example: "USD", + }, + includes_tax: { + description: "Whether or not this price is tax inclusive.", + type: "boolean", + readOnly: true, + example: false, + }, + }, +} as const + +export const $CartsRelationshipsAccountsData = { + title: "Carts Relationships Accounts Data", + type: "object", + properties: { + data: { + type: "array", + items: { + properties: { + id: { + description: "The ID of the account.", + type: "string", + example: "{{accountID}}", + }, + type: { + description: + "The type of related object. Ensure that it is account.", + type: "string", + example: "account", + }, + }, + }, + }, + }, +} as const + +export const $CartsRelationshipsCustomersData = { + title: "Carts Relationships Customers Data", + type: "object", + properties: { + data: { + type: "array", + items: { + properties: { + id: { + description: "The ID of the customer.", + type: "string", + example: "{{customerID}}", + }, + type: { + description: + "The type of related object. Ensure that it is customer.", + type: "string", + example: "customer", + }, + }, + }, + }, + }, +} as const + +export const $CartsItemsTaxesObject = { + title: "Carts Items Taxes Object", + type: "object", + required: ["type", "rate"], + properties: { + code: { + description: "A unique tax code in this jurisdiction.", + type: "string", + example: "TAX01", + }, + jurisdiction: { + description: "The relevant tax jurisdiction.", + type: "string", + example: "UK", + }, + name: { + description: "The name of the tax item.", + type: "string", + example: "Tax name", + }, + rate: { + description: "The tax rate represented as a decimal (12.5% -> 0.125).", + type: "number", + example: 0.2, + }, + type: { + description: "The type of object being returned. Use `tax_item`.", + type: "string", + example: "tax_item", + }, + id: { + description: "The unique identifier for this tax item.", + type: "string", + format: "uuid", + readOnly: true, + example: "662461ad-ddcb-4dbd-8ed7-ade9aa63b5f9", + }, + }, +} as const + +export const $CartsBulkCustomDiscounts = { + title: "CartsBulkCustomDiscounts", + type: "object", + properties: { + data: { + type: "array", + items: { + allOf: [ + { + $ref: "#/components/schemas/CartsCustomDiscountsObject", + }, + { + $ref: "#/components/schemas/CartItemBulkCustomDiscountObject", + }, + ], + }, + }, + options: { + $ref: "#/components/schemas/AddAllOrNothingOptionsObject", + }, + }, +} as const + +export const $CartsBulkCustomDiscountsResponse = { + title: "CartsBulkCustomDiscountsResponse", + type: "object", + properties: { + data: { + type: "array", + items: { + allOf: [ + { + $ref: "#/components/schemas/CartsCustomDiscountsResponse", + }, + { + $ref: "#/components/schemas/artItemBulkCustomDiscountResponse", + }, + ], + }, + }, + options: { + $ref: "#/components/schemas/AddAllOrNothingOptionsObject", + }, + }, +} as const + +export const $CartItemBulkCustomDiscountObject = { + title: "CartItemBulkCustomDiscountObject", + type: "object", + allOf: [ + { + $ref: "#/components/schemas/CartsCustomDiscountsObject", + }, + { + $ref: "#/components/schemas/CustomDiscountRelationshipsCartItemRequest", + }, + ], +} as const + +export const $artItemBulkCustomDiscountResponse = { + title: "artItemBulkCustomDiscountResponse", + type: "object", + allOf: [ + { + $ref: "#/components/schemas/CartsCustomDiscountsResponse", + }, + { + $ref: "#/components/schemas/CustomDiscountRelationshipsCartItemRequest", + }, + ], +} as const + +export const $CartsCustomDiscountsObject = { + title: "CartsCustomDiscountsObject", + type: "object", + required: [ + "amount", + "description", + "discount_code", + "discount_engine", + "external_id", + "type", + ], + properties: { + amount: { + description: + "Specifies an amount to be applied for the custom discount. It must be less than zero.", + type: "number", + example: -1000, + }, + description: { + description: "Specifies a description for the custom discount.", + type: "string", + example: "Custom discount description", + }, + discount_code: { + description: "Specifies the discount code used for the custom discount.", + type: "string", + example: "cart-custom-promo-code", + }, + discount_engine: { + description: + "Specifies from where the custom discount is applied. For example, Talon.one.", + type: "string", + example: "Custom Discount Engine", + }, + external_id: { + description: "Specifies an external id for the custom discount.", + type: "string", + example: "custom-discount-external-id", + }, + type: { + description: + "Specifies the type of the resource. Always `custom_discount`.", + type: "string", + example: "custom_discount", + }, + }, +} as const + +export const $CartsCustomDiscountsResponse = { + title: "CartsCustomDiscountsResponse", + type: "object", + properties: { + amount: { + type: "object", + properties: { + amount: { + description: + "Specifies an amount to be applied for the custom discount. It must be less than zero.", + type: "number", + example: -1000, + }, + currency: { + description: "The currency set for the custom discount.", + type: "string", + example: "USD", + }, + formatted: { + description: "The formatted value for the custom discount.", + type: "string", + example: "-$10.00", + }, + }, + }, + description: { + description: "Specifies a description for the custom discount.", + type: "string", + example: "Custom discount description", + }, + discount_code: { + description: "Specifies the discount code used for the custom discount.", + type: "string", + example: "cart-custom-promo-code", + }, + discount_engine: { + description: + "Specifies from where the custom discount is applied. For example, Talon.one.", + type: "string", + example: "Custom Discount Engine", + }, + external_id: { + description: "Specifies an external id for the custom discount.", + type: "string", + example: "custom-discount-external-id", + }, + type: { + description: + "Specifies the type of the resource. Always `custom_discount`.", + type: "string", + example: "custom_discount", + }, + id: { + description: "Specifies the UUID of the custom discount.", + type: "string", + format: "uuid", + readOnly: true, + example: "662461ad-ddcb-4dbd-8ed7-ade9aa63b5f9", + }, + }, +} as const + +export const $CustomDiscountRelationshipsCartItemRequest = { + title: "CustomDiscountRelationshipsCartItemRequest", + type: "object", + required: ["type", "id"], + properties: { + relationships: { + type: "object", + properties: { + item: { + type: "object", + properties: { + data: { + type: "object", + properties: { + type: { + description: + "Specifies the type of item. For example, `custom_item` or `cart_item`.", + type: "string", + example: "cart_item", + }, + id: { + description: + "Specifies the unique identifier of the `cart_item` or `custom_item` in the cart.", + type: "string", + format: "uuid", + example: "5601a4b1-9d13-42d3-8fb7-03b35169d1b6", + }, + }, + }, + }, + }, + }, + }, + }, +} as const + +export const $CartItemRelationship = { + title: "CartItemRelationship", + type: "object", + required: ["type", "id"], + properties: { + relationships: { + type: "object", + properties: { + order: { + type: "object", + properties: { + data: { + type: "object", + properties: { + type: { + description: "This specifies the type of item.", + type: "string", + example: "order", + }, + id: { + description: + "This specifies the ID of the cart_item or custom_item in the cart.", + type: "string", + format: "uuid", + example: "5601a4b1-9d13-42d3-8fb7-03b35169d1b6", + }, + }, + }, + }, + }, + }, + }, + }, +} as const + +export const $CartsBulkTaxes = { + title: "CartsBulkTaxes", + type: "object", + properties: { + data: { + type: "array", + items: { + allOf: [ + { + $ref: "#/components/schemas/CartsItemsTaxesObject", + }, + { + $ref: "#/components/schemas/CartItemRelationship", + }, + ], + }, + }, + options: { + $ref: "#/components/schemas/AddAllOrNothingOptionsObject", + }, + }, +} as const + +export const $OrdersAnonymizeRequest = { + title: "OrdersAnonymizeRequest", + type: "object", + properties: { + data: { + $ref: "#/components/schemas/OrdersAnonymizeData", + }, + }, +} as const + +export const $OrdersAnonymizeData = { + title: "OrdersAnonymizeData", + type: "object", + properties: { + order_ids: { + description: + "The unique identifiers of the orders to be anonymized. You can anonymize multiple orders at the same time.", + type: "array", + items: { + type: "string", + }, + example: "{{orderID}}", + }, + }, +} as const + +export const $OrdersUpdateRequest = { + title: "OrdersUpdateRequest", + type: "object", + properties: { + data: { + oneOf: [ + { + $ref: "#/components/schemas/OrdersAddressData", + }, + { + $ref: "#/components/schemas/OrdersCancelData", + }, + { + $ref: "#/components/schemas/OrdersFulfulledData", + }, + ], + }, + }, +} as const + +export const $OrdersAddressData = { + title: "OrdersAddressData", + type: "object", + required: ["type", "shipping_address"], + properties: { + external_ref: { + description: + "Represents an optional external ID reference for an order. It can contain alphanumeric characters, special characters, and spaces, and does not required to be unique. The maximum allowed length is 64 characters. It can be used to include an external reference from a separate company system.", + type: "string", + example: "external_order_123", + }, + shipping_address: { + type: "object", + properties: { + first_name: { + description: "Specifies the first name of the address holder.", + type: "string", + example: "James", + }, + last_name: { + description: "Specifies the last name of the address holder.", + type: "string", + example: "Doe", + }, + phone_number: { + description: "Specifies the phone number of the address holder.", + type: "string", + example: 5558679305, + }, + company_name: { + description: "Specifies the company name.", + type: "string", + example: "company name", + }, + line_1: { + description: "Specifies the first line of the address.", + type: "string", + example: "1234 Disney Drive", + }, + line_2: { + description: "Specifies the second line of the address.", + type: "string", + example: "Disney Resort", + }, + city: { + description: + "Specifies the name of the city in the shipping address.", + type: "string", + example: "Anaheim", + }, + county: { + description: "Specifies the county of the shipping address.", + type: "string", + example: "Orange", + }, + region: { + description: + "Specifies the state, province, or region of the shipping address.", + type: "string", + example: "CA", + }, + postcode: { + description: "Specifies the postcode or ZIP code of the address.", + type: "string", + example: 92802, + }, + country: { + description: "Specifies the country in the shipping address.", + type: "string", + example: "US", + }, + instructions: { + description: + "Specifies any instructions provided with the shipping address.", + type: "string", + example: "Buzzer 10233", + }, + }, + }, + }, +} as const + +export const $OrdersCancelData = { + title: "OrdersCancelData", + type: "object", + required: ["type", "status"], + properties: { + status: { + description: + "The status of the order. You can only update the status to `cancelled`.", + type: "string", + example: "cancelled", + }, + type: { + description: "The type of the resource. You must use order.", + type: "string", + example: "order", + }, + external_ref: { + description: + "Represents an optional external ID reference for an order. It can contain alphanumeric characters, special characters, and spaces, and does not required to be unique. The maximum allowed length is 64 characters. It can be used to include an external reference from a separate company system.", + type: "string", + example: "external_order_123", + }, + }, +} as const + +export const $OrdersFulfulledData = { + title: "OrdersFulfulledData", + type: "object", + required: ["type", "shipping"], + properties: { + shipping: { + description: + "The shipping status of the order. You can only update the shipping status to `fulfilled`.", + type: "string", + example: "fulfilled", + }, + type: { + description: "The type of the resource. You must use order.", + type: "string", + example: "order", + }, + external_ref: { + description: + "Represents an optional external ID reference for an order. It can contain alphanumeric characters, special characters, and spaces, and does not required to be unique. The maximum allowed length is 64 characters. It can be used to include an external reference from a separate company system.", + type: "string", + example: "external_order_123", + }, + }, +} as const + +export const $PaymentsRequest = { + title: "PaymentsRequest", + type: "object", + properties: { + data: { + $ref: "#/components/schemas/Data.PaymentObject", + }, + }, +} as const + +export const $Data_BasePayments = { + title: "Data.BasePayments", + type: "object", + required: ["gateway", "method"], + properties: { + gateway: { + type: "string", + enum: [ + "adyen", + "authorize_net", + "braintree", + "card_connect", + "cyber_source", + "elastic_path_payments_stripe", + "manual", + "paypal_express_checkout", + "stripe", + "stripe_connect", + "stripe_payment_intents", + ], + }, + method: { + description: + "Specifies the transaction method, such as `purchase` or `authorize`.", + type: "string", + enum: ["authorize", "purchase", "purchase_setup", "authorize_setup"], + }, + amount: { + description: "The amount to be paid for the transaction.", + type: "number", + example: 10000, + }, + }, +} as const + +export const $Data_AdyenPayment = { + title: "Data.AdyenPayment", + required: ["payment", "gateway"], + allOf: [ + { + $ref: "#/components/schemas/Data.BasePayments", + }, + { + type: "object", + properties: { + gateway: { + description: "Specifies the gateway. You must use `adyen`.", + type: "string", + enum: ["adyen"], + }, + options: { + type: "object", + properties: { + shopper_reference: { + description: + "The shopper reference token associated with the saved payment method.", + type: "string", + }, + recurring_processing_model: { + description: "Enter CardOnFile for a one-time purchase.", + type: "string", + }, + }, + }, + payment: { + description: + "The Adyen recurringDetailReference payment method identifier.", + type: "string", + }, + }, + }, + ], +} as const + +export const $Data_AuthorizeNetPayment = { + title: "Data.AuthorizeNetPayment", + required: ["payment", "gateway"], + allOf: [ + { + $ref: "#/components/schemas/Data.BasePayments", + }, + { + type: "object", + properties: { + gateway: { + description: "Specifies the gateway. You must use `authorize_net`.", + type: "string", + enum: ["authorize_net"], + }, + options: { + type: "object", + properties: { + customer_payment_profile_id: { + description: "The Authorize.net customer payment profile ID.", + type: "string", + }, + }, + }, + payment: { + description: "The Authorize.net customer profile ID.", + type: "string", + }, + }, + }, + ], +} as const + +export const $Data_BraintreePayment = { + title: "Data.BraintreePayment", + required: ["payment", "gateway"], + allOf: [ + { + $ref: "#/components/schemas/Data.BasePayments", + }, + { + type: "object", + properties: { + gateway: { + description: "Specifies the gateway. You must use `braintree`.", + type: "string", + enum: ["braintree"], + }, + payment: { + description: "The Braintree Customer ID that you want to bill.", + type: "string", + }, + }, + }, + ], +} as const + +export const $Data_CardConnectPayment = { + title: "Data.CardConnectPayment", + required: ["payment", "gateway"], + allOf: [ + { + $ref: "#/components/schemas/Data.BasePayments", + }, + { + type: "object", + properties: { + gateway: { + description: "Specifies the gateway. You must use `card_connect`.", + type: "string", + enum: ["card_connect"], + }, + payment: { + description: + "Enter account_id, profile_id from CardPointe API. For example, 1|16178397535388255208.", + type: "string", + }, + }, + }, + ], +} as const + +export const $Data_CyberSourcePayment = { + title: "Data.CyberSourcePayment", + required: ["payment", "gateway"], + allOf: [ + { + $ref: "#/components/schemas/Data.BasePayments", + }, + { + type: "object", + properties: { + gateway: { + description: "Specifies the gateway. You must use `cyber_source`.", + type: "string", + enum: ["cyber_source"], + }, + payment: { + description: "The CyberSource token.", + type: "string", + }, + }, + }, + ], +} as const + +export const $ElasticPathPaymentsPoweredByStripePayment = { + title: "Elastic Path Payments Powered By Stripe", + required: ["gateway"], + allOf: [ + { + $ref: "#/components/schemas/Data.BasePayments", + }, + { + type: "object", + properties: { + gateway: { + description: + "Specifies the gateway. You must use `elastic_path_payments_stripe`.", + type: "string", + enum: ["elastic_path_payments_stripe"], + }, + options: { + type: "object", + properties: { + receipt_email: { + description: + "Provides the email address to which you want to send the Stripe receipts for the transactions within the store. This feature is available only in the live mode.", + type: "string", + }, + automatic_payment_methods: { + type: "object", + description: + "Parent object determining whether to use Stripe's `automatic_payment_methods` setting.", + properties: { + enabled: { + type: "boolean", + description: + "When set to true, it displays all enabled payment methods from the Stripe dashboard. When set to false, the Stripe default, which is card, is used.", + }, + }, + }, + }, + }, + payment_method_types: { + type: "array", + items: { + type: "string", + }, + description: + "Specifies the Stripe payment method types configured for the store. See [Stripe Documentation](https://docs.stripe.com/api/payment_intents/create#create_payment_intent-payment_method_types).", + example: "card", + }, + payment: { + description: "Specifies the Stripe token or source.", + type: "string", + }, + }, + }, + ], +} as const + +export const $Data_ManualPayment = { + title: "Data.ManualPayment", + required: ["gateway"], + allOf: [ + { + $ref: "#/components/schemas/Data.BasePayments", + }, + { + type: "object", + properties: { + gateway: { + description: + "Specifies the type of payment gateway. You must use `manual`.", + type: "string", + enum: ["manual"], + }, + paymentmethod_meta: { + type: "object", + properties: { + custom_reference: { + description: + "A reference associated with the payment method. This might include loyalty points or gift card identifiers. We recommend not to include personal information in this field.", + type: "string", + }, + name: { + description: "A custom name associated with the payment method.", + type: "string", + }, + }, + }, + }, + }, + ], +} as const + +export const $Data_PayPalExpressCheckoutPayment = { + title: "Data.PayPalExpressCheckoutPayment", + required: ["gateway"], + allOf: [ + { + $ref: "#/components/schemas/Data.BasePayments", + }, + { + type: "object", + properties: { + gateway: { + description: + "Specifies the type of payment gateway. You must use `paypal_express_checkout`.", + type: "string", + enum: ["paypal_express_checkout"], + }, + options: { + type: "object", + properties: { + description: { + description: "The description for the payment.", + type: "string", + }, + soft_descriptor: { + description: + "The descriptor appended to PayPal generated descriptor that is visible on the card statement of the payer.", + type: "string", + }, + application_context: { + type: "object", + properties: { + brand_name: { + description: + "The label that overrides the business name in the PayPal account on the payPal site.", + type: "string", + }, + locale: { + description: + "The locale pages that appear based on language and country code. PayPal supports a five-character code. For example, ja-JP.", + type: "string", + }, + landing_page: { + description: + "The type of landing page to show on the PayPal site for customer checkout. Use values LOGIN, BILLING, or NO_PREFERENCE.", + type: "string", + }, + shipping_preference: { + description: + "The shipping preference. Use SET_PROVIDED_ADDRESS value. This parameter does allow the user to change their address on PayPal site.", + type: "string", + }, + user_action: { + description: + "If you set `useraction=commit` in the query string, the flow redirects the buyer to the PayPal payment page and displays a Pay Now button. When the shopper clicks **Pay Now**, call `DoExpressCheckoutPayment` to complete the payment without additional interaction from the shopper. Choose this flow when you know the final payment amount when you initiate the checkout flow.", + type: "string", + }, + return_url: { + description: + "The callback URL for PayPal to redirect the user in the case of approved payment.", + type: "string", + }, + cancel_url: { + description: + "The callback URL for PayPal to redirect user in the case a cancelled payment.", + type: "string", + }, + }, + }, + }, + }, + }, + }, + ], +} as const + +export const $Data_StripePayment = { + title: "Data.StripePayment", + required: ["gateway"], + allOf: [ + { + $ref: "#/components/schemas/Data.BasePayments", + }, + { + type: "object", + properties: { + gateway: { + description: + "Specifies the type of payment gateway. You must use `stripe`.", + type: "string", + enum: ["stripe"], + }, + options: { + type: "object", + properties: { + receipt_email: { + description: + "The option to provide an email for Stripe receipts. Specify live mode to access this feature.", + type: "string", + }, + }, + }, + payment: { + description: "The Stripe token or source.", + type: "string", + }, + }, + }, + ], +} as const + +export const $Data_StripeConnectPayment = { + title: "Data.StripeConnectPayment", + required: ["gateway"], + allOf: [ + { + $ref: "#/components/schemas/Data.BasePayments", + }, + { + type: "object", + properties: { + gateway: { + description: + "Specifies the type of payment gateway. You must use `stripe_connect`.", + type: "string", + enum: ["stripe_connect"], + }, + options: { + type: "object", + properties: { + receipt_email: { + description: + "Provides the email address to which you want to send the Stripe receipts for the transactions within the store. This feature is available only in the live mode.", + type: "string", + }, + }, + }, + payment: { + description: "Specifies the Stripe token or source.", + type: "string", + }, + }, + }, + ], +} as const + +export const $Data_StripePaymentIntentsPayment = { + title: "Data.StripePaymentIntentsPayment", + required: ["gateway"], + allOf: [ + { + $ref: "#/components/schemas/Data.BasePayments", + }, + { + type: "object", + properties: { + gateway: { + description: + "Specifies the type of payment gateway. You must use `stripe_payment_intents`.", + type: "string", + enum: ["stripe_payment_intents"], + }, + options: { + type: "object", + properties: { + receipt_email: { + description: + "Provides the email address to which you want to send the Stripe receipts for the transactions within the store. This feature is available only in the live mode.", + type: "string", + }, + }, + }, + payment: { + description: "Specifies the Stripe token or source.", + type: "string", + }, + }, + }, + ], +} as const + +export const $Data_PaymentObject = { + oneOf: [ + { + $ref: "#/components/schemas/Data.AdyenPayment", + }, + { + $ref: "#/components/schemas/Data.AuthorizeNetPayment", + }, + { + $ref: "#/components/schemas/Data.BraintreePayment", + }, + { + $ref: "#/components/schemas/Data.CardConnectPayment", + }, + { + $ref: "#/components/schemas/Data.CyberSourcePayment", + }, + { + $ref: "#/components/schemas/ElasticPathPaymentsPoweredByStripePayment", + }, + { + $ref: "#/components/schemas/Data.ManualPayment", + }, + { + $ref: "#/components/schemas/Data.PayPalExpressCheckoutPayment", + }, + { + $ref: "#/components/schemas/Data.StripePayment", + }, + { + $ref: "#/components/schemas/Data.StripeConnectPayment", + }, + { + $ref: "#/components/schemas/Data.StripePaymentIntentsPayment", + }, + ], +} as const + +export const $TransactionResponse = { + title: "TransactionResponse", + type: "object", + properties: { + id: { + description: "The ID of the transaction.", + type: "string", + format: "uuid", + readOnly: true, + }, + reference: { + description: "The payment gateway reference.", + type: "string", + example: "manual", + }, + name: { + description: "A custom name associated with the payment method.", + type: "string", + example: "payment method name", + }, + custom_reference: { + description: + "A reference associated with the payment method. This might include loyalty points or gift card identifiers. We recommend you not to include personal information in this field.", + type: "string", + example: "custom reference", + }, + gateway: { + description: "The name of the payment gateway used.", + type: "string", + enum: [ + "adyen", + "authorize_net", + "braintree", + "card_connect", + "cyber_source", + "elastic_path_payments_stripe", + "manual", + "paypal_express_checkout", + "stripe", + "stripe_connect", + "stripe_payment_intents", + ], + }, + amount: { + description: "The amount for this transaction.", + type: "number", + example: 10000, + }, + refunded_amount: { + description: "The refunded amount.", + type: "number", + example: 0, + }, + currency: { + description: "The transaction currency.", + type: "string", + example: "USD", + }, + "transaction-type": { + description: + "The type of transaction, such as `purchase`, `capture`, `authorize` or `refund`.", + type: "string", + example: "capture", + }, + status: { + description: + "The status provided by the gateway for this transaction, such as `complete` or `failed`.", + type: "string", + example: "complete", + }, + relationships: { + type: "object", + properties: { + order: { + type: "object", + properties: { + data: { + type: "object", + properties: { + type: { + description: + "Represents the type of the object being returned. It is always `order`.", + type: "string", + example: "order", + }, + id: { + description: "The ID of the order.", + type: "string", + format: "uuid", + example: "5601a4b1-9d13-42d3-8fb7-03b35169d1b6", + }, + }, + }, + }, + }, + }, + }, + meta: { + type: "object", + properties: { + display_price: { + $ref: "#/components/schemas/FormattedPriceData", + }, + display_refunded_amount: { + $ref: "#/components/schemas/FormattedPriceData", + }, + timestamps: { + $ref: "#/components/schemas/Timestamps", + }, + }, + }, + }, +} as const + +export const $OrdersTransactionsConfirmRequest = { + title: "OrdersTransactionsConfirmRequest", + type: "object", + properties: { + data: { + type: "object", + }, + }, +} as const + +export const $OrdersTransactionsCaptureRequest = { + title: "OrdersTransactionsCaptureRequest", + type: "object", + properties: { + data: { + type: "object", + properties: { + options: { + type: "object", + properties: { + soft_descriptor: { + type: "string", + }, + note_to_payer: { + type: "string", + }, + }, + }, + }, + }, + }, +} as const + +export const $OrdersTransactionsRefundRequest = { + title: "OrdersTransactionsRefundRequest", + type: "object", + properties: { + data: { + type: "object", + properties: { + amount: { + description: + "The amount value to be refunded. If this field is not provided, it will be considered as manual refund (Mark as Refunded) and the refund process must be manually handled via payment provider. If the amount value is same as payment value, then it will be treated as a full refund and sent to the payment provider to process refund automatically.", + type: "number", + example: 1000, + }, + options: { + type: "object", + properties: { + note: { + description: + "Provides comments about the refund. It is used by PayPal Express.", + type: "string", + }, + }, + }, + }, + }, + }, +} as const + +export const $OrdersTransactionsCancelRequest = { + title: "OrdersTransactionsCancelRequest", + type: "object", + properties: { + data: { + type: "object", + properties: { + options: { + type: "object", + }, + reason: { + description: + "Specifies the reason for canceling the transaction. The reason may include `duplicate`, `fraudulent`, `requested_by_customer`, or `abandoned`.", + type: "string", + example: "requested_by_customer", + }, + }, + }, + }, +} as const + +export const $OrderPriceData = { + title: "OrderPriceData", + type: "object", + properties: { + amount: { + description: "The amount for this item.", + type: "number", + example: 10000, + }, + currency: { + description: "The currency this item.", + type: "string", + example: "USD", + }, + includes_tax: { + description: "Whether or not this price is tax inclusive.", + type: "boolean", + example: false, + }, + }, +} as const + +export const $FormattedPriceData = { + title: "FormattedPriceData", + type: "object", + properties: { + amount: { + description: "The raw total of this cart.", + type: "number", + example: 10000, + }, + currency: { + description: "The currency set for this cart.", + type: "string", + example: "USD", + }, + formatted: { + description: "The tax inclusive formatted total based on the currency.", + type: "string", + example: "$10.00", + }, + }, +} as const + +export const $OrderItemFormattedUnitPriceData = { + title: "OrderItemFormattedUnitPriceData", + type: "object", + properties: { + unit: { + $ref: "#/components/schemas/FormattedPriceData", + }, + value: { + $ref: "#/components/schemas/FormattedPriceData", + }, + }, +} as const + +export const $DiscountData = { + title: "DiscountData", + type: "object", + properties: { + amount: { + $ref: "#/components/schemas/OrderPriceData", + }, + code: { + type: "string", + example: "10_off", + }, + id: { + type: "string", + format: "uuid", + readOnly: true, + example: "a01cf221-751b-46e4-b612-57ad3c645ee6", + }, + }, +} as const + +export const $OrderItemResponse = { + title: "OrderItemResponse", + type: "object", + properties: { + type: { + description: "The type represents the object being returned.", + type: "string", + example: "order_item", + }, + id: { + description: "The unique identifier for this order item.", + type: "string", + format: "uuid", + readOnly: true, + example: "68bf8510-bebf-47b1-96ba-8a9930c7d928", + }, + quantity: { + description: "The quantity of this item were ordered.", + type: "number", + example: 1, + }, + product_id: { + description: "The unique identifier for this order item.", + type: "string", + format: "uuid", + readOnly: true, + example: "4e9c6098-9701-4839-a69c-54d8256d9012", + }, + name: { + description: "The name of this order item.", + type: "string", + example: "Product 123", + }, + sku: { + description: "The SKU code for the order item.", + type: "string", + example: "IFD-1", + }, + unit_price: { + $ref: "#/components/schemas/OrderPriceData", + }, + value: { + $ref: "#/components/schemas/OrderPriceData", + }, + discounts: { + type: "array", + items: { + $ref: "#/components/schemas/DiscountData", + }, + }, + links: { + type: "object", + }, + meta: { + type: "object", + properties: { + display_price: { + type: "object", + properties: { + with_tax: { + $ref: "#/components/schemas/OrderItemFormattedUnitPriceData", + }, + without_tax: { + $ref: "#/components/schemas/OrderItemFormattedUnitPriceData", + }, + tax: { + $ref: "#/components/schemas/OrderItemFormattedUnitPriceData", + }, + discount: { + $ref: "#/components/schemas/OrderItemFormattedUnitPriceData", + }, + without_discount: { + $ref: "#/components/schemas/OrderItemFormattedUnitPriceData", + }, + discounts: { + type: "object", + additionalProperties: { + type: "object", + properties: { + amount: { + type: "number", + example: -1000, + }, + currency: { + type: "string", + example: "USD", + }, + formatted: { + type: "string", + example: "-$1.00", + }, + }, + }, + }, + }, + }, + timestamps: { + $ref: "#/components/schemas/Timestamps", + }, + }, + }, + relationships: { + type: "object", + properties: { + cart_item: { + type: "object", + properties: { + data: { + type: "object", + properties: { + type: { + description: "The type represents the object being returned.", + type: "string", + example: "order_item", + }, + id: { + description: "The unique identifier for this item.", + type: "string", + format: "uuid", + readOnly: true, + example: "5601a4b1-9d13-42d3-8fb7-03b35169d1b6", + }, + }, + }, + }, + }, + }, + }, + catalog_id: { + description: + "The unique identifier of the catalog associated with the product is shown if `catalog_source=pim` is set.", + type: "string", + example: "default", + }, + catalog_source: { + description: "The catalog source. Always `pim` or `legacy`.", + type: "string", + example: "pim - legacy", + }, + }, +} as const + +export const $OrderResponse = { + title: "OrderResponse", + type: "object", + properties: { + type: { + description: + "Specifies the type of object being returned. You must use `order`.", + type: "string", + example: "order", + }, + id: { + description: "Specifies the unique identifier of the order.", + type: "string", + format: "uuid", + readOnly: true, + example: "aa854b8f-5930-476d-951a-e9b9cfbdefb1", + }, + status: { + description: + "Specifies the status of the order, such as `incomplete`, `complete`, `processing`, or `cancelled`.", + type: "string", + example: "complete - incomplete - cancelled", + }, + payment: { + description: + "Specifies the status of the payment, such as `unpaid`, `authorized`, `paid`, or `refunded`.", + type: "string", + example: "authorized - paid - unpaid - refunded", + }, + shipping: { + description: + "Specifies the status of the shipment, such as `fulfilled` or `unfulfilled`.", + type: "string", + example: "unfulfilled - fulfilled", + }, + anonymized: { + description: "Specifies if the order is anonymized.", + type: "boolean", + example: false, + }, + meta: { + $ref: "#/components/schemas/OrderMeta", + }, + billing_address: { + $ref: "#/components/schemas/BillingAddress", + }, + contact: { + $ref: "#/components/schemas/Contact", + }, + shipping_address: { + $ref: "#/components/schemas/ShippingAddress", + }, + }, +} as const + +export const $OrderMeta = { + title: "OrderMeta", + type: "object", + properties: { + timestamps: { + $ref: "#/components/schemas/Timestamps", + }, + with_tax: { + $ref: "#/components/schemas/FormattedPriceData", + }, + without_tax: { + $ref: "#/components/schemas/FormattedPriceData", + }, + tax: { + $ref: "#/components/schemas/FormattedPriceData", + }, + discount: { + $ref: "#/components/schemas/FormattedPriceData", + }, + paid: { + $ref: "#/components/schemas/FormattedPriceData", + }, + authorized: { + $ref: "#/components/schemas/FormattedPriceData", + }, + without_discount: { + $ref: "#/components/schemas/FormattedPriceData", + }, + }, +} as const + +export const $CustomerCheckout = { + title: "Customer Checkout", + type: "object", + properties: { + data: { + type: "object", + properties: { + customer: { + type: "object", + properties: { + id: { + description: "The ID of the customer.", + type: "string", + }, + }, + }, + billing_address: { + $ref: "#/components/schemas/BillingAddress", + }, + shipping_address: { + $ref: "#/components/schemas/ShippingAddress", + }, + }, + }, + }, +} as const + +export const $AccountCheckout = { + title: "Account Checkout", + type: "object", + properties: { + data: { + type: "object", + properties: { + account: { + type: "object", + properties: { + id: { + description: "The account ID.", + type: "string", + }, + member_id: { + description: "The account member ID.", + type: "string", + }, + }, + }, + contact: { + type: "object", + properties: { + name: { + description: "The name of the account member.", + type: "string", + }, + email: { + description: "The email address of the account member.", + type: "string", + format: "email", + }, + }, + }, + billing_address: { + $ref: "#/components/schemas/BillingAddress", + }, + shipping_address: { + $ref: "#/components/schemas/ShippingAddress", + }, + }, + }, + }, +} as const + +export const $BillingAddress = { + title: "BillingAddress", + type: "object", + required: [ + "first_name", + "last_name", + "line_1", + "region", + "postcode", + "country", + ], + properties: { + company_name: { + description: "Company name of the billing recipient.", + type: "string", + example: "John Doe Enterprises", + }, + country: { + description: "Specifies the country of the billing address.", + type: "string", + example: "US", + }, + county: { + description: "Specifies the county of the billing address.", + type: "string", + example: "Orange", + }, + first_name: { + description: "First name of the billing recipient.", + type: "string", + example: "John", + }, + last_name: { + description: "Last name of the billing recipient.", + type: "string", + example: "Doe", + }, + line_1: { + description: "First line of the billing address.", + type: "string", + example: "1 Sunny Street", + }, + line_2: { + description: "Second line of the billing address.", + type: "string", + }, + postcode: { + description: "Postcode of the billing address.", + type: "string", + example: "92802", + }, + region: { + description: + "Specifies state, province, or region of the billing address.", + type: "string", + example: "CA", + }, + }, +} as const + +export const $Contact = { + title: "Contact", + type: "object", + properties: { + email: { + description: "The email address of the contact.", + type: "string", + example: "johndoe@email.com", + }, + name: { + description: "The name of the contact.", + type: "string", + example: "John Doe", + }, + }, +} as const + +export const $ShippingAddress = { + title: "ShippingAddress", + type: "object", + required: [ + "first_name", + "last_name", + "line_1", + "region", + "postcode", + "country", + ], + properties: { + company_name: { + description: "Company of the shipping recipient.", + type: "string", + example: "John Doe Enterprises", + }, + country: { + description: "Specifies the country of the shipping address.", + type: "string", + example: "US", + }, + county: { + description: "Specifies the county of the shipping address.", + type: "string", + example: "Orange", + }, + first_name: { + description: "First name of the shipping recipient.", + type: "string", + example: "John", + }, + last_name: { + description: "Last name of the shipping recipient.", + type: "string", + example: "Doe", + }, + line_1: { + description: "First line of the shipping address.", + type: "string", + example: "1 Sunny Street", + }, + line_2: { + description: "Second line of the shipping address.", + type: "string", + }, + postcode: { + description: "Post code of the shipping address.", + type: "string", + example: "92802", + }, + region: { + description: + "Specifies the state, province, or region of the shipping address.", + type: "string", + example: "CA", + }, + }, +} as const + +export const $Response_Meta_Carts = { + type: "object", + properties: { + page: { + $ref: "#/components/schemas/Response.PaginationPage", + }, + results: { + $ref: "#/components/schemas/Response.PaginationResults", + }, + }, +} as const + +export const $Response_Meta_Orders = { + type: "object", + properties: { + page: { + $ref: "#/components/schemas/Response.PaginationPage", + }, + results: { + $ref: "#/components/schemas/Response.PaginationResults", + }, + }, +} as const + +export const $Response_PaginationPage = { + type: "object", + properties: { + current: { + description: "The current page.", + type: "integer", + }, + limit: { + description: + "The maximum number of records per page for this response. You can set this value up to 100.", + type: "integer", + }, + offset: { + description: + "The current offset by number of records, not pages. Offset is zero-based.", + type: "integer", + }, + total: { + description: "The total page count.", + type: "integer", + }, + }, +} as const + +export const $Response_PaginationResults = { + type: "object", + properties: { + total: { + description: "The total page count.", + type: "integer", + }, + }, +} as const + +export const $Response_PageLinks = { + type: "object", + properties: { + current: { + description: "Always the current page.", + type: "string", + }, + first: { + description: "Always the first page.", + type: "string", + }, + last: { + description: "If there is only one page, it is `null`.", + type: "string", + }, + next: { + description: "If there is only one page, it is `null`.", + type: "string", + }, + prev: { + description: "if the user is on the first page, it is `null`.", + type: "string", + }, + }, +} as const + +export const $Response_Data = { + type: "object", + properties: { + data: {}, + }, +} as const + +export const $Response_Error = { + type: "array", + properties: { + detail: { + type: "string", + }, + status: { + type: "string", + }, + title: { + type: "string", + }, + }, +} as const + +export const $Timestamps = { + type: "object", + properties: { + created_at: { + description: "The date this was created.", + type: "string", + example: "2023-11-07T23:04:18.845Z", + }, + updated_at: { + description: "The date this was last updated.", + example: "2023-11-07T23:04:18.845Z", + }, + }, +} as const + +export const $CartTimestamps = { + type: "object", + properties: { + created_at: { + type: "string", + example: "2023-11-07T23:04:18.845Z", + }, + updated_at: { + example: "2023-11-07T23:04:18.845Z", + }, + expires_at: { + example: "2023-11-12T23:04:18.845Z", }, }, } as const diff --git a/packages/sdks/shopper/src/client/services.gen.ts b/packages/sdks/shopper/src/client/services.gen.ts index d3eba25f..37a60a4e 100644 --- a/packages/sdks/shopper/src/client/services.gen.ts +++ b/packages/sdks/shopper/src/client/services.gen.ts @@ -2,6 +2,51 @@ import { client, type Options } from "@hey-api/client-fetch" import { + type GetByContextReleaseData, + type GetByContextReleaseError, + type GetByContextReleaseResponse, + type GetByContextAllHierarchiesData, + type GetByContextAllHierarchiesError, + type GetByContextAllHierarchiesResponse, + type GetByContextHierarchyData, + type GetByContextHierarchyError, + type GetByContextHierarchyResponse, + type GetByContextHierarchyNodesData, + type GetByContextHierarchyNodesError, + type GetByContextHierarchyNodesResponse, + type GetByContextHierarchyChildNodesData, + type GetByContextHierarchyChildNodesError, + type GetByContextHierarchyChildNodesResponse, + type GetByContextAllNodesData, + type GetByContextAllNodesError, + type GetByContextAllNodesResponse, + type GetByContextNodeData, + type GetByContextNodeError, + type GetByContextNodeResponse, + type GetByContextChildNodesData, + type GetByContextChildNodesError, + type GetByContextChildNodesResponse, + type GetByContextAllProductsData, + type GetByContextAllProductsError, + type GetByContextAllProductsResponse, + type GetByContextProductData, + type GetByContextProductError, + type GetByContextProductResponse, + type GetByContextComponentProductIdsData, + type GetByContextComponentProductIdsError, + type GetByContextComponentProductIdsResponse, + type GetByContextChildProductsData, + type GetByContextChildProductsError, + type GetByContextChildProductsResponse, + type GetByContextProductsForHierarchyData, + type GetByContextProductsForHierarchyError, + type GetByContextProductsForHierarchyResponse, + type GetByContextProductsForNodeData, + type GetByContextProductsForNodeError, + type GetByContextProductsForNodeResponse, + type ConfigureByContextProductData, + type ConfigureByContextProductError, + type ConfigureByContextProductResponse, type CreateCatalogData, type CreateCatalogError, type CreateCatalogResponse, @@ -85,51 +130,142 @@ import { type GetProductsForNodeData, type GetProductsForNodeError, type GetProductsForNodeResponse, - type GetByContextReleaseData, - type GetByContextReleaseError, - type GetByContextReleaseResponse, - type GetByContextAllHierarchiesData, - type GetByContextAllHierarchiesError, - type GetByContextAllHierarchiesResponse, - type GetByContextHierarchyData, - type GetByContextHierarchyError, - type GetByContextHierarchyResponse, - type GetByContextHierarchyNodesData, - type GetByContextHierarchyNodesError, - type GetByContextHierarchyNodesResponse, - type GetByContextHierarchyChildNodesData, - type GetByContextHierarchyChildNodesError, - type GetByContextHierarchyChildNodesResponse, - type GetByContextAllNodesData, - type GetByContextAllNodesError, - type GetByContextAllNodesResponse, - type GetByContextNodeData, - type GetByContextNodeError, - type GetByContextNodeResponse, - type GetByContextChildNodesData, - type GetByContextChildNodesError, - type GetByContextChildNodesResponse, - type GetByContextAllProductsData, - type GetByContextAllProductsError, - type GetByContextAllProductsResponse, - type GetByContextProductData, - type GetByContextProductError, - type GetByContextProductResponse, - type GetByContextComponentProductIdsData, - type GetByContextComponentProductIdsError, - type GetByContextComponentProductIdsResponse, - type GetByContextChildProductsData, - type GetByContextChildProductsError, - type GetByContextChildProductsResponse, - type GetByContextProductsForHierarchyData, - type GetByContextProductsForHierarchyError, - type GetByContextProductsForHierarchyResponse, - type GetByContextProductsForNodeData, - type GetByContextProductsForNodeError, - type GetByContextProductsForNodeResponse, - type ConfigureByContextProductData, - type ConfigureByContextProductError, - type ConfigureByContextProductResponse, + type GetCartsData, + type GetCartsError, + type GetCartsResponse, + type CreateAcartData, + type CreateAcartError, + type CreateAcartResponse, + type GetCartData, + type GetCartError, + type GetCartResponse, + type UpdateAcartData, + type UpdateAcartError, + type UpdateAcartResponse, + type DeleteAcartData, + type DeleteAcartError, + type DeleteAcartResponse, + type GetCartItemsData, + type GetCartItemsError, + type GetCartItemsResponse, + type BulkUpdateItemsInCartData, + type BulkUpdateItemsInCartError, + type BulkUpdateItemsInCartResponse, + type ManageCartsData, + type ManageCartsError, + type ManageCartsResponse, + type DeleteAllCartItemsData, + type DeleteAllCartItemsError, + type DeleteAllCartItemsResponse, + type UpdateAcartItemData, + type UpdateAcartItemError, + type UpdateAcartItemResponse, + type DeleteAcartItemData, + type DeleteAcartItemError, + type DeleteAcartItemResponse, + type CreateAccountCartAssociationData, + type CreateAccountCartAssociationError, + type CreateAccountCartAssociationResponse, + type DeleteAccountCartAssociationData, + type DeleteAccountCartAssociationError, + type DeleteAccountCartAssociationResponse, + type CreateCustomerCartAssociationData, + type CreateCustomerCartAssociationError, + type CreateCustomerCartAssociationResponse, + type DeleteCustomerCartAssociationData, + type DeleteCustomerCartAssociationError, + type DeleteCustomerCartAssociationResponse, + type DeleteApromotionViaPromotionCodeData, + type DeleteApromotionViaPromotionCodeError, + type DeleteApromotionViaPromotionCodeResponse, + type AddTaxItemToCartData, + type AddTaxItemToCartError, + type AddTaxItemToCartResponse, + type BulkAddTaxItemsToCartData, + type BulkAddTaxItemsToCartError, + type BulkAddTaxItemsToCartResponse, + type BulkDeleteTaxItemsFromCartData, + type BulkDeleteTaxItemsFromCartError, + type BulkDeleteTaxItemsFromCartResponse, + type UpdateAtaxItemData, + type UpdateAtaxItemError, + type UpdateAtaxItemResponse, + type DeleteAtaxItemData, + type DeleteAtaxItemError, + type DeleteAtaxItemResponse, + type BulkAddCustomDiscountsToCartData, + type BulkAddCustomDiscountsToCartError, + type BulkAddCustomDiscountsToCartResponse, + type BulkDeleteCustomDiscountsFromCartData, + type BulkDeleteCustomDiscountsFromCartError, + type BulkDeleteCustomDiscountsFromCartResponse, + type UpdateCustomDiscountForCartData, + type UpdateCustomDiscountForCartError, + type UpdateCustomDiscountForCartResponse, + type DeleteCustomDiscountFromCartData, + type DeleteCustomDiscountFromCartError, + type DeleteCustomDiscountFromCartResponse, + type AddCustomDiscountToCartItemData, + type UpdateCustomDiscountForCartItemData, + type DeleteCustomDiscountFromCartItemData, + type DeleteCustomDiscountFromCartItemError, + type DeleteCustomDiscountFromCartItemResponse, + type CreateCartPaymentIntentData, + type CreateCartPaymentIntentError, + type CreateCartPaymentIntentResponse, + type CheckoutApiData, + type CheckoutApiError, + type CheckoutApiResponse, + type GetCustomerOrdersData, + type GetCustomerOrdersError, + type GetCustomerOrdersResponse, + type GetAnOrderData, + type GetAnOrderError, + type GetAnOrderResponse, + type UpdateAnOrderData, + type UpdateAnOrderError, + type UpdateAnOrderResponse, + type GetOrderItemsData, + type GetOrderItemsError, + type GetOrderItemsResponse, + type AnonymizeOrdersData, + type AnonymizeOrdersError, + type AnonymizeOrdersResponse, + type AuthorizeSetupData, + type AuthorizeSetupError, + type AuthorizeSetupResponse, + type ConfirmSetupData, + type ConfirmSetupError, + type ConfirmSetupResponse, + type CaptureAtransactionData, + type CaptureAtransactionError, + type CaptureAtransactionResponse, + type RefundAtransactionData, + type RefundAtransactionError, + type RefundAtransactionResponse, + type GetOrderTransactionsData, + type GetOrderTransactionsError, + type GetOrderTransactionsResponse, + type GetAtransactionData, + type GetAtransactionError, + type GetAtransactionResponse, + type CancelAtransactionData, + type CancelAtransactionError, + type CancelAtransactionResponse, + GetByContextReleaseResponseTransformer, + GetByContextAllHierarchiesResponseTransformer, + GetByContextHierarchyResponseTransformer, + GetByContextHierarchyNodesResponseTransformer, + GetByContextHierarchyChildNodesResponseTransformer, + GetByContextAllNodesResponseTransformer, + GetByContextNodeResponseTransformer, + GetByContextChildNodesResponseTransformer, + GetByContextAllProductsResponseTransformer, + GetByContextProductResponseTransformer, + GetByContextChildProductsResponseTransformer, + GetByContextProductsForHierarchyResponseTransformer, + GetByContextProductsForNodeResponseTransformer, + ConfigureByContextProductResponseTransformer, CreateCatalogResponseTransformer, GetCatalogsResponseTransformer, GetCatalogByIdResponseTransformer, @@ -153,327 +289,272 @@ import { GetChildProductsResponseTransformer, GetProductsForHierarchyResponseTransformer, GetProductsForNodeResponseTransformer, - GetByContextReleaseResponseTransformer, - GetByContextAllHierarchiesResponseTransformer, - GetByContextHierarchyResponseTransformer, - GetByContextHierarchyNodesResponseTransformer, - GetByContextHierarchyChildNodesResponseTransformer, - GetByContextAllNodesResponseTransformer, - GetByContextNodeResponseTransformer, - GetByContextChildNodesResponseTransformer, - GetByContextAllProductsResponseTransformer, - GetByContextProductResponseTransformer, - GetByContextChildProductsResponseTransformer, - GetByContextProductsForHierarchyResponseTransformer, - GetByContextProductsForNodeResponseTransformer, - ConfigureByContextProductResponseTransformer, } from "./types.gen" /** - * Creates a new catalog - * Before you create a catalog, you must define the following resources: - * - * - Hierarchies - hierarchies and nodes to categorize the products. - * - Products - product information, associated assets, and links to hierarchy nodes. - * - Price Books - prices for the products associated with the hierarchies. You can create multiple price books for different scenarios, such as seasonal sales, business versus retail customer pricing, and reward programs. When creating a catalog, you can specify up to five price books. You must configure a priority for your price books. Product prices are displayed in the catalog according to the priority of the price books. Priority is a number and the price book with the highest number has the highest priority. - * + * Get the catalog release as shoppers + * Returns a list of all published releases of the specified catalog. */ -export const createCatalog = (options: Options) => { - return (options?.client ?? client).post< - CreateCatalogResponse, - CreateCatalogError +export const getByContextRelease = ( + options?: Options, +) => { + return (options?.client ?? client).get< + GetByContextReleaseResponse, + GetByContextReleaseError >({ ...options, - url: "/pcm/catalogs", - responseTransformer: CreateCatalogResponseTransformer, + url: "/catalog", + responseTransformer: GetByContextReleaseResponseTransformer, }) } /** - * Gets all authorized catalogs - * Retrieves a list of all the catalogs that you are authorized to view. Currently, published catalogs are limited to the current release and two releases prior to the current release. You can see the differences between the last 2 consecutive catalog releases using the delta link returned in the response of a [publish a catalog](/docs/api/pxm/catalog/publish-release) endpoint. + * Get all Hierarchies + * Returns all hierarchies from a catalog. * - * You can use the `is_full_delta` attribute returned from the `get a release of a catalog` endpoint to determine if you need to refresh the data in your company system before publishing a catalog release and injecting fresh data in a delta link. The `is_full_delta` attribute tells you if this is a full publish of a catalog release. Using a search service as an example, if the `is_full_delta` attribute is `true`, you should remove all data about that catalog from the search service before publishing a catalog release and injecting fresh data from the delta file. See [Publish a catalog](/docs/api/pxm/catalog/publish-release). + * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). * - * If the `is_full_publish` attribute returned in the response is `false`, data from the previous catalog release overlaid the existing data in the delta file. The `is_full_publish` attribute is always `true` the first time a catalog is published. + * ### Filtering + * + * This endpoint supports filtering. For general syntax, see [Filtering](/guides/Getting-Started/filtering). + * + * | Operator | Description | Supported Attributes | Example | + * |:--- |:--- |:--- |:--- | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | + * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | + * + * ### Building breadcrumbs in a storefront + * + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + * + * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + * + * - Specify the node Ids in the filter expression. + * - You can have as many node Ids as you want. + * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. * */ -export const getCatalogs = (options?: Options) => { - return (options?.client ?? client).get( - { - ...options, - url: "/pcm/catalogs", - responseTransformer: GetCatalogsResponseTransformer, - }, - ) -} - -/** - * Get a catalog by ID - * Retrieves the specified catalog. - */ -export const getCatalogById = (options: Options) => { +export const getByContextAllHierarchies = ( + options?: Options, +) => { return (options?.client ?? client).get< - GetCatalogByIdResponse, - GetCatalogByIdError + GetByContextAllHierarchiesResponse, + GetByContextAllHierarchiesError >({ ...options, - url: "/pcm/catalogs/{catalog_id}", - responseTransformer: GetCatalogByIdResponseTransformer, + url: "/catalog/hierarchies", + responseTransformer: GetByContextAllHierarchiesResponseTransformer, }) } /** - * Updates a catalog - * Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the catalog is not updated. + * Get a Hierarchy + * Returns a hierarchy from the catalog. + * + * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog to retrieve. For information about how catalog rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules). + * */ -export const updateCatalog = (options: Options) => { - return (options?.client ?? client).put< - UpdateCatalogResponse, - UpdateCatalogError +export const getByContextHierarchy = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetByContextHierarchyResponse, + GetByContextHierarchyError >({ ...options, - url: "/pcm/catalogs/{catalog_id}", - responseTransformer: UpdateCatalogResponseTransformer, + url: "/catalog/hierarchies/{hierarchy_id}", + responseTransformer: GetByContextHierarchyResponseTransformer, }) } /** - * Deletes a catalog - * Deletes an unpublished catalog. Use [**Delete a Release**](/docs/api/pxm/catalog/delete-release-by-id) and [**Delete All Releases**](/docs/api/pxm/catalog/delete-releases) to delete releases of a catalog. If the catalog is associated with any catalog rules, you must first update the catalog rules to remove the catalog. + * Get a Hierarchy's Nodes + * Returns all the nodes for the specified hierarchy. + * + * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + * + * In the `bread_crumb` metadata, you can identify the parent nodes that a node is associated with. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). + * + * ### Filtering + * + * This endpoint supports filtering. For general syntax, see [Filtering](/guides/Getting-Started/filtering). + * + * | Operator | Description | Supported Attributes | Example | + * |:--- |:--- |:--- |:--- | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | + * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | + * + * ### Building breadcrumbs in a storefront + * + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + * + * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + * + * - Specify the node Ids in the filter expression. + * - You can have as many node Ids as you want. + * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + * */ -export const deleteCatalogById = (options: Options) => { - return (options?.client ?? client).delete< - DeleteCatalogByIdResponse, - DeleteCatalogByIdError +export const getByContextHierarchyNodes = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetByContextHierarchyNodesResponse, + GetByContextHierarchyNodesError >({ ...options, - url: "/pcm/catalogs/{catalog_id}", + url: "/catalog/hierarchies/{hierarchy_id}/nodes", + responseTransformer: GetByContextHierarchyNodesResponseTransformer, }) } /** - * Publishes a catalog + * Get a Hierarchy's Children + * Returns the parent nodes for the specified hierarchy. * - * Publishes a catalog. You must publish a catalog before you can retrieve that catalog in an organization or store. The hierarchies, live products, and prices associated with a published catalog are in read-only mode. If you make a change to these resources, for example, a change to your price book or hierarchies, you need to republish the catalog. + * ![Parent Nodes](/assets/rootnodes.PNG) * - * You can get [a catalog release](/docs/api/pxm/catalog/get-release-by-id) to retrieve a published catalog. Currently, published catalogs are limited to the current release and two releases prior to the current release. + * If you have multiple catalog rules defined, the rule that best matches the shopperʼs context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). * - * You can see the differences between the last 2 consecutive catalog releases. This is useful if want to understand how your products have changed in your catalog, ensuring your site search integration is kept up-to-date. + * In the `bread_crumb` metadata, you can identify the parent nodes that a node is associated with. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). * - * Once a catalog release has completed publishing, the delta relationship links to the delta document. + * ### Filtering * - * The `delta` links are signed and only valid for 1 hour. Re-reading a catalog release, for example, using [Getting a release of a catalog](/docs/pxm/catalogs/catalog-latest-release/get-a-release-of-a-catalog) returns a fresh a link. - * - * You can use the `is_full_delta` attribute returned from the `get a release of a catalog` endpoint to determine if you need to refresh the data in your company system before injecting fresh data in a `delta` link. The `is_full_delta` attribute tells you if this is a full publish of the catalog. Using a search service as an example, if the `is_full_delta` attribute is `true`, you should remove all data about that catalog from the search service before injecting fresh data from the `delta` file. If the `is_full_delta` attribute is `false`, then data from the previous catalog overlays the existing data in the `delta` file. To publish a catalog and inject fresh data in a `delta` link, set `export_full_delta` to `true`. - * - * If a previous catalog publish date is greater than 90 days, then a full catalog publish is automatically performed. If you publish your catalogs infrequently, Commerce may perform a full publish when you are expecting a delta publish. - * - * :::caution - * - * Generating a full delta is resource intensive and slows down the publishing process and so should only be performed in certain circumstances, for example, when initializing an integration with a service like Algolia. - * - * ::: - * - * The `is_full_delta` attribute is always `true` the first time a catalog is published. The information is stored in a collection of `json` documents in a compressed file. You can either manually check the file or, for example, use them to automatically update another company system you may have. - * - * - Delta files are only available for 30 days. - * - Delta files are removed when a catalog release is deleted. - * - * Each document has a `delta_type` with one of the following values, depending on whether a product has been deleted, updated or created in a catalog release. + * The following operators and attributes are available when filtering on this endpoint. * - * - `delete` describes products deleted from this release of a catalog. - * - `createupdate` describes products updated in this release of a catalog. + * | Operator | Description | Supported Attributes | Example | + * |:--- |:--- |:--- |:--- | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | + * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | * - * ### Multi-Store Management Solutions + * For more information, see [Filtering](/guides/Getting-Started/filtering). * - * In a multi-store management solution. + * ### Building breadcrumbs in a storefront * - * - You can create organization catalogs. Your organization catalogs are available for your stores to use. - * - Your stores can create their own catalogs. - * - Your stores can create catalogs that have a combination of organization products and store products. + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. * - * If you are publishing a catalog in a store that contains resources from an organization, in Commerce Manager, you must enable the **Include Organization Resources in Catalog Publishes** checkbox. + * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` * - * 1. Go to **SYSTEM** > **Store Settings**. - * 2. Click **General Settings**. - * 3. Select **PXM** from the list. - * 4. Select the **Include Organization Resources in Catalog Publishes** checkbox. + * - Specify the node Ids in the filter expression. + * - You can have as many node Ids as you want. + * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. * */ -export const publishRelease = (options: Options) => { - return (options?.client ?? client).post< - PublishReleaseResponse, - PublishReleaseError +export const getByContextHierarchyChildNodes = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetByContextHierarchyChildNodesResponse, + GetByContextHierarchyChildNodesError >({ ...options, - url: "/pcm/catalogs/{catalog_id}/releases", - responseTransformer: PublishReleaseResponseTransformer, + url: "/catalog/hierarchies/{hierarchy_id}/children", + responseTransformer: GetByContextHierarchyChildNodesResponseTransformer, }) } /** - * Gets all authorized catalog releases - * Returns a list of all published releases of the specified catalog. Currently, published catalogs are limited to the current release and two releases prior to the current release. You can see the differences between the last 2 consecutive catalog releases using the `delta` link returned in the response of a `publish a catalog` endpoint. + * Get all Nodes + * Returns all nodes in the catalog. * - * You can use the `is_full_delta` attribute returned from the `get a release of a catalog` endpoint to determine if you need to refresh the data in your company system before publishing a catalog release and injecting fresh data in a delta link. The `is_full_delta` attribute tells you if this is a full publish of a catalog release. Using a search service as an example, if the `is_full_delta` attribute is `true`, you should remove all data about that catalog from the search service before publishing a catalog release and injecting fresh data from the delta file. + * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). * - * If the `is_full_publish` attribute returned in the response is `false`, data from the previous catalog release overlaid the existing data in the delta file. The `is_full_publish` attribute is always `true` the first time a catalog is published. + * You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). * - */ -export const getReleases = (options: Options) => { - return (options?.client ?? client).get( - { - ...options, - url: "/pcm/catalogs/{catalog_id}/releases", - responseTransformer: GetReleasesResponseTransformer, - }, - ) -} - -/** - * Deletes all releases - * Deletes all releases of the specified published catalog. - */ -export const deleteReleases = (options: Options) => { - return (options?.client ?? client).delete< - DeleteReleasesResponse, - DeleteReleasesError - >({ - ...options, - url: "/pcm/catalogs/{catalog_id}/releases", - }) -} - -/** - * Get a catalog release by ID - * Retrieves the specified catalog release. - */ -export const getReleaseById = (options: Options) => { - return (options?.client ?? client).get< - GetReleaseByIdResponse, - GetReleaseByIdError - >({ - ...options, - url: "/pcm/catalogs/{catalog_id}/releases/{release_id}", - responseTransformer: GetReleaseByIdResponseTransformer, - }) -} - -/** - * Deletes a release - * Deletes the specified published catalog release. - */ -export const deleteReleaseById = (options: Options) => { - return (options?.client ?? client).delete< - DeleteReleaseByIdResponse, - DeleteReleaseByIdError - >({ - ...options, - url: "/pcm/catalogs/{catalog_id}/releases/{release_id}", - }) -} - -/** - * Creates a new catalog rule - * If you have multiple catalogs, create catalog rule resources. With catalog rules, you can display different catalogs to different shoppers. For example, you can display a preferred pricing catalog to a few special customers. Or you can display one catalog to shoppers using your website and a different catalog to shoppers using your mobile app. Finally, you can define custom criteria by creating tags. + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. For more information, see [Building breadcrumbs in a storefront](#building-breadcrumbs-in-a-storefront). * - * :::note + * The response lists the products associated with the nodes. If products are [curated](/guides/How-To/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront. * - * - If you have one catalog for all customers and channels, you can omit creating this resource. - * - Due to the way catalogs are cached in Commerce, using catalog rules to display catalogs sometimes causes a 5-minute time delay before the catalogs are displayed. - * - You cannot create catalog rules for organization catalogs. + * - You can only curate 20 products or less. You cannot have more than 20 curated products. + * - If a curated product is removed from a node, the product is also removed from the `curated_products` list. * - * ::: + * ### Filtering * - * For ideas about the kinds of business scenarios you can achieve with catalog rules, see [Catalog Rules](/docs/api/pxm/catalog/rules). To understand how catalogs are matched to shoppers by using rules, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + * This endpoint supports filtering. For general syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available. * - */ -export const createRule = (options: Options) => { - return (options?.client ?? client).post({ - ...options, - url: "/pcm/catalogs/rules", - responseTransformer: CreateRuleResponseTransformer, - }) -} - -/** - * Gets all authorized catalog rules - * Retrieves all authorized catalog rules. + * | Operator | Description | Attributes | Example | + * | --- | --- | --- | --- | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug` | `filter=eq(name,some-name)` | + * | `in` | Checks if the values are included in the specified string. If they are, the condition is true. + * | `Id` | `filter=in(id,9214719b-17fe-4ea7-896c-d61e60fc0d05,e104d541-2c52-47fa-8a9a-c4382480d97c,65daaf68-ff2e-4632-8944-370de835967d)` | * - * ### Filtering + * ### Building breadcrumbs in a storefront * - * This endpoint supports filtering. For general filtering syntax, see [Filtering](https://elasticpath.dev/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are supported. + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. * - * | Operator | Description | Supported Attributes | Example | - * |:--- |:--- |:--- |:--- | - * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | + * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + * + * - Specify the node Ids in the filter expression. + * - You can have as many node Ids as you want. + * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. * */ -export const getRules = (options?: Options) => { - return (options?.client ?? client).get({ - ...options, - url: "/pcm/catalogs/rules", - responseTransformer: GetRulesResponseTransformer, - }) -} - -/** - * Get a catalog rule by ID - */ -export const getRuleById = (options: Options) => { - return (options?.client ?? client).get( - { - ...options, - url: "/pcm/catalogs/rules/{catalog_rule_id}", - responseTransformer: GetRuleByIdResponseTransformer, - }, - ) -} - -/** - * Updates a catalog rule - * Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the catalog rule is not updated. - */ -export const updateRule = (options: Options) => { - return (options?.client ?? client).put({ +export const getByContextAllNodes = ( + options?: Options, +) => { + return (options?.client ?? client).get< + GetByContextAllNodesResponse, + GetByContextAllNodesError + >({ ...options, - url: "/pcm/catalogs/rules/{catalog_rule_id}", - responseTransformer: UpdateRuleResponseTransformer, + url: "/catalog/nodes", + responseTransformer: GetByContextAllNodesResponseTransformer, }) } /** - * Deletes a catalog rule + * Get a Node + * Returns a node from the catalog. + * + * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + * + * You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). + * + * The response lists the products associated with a node. If products are [curated](/guides/How-To/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your nodes, enabling you to create unique product collections in your storefront. + * + * - If you don't provide any `curated_products`, products are listed by their `updated_at` time in descending order, with the most recently updated product first. + * - If you configure `curated_products` for only a few products, the curated products are displayed first and the other products are displayed in the order of `updated_at` time. + * - You can only curate 20 products or less. You cannot have more than 20 curated products. + * - A product that is curated has the `"curated_product": true` attribute displayed. + * - If a curated product is removed from a node, the product is also removed from the `curated_products` list. + * */ -export const deleteRuleById = (options: Options) => { - return (options?.client ?? client).delete< - DeleteRuleByIdResponse, - DeleteRuleByIdError +export const getByContextNode = (options: Options) => { + return (options?.client ?? client).get< + GetByContextNodeResponse, + GetByContextNodeError >({ ...options, - url: "/pcm/catalogs/rules/{catalog_rule_id}", + url: "/catalog/nodes/{node_id}", + responseTransformer: GetByContextNodeResponseTransformer, }) } /** - * Get all Hierarchies - * Returns the hierarchies from a published catalog. + * Get a Node's Children + * Returns the child nodes for a node in the catalog. * - * :::note + * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). * - * Currently, published catalogs are limited to the current release and two releases prior to the current release. + * You can see which parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). * - * ::: + * The response lists the products associated with the nodes. If products are [curated](/guides/How-To/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront. + * + * - If you don't provide any curated_products, products are listed by their updated_at time in descending order, with the most recently updated product first. + * - If you configure curated_products for only a few products, the curated products are displayed first and the other products are displayed in the order of updated_at time. + * - You can only curate 20 products or less. You cannot have more than 20 curated products. + * - A product that is curated has the "curated_product": true attribute displayed. + * - If a curated product is removed from a node, the product is also removed from the curated_products list. * * ### Filtering * - * This endpoint supports filtering. For general syntax, see [Filtering](https://beta.elasticpath.dev/docs/commerce-cloud/api-overview/filtering). + * This endpoint supports filtering. For general syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available. * - * | Operator | Description | Supported Attributes | Example | - * |:--- |:--- |:--- |:--- | - * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | - * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | + * | Operator | Description | Attributes | Example | + * | --- | --- | --- | --- | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug` | `filter=eq(name,some-name)` | + * | `in` | Checks if the values are included in the specified string. If they are, the condition is true. + * | `Id` | `filter=in(id,9214719b-17fe-4ea7-896c-d61e60fc0d05,e104d541-2c52-47fa-8a9a-c4382480d97c,65daaf68-ff2e-4632-8944-370de835967d)` | * * ### Building breadcrumbs in a storefront * @@ -486,59 +567,52 @@ export const deleteRuleById = (options: Options) => { * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. * */ -export const getAllHierarchies = (options: Options) => { +export const getByContextChildNodes = ( + options: Options, +) => { return (options?.client ?? client).get< - GetAllHierarchiesResponse, - GetAllHierarchiesError + GetByContextChildNodesResponse, + GetByContextChildNodesError >({ ...options, - url: "/pcm/catalogs/{catalog_id}/releases/{release_id}/hierarchies", - responseTransformer: GetAllHierarchiesResponseTransformer, + url: "/catalog/nodes/{node_id}/relationships/children", + responseTransformer: GetByContextChildNodesResponseTransformer, }) } /** - * Get a Hierarchy - * Returns the specified hierarchy from a published catalog. + * Get all Products + * Retrieves the list of products from the catalog. Only the products in a live status are retrieved. * - * :::note + * ### Catalog Rules * - * Currently, published catalogs are limited to the current release and two releases prior to the current release. + * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. If no catalog rules are configured, the first catalog found is returned. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). * - * ::: + * ### Product and Node Associations * - */ -export const getHierarchy = (options: Options) => { - return (options?.client ?? client).get< - GetHierarchyResponse, - GetHierarchyError - >({ - ...options, - url: "/pcm/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}", - responseTransformer: GetHierarchyResponseTransformer, - }) -} - -/** - * Get a Hierarchy's Nodes - * Returns all nodes for the specified hierarchy from a published catalog. + * You can see the parent nodes a product is associated within the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. For example, this is useful if you want to improve how your shoppers search your store. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). * - * :::note * - * Currently, published catalogs are limited to the current release and two releases prior to the current release. + * ### Including Resources * - * ::: + * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + * + * | Parameter | Required | Description | + * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + * | `main_image` | Optional | The main images associated with a product. | + * | `files` | Optional | Any files associated with a product. | * - * In the `bread_crumb` metadata, you can identify the parent nodes that a node is associated with. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + * See [**Including Resources**](/guides/Getting-Started/includes). * * ### Filtering * - * This endpoint supports filtering. For general syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). + * This endpoint supports filtering. For general filtering syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available when filtering on this endpoint. * - * | Operator | Description | Supported Attributes | Example | - * |:--- |:--- |:--- |:--- | - * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | - * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | + * | Operator | Description | Supported Attributes | Example | + * |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | * * ### Building breadcrumbs in a storefront * @@ -551,95 +625,88 @@ export const getHierarchy = (options: Options) => { * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. * */ -export const getHierarchyNodes = (options: Options) => { +export const getByContextAllProducts = ( + options?: Options, +) => { return (options?.client ?? client).get< - GetHierarchyNodesResponse, - GetHierarchyNodesError + GetByContextAllProductsResponse, + GetByContextAllProductsError >({ ...options, - url: "/pcm/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/nodes", - responseTransformer: GetHierarchyNodesResponseTransformer, + url: "/catalog/products", + responseTransformer: GetByContextAllProductsResponseTransformer, }) } /** - * Get a Hierarchy's Children - * Returns the parent nodes for the specified hierarchy from a published catalog. - * - * ![Parent Nodes](/assets/rootnodes.PNG) - * - * :::note - * - * Currently, published catalogs are limited to the current release and two releases prior to the current release. - * - * ::: - * - * In the `bread_crumb` metadata, you can identify the parent nodes that a node is associated with. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). - * - * ### Filtering - * - * This endpoint supports filtering. For general syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). + * Get a Product + * Returns the specified product from the catalog. The product must be in the `live` status. * - * | Operator | Description | Supported Attributes | Example | - * |:--- |:--- |:--- |:--- | - * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | - * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | + * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). * - * ### Building breadcrumbs in a storefront + * You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). * - * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. * - * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + * | Parameter | Required | Description | + * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + * | `main_image` | Optional | The main images associated with a product. | + * | `files` | Optional | Any files associated with a product. | * - * - Specify the node Ids in the filter expression. - * - You can have as many node Ids as you want. - * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + * See [**Including Resources**](/guides/Getting-Started/includes). * */ -export const getHierarchyChildNodes = ( - options: Options, +export const getByContextProduct = ( + options: Options, ) => { return (options?.client ?? client).get< - GetHierarchyChildNodesResponse, - GetHierarchyChildNodesError + GetByContextProductResponse, + GetByContextProductError >({ ...options, - url: "/pcm/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/children", - responseTransformer: GetHierarchyChildNodesResponseTransformer, + url: "/catalog/products/{product_id}", + responseTransformer: GetByContextProductResponseTransformer, }) } /** - * Get all Nodes - * Returns the child nodes from a published catalog. - * - * :::note - * - * Currently, published catalogs are limited to the current release and two releases prior to the current release. + * Get a Bundle's Component Products + * With Product Experience Manager, you can [create](/docs/api/pxm/products/create-product) and manage bundles. A bundle is a purchasable product, comprising of one or more products that you want to sell together. * - * ::: + * You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. * - * You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + * This endpoint returns a list of component product IDs for the specified bundle. * - * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. See [Building breadcrumbs in a storefront](#building-breadcrumbs-in-a-storefront). + */ +export const getByContextComponentProductIds = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetByContextComponentProductIdsResponse, + GetByContextComponentProductIdsError + >({ + ...options, + url: "/catalog/products/{product_id}/relationships/component_products", + }) +} + +/** + * Get a Parent Product's Child Products + * For a specified product and catalog release, retrieves a list of child products from a parent product. Any product other than a base product results in a `422 Unprocessable Entity` response. Only the products in a `live` status are retrieved. * - * The response lists the products associated with the nodes. If products are [curated](https://beta.elasticpath.dev/guides/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront. + * If you have multiple catalog rules defined, the rule that best matches the shopperʼs context is used to determine which catalog is retrieved. If no catalog rules are configured, the first catalog found is returned. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). * - * - If you don't provide any `curated_products`, products are listed by their `updated_at` time in descending order, with the most recently updated product first. - * - If you configure `curated_products` for only a few products, the curated products are displayed first and the other products are displayed in the order of `updated_at` time. - * - You can only curate 20 products or less. You cannot have more than 20 curated products. - * - If a curated product is removed from a node, the product is also removed from the `curated_products` list. - * - A product that is curated has the `"curated_product": true` attribute displayed. + * You can see the parent nodes a product is associated within the `breadcrumbs` metadata for each product. For example, this is useful if you want to improve how your shoppers search your store. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). * * ### Filtering * - * This endpoint supports filtering. For general syntax, see (/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available. + * This endpoint supports filtering. For general filtering syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available when filtering on this endpoint. * - * | Operator | Description | Attributes | Example | - * | --- | --- | --- | --- | - * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug` | `filter=eq(name,some-name)` | - * | `in` | Checks if the values are included in the specified string. If they are, the condition is true. - * | `Id` | `filter=in(id,9214719b-17fe-4ea7-896c-d61e60fc0d05,e104d541-2c52-47fa-8a9a-c4382480d97c,65daaf68-ff2e-4632-8944-370de835967d)` | + * | Operator | Description | Supported Attributes | Example | + * |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | * * ### Building breadcrumbs in a storefront * @@ -651,77 +718,48 @@ export const getHierarchyChildNodes = ( * - You can have as many node Ids as you want. * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. * - */ -export const getAllNodes = (options: Options) => { - return (options?.client ?? client).get( - { - ...options, - url: "/pcm/catalogs/{catalog_id}/releases/{release_id}/nodes", - responseTransformer: GetAllNodesResponseTransformer, - }, - ) -} - -/** - * Get a Node - * Returns a node from a published catalog. - * - * :::note - * - * Currently, published catalogs are limited to the current release and two releases prior to the current release. - * - * ::: + * ### Including Resources * - * You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. * - * The response lists the products associated with the nodes. If products are [curated](https://beta.elasticpath.dev/guides/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront. + * | Parameter | Required | Description | + * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + * | `main_image` | Optional | The main images associated with a product. | + * | `files` | Optional | Any files associated with a product. | * - * - If you don't provide any `curated_products`, products are listed by their `updated_at` time in descending order, with the most recently updated product first. - * - If you configure `curated_products` for only a few products, the curated products are displayed first and the other products are displayed in the order of `updated_at` time. - * - You can only curate 20 products or less. You cannot have more than 20 curated products. - * - If a curated product is removed from a node, the product is also removed from the `curated_products` list. - * - A product that is curated has the `"curated_product": true` attribute displayed. + * See [**Including Resources**](/guides/Getting-Started/includes). * */ -export const getNode = (options: Options) => { - return (options?.client ?? client).get({ +export const getByContextChildProducts = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetByContextChildProductsResponse, + GetByContextChildProductsError + >({ ...options, - url: "/pcm/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}", - responseTransformer: GetNodeResponseTransformer, + url: "/catalog/products/{product_id}/relationships/children", + responseTransformer: GetByContextChildProductsResponseTransformer, }) } /** - * Get a Node's Children - * Returns the child nodes for a node from a published catalog. - * - * :::note - * - * Currently, published catalogs are limited to the current release and two releases prior to the current release. - * - * ::: - * - * You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). - * - * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. For more information, see [Building breadcrumbs in a storefront](#building-breadcrumbs-in-a-storefront). + * Get a Hierarchy's Products + * Returns the products associated with the specified hierarchy in the catalog. The products must be in the live status. * - * The response lists the products associated with the nodes. If products are [curated](https://beta.elasticpath.dev/guides/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront. + * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. See [Resolving catalog rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). * - * - If you don't provide any `curated_products`, products are listed by their `updated_at` time in descending order, with the most recently updated product first. - * - If you configure `curated_products` for only a few products, the curated products are displayed first and the other products are displayed in the order of `updated_at` time. - * - You can only curate 20 products or less. You cannot have more than 20 curated products. - * - If a curated product is removed from a node, the product is also removed from the `curated_products` list. - * - A product that is curated has the `"curated_product": true` attribute displayed. + * You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). * * ### Filtering * - * This endpoint supports filtering. For general syntax, see (/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available. + * This endpoint supports filtering. For general filtering syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available when filtering on this endpoint. * - * | Operator | Description | Attributes | Example | - * | --- | --- | --- | --- | - * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug` | `filter=eq(name,some-name)` | - * | `in` | Checks if the values are included in the specified string. If they are, the condition is true. - * | `Id` | `filter=in(id,9214719b-17fe-4ea7-896c-d61e60fc0d05,e104d541-2c52-47fa-8a9a-c4382480d97c,65daaf68-ff2e-4632-8944-370de835967d)` | + * | Operator | Description | Supported Attributes | Example | + * |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | * * ### Building breadcrumbs in a storefront * @@ -733,44 +771,49 @@ export const getNode = (options: Options) => { * - You can have as many node Ids as you want. * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. * + * ### Including Resources + * + * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + * + * | Parameter | Required | Description | + * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + * | `main_image` | Optional | The main images associated with a product. | + * `files` | Optional | Any files associated with a product. | + * + * + * See [**Including Resources**](/guides/Getting-Started/includes). + * */ -export const getChildNodes = (options: Options) => { +export const getByContextProductsForHierarchy = ( + options: Options, +) => { return (options?.client ?? client).get< - GetChildNodesResponse, - GetChildNodesError + GetByContextProductsForHierarchyResponse, + GetByContextProductsForHierarchyError >({ ...options, - url: "/pcm/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/children", - responseTransformer: GetChildNodesResponseTransformer, + url: "/catalog/hierarchies/{hierarchy_id}/products", + responseTransformer: GetByContextProductsForHierarchyResponseTransformer, }) } /** - * Get all Products - * Returns the products from a published catalog. Only the products in a `live` status are retrieved. Currently, published catalogs are limited to the current release and two releases prior to the current release. - * - * You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). - * - * The `variations` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. The `variations` object can then be added to your catalogs. By default, variations and variation options are sorted randomly. You can use the `sort_order` attribute to sort the order of your variation and variation options in `variations`. Once a parent product is published in a catalog, the [Get a List of products in a catalog release](/docs/api/pxm/catalog/get-all-products) response displays the sorted variations and variation options. Variations and variation options are displayed in descending order according to their `sort_order` values. - * - * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + * Get a Node's Products + * Returns the products associated with the specified hierarchy node in the catalog. The products must be in the `live` status. If the products have been curated then the products are returned in the order specified in the `curated_products` attribute. A product that is curated has the `"curated_product": true` attribute displayed. * - * | Parameter | Required | Description | - * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| - * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | - * | `main_image` | Optional | The main images associated with a product. | - * | `files` | Optional | Any files associated with a product. + * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. See [Resolving catalog rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). * - * See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + * You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). * * ### Filtering * - * This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. + * This endpoint supports filtering. For general filtering syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available when filtering on this endpoint. * * | Operator | Description | Supported Attributes | Example | * |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | - * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types`, you can only specify one product type. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | - * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | * * ### Building breadcrumbs in a storefront * @@ -792,279 +835,358 @@ export const getChildNodes = (options: Options) => { * | `main_image` | Optional | The main images associated with a product. | * | `files` | Optional | Any files associated with a product. | * - * See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + * See [**Including Resources**](/guides/Getting-Started/includes). * */ -export const getAllProducts = (options: Options) => { +export const getByContextProductsForNode = ( + options: Options, +) => { return (options?.client ?? client).get< - GetAllProductsResponse, - GetAllProductsError + GetByContextProductsForNodeResponse, + GetByContextProductsForNodeError >({ ...options, - url: "/pcm/catalogs/{catalog_id}/releases/{release_id}/products", - responseTransformer: GetAllProductsResponseTransformer, + url: "/catalog/nodes/{node_id}/relationships/products", + responseTransformer: GetByContextProductsForNodeResponseTransformer, }) } /** - * Get a Product - * Returns a product from a published catalog. The product must be in `live` status. Currently, published catalogs are limited to the current release and two releases prior to the current release. - * - * ### Product and Node Associations in Breadcrumb Metadata + * Configure a Shopper Bundle + * Once you have configured your product bundles, you can display them in your storefront in your published catalog. Depending on how you have configured the minimum and maximum values for the product options in your components, you can allow your shoppers to choose which products they want to select. For example, you can enable a shopper to select 1 or more product options from a list of 10, giving your shoppers greater flexibility when selecting products in your store front. * - * You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + * - Products must be in a `live` status. + * - If you have not specified any minimum or maximum values for the product options in your components, your shoppers can select any combination of product options. * - * ### Product Variations + * If you have configured minimum and maximum values using [Create a Bundle](/docs/api/pxm/products/create-product), this becomes part of the `bundle_configuration`. You can check how your bundle is configured using [Get a product in a catalog release](/docs/api/pxm/catalog/get-product) in `bundle_configuration` under `meta`. The `bundle_configuration` forms the body of the request. * - * The `variations` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. The `variations` object can then be added to your catalogs. By default, variations and variation options are sorted randomly. You can use the `sort_order`attribute to sort the order of your variation and variation options in `variations`. Once a parent product is published in a catalog, the get a product in a catalog release response displays the sorted variations and variation options. Variations and variation options are displayed in descending order according to their `sort_order` values. + * The response updates the `bundle_configuration` with the product options the shopper selects. The `meta` data is updated with the `meta` data of the selected product options. In your storefront, you could display this as a summary of the product options a shopper has selected. * * ### Including Resources * * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. * - * | Parameter | Required | Description | + * | Parameter | Required | Description | * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | - * | `main_image` | Optional | The main images associated with a product. | - * | `files` | Optional | Any files associated with a product. + * | `main_image` | Optional | The main images associated with a product. | + * | `files` | Optional | Any files associated with a product. | * - * See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + * See [**Including Resources**](/guides/Getting-Started/includes). * */ -export const getProduct = (options: Options) => { - return (options?.client ?? client).get({ +export const configureByContextProduct = ( + options: Options, +) => { + return (options?.client ?? client).post< + ConfigureByContextProductResponse, + ConfigureByContextProductError + >({ ...options, - url: "/pcm/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}", - responseTransformer: GetProductResponseTransformer, + url: "/catalog/products/{product_id}/configure", + responseTransformer: ConfigureByContextProductResponseTransformer, }) } /** - * Get a Bundle's Component Products - * With Product Experience Manager, you can [create](/docs/api/pxm/products/create-product) and manage bundles. A bundle is a purchasable product, comprising of one or more products that you want to sell together. - * - * You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. - * - * This endpoint returns a list of component product IDs for the specified bundle. - * - * ### Including Resources - * - * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. - * - * | Parameter | Required | Description | - * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| - * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | - * | `main_image` | Optional | The main images associated with a product. | - * | `files` | Optional | Any files associated with a product. | + * Creates a new catalog + * Before you create a catalog, you must define the following resources: * - * See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + * - Hierarchies - hierarchies and nodes to categorize the products. + * - Products - product information, associated assets, and links to hierarchy nodes. + * - Price Books - prices for the products associated with the hierarchies. You can create multiple price books for different scenarios, such as seasonal sales, business versus retail customer pricing, and reward programs. When creating a catalog, you can specify up to five price books. You must configure a priority for your price books. Product prices are displayed in the catalog according to the priority of the price books. Priority is a number and the price book with the highest number has the highest priority. * */ -export const getComponentProductIds = ( - options: Options, -) => { - return (options?.client ?? client).get< - GetComponentProductIdsResponse, - GetComponentProductIdsError +export const createCatalog = (options: Options) => { + return (options?.client ?? client).post< + CreateCatalogResponse, + CreateCatalogError >({ ...options, - url: "/pcm/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/component_products", + url: "/catalogs", + responseTransformer: CreateCatalogResponseTransformer, }) } /** - * Get a Parent Product's Child Products - * For a specified product and catalog release, retrieves a list of child products from a parent product. Any product other than a base product results in a `422 Unprocessable Entity` response. Only the products in a `live` status are retrieved. - * - * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. If no catalog rules are configured, the first catalog found is returned. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). - * - * You can see the parent nodes a product is associated within the breadcrumbs metadata for each product. For example, this is useful if you want to improve how your shoppers search your store. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). - * - * ### Filtering - * - * This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. - * - * | Operator | Description | Supported Attributes | Example | - * |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | - * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types`, you can only specify one product type. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | - * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | - * - * ### Building breadcrumbs in a storefront - * - * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. - * - * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` - * - * - Specify the node Ids in the filter expression. - * - You can have as many node Ids as you want. - * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. - * - * ### Including Resources - * - * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + * Gets all authorized catalogs + * Retrieves a list of all the catalogs that you are authorized to view. Currently, published catalogs are limited to the current release and two releases prior to the current release. You can see the differences between the last 2 consecutive catalog releases using the delta link returned in the response of a [publish a catalog](/docs/api/pxm/catalog/publish-release) endpoint. * - * | Parameter | Required | Description | - * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| - * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | - * | `main_image` | Optional | The main images associated with a product. | - * | `files` | Optional | Any files associated with a product. | + * You can use the `is_full_delta` attribute returned from the `get a release of a catalog` endpoint to determine if you need to refresh the data in your company system before publishing a catalog release and injecting fresh data in a delta link. The `is_full_delta` attribute tells you if this is a full publish of a catalog release. Using a search service as an example, if the `is_full_delta` attribute is `true`, you should remove all data about that catalog from the search service before publishing a catalog release and injecting fresh data from the delta file. See [Publish a catalog](/docs/api/pxm/catalog/publish-release). * - * See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + * If the `is_full_publish` attribute returned in the response is `false`, data from the previous catalog release overlaid the existing data in the delta file. The `is_full_publish` attribute is always `true` the first time a catalog is published. * */ -export const getChildProducts = (options: Options) => { +export const getCatalogs = (options?: Options) => { + return (options?.client ?? client).get( + { + ...options, + url: "/catalogs", + responseTransformer: GetCatalogsResponseTransformer, + }, + ) +} + +/** + * Get a catalog by ID + * Retrieves the specified catalog. + */ +export const getCatalogById = (options: Options) => { return (options?.client ?? client).get< - GetChildProductsResponse, - GetChildProductsError + GetCatalogByIdResponse, + GetCatalogByIdError >({ ...options, - url: "/pcm/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/children", - responseTransformer: GetChildProductsResponseTransformer, + url: "/catalogs/{catalog_id}", + responseTransformer: GetCatalogByIdResponseTransformer, }) } /** - * Get a Hierarchy's Products - * Returns the products associated with the specified hierarchy in the catalog. The products must be in the `live` status. - * - * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. See [Resolving catalog rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). - * - * You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). - * - * The `variations` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. The variations object can then be added to your catalogs. By default, variations and variation options are sorted randomly. You can use the `sort_order` attribute to sort the order of your variation and variation options in variations. Once a parent product is published in a catalog, the [Get a List of products in a catalog](/docs/api/pxm/catalog/get-all-products) release response displays the sorted variations and variation options. Variations and variation options are displayed in descending order according to their `sort_order` values. - * - * ### Filtering - * - * This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. - * - * | Operator | Description | Supported Attributes | Example | - * |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | - * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types`, you can only specify one product type. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | - * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | - * - * ### Building breadcrumbs in a storefront - * - * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. - * - * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` - * - * - Specify the node Ids in the filter expression. - * - You can have as many node Ids as you want. - * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. - * - * ### Including Resources - * - * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. - * - * | Parameter | Required | Description | - * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| - * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | - * | `main_image` | Optional | The main images associated with a product. | - * | `files` | Optional | Any files associated with a product. | - * - * See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). - * + * Updates a catalog + * Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the catalog is not updated. */ -export const getProductsForHierarchy = ( - options: Options, -) => { - return (options?.client ?? client).get< - GetProductsForHierarchyResponse, - GetProductsForHierarchyError +export const updateCatalog = (options: Options) => { + return (options?.client ?? client).put< + UpdateCatalogResponse, + UpdateCatalogError >({ ...options, - url: "/pcm/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/products", - responseTransformer: GetProductsForHierarchyResponseTransformer, + url: "/catalogs/{catalog_id}", + responseTransformer: UpdateCatalogResponseTransformer, }) } /** - * Get a Node's Products - * Returns the products associated with the specified hierarchy node in the catalog. The products must be in the `live` status. If the products have been curated, then the products are returned in the order specified in the `curated_products` attribute. A product that is curated has the `"curated_product": true` attribute displayed. + * Deletes a catalog + * Deletes an unpublished catalog. Use [**Delete a Release**](/docs/api/pxm/catalog/delete-release-by-id) and [**Delete All Releases**](/docs/api/pxm/catalog/delete-releases) to delete releases of a catalog. If the catalog is associated with any catalog rules, you must first update the catalog rules to remove the catalog. + */ +export const deleteCatalogById = (options: Options) => { + return (options?.client ?? client).delete< + DeleteCatalogByIdResponse, + DeleteCatalogByIdError + >({ + ...options, + url: "/catalogs/{catalog_id}", + }) +} + +/** + * Publishes a catalog + * Publishes a catalog. You must publish a catalog before you can retrieve that catalog in an organization or store. The hierarchies, live products, and prices associated with a published catalog are in read-only mode. If you make a change to these resources, for example, a change to your price book or hierarchies, you need to republish the catalog. * - * :::note + * You can get [a catalog release](/docs/api/pxm/catalog/get-release-by-id) to retrieve a published catalog. Currently, published catalogs are limited to the current release and two releases prior to the current release. * - * Currently, published catalogs are limited to the current release and two releases prior to the current release. + * You can see the differences between the last 2 consecutive catalog releases. This is useful if want to understand how your products have changed in your catalog, ensuring your site search integration is kept up-to-date. * - * ::: + * Once a catalog release has completed publishing, the delta relationship links to the delta document. * - * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. See [Resolving catalog rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + * The `delta` links are signed and only valid for 1 hour. Re-reading a catalog release, for example, using [Getting a release of a catalog](/docs/pxm/catalogs/catalog-latest-release/get-a-release-of-a-catalog) returns a fresh a link. * - * You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://elasticpath.dev/guides/Catalogs/breadcrumbs). + * You can use the `is_full_delta` attribute returned from the `get a release of a catalog` endpoint to determine if you need to refresh the data in your company system before injecting fresh data in a `delta` link. The `is_full_delta` attribute tells you if this is a full publish of the catalog. Using a search service as an example, if the `is_full_delta` attribute is `true`, you should remove all data about that catalog from the search service before injecting fresh data from the `delta` file. If the `is_full_delta` attribute is `false`, then data from the previous catalog overlays the existing data in the `delta` file. To publish a catalog and inject fresh data in a `delta` link, set `export_full_delta` to `true`. * - * The `variations` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. The `variations` object can then be added to your catalogs. By default, variations and variation options are sorted randomly. You can use the `sort_order` attribute to sort the order of your variation and variation options in `variations`. Once a parent product is published in a catalog, the [Get a List of products in a catalog release](/docs/api/pxm/catalog/get-all-products) response displays the sorted variations and variation options. Variations and variation options are displayed in descending order according to their `sort_order` values. + * If a previous catalog publish date is greater than 90 days, then a full catalog publish is automatically performed. If you publish your catalogs infrequently, Commerce may perform a full publish when you are expecting a delta publish. * - * ### Filtering + * :::caution * - * This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. + * Generating a full delta is resource intensive and slows down the publishing process and so should only be performed in certain circumstances, for example, when initializing an integration with a service like Algolia. * - * | Operator | Description | Supported Attributes | Example | - * |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | - * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | - * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | + * ::: * - * ### Building breadcrumbs in a storefront + * The `is_full_delta` attribute is always `true` the first time a catalog is published. The information is stored in a collection of `json` documents in a compressed file. You can either manually check the file or, for example, use them to automatically update another company system you may have. * - * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + * - Delta files are only available for 30 days. + * - Delta files are removed when a catalog release is deleted. * - * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + * Each document has a `delta_type` with one of the following values, depending on whether a product has been deleted, updated or created in a catalog release. * - * - Specify the node Ids in the filter expression. - * - You can have as many node Ids as you want. - * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + * - `delete` describes products deleted from this release of a catalog. + * - `createupdate` describes products updated in this release of a catalog. * - * ### Including Resources + * ### Multi-Store Management Solutions * - * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + * In a multi-store management solution. * - * | Parameter | Required | Description | - * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| - * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | - * | `main_image` | Optional | The main images associated with a product. | - * | `files` | Optional | Any files associated with a product. | + * - You can create organization catalogs. Your organization catalogs are available for your stores to use. + * - Your stores can create their own catalogs. + * - Your stores can create catalogs that have a combination of organization products and store products. + * + * If you are publishing a catalog in a store that contains resources from an organization, in Commerce Manager, you must enable the **Include Organization Resources in Catalog Publishes** checkbox. * - * See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + * 1. Go to **SYSTEM** > **Store Settings**. + * 2. Click **General Settings**. + * 3. Select **PXM** from the list. + * 4. Select the **Include Organization Resources in Catalog Publishes** checkbox. * */ -export const getProductsForNode = ( - options: Options, -) => { - return (options?.client ?? client).get< - GetProductsForNodeResponse, - GetProductsForNodeError +export const publishRelease = (options: Options) => { + return (options?.client ?? client).post< + PublishReleaseResponse, + PublishReleaseError >({ ...options, - url: "/pcm/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/products", - responseTransformer: GetProductsForNodeResponseTransformer, + url: "/catalogs/{catalog_id}/releases", + responseTransformer: PublishReleaseResponseTransformer, }) } /** - * Get the catalog release as shoppers - * Returns a list of all published releases of the specified catalog. + * Gets all authorized catalog releases + * Returns a list of all published releases of the specified catalog. Currently, published catalogs are limited to the current release and two releases prior to the current release. You can see the differences between the last 2 consecutive catalog releases using the `delta` link returned in the response of a `publish a catalog` endpoint. + * + * You can use the `is_full_delta` attribute returned from the `get a release of a catalog` endpoint to determine if you need to refresh the data in your company system before publishing a catalog release and injecting fresh data in a delta link. The `is_full_delta` attribute tells you if this is a full publish of a catalog release. Using a search service as an example, if the `is_full_delta` attribute is `true`, you should remove all data about that catalog from the search service before publishing a catalog release and injecting fresh data from the delta file. + * + * If the `is_full_publish` attribute returned in the response is `false`, data from the previous catalog release overlaid the existing data in the delta file. The `is_full_publish` attribute is always `true` the first time a catalog is published. + * */ -export const getByContextRelease = ( - options?: Options, -) => { +export const getReleases = (options: Options) => { + return (options?.client ?? client).get( + { + ...options, + url: "/catalogs/{catalog_id}/releases", + responseTransformer: GetReleasesResponseTransformer, + }, + ) +} + +/** + * Deletes all releases + * Deletes all releases of the specified published catalog. + */ +export const deleteReleases = (options: Options) => { + return (options?.client ?? client).delete< + DeleteReleasesResponse, + DeleteReleasesError + >({ + ...options, + url: "/catalogs/{catalog_id}/releases", + }) +} + +/** + * Get a catalog release by ID + * Retrieves the specified catalog release. + */ +export const getReleaseById = (options: Options) => { return (options?.client ?? client).get< - GetByContextReleaseResponse, - GetByContextReleaseError + GetReleaseByIdResponse, + GetReleaseByIdError >({ ...options, - url: "/catalog", - responseTransformer: GetByContextReleaseResponseTransformer, + url: "/catalogs/{catalog_id}/releases/{release_id}", + responseTransformer: GetReleaseByIdResponseTransformer, + }) +} + +/** + * Deletes a release + * Deletes the specified published catalog release. + */ +export const deleteReleaseById = (options: Options) => { + return (options?.client ?? client).delete< + DeleteReleaseByIdResponse, + DeleteReleaseByIdError + >({ + ...options, + url: "/catalogs/{catalog_id}/releases/{release_id}", + }) +} + +/** + * Creates a new catalog rule + * If you have multiple catalogs, create catalog rule resources. With catalog rules, you can display different catalogs to different shoppers. For example, you can display a preferred pricing catalog to a few special customers. Or you can display one catalog to shoppers using your website and a different catalog to shoppers using your mobile app. Finally, you can define custom criteria by creating tags. + * + * :::note + * + * - If you have one catalog for all customers and channels, you can omit creating this resource. + * - Due to the way catalogs are cached in Commerce, using catalog rules to display catalogs sometimes causes a 5-minute time delay before the catalogs are displayed. + * - You cannot create catalog rules for organization catalogs. + * + * ::: + * + * For ideas about the kinds of business scenarios you can achieve with catalog rules, see [Catalog Rules](/docs/api/pxm/catalog/rules). To understand how catalogs are matched to shoppers by using rules, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + * + */ +export const createRule = (options: Options) => { + return (options?.client ?? client).post({ + ...options, + url: "/catalogs/rules", + responseTransformer: CreateRuleResponseTransformer, + }) +} + +/** + * Gets all authorized catalog rules + * Retrieves all authorized catalog rules. + * + * ### Filtering + * + * This endpoint supports filtering. For general filtering syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are supported. + * + * | Operator | Description | Supported Attributes | Example | + * |:--- |:--- |:--- |:--- | + * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | + * + */ +export const getRules = (options?: Options) => { + return (options?.client ?? client).get({ + ...options, + url: "/catalogs/rules", + responseTransformer: GetRulesResponseTransformer, + }) +} + +/** + * Get a catalog rule by ID + */ +export const getRuleById = (options: Options) => { + return (options?.client ?? client).get( + { + ...options, + url: "/catalogs/rules/{catalog_rule_id}", + responseTransformer: GetRuleByIdResponseTransformer, + }, + ) +} + +/** + * Updates a catalog rule + * Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the catalog rule is not updated. + */ +export const updateRule = (options: Options) => { + return (options?.client ?? client).put({ + ...options, + url: "/catalogs/rules/{catalog_rule_id}", + responseTransformer: UpdateRuleResponseTransformer, + }) +} + +/** + * Deletes a catalog rule + */ +export const deleteRuleById = (options: Options) => { + return (options?.client ?? client).delete< + DeleteRuleByIdResponse, + DeleteRuleByIdError + >({ + ...options, + url: "/catalogs/rules/{catalog_rule_id}", }) } /** * Get all Hierarchies - * Returns all hierarchies from a catalog. + * Returns the hierarchies from a published catalog. * - * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + * :::note + * + * Currently, published catalogs are limited to the current release and two releases prior to the current release. + * + * ::: * * ### Filtering * - * This endpoint supports filtering. For general syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). + * This endpoint supports filtering. For general syntax, see [Filtering](/guides/Getting-Started/filtering). * * | Operator | Description | Supported Attributes | Example | * |:--- |:--- |:--- |:--- | @@ -1082,50 +1204,54 @@ export const getByContextRelease = ( * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. * */ -export const getByContextAllHierarchies = ( - options?: Options, -) => { +export const getAllHierarchies = (options: Options) => { return (options?.client ?? client).get< - GetByContextAllHierarchiesResponse, - GetByContextAllHierarchiesError + GetAllHierarchiesResponse, + GetAllHierarchiesError >({ ...options, - url: "/catalog/hierarchies", - responseTransformer: GetByContextAllHierarchiesResponseTransformer, + url: "/catalogs/{catalog_id}/releases/{release_id}/hierarchies", + responseTransformer: GetAllHierarchiesResponseTransformer, }) } /** * Get a Hierarchy - * Returns a hierarchy from the catalog. + * Returns the specified hierarchy from a published catalog. * - * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog to retrieve. For information about how catalog rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules). + * :::note + * + * Currently, published catalogs are limited to the current release and two releases prior to the current release. + * + * ::: * */ -export const getByContextHierarchy = ( - options: Options, -) => { +export const getHierarchy = (options: Options) => { return (options?.client ?? client).get< - GetByContextHierarchyResponse, - GetByContextHierarchyError + GetHierarchyResponse, + GetHierarchyError >({ ...options, - url: "/catalog/hierarchies/{hierarchy_id}", - responseTransformer: GetByContextHierarchyResponseTransformer, + url: "/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}", + responseTransformer: GetHierarchyResponseTransformer, }) } /** * Get a Hierarchy's Nodes - * Returns all the nodes for the specified hierarchy. + * Returns all nodes for the specified hierarchy from a published catalog. * - * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + * :::note + * + * Currently, published catalogs are limited to the current release and two releases prior to the current release. * - * In the `bread_crumb` metadata, you can identify the parent nodes that a node is associated with. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + * ::: + * + * In the `bread_crumb` metadata, you can identify the parent nodes that a node is associated with. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). * * ### Filtering * - * This endpoint supports filtering. For general syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). + * This endpoint supports filtering. For general syntax, see [Filtering](/guides/Getting-Started/filtering). * * | Operator | Description | Supported Attributes | Example | * |:--- |:--- |:--- |:--- | @@ -1143,40 +1269,40 @@ export const getByContextHierarchy = ( * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. * */ -export const getByContextHierarchyNodes = ( - options: Options, -) => { +export const getHierarchyNodes = (options: Options) => { return (options?.client ?? client).get< - GetByContextHierarchyNodesResponse, - GetByContextHierarchyNodesError + GetHierarchyNodesResponse, + GetHierarchyNodesError >({ ...options, - url: "/catalog/hierarchies/{hierarchy_id}/nodes", - responseTransformer: GetByContextHierarchyNodesResponseTransformer, + url: "/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/nodes", + responseTransformer: GetHierarchyNodesResponseTransformer, }) } /** * Get a Hierarchy's Children - * Returns the parent nodes for the specified hierarchy. + * Returns the parent nodes for the specified hierarchy from a published catalog. * * ![Parent Nodes](/assets/rootnodes.PNG) * - * If you have multiple catalog rules defined, the rule that best matches the shopperʼs context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + * :::note + * + * Currently, published catalogs are limited to the current release and two releases prior to the current release. + * + * ::: * - * In the `bread_crumb` metadata, you can identify the parent nodes that a node is associated with. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + * In the `bread_crumb` metadata, you can identify the parent nodes that a node is associated with. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). * * ### Filtering * - * The following operators and attributes are available when filtering on this endpoint. + * This endpoint supports filtering. For general syntax, see [Filtering](/guides/Getting-Started/filtering). * * | Operator | Description | Supported Attributes | Example | * |:--- |:--- |:--- |:--- | * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. | `name`, `slug`| `filter=eq(name,some-name)` | * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | * - * For more information, see [Filtering](/docs/commerce-cloud/api-overview/filtering). - * * ### Building breadcrumbs in a storefront * * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. @@ -1188,37 +1314,44 @@ export const getByContextHierarchyNodes = ( * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. * */ -export const getByContextHierarchyChildNodes = ( - options: Options, +export const getHierarchyChildNodes = ( + options: Options, ) => { return (options?.client ?? client).get< - GetByContextHierarchyChildNodesResponse, - GetByContextHierarchyChildNodesError + GetHierarchyChildNodesResponse, + GetHierarchyChildNodesError >({ ...options, - url: "/catalog/hierarchies/{hierarchy_id}/children", - responseTransformer: GetByContextHierarchyChildNodesResponseTransformer, + url: "/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/children", + responseTransformer: GetHierarchyChildNodesResponseTransformer, }) } /** * Get all Nodes - * Returns all nodes in the catalog. + * Returns the child nodes from a published catalog. * - * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + * :::note * - * You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + * Currently, published catalogs are limited to the current release and two releases prior to the current release. * - * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. For more information, see [Building breadcrumbs in a storefront](#building-breadcrumbs-in-a-storefront). + * ::: + * + * You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). + * + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. See [Building breadcrumbs in a storefront](#building-breadcrumbs-in-a-storefront). * - * The response lists the products associated with the nodes. If products are [curated](https://beta.elasticpath.dev/guides/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront. + * The response lists the products associated with the nodes. If products are [curated](/guides/How-To/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront. * + * - If you don't provide any `curated_products`, products are listed by their `updated_at` time in descending order, with the most recently updated product first. + * - If you configure `curated_products` for only a few products, the curated products are displayed first and the other products are displayed in the order of `updated_at` time. * - You can only curate 20 products or less. You cannot have more than 20 curated products. * - If a curated product is removed from a node, the product is also removed from the `curated_products` list. + * - A product that is curated has the `"curated_product": true` attribute displayed. * * ### Filtering * - * This endpoint supports filtering. For general syntax, see (/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available. + * This endpoint supports filtering. For general syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available. * * | Operator | Description | Attributes | Example | * | --- | --- | --- | --- | @@ -1237,66 +1370,70 @@ export const getByContextHierarchyChildNodes = ( * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. * */ -export const getByContextAllNodes = ( - options?: Options, -) => { - return (options?.client ?? client).get< - GetByContextAllNodesResponse, - GetByContextAllNodesError - >({ - ...options, - url: "/catalog/nodes", - responseTransformer: GetByContextAllNodesResponseTransformer, - }) +export const getAllNodes = (options: Options) => { + return (options?.client ?? client).get( + { + ...options, + url: "/catalogs/{catalog_id}/releases/{release_id}/nodes", + responseTransformer: GetAllNodesResponseTransformer, + }, + ) } /** * Get a Node - * Returns a node from the catalog. + * Returns a node from a published catalog. * - * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + * :::note + * + * Currently, published catalogs are limited to the current release and two releases prior to the current release. + * + * ::: * - * You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + * You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). * - * The response lists the products associated with a node. If products are curated, they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your nodes, enabling you to create unique product collections in your storefront. + * The response lists the products associated with the nodes. If products are [curated](/guides/How-To/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront. * * - If you don't provide any `curated_products`, products are listed by their `updated_at` time in descending order, with the most recently updated product first. * - If you configure `curated_products` for only a few products, the curated products are displayed first and the other products are displayed in the order of `updated_at` time. * - You can only curate 20 products or less. You cannot have more than 20 curated products. - * - A product that is curated has the `"curated_product": true` attribute displayed. * - If a curated product is removed from a node, the product is also removed from the `curated_products` list. + * - A product that is curated has the `"curated_product": true` attribute displayed. * */ -export const getByContextNode = (options: Options) => { - return (options?.client ?? client).get< - GetByContextNodeResponse, - GetByContextNodeError - >({ +export const getNode = (options: Options) => { + return (options?.client ?? client).get({ ...options, - url: "/catalog/nodes/{node_id}", - responseTransformer: GetByContextNodeResponseTransformer, + url: "/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}", + responseTransformer: GetNodeResponseTransformer, }) } /** * Get a Node's Children - * Returns the child nodes for a node in the catalog. + * Returns the child nodes for a node from a published catalog. * - * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + * :::note * - * You can see which parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://beta.elasticpath.dev/guides/Catalogs/breadcrumbs). + * Currently, published catalogs are limited to the current release and two releases prior to the current release. * - * The response lists the products associated with the nodes. If products are [curated](https://beta.elasticpath.dev/guides/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront. + * ::: * - * - If you don't provide any curated_products, products are listed by their updated_at time in descending order, with the most recently updated product first. - * - If you configure curated_products for only a few products, the curated products are displayed first and the other products are displayed in the order of updated_at time. + * You can see the parent nodes a node is associated with in the `bread_crumb` metadata for each node. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). + * + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. For more information, see [Building breadcrumbs in a storefront](#building-breadcrumbs-in-a-storefront). + * + * The response lists the products associated with the nodes. If products are [curated](/guides/How-To/Products/curating-products), they are displayed in `curated_products`. Product curation allows you to promote specific products within each of your hierarchies, enabling you to create unique product collections in your storefront. + * + * - If you don't provide any `curated_products`, products are listed by their `updated_at` time in descending order, with the most recently updated product first. + * - If you configure `curated_products` for only a few products, the curated products are displayed first and the other products are displayed in the order of `updated_at` time. * - You can only curate 20 products or less. You cannot have more than 20 curated products. - * - A product that is curated has the "curated_product": true attribute displayed. - * - If a curated product is removed from a node, the product is also removed from the curated_products list. + * - If a curated product is removed from a node, the product is also removed from the `curated_products` list. + * - A product that is curated has the `"curated_product": true` attribute displayed. * * ### Filtering * - * This endpoint supports filtering. For general syntax, see (/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available. + * This endpoint supports filtering. For general syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available. * * | Operator | Description | Attributes | Example | * | --- | --- | --- | --- | @@ -1315,31 +1452,160 @@ export const getByContextNode = (options: Options) => { * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. * */ -export const getByContextChildNodes = ( - options: Options, -) => { +export const getChildNodes = (options: Options) => { return (options?.client ?? client).get< - GetByContextChildNodesResponse, - GetByContextChildNodesError + GetChildNodesResponse, + GetChildNodesError >({ ...options, - url: "/catalog/nodes/{node_id}/relationships/children", - responseTransformer: GetByContextChildNodesResponseTransformer, + url: "/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/children", + responseTransformer: GetChildNodesResponseTransformer, }) } /** * Get all Products - * Retrieves the list of products from the catalog. Only the products in a live status are retrieved. + * Returns the products from a published catalog. Only the products in a `live` status are retrieved. Currently, published catalogs are limited to the current release and two releases prior to the current release. * - * ### Catalog Rules + * You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). + * + * The `variations` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. The `variations` object can then be added to your catalogs. By default, variations and variation options are sorted randomly. You can use the `sort_order` attribute to sort the order of your variation and variation options in `variations`. Once a parent product is published in a catalog, the [Get a List of products in a catalog release](/docs/api/pxm/catalog/get-all-products) response displays the sorted variations and variation options. Variations and variation options are displayed in descending order according to their `sort_order` values. + * + * ### Including Resources + * + * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + * + * | Parameter | Required | Description | + * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + * | `main_image` | Optional | The main images associated with a product. | + * | `files` | Optional | Any files associated with a product. + * + * See [**Including Resources**](/guides/Getting-Started/includes). + * + * ### Filtering + * + * This endpoint supports filtering. For general filtering syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available when filtering on this endpoint. + * + * | Operator | Description | Supported Attributes | Example | + * |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types`, you can only specify one product type. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | + * + * ### Building breadcrumbs in a storefront + * + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + * + * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + * + * - Specify the node Ids in the filter expression. + * - You can have as many node Ids as you want. + * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + * + */ +export const getAllProducts = (options: Options) => { + return (options?.client ?? client).get< + GetAllProductsResponse, + GetAllProductsError + >({ + ...options, + url: "/catalogs/{catalog_id}/releases/{release_id}/products", + responseTransformer: GetAllProductsResponseTransformer, + }) +} + +/** + * Get a Product + * Returns a product from a published catalog. The product must be in `live` status. Currently, published catalogs are limited to the current release and two releases prior to the current release. + * + * ### Product and Node Associations in Breadcrumb Metadata + * + * You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). + * + * ### Product Variations + * + * The `variations` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. The `variations` object can then be added to your catalogs. By default, variations and variation options are sorted randomly. You can use the `sort_order`attribute to sort the order of your variation and variation options in `variations`. Once a parent product is published in a catalog, the get a product in a catalog release response displays the sorted variations and variation options. Variations and variation options are displayed in descending order according to their `sort_order` values. + * + * ### Including Resources + * + * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + * + * | Parameter | Required | Description | + * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + * | `main_image` | Optional | The main images associated with a product. | + * | `files` | Optional | Any files associated with a product. + * + * See [**Including Resources**](/guides/Getting-Started/includes). + * + */ +export const getProduct = (options: Options) => { + return (options?.client ?? client).get({ + ...options, + url: "/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}", + responseTransformer: GetProductResponseTransformer, + }) +} + +/** + * Get a Bundle's Component Products + * With Product Experience Manager, you can [create](/docs/api/pxm/products/create-product) and manage bundles. A bundle is a purchasable product, comprising of one or more products that you want to sell together. + * + * You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. + * + * This endpoint returns a list of component product IDs for the specified bundle. + * + * ### Including Resources + * + * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + * + * | Parameter | Required | Description | + * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + * | `main_image` | Optional | The main images associated with a product. | + * | `files` | Optional | Any files associated with a product. | + * + * See [**Including Resources**](/guides/Getting-Started/includes). + * + */ +export const getComponentProductIds = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetComponentProductIdsResponse, + GetComponentProductIdsError + >({ + ...options, + url: "/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/component_products", + }) +} + +/** + * Get a Parent Product's Child Products + * For a specified product and catalog release, retrieves a list of child products from a parent product. Any product other than a base product results in a `422 Unprocessable Entity` response. Only the products in a `live` status are retrieved. * * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. If no catalog rules are configured, the first catalog found is returned. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). * - * ### Product and Node Associations + * You can see the parent nodes a product is associated within the breadcrumbs metadata for each product. For example, this is useful if you want to improve how your shoppers search your store. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). + * + * ### Filtering + * + * This endpoint supports filtering. For general filtering syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available when filtering on this endpoint. + * + * | Operator | Description | Supported Attributes | Example | + * |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types`, you can only specify one product type. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | + * + * ### Building breadcrumbs in a storefront + * + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. * - * You can see the parent nodes a product is associated within the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. For example, this is useful if you want to improve how your shoppers search your store. See [Product and Node Associations in Breadcrumb Metadata](https://elasticpath.dev/guides/Catalogs/breadcrumbs). + * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` * + * - Specify the node Ids in the filter expression. + * - You can have as many node Ids as you want. + * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. * * ### Including Resources * @@ -1351,15 +1617,98 @@ export const getByContextChildNodes = ( * | `main_image` | Optional | The main images associated with a product. | * | `files` | Optional | Any files associated with a product. | * - * See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + * See [**Including Resources**](/guides/Getting-Started/includes). + * + */ +export const getChildProducts = (options: Options) => { + return (options?.client ?? client).get< + GetChildProductsResponse, + GetChildProductsError + >({ + ...options, + url: "/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/children", + responseTransformer: GetChildProductsResponseTransformer, + }) +} + +/** + * Get a Hierarchy's Products + * Returns the products associated with the specified hierarchy in the catalog. The products must be in the `live` status. + * + * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. See [Resolving catalog rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + * + * You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). + * + * The `variations` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. The variations object can then be added to your catalogs. By default, variations and variation options are sorted randomly. You can use the `sort_order` attribute to sort the order of your variation and variation options in variations. Once a parent product is published in a catalog, the [Get a List of products in a catalog](/docs/api/pxm/catalog/get-all-products) release response displays the sorted variations and variation options. Variations and variation options are displayed in descending order according to their `sort_order` values. * * ### Filtering * - * This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. + * This endpoint supports filtering. For general filtering syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available when filtering on this endpoint. * * | Operator | Description | Supported Attributes | Example | * |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | - * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types`, you can only specify one product type. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | + * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | + * + * ### Building breadcrumbs in a storefront + * + * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + * + * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + * + * - Specify the node Ids in the filter expression. + * - You can have as many node Ids as you want. + * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + * + * ### Including Resources + * + * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + * + * | Parameter | Required | Description | + * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| + * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | + * | `main_image` | Optional | The main images associated with a product. | + * | `files` | Optional | Any files associated with a product. | + * + * See [**Including Resources**](/guides/Getting-Started/includes). + * + */ +export const getProductsForHierarchy = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetProductsForHierarchyResponse, + GetProductsForHierarchyError + >({ + ...options, + url: "/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/products", + responseTransformer: GetProductsForHierarchyResponseTransformer, + }) +} + +/** + * Get a Node's Products + * Returns the products associated with the specified hierarchy node in the catalog. The products must be in the `live` status. If the products have been curated, then the products are returned in the order specified in the `curated_products` attribute. A product that is curated has the `"curated_product": true` attribute displayed. + * + * :::note + * + * Currently, published catalogs are limited to the current release and two releases prior to the current release. + * + * ::: + * + * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. See [Resolving catalog rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + * + * You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](/guides/How-To/Catalogs/breadcrumbs). + * + * The `variations` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. The `variations` object can then be added to your catalogs. By default, variations and variation options are sorted randomly. You can use the `sort_order` attribute to sort the order of your variation and variation options in `variations`. Once a parent product is published in a catalog, the [Get a List of products in a catalog release](/docs/api/pxm/catalog/get-all-products) response displays the sorted variations and variation options. Variations and variation options are displayed in descending order according to their `sort_order` values. + * + * ### Filtering + * + * This endpoint supports filtering. For general filtering syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are available when filtering on this endpoint. + * + * | Operator | Description | Supported Attributes | Example | + * |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | + * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | * * ### Building breadcrumbs in a storefront @@ -1382,267 +1731,1362 @@ export const getByContextChildNodes = ( * | `main_image` | Optional | The main images associated with a product. | * | `files` | Optional | Any files associated with a product. | * - * See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + * See [**Including Resources**](/guides/Getting-Started/includes). + * + */ +export const getProductsForNode = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetProductsForNodeResponse, + GetProductsForNodeError + >({ + ...options, + url: "/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/products", + responseTransformer: GetProductsForNodeResponseTransformer, + }) +} + +/** + * Get Shopper Carts + * You can retrieve the carts that are associated with an [account](/docs/api/carts/account-cart-associations) or a [customer](/docs/api/carts/customer-cart-associations). + * + * When a shopper retrieves their latest carts, the carts are sorted in descending order by the updated_date. For more information, see [Pagination](/guides/Getting-Started/pagination). * + * :::note + * + * Requires an `implicit` token with only one of [Account Management Authentication Token](/docs/api/accounts/post-v-2-account-members-tokens) or [customer token](/docs/customer-management/customer-management-api/customer-tokens). + * + * ::: + * + */ +export const getCarts = (options?: Options) => { + return (options?.client ?? client).get({ + ...options, + url: "/v2/carts", + }) +} + +/** + * Create a Cart + * + * Creates a cart. Call this endpoint each time a customer creates a cart. + * + * Each shopper can have multiple carts. Use the carts API to create a cart. The carts are distinct from one another. Shoppers can add different items to their carts. They can check out one of the carts without affecting the content or status of their other carts. + * + * After the shopper checks out the cart, the cart remains available to the shopper. The cart is persistent and stays with the shopper after it is used. + * + * You can also create a cart to specify custom discounts. You can enable custom discounts when the `discount_settings.custom_discounts_enabled` field is set to `true`. Default is set from cart discount settings for the store. See [Update Cart Settings](/docs/api/settings/put-v-2-settings-cart). + * + * ### Preview Cart + * + * You can set a future date for your shopping cart and view the promotions that will be available during that time period. This feature enables you to validate your promotion settings and observe how they will be applied in the cart. + * + * :::caution + * - Once the cart is in preview mode, you cannot revert it to a regular cart. + * - Carts with `snapshot_date` are same as preview carts. + * - You cannot checkout a cart that includes a `snapshot_date`. + * - To delete a promotion preview cart, use [Delete a cart](/docs/api/carts/delete-a-cart) endpoint. + * - The promotion preview cart has the same expiration time as a regular cart based on the store's [cart settings](/docs/api/settings/put-v-2-settings-cart). + * - Preview cart interactions skip inventory checks and events, allowing users to preview future carts without impacting related external systems. + * ::: + * + * ### Errors + * + * - `400 Bad Request` : This is returned when the submitted request does not adhere to the expected API contract for the endpoint. + * + * - For example, in the case of string fields, this error might indicate issues in the length or format of submitted strings. For more information about valid string fields, refer to Safe Characters section. + * - In the case of preview carts (those with `snapshot_date`), an error is returned for invalid actions, such as removing the preview date, setting a preview date in the past, or attempting to checkout a cart with a `snapshot_date`. + * + */ +export const createAcart = (options?: Options) => { + return (options?.client ?? client).post< + CreateAcartResponse, + CreateAcartError + >({ + ...options, + url: "/v2/carts", + }) +} + +/** + * Get a Cart + * Use this endpoint to retrieve a specific cart. If a cart ID does not exist, a new cart will be automatically created. If the cart is associated with shipping groups, calling this endpoint displays the associated shipping group IDs in the `relationships` section. + * + * You can easily get a new or existing cart by providing the unique cart reference in the request. If the cart is associated with shipping groups, calling this endpoint displays the associated shipping group IDs in the relationships section. + * + * :::note + * + * - The default cart name is Cart. However, you can update the cart name as required. Ensure that the string length of the name is greater than or equal to one. Follow the safe character guidelines for name and description naming. For more information about cart ID naming requirements, see the [Safe Characters](/guides/Getting-Started/safe-characters) section. + * - Outside of the JS-SDK, we don’t handle creating cart references. You need to create your own. + * + * ::: + * + * :::caution + * + * An empty cart is returned for any carts that don’t currently exist. For more information about the cart items object, see [Get Cart Items](/docs/api/carts/get-cart-items). + * + * ::: + * + * ### Query parameters + * + * + * | Name | Required | Type | Description | + * |:----------|:---------|:---------|:-------------------------------------------| + * | `include` | Optional | `string` | Comma-delimited string of entities that can be included. The information included are `items`,`tax_items`, `custom_discounts`, or `promotions`. | + * + */ +export const getCart = (options: Options) => { + return (options?.client ?? client).get({ + ...options, + url: "/v2/carts/{cartID}", + }) +} + +/** + * Update a Cart + * Updates cart properties for the specified cartID. + * + * You can also update a cart to specify custom discounts. You can enable custom discounts when the `discount_settings.custom_discounts_enabled` field is set to `true`. Default is set from cart discount settings for the store. See [Cart Settings](/docs/api/settings/put-v-2-settings-cart). + * + */ +export const updateAcart = (options: Options) => { + return (options?.client ?? client).put( + { + ...options, + url: "/v2/carts/{cartID}", + }, + ) +} + +/** + * Delete a Cart + * You can delete a cart, including the items, name, description, and remove all associations. + * + * ### Errors + * + * The following error message is received when you attempt to delete a cart that is associated with a customer. Before deletion, ensure that the cart is disassociated. + * + * ```json + * message: { + * errors: [ + * { + * status: 400, + * title: 'Last cart', + * detail: 'This is the last cart associated with a customer and it cannot be deleted, try disassociating instead' + * } + * ] + * } + * ```` + * + */ +export const deleteAcart = (options: Options) => { + return (options?.client ?? client).delete< + DeleteAcartResponse, + DeleteAcartError + >({ + ...options, + url: "/v2/carts/{cartID}", + }) +} + +/** + * Get Cart Items + * + * Use this endpoint to retrieve cart items. If the cart is associated with shipping groups, calling this endpoint displays the associated shipping group IDs. + * + * You can use this endpoint to retrieve the breakdown of cart items by promotion ID. For example, if you have Promotions Standard item discount with code *sale2024*, Rule Promotions item discount with code *sale2024*, and Rule Promotions cart discount with code *sale2024*, the `discounts.constituents` field in the response example will show the breakdown of the same promotion code used in both Promotions Standard and Rule Promotions. + * + * ```json + * "data": [ + * { + * "id": "98de010d-dd10-4fa5-a070-0b9bcdc72974", + * "type": "cart_item", + * "product_id": "5a4662d2-9a2b-4f6e-a215-2970db914b0c", + * "name": "sku1", + * "description": "sku1", + * "sku": "sku1", + * "slug": "sku1", + * "image": { + * "mime_type": "", + * "file_name": "", + * "href": "" + * }, + * "quantity": 1, + * "manage_stock": false, + * "unit_price": { + * "amount": 10000, + * "currency": "USD", + * "includes_tax": false + * }, + * "value": { + * "amount": 10000, + * "currency": "USD", + * "includes_tax": false + * }, + * "discounts": [ + * { + * "amount": { + * "amount": -2000, + * "currency": "USD", + * "includes_tax": false + * }, + * "code": "sale2024", + * "id": "e4d929d5-f471-4317-9a86-a84a6c572b44", + * "promotion_source": "rule-promotion", + * "is_cart_discount": true + * }, + * { + * "amount": { + * "amount": -1000, + * "currency": "USD", + * "includes_tax": false + * }, + * "code": "sale2024", + * "id": "de19a043-a6da-4bde-b896-d17e16b77e25", + * "promotion_source": "rule-promotion" + * }, + * { + * "amount": { + * "amount": -1000, + * "currency": "USD", + * "includes_tax": false + * }, + * "code": "sale2024", + * "id": "509295ee-2971-45b6-801e-95df09756989" + * }, + * { + * "amount": { + * "amount": -1000, + * "currency": "USD", + * "includes_tax": false + * }, + * "code": "sale2024", + * "id": "ca79e606-7ecd-41ac-9478-af4c8c28c546", + * "promotion_source": "rule-promotion", + * "is_cart_discount": true + * } + * ], + * "links": { + * "product": "https://useast.api.elasticpath.com/v2/products/5a4662d2-9a2b-4f6e-a215-2970db914b0c" + * }, + * "meta": { + * "display_price": { + * "with_tax": { + * "unit": { + * "amount": 5000, + * "currency": "USD", + * "formatted": "$50.00" + * }, + * "value": { + * "amount": 5000, + * "currency": "USD", + * "formatted": "$50.00" + * } + * }, + * "without_tax": { + * "unit": { + * "amount": 5000, + * "currency": "USD", + * "formatted": "$50.00" + * }, + * "value": { + * "amount": 5000, + * "currency": "USD", + * "formatted": "$50.00" + * } + * }, + * "tax": { + * "unit": { + * "amount": 0, + * "currency": "USD", + * "formatted": "$0.00" + * }, + * "value": { + * "amount": 0, + * "currency": "USD", + * "formatted": "$0.00" + * } + * }, + * "discount": { + * "unit": { + * "amount": -5000, + * "currency": "USD", + * "formatted": "-$50.00" + * }, + * "value": { + * "amount": -5000, + * "currency": "USD", + * "formatted": "-$50.00" + * } + * }, + * "without_discount": { + * "unit": { + * "amount": 10000, + * "currency": "USD", + * "formatted": "$100.00" + * }, + * "value": { + * "amount": 10000, + * "currency": "USD", + * "formatted": "$100.00" + * } + * }, + * "discounts": { + * "sale2024": { + * "amount": -5000, + * "currency": "USD", + * "formatted": "-$50.00", + * "constituents": { + * "509295ee-2971-45b6-801e-95df09756989": { + * "amount": -1000, + * "currency": "USD", + * "formatted": "-$10.00" + * }, + * "ca79e606-7ecd-41ac-9478-af4c8c28c546": { + * "amount": -1000, + * "currency": "USD", + * "formatted": "-$10.00" + * }, + * "de19a043-a6da-4bde-b896-d17e16b77e25": { + * "amount": -1000, + * "currency": "USD", + * "formatted": "-$10.00" + * }, + * "e4d929d5-f471-4317-9a86-a84a6c572b44": { + * "amount": -2000, + * "currency": "USD", + * "formatted": "-$20.00" + * } + * } + * } + * } + * }, + * "timestamps": { + * "created_at": "2024-05-24T18:00:58Z", + * "updated_at": "2024-05-24T18:00:58Z" + * } + * }, + * "catalog_id": "09b9359f-897f-407f-89a2-702e167fe781", + * "catalog_source": "pim" + * } + * ``` + * + */ +export const getCartItems = (options: Options) => { + return (options?.client ?? client).get< + GetCartItemsResponse, + GetCartItemsError + >({ + ...options, + url: "/v2/carts/{cartID}/items", + }) +} + +/** + * Bulk Update Items in Cart + * The bulk update feature allows shoppers to update an array of items to their cart in one action, rather than updating each item one at a time. Shoppers can update quantity and shipping group details in bulk requests. This minimizes the time for shoppers while updating items to their cart. Shoppers can even update multiple items with the same or different shipping groups to their cart. + * + * When you update multiple items that qualify for free gifts in the cart, the corresponding free gifts for all eligible products are also automatically updated in the cart. + * + */ +export const bulkUpdateItemsInCart = ( + options: Options, +) => { + return (options?.client ?? client).put< + BulkUpdateItemsInCartResponse, + BulkUpdateItemsInCartError + >({ + ...options, + url: "/v2/carts/{cartID}/items", + }) +} + +/** + * Manage Carts + * + * ### Add Product to Cart + * + * Adding a Product to Cart is the most common Cart action. If you want to add any custom products or promotions, you need to do that as a separate action. + * + * #### Dynamic Bundles + * + * A bundle is a purchasable product that is composed of a combination of two or more products that you want to sell together. You can create multiple components within a bundle. Each component can have one or more options. Each option is a product and a quantity. You can configure minimum and/or maximum values for the number of product options in a component that your shoppers can select. For example, you can enable a shopper to select 1 or more product options from a list of 10. These are called [dynamic bundles](/docs/api/pxm/products/products#dynamic-bundles). + * + * Your dynamic bundles are displayed in your published catalogs. + * + * 1. Use the configure a shopper endpoint to allow shoppers to make their selections from a bundle. + * 2. In the response of the configure a shopper, the `bundle_configuration` object contains the bundle selections a shopper has made. + * 3. In the add a product to cart request, use the `bundle_configuration` object to add the customers selections to a cart. + * + * ```json + * "bundle_configuration": { + * "selected_options": { + * "games": { + * "d7b79eb8-19d8-45ea-86ed-2324a604dd9c": 1 + * }, + * "toys": { + * "0192ccdd-6d33-4898-87d7-c4d87f2bf8ea": 1, + * "1aea6f97-f0d9-452c-b3c1-7fb5629ead82": 1 + * } + * } + * } + * ``` + * + * When a cart is checked out, the options a shopper selected are added to the order. See [order items](/docs/api/carts/get-order-items). + * + * #### Personalized Products + * + * You can allow shoppers to personalize their goods by adding custom text inputs to products directly. This feature is particularly useful for customizable items, such as personalized T-shirts or greeting cards. You can use this functionality by leveraging the `custom_inputs` attribute, and defining the details and validation rules for the custom text. + * + * First, you must configure a `custom_inputs` attribute when creating a new product or updating an existing product. Once you have defined your custom inputs on a product, you must configure the custom inputs in your orders. + * + * For example, you may sell T-shirts that can have personalized text on the front and back of the shirt. + * + * ```json + * { + * "data": { + * "type": "product", + * "attributes": { + * "custom_inputs": { + * "front": { + * "name": "T-Shirt Front", + * "validation_rules": [ + * { + * "type": "string", + * "options": { + * "max_length": 50 + * } + * } + * ], + * "required": false + * }, + * "back": { + * "name": "T-Shirt Back", + * "validation_rules": [ + * { + * "type": "string", + * "options": { + * "max_length": 50 + * } + * } + * ], + * "required": false + * } + * } + * } + * } + * } + * ``` + * + * If the same product has different `custom_inputs` attributes, then these are added as separate items in a cart. + * + * The `custom_inputs` attribute is stored in the cart item and the text for `custom_input` must not exceed 255 characters in length. When a cart is checked out, the `custom_inputs` attribute becomes part of the order. + * + * #### Limitations on Usage of `custom_inputs` with Specific Promotion Types + * + * When you add products to a cart with `custom_inputs`, there are certain limitations on usage of the `custom_inputs` with the following promotion types: + * + * - For [Free Gift Promotions](/docs/api/promotions/create-a-promotion), you can add `custom_inputs` to gift items. + * - For [Fixed Bundle Discount Promotions](/docs/api/promotions/create-a-promotion), the promotion applies as long as the cart contains the bundle SKUs even when there are different `custom_inputs`. + * - For [X for Y Discount Promotion and X for amount discount promotion](/docs/api/promotions/create-a-promotion), the promotion applies when there are two SKUs with the same `custom_inputs`. The promotion does not apply when there are different `custom_inputs` and the SKUs are in different line items. + * + * :::note + * + * - Any requests to add a product to cart returns the collection of cart items. + * - [Tax items](/docs/api/carts/tax-items) may optionally be added with the product. Only administrators with [client credentials](/docs/authentication/Tokens/client-credential-token) are able to do this. If included, they replace any existing taxes on the product. + * - The cart currency is set when the first item is added to the cart. + * - The product being added to the cart requires a price in the same currency as the other items in the cart. The API returns a 400 error if a price is not defined in the correct currency. + * - A cart can contain a maximum of 100 unique items. Items include products, custom items, tax items, and promotions. + * - There are a number of actions that happen to your inventory when checking out and paying for an order. For more information, see the [Inventory](/docs/api/pxm/inventory/inventories-introduction) documentation. + * + * ::: + * + * ### Add Custom Item to Cart + * + * You can add a custom item to the cart when you don't manage things like shipping, taxes and inventory in Commerce. + * + * For [Shipping Groups](/docs/ship-groups/shipping-groups), once you have created a [cart shipping group](/docs/ship-groups/shipping-groups/shipping-groups-api/create-cart-shipping-group), you need to link it to the cart items. This is important, because it is necessary to associate items with shipping groups in order to include shipping groups in the corresponding cart, order, and totals. + * + * :::note + * + * - Custom Cart Items are available through [implicit authentication](/docs/authentication/Tokens/implicit-token). Ensure that you always check each order has the correct details for each item, most importantly, price. + * + * ::: + * + * ### Add Promotion to Cart + * + * You can use the Promotions API to apply discounts to your cart as a special cart item type. Any requests to add a product to cart will return a collection of cart items. + * + * There are certain limitations on usage of the `custom_inputs` attribute with some promotion types. See [Limitations on Usage of `custom_inputs` with Specific Promotion Types](/docs/api/carts/manage-carts#limitations-on-usage-of-custom_inputs-with-specific-promotion-types). + * + * To remove promotion from the cart via the promotion code, see [Delete Promotion Code from Cart](/docs/api/carts/delete-a-promotion-via-promotion-code). + * + * ### Re-order + * + * From a shopper’s order history, they can add the items from a previous order into their carts. Shoppers can add items regardless of past order status, such as incomplete or not paid. For more information, see [Orders](/docs/api/carts/orders). + * + * :::note + * - Any requests to add an item to cart return a collection of [cart items](/docs/api/carts/cart-items). + * - A cart can contain a maximum of 100 unique items. Items include products, custom items, and promotions. + * - When a shopper creates a cart and re-orders items from an order with properties such as custom attributes, custom discounts, and payment intent ID, these properties will remain unchanged in the original cart. + * - Custom items do not exist in catalogs, and therefore cannot be reordered. + * ::: + * + * ### Merging Carts + * + * A shopper can have multiple carts, and the system may automatically merge items from an anonymous cart into the shopper's registered cart when they sign in. For example, if a shopper has an existing cart with items `A`, `B` and `C`, and later adds items `D` and `E` while not signed in, the system can merge these carts when the shopper signs in. After the carts merge, the cart contains items `A`, `B`, `C`, `D` and `E`. + * + * If any items are duplicated from the anonymous cart to the registered cart, their quantities are incremented accordingly. For example, if a shopper's existing cart with items `A`, `B` and `C`, and they later add two more `A` items and one `B` item while not signed in, the system will merge the carts when the shopper signs in. The existing cart will now contain three `A` items, two `B` items, and one `C` item. + * + * :::note + * + * When the system merges items from one cart into another cart, properties such as custom attributes, custom discounts, and payment intent ID will remain unchanged in the original cart. + * + * ::: + * + * ### Best Practices + * + * We recommend to include a unique `sku` code within the request body while adding custom items to carts. If the same `sku` is used for multiple products, they are merged into a single line item. + * + * For example, if a cart consists of the following items: + * + * - `product-1` with quantity 1 and sku code as `sku-1` + * - `product-2` with quantity 1 and sku code as `sku-1` + * - `product-3` with quantity 1 and sku code as `sku-2`. + * + * The following response is returned where it combines all products with the same sku codes into a single line item, while products with a unique sku codes are represented as separate items: + * + * ```json + * { + * "data": [ + * { + * "id": "c58760f4-8889-4719-b34d-be1f1d11ae59", + * "type": "custom_item", + * "name": "product-1", + * "description": "My first custom item!", + * "sku": "sku-1", + * "slug": "", + * "image": { + * "mime_type": "", + * "file_name": "", + * "href": "" + * }, + * "quantity": 2, + * "manage_stock": false, + * "unit_price": { + * "amount": 20000, + * "currency": "USD", + * "includes_tax": true + * }, + * "value": { + * "amount": 40000, + * "currency": "USD", + * "includes_tax": true + * }, + * "links": {}, + * "meta": { + * "display_price": { + * "with_tax": { + * "unit": { + * "amount": 20000, + * "currency": "USD", + * "formatted": "$200.00" + * }, + * "value": { + * "amount": 40000, + * "currency": "USD", + * "formatted": "$400.00" + * } + * }, + * "without_tax": { + * "unit": { + * "amount": 20000, + * "currency": "USD", + * "formatted": "$200.00" + * }, + * "value": { + * "amount": 40000, + * "currency": "USD", + * "formatted": "$400.00" + * } + * }, + * "tax": { + * "unit": { + * "amount": 0, + * "currency": "USD", + * "formatted": "$0.00" + * }, + * "value": { + * "amount": 0, + * "currency": "USD", + * "formatted": "$0.00" + * } + * }, + * "discount": { + * "unit": { + * "amount": 0, + * "currency": "USD", + * "formatted": "$0.00" + * }, + * "value": { + * "amount": 0, + * "currency": "USD", + * "formatted": "$0.00" + * } + * }, + * "without_discount": { + * "unit": { + * "amount": 20000, + * "currency": "USD", + * "formatted": "$200.00" + * }, + * "value": { + * "amount": 40000, + * "currency": "USD", + * "formatted": "$400.00" + * } + * } + * }, + * "timestamps": { + * "created_at": "2023-05-02T16:28:11Z", + * "updated_at": "2023-05-02T16:28:18Z" + * } + * } + * } + * ``` + * + */ +export const manageCarts = (options: Options) => { + return (options?.client ?? client).post< + ManageCartsResponse, + ManageCartsError + >({ + ...options, + url: "/v2/carts/{cartID}/items", + }) +} + +/** + * Delete all Cart Items + * A shopper can clean up their cart, deleting custom items, promotions, and so on, while the empty cart remains available. The cart id, name, description, and any account or customer associations persist. The shopper can continue to add items to the cart. + * + */ +export const deleteAllCartItems = ( + options: Options, +) => { + return (options?.client ?? client).delete< + DeleteAllCartItemsResponse, + DeleteAllCartItemsError + >({ + ...options, + url: "/v2/carts/{cartID}/items", + }) +} + +/** + * Update a Cart Item + * You can easily update a cart item. A successful update returns the cart items. + */ +export const updateAcartItem = (options: Options) => { + return (options?.client ?? client).put< + UpdateAcartItemResponse, + UpdateAcartItemError + >({ + ...options, + url: "/v2/carts/{cartID}/items/{cartitemID}", + }) +} + +/** + * Delete a Cart Item + * Use this endpoint to delete a cart item. + */ +export const deleteAcartItem = (options: Options) => { + return (options?.client ?? client).delete< + DeleteAcartItemResponse, + DeleteAcartItemError + >({ + ...options, + url: "/v2/carts/{cartID}/items/{cartitemID}", + }) +} + +/** + * Create an Account Cart Association + * You can create associations between an account and one or more carts. After cart associations exist for an account, the account can access those carts across any device. + */ +export const createAccountCartAssociation = ( + options: Options, +) => { + return (options?.client ?? client).post< + CreateAccountCartAssociationResponse, + CreateAccountCartAssociationError + >({ + ...options, + url: "/v2/carts/{cartID}/relationships/accounts", + }) +} + +/** + * Delete Account Cart Association + * You can delete an association between an account and a cart. + */ +export const deleteAccountCartAssociation = ( + options: Options, +) => { + return (options?.client ?? client).delete< + DeleteAccountCartAssociationResponse, + DeleteAccountCartAssociationError + >({ + ...options, + url: "/v2/carts/{cartID}/relationships/accounts", + }) +} + +/** + * Create a Customer Cart Association + * You can create associations between a customer and one or more carts. After cart associations exist for a customer, the customer can access those carts across any device. + */ +export const createCustomerCartAssociation = ( + options: Options, +) => { + return (options?.client ?? client).post< + CreateCustomerCartAssociationResponse, + CreateCustomerCartAssociationError + >({ + ...options, + url: "/v2/carts/{cartID}/relationships/customers", + }) +} + +/** + * Delete Customer Cart Association + * You can delete an association between a customer and a cart. + */ +export const deleteCustomerCartAssociation = ( + options: Options, +) => { + return (options?.client ?? client).delete< + DeleteCustomerCartAssociationResponse, + DeleteCustomerCartAssociationError + >({ + ...options, + url: "/v2/carts/{cartID}/relationships/customers", + }) +} + +/** + * Delete a Promotion via Promotion Code + * You can remove promotion code from a cart if it was applied manually. This endpoint does not work if the promotion is applied automatically. + */ +export const deleteApromotionViaPromotionCode = ( + options: Options, +) => { + return (options?.client ?? client).delete< + DeleteApromotionViaPromotionCodeResponse, + DeleteApromotionViaPromotionCodeError + >({ + ...options, + url: "/v2/carts/{cartID}/discounts/{promoCode}", + }) +} + +/** + * Add Tax Item to Cart + * + * Use this endpoint to add a tax item to a cart. + * + * :::note + * + * There is a soft limit of 5 unique tax items per cart item at any one time. + * + * ::: + * + */ +export const addTaxItemToCart = (options: Options) => { + return (options?.client ?? client).post< + AddTaxItemToCartResponse, + AddTaxItemToCartError + >({ + ...options, + url: "/v2/carts/{cartID}/items/{cartitemID}/taxes", + }) +} + +/** + * Bulk Add Tax Items to Cart + * :::note + * + * A cart item can only have a maximum of five tax items. + * + * ::: + * + * ### Errors + * + * `422 Unprocessable Entity` + * + * In this example, when `options.add_all_or_nothing` is set to `true` and if one of cart items is not found or or has reached its maximum tax item limit, the following error response is returned: + * + * ```json + * { + * "status": 422, + * "title": "Add all or nothing.", + * "detail": "Add all or nothing set to (true). Could not bulk add tax items to cart." + * } + * + * ``` + * + * In this example, if you add more than five tax items to the same cart item, the following error response is returned: + * + * ```json + * { + * "status": 422, + * "title": "Tax item not added to cart item.", + * "detail": "Cannot exceed tax item limit of (5) on cart item.", + * "meta": { + * "id": "f88e6370-cb35-40b2-a998-c759f31dec0a" + * } + * } + * ``` + * + * `404` + * + * In this example, if there is a mismatch between `cart_item`/`custom_item` and the `relationships.item.data.type` specified in the bulk add tax item, the following error response is returned: + * + * ```json + * { + * "data": [], + * "errors": [ + * { + * "status": 404, + * "title": "Tax item not added to cart item.", + * "detail": "Mismatch between bulk tax item type(cart_item) and cart item type(custom_item).", + * "meta": { + * "id": "56aab5d1-1dd4-45ed-88ed-4d0cc396b62d" + * } + * }, + * { + * "status": 404, + * "title": "Tax item not added to cart item.", + * "detail": "Mismatch between bulk tax item type(cart_item) and cart item type(custom_item).", + * "meta": { + * "id": "56aab5d1-1dd4-45ed-88ed-4d0cc396b62d" + * } + * } + * ] + * } + * ``` + * + */ +export const bulkAddTaxItemsToCart = ( + options: Options, +) => { + return (options?.client ?? client).post< + BulkAddTaxItemsToCartResponse, + BulkAddTaxItemsToCartError + >({ + ...options, + url: "/v2/carts/{cartID}/taxes", + }) +} + +/** + * Bulk Delete Tax Items from Cart + * Use this endpoint to bulk delete tax items from cart. + */ +export const bulkDeleteTaxItemsFromCart = ( + options: Options, +) => { + return (options?.client ?? client).delete< + BulkDeleteTaxItemsFromCartResponse, + BulkDeleteTaxItemsFromCartError + >({ + ...options, + url: "/v2/carts/{cartID}/taxes", + }) +} + +/** + * Update a TaxItem + * Use this endpoint to update a tax item. + */ +export const updateAtaxItem = (options: Options) => { + return (options?.client ?? client).put< + UpdateAtaxItemResponse, + UpdateAtaxItemError + >({ + ...options, + url: "/v2/carts/{cartID}/items/{cartitemID}/taxes/{taxitemID}", + }) +} + +/** + * Delete a Tax Item + * Use this endpoint to delete a tax item. + */ +export const deleteAtaxItem = (options: Options) => { + return (options?.client ?? client).delete< + DeleteAtaxItemResponse, + DeleteAtaxItemError + >({ + ...options, + url: "/v2/carts/{cartID}/items/{cartitemID}/taxes/{taxitemID}", + }) +} + +/** + * Bulk Add Custom Discounts to Cart + * The default value for custom discounts on both the cart and cart items is set to 5 if this parameter is not configured in the store. To verify the custom discount limit value, call [Get all settings](/docs/api/settings/get-v-2-settings) endpoint. + * + * To increase the custom discount value, contact [Elastic Path Support team](https://support.elasticpath.com/hc/en-us). + * + */ +export const bulkAddCustomDiscountsToCart = ( + options: Options, +) => { + return (options?.client ?? client).post< + BulkAddCustomDiscountsToCartResponse, + BulkAddCustomDiscountsToCartError + >({ + ...options, + url: "/v2/carts/{cartID}/custom-discounts", + }) +} + +/** + * Bulk Delete Custom Discounts From Cart + * Use this endpoint to bulk delete custom discounts from cart. + */ +export const bulkDeleteCustomDiscountsFromCart = ( + options: Options, +) => { + return (options?.client ?? client).delete< + BulkDeleteCustomDiscountsFromCartResponse, + BulkDeleteCustomDiscountsFromCartError + >({ + ...options, + url: "/v2/carts/{cartID}/custom-discounts", + }) +} + +/** + * Update Custom Discount For Cart + * Use this endpoint to update a custom discount in your cart. + */ +export const updateCustomDiscountForCart = ( + options: Options, +) => { + return (options?.client ?? client).put< + UpdateCustomDiscountForCartResponse, + UpdateCustomDiscountForCartError + >({ + ...options, + url: "/v2/carts/{cartID}/custom-discounts/{customdiscountID}", + }) +} + +/** + * Delete Custom Discount From Cart + * Use this endpoint to delete custom discount from cart. + */ +export const deleteCustomDiscountFromCart = ( + options: Options, +) => { + return (options?.client ?? client).delete< + DeleteCustomDiscountFromCartResponse, + DeleteCustomDiscountFromCartError + >({ + ...options, + url: "/v2/carts/{cartID}/custom-discounts/{customdiscountID}", + }) +} + +/** + * Add Custom Discount To Cart Item + * Use this endpoint to add a custom discount to cart item. */ -export const getByContextAllProducts = ( - options?: Options, +export const addCustomDiscountToCartItem = ( + options: Options, ) => { - return (options?.client ?? client).get< - GetByContextAllProductsResponse, - GetByContextAllProductsError - >({ + return (options?.client ?? client).post({ ...options, - url: "/catalog/products", - responseTransformer: GetByContextAllProductsResponseTransformer, + url: "/v2/carts/{cartID}/items/{cartitemID}/custom-discounts", }) } /** - * Get a Product - * Returns the specified product from the catalog. The product must be in the `live` status. - * - * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). - * - * You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://elasticpath.dev/guides/Catalogs/breadcrumbs). - * - * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. - * - * | Parameter | Required | Description | - * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| - * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | - * | `main_image` | Optional | The main images associated with a product. | - * | `files` | Optional | Any files associated with a product. | - * - * See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). - * + * Update Custom Discount For Cart Item + * Use this endpoint to update a custom discount in your cart item. */ -export const getByContextProduct = ( - options: Options, +export const updateCustomDiscountForCartItem = ( + options: Options, ) => { - return (options?.client ?? client).get< - GetByContextProductResponse, - GetByContextProductError - >({ + return (options?.client ?? client).put({ ...options, - url: "/catalog/products/{product_id}", - responseTransformer: GetByContextProductResponseTransformer, + url: "/v2/carts/{cartID}/items/{cartitemID}/custom-discounts/{customdiscountID}", }) } /** - * Get a Bundle's Component Products - * With Product Experience Manager, you can [create](/docs/api/pxm/products/create-product) and manage bundles. A bundle is a purchasable product, comprising of one or more products that you want to sell together. - * - * You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. - * - * This endpoint returns a list of component product IDs for the specified bundle. - * + * Delete Custom Discount From Cart Item + * Use this endpoint to delete custom discount from cart item. */ -export const getByContextComponentProductIds = ( - options: Options, +export const deleteCustomDiscountFromCartItem = ( + options: Options, ) => { - return (options?.client ?? client).get< - GetByContextComponentProductIdsResponse, - GetByContextComponentProductIdsError + return (options?.client ?? client).delete< + DeleteCustomDiscountFromCartItemResponse, + DeleteCustomDiscountFromCartItemError >({ ...options, - url: "/catalog/products/{product_id}/relationships/component_products", + url: "/v2/carts/{cartID}/items/{cartitemID}/custom-discounts/{customdiscountID}", }) } /** - * Get a Parent Product's Child Products - * For a specified product and catalog release, retrieves a list of child products from a parent product. Any product other than a base product results in a `422 Unprocessable Entity` response. Only the products in a `live` status are retrieved. + * Create Stripe Payment Intent for a Cart + * The Cart Payment Intent feature enables the creation of a Stripe Payment Intent specifically tied to a shopping cart and its subsequent order. This allows Payment Intent users to track payment details from the cart stage and seamlessly maintain consistency in payment information throughout the order stage. Using these features, you can create Payment Intents for their carts, update Payment Intents with final cart details, and synchronize Payment Intents from Stripe to Commerce. * - * If you have multiple catalog rules defined, the rule that best matches the shopperʼs context is used to determine which catalog is retrieved. If no catalog rules are configured, the first catalog found is returned. For information about how rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). - * - * You can see the parent nodes a product is associated within the `breadcrumbs` metadata for each product. For example, this is useful if you want to improve how your shoppers search your store. See [Product and Node Associations in Breadcrumb Metadata](https://elasticpath.dev/guides/Catalogs/breadcrumbs). - * - * ### Filtering - * - * This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. - * - * | Operator | Description | Supported Attributes | Example | - * |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | - * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | - * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | - * - * ### Building breadcrumbs in a storefront + * :::note * - * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + * - Typically, in Commerce, inventory is allocated at the time of payment initiation after an order is created. However, in the case of Cart Payment Intent, information about the payment is received only upon synchronizing the order from Stripe to Commerce. This may happen after the payment is completed. Therefore, there might be a delay between the payment made and allocation, increasing the chance of paying for items that are not in stock. + * - There are certain fields you can choose to set up when [creating a payment intent](https://stripe.com/docs/api/payment_intents/create). However, if you decide to update a payment intent, the available options may not be the same as those allowed while creating a payment intent. See [updating a payment intent](https://stripe.com/docs/api/payment_intents/update). * - * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + * ::: * - * - Specify the node Ids in the filter expression. - * - You can have as many node Ids as you want. - * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + * The following steps outline the workflow associated with the Payment Intent: * - * ### Including Resources + * 1. [Add items to cart](/docs/api/carts/manage-carts#add-custom-item-to-cart). + * 1. [Create a Payment Intent for the cart](/docs/api/carts/create-cart-payment-intent). The Payment Intent is created in Stripe, reflecting the cart and transaction details, including currency, amounts, payment type, and any optional Stripe details. The Payment Intent ID is generated and linked to the cart. + * 1. [Update a Payment Intent](/docs/carts-orders/update-cart-payment-intent). This step is optional but becomes necessary when there are changes in the cart details at the time of payment. It ensures the Payment Intent accurately reflects the current cart details when processing the payments on the front end. + * 1. [Checkout the cart](/docs/api/carts/checkout). An unpaid order is created, and the Payment Intent ID is linked to the order. + * 1. [Confirm the order](/docs/carts-orders/confirm-an-order). This is important because after checkout, it is essential to confirm the Payment Intent and synchronize it with Commerce. This results in a corresponding transaction and change in order statuses in Commerce. Additionally, the Payment Intent ID is removed from the order once it is linked via the transaction. * - * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + * ### Best Practices * - * | Parameter | Required | Description | - * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| - * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | - * | `main_image` | Optional | The main images associated with a product. | - * | `files` | Optional | Any files associated with a product. | + * We recommend you follow these practices to maintain consistency and accuracy when using Cart Payment Intent. * - * See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + * - After checkout, we recommend clearing the shopping cart. You can achieve this using a [Delete a cart](/docs/api/carts/delete-a-cart) endpoint or [Update a cart](/docs/api/carts/update-a-cart) to remove the Payment Intent ID. This helps to avoid potential issues where subsequent checkouts for the same cart might unintentionally use the previous Stripe Payment Intent ID. + * - If it is not reasonable to clear the cart immediately after checkout due to several subsequent, duplicate checkouts to the same cart, ensure that you only synchronize the Payment Intent when finalizing the order. Each order confirmation is unaware of the others, and syncing Payment Intent IDs for each confirmation can lead to duplicate transactions in Commerce. In other words, if you synchronize Payment Intents for earlier versions of a repeated checkout, you'll end up with multiple orders from the same cart, each having transactions linked to the same Payment Intent. + * - To pay the entire amount at once, use the [Update Cart Payment Intent](/docs/carts-orders/update-cart-payment-intent) endpoint to update the Stripe Payment Intent with the final cart details when preparing to take the payment. Doing so, ensures that the Payment Intent accurately reflects the current cart details when processing payments on the front end. We do not recommend calling the [Update Cart Payment Intent](/docs/carts-orders/update-cart-payment-intent) for each individual change in the cart, as this can lead to more requests and may slow down the front-end performance. * */ -export const getByContextChildProducts = ( - options: Options, +export const createCartPaymentIntent = ( + options: Options, ) => { - return (options?.client ?? client).get< - GetByContextChildProductsResponse, - GetByContextChildProductsError + return (options?.client ?? client).post< + CreateCartPaymentIntentResponse, + CreateCartPaymentIntentError >({ ...options, - url: "/catalog/products/{product_id}/relationships/children", - responseTransformer: GetByContextChildProductsResponseTransformer, + url: "/v2/carts/{cartID}/payments", }) } /** - * Get a Hierarchy's Products - * Returns the products associated with the specified hierarchy in the catalog. The products must be in the live status. + * Checkout API + * When a Cart is ready for checkout, you can convert the cart to an order. The cart remains and can be modified and checked out again if required. * - * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. See [Resolving catalog rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + * A cart can be checked out with a customer ID, customer object, or with an account by authenticating with the `Client Credentials Token`. * - * You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://elasticpath.dev/guides/Catalogs/breadcrumbs). + * After a successful checkout, a response that contains the order is returned. If the cart is linked to a shipping group, the shipping group is also associated with the order after checkout. * - * ### Filtering + * You can checkout using one of the following methods: + * - Customer ID. You can checkout a cart with an existing customer ID. + * - Guest Checkout (Checkout with Customer Object). You can checkout a cart with an associated customer name and email. + * - Checkout with Account. The shopper authenticates with the `Client Credentials` Token. + * - Checkout with Account Management Authentication Token. The shopper authenticates with the `Implicit Token` and the `EP-Account-Management-Authentication-Token`. * - * This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. + * :::note * - * | Operator | Description | Supported Attributes | Example | - * |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | - * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | - * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | + * - The cart currency is set when the first item is added to the cart. + * - The product being added to the cart requires a price in the same currency as the other items in the cart. The API returns a 400 error if a price is not defined in the correct currency. + * - To ensure that a free gift is automatically applied to an order, set the promotion to automatic. The checkout process will not be successful if free gift items are out of stock. See [Errors](#errors) section. * - * ### Building breadcrumbs in a storefront + * ::: * - * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + * :::caution * - * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + * - By default, carts are automatically deleted 7 days after the last update. You can change this setting by [updating cart settings](/docs/api/settings/put-v-2-settings-cart). + * - Your inventory is modified during checkout and payment of an order. For more information about the changes in the inventory, see the [Inventory](/docs/api/pxm/inventory/inventories-introduction) section. * - * - Specify the node Ids in the filter expression. - * - You can have as many node Ids as you want. - * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + * ::: * - * ### Including Resources + * ### Next Steps * - * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + * After a cart has been converted to an Order using either of the previous methods, you most likely want to capture payment for order. See [Paying for an Order](/docs/api/carts/payments). * - * | Parameter | Required | Description | - * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| - * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | - * | `main_image` | Optional | The main images associated with a product. | - * `files` | Optional | Any files associated with a product. | + * ### Errors + * + * The following error response is returned during checkout when an eligible item is added to the cart, and the free gift is out of stock. * - * See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + * ```json + * { + * "errors": [ + * { + * "status": 400, + * "title": "Insufficient stock", + * "detail": "There is not enough stock to add gift2 to your cart", + * "meta": { + * "id": "f2b68648-9621-45a3-aed6-1b526b0f5beb", + * "sku": "gift2" + * } + * } + * ] + * } + * ``` * */ -export const getByContextProductsForHierarchy = ( - options: Options, -) => { - return (options?.client ?? client).get< - GetByContextProductsForHierarchyResponse, - GetByContextProductsForHierarchyError +export const checkoutApi = (options: Options) => { + return (options?.client ?? client).post< + CheckoutApiResponse, + CheckoutApiError >({ ...options, - url: "/catalog/hierarchies/{hierarchy_id}/products", - responseTransformer: GetByContextProductsForHierarchyResponseTransformer, + url: "/v2/carts/{cartID}/checkout", }) } /** - * Get a Node's Products - * Returns the products associated with the specified hierarchy node in the catalog. The products must be in the `live` status. If the products have been curated then the products are returned in the order specified in the `curated_products` attribute. A product that is curated has the `"curated_product": true` attribute displayed. + * Get All Orders + * This endpoint returns all orders with custom flow fields. The pagination offset is set to fetch a maximum of 10,000 orders. If the store has 10,000 orders and you fetch the orders without using filters, an error is returned. Use a filter to view orders when the order is beyond the 10,000 mark. * - * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog is retrieved. See [Resolving catalog rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). + * :::note + * + * - Pass the `X-Moltin-Customer-Token` header to limit orders to a specific customer. See [Customer Tokens](/docs/customer-management/customer-management-api/customer-tokens). + * - Pass the `EP-Account-Management-Authentication-Token` header to limit orders to a specific account. See [Account Management Token](/docs/api/accounts/post-v-2-account-members-tokens). + * - You can use pagination with this resource. For more information, see [pagination](/guides/Getting-Started/pagination). * - * You can see the parent nodes a product is associated with in the `bread_crumbs` and `bread_crumb_nodes` metadata for each product. This is useful if you want to improve how your shoppers search your store, for example. See [Product and Node Associations in Breadcrumb Metadata](https://elasticpath.dev/guides/Catalogs/breadcrumbs). + * ::: * * ### Filtering * - * This endpoint supports filtering. For general filtering syntax, see [Filtering](/docs/commerce-cloud/api-overview/filtering). The following operators and attributes are available when filtering on this endpoint. + * The following operators and attributes are available for filtering orders. + * + * | Attribute | Type | Operator | Example | + * | :--- | :--- | :--- | :--- | + * | `status` | `string` | `eq` | `eq(status,complete)` | + * | `payment` | `string` | `eq` | `eq(payment,paid)` | + * | `shipping` | `string` | `eq` | `eq(shipping,unfulfilled)` | + * | `name` (`customer.name`) | `string` | `eq` / `like` | `like(name,Brad*)` | + * | `email` (`customer.email`) | `string` | `eq` / `like` | `like(email,*@elasticpath.com)` | + * | `customer_id` | `string` | `eq` / `like` | `eq(customer_id, e5a0d684-a4af-4919-a348-f66b0b4955e0)` | + * | `account_id` | `string` | `eq` / `like` | `eq(account_id,3d7200c9-a9bc-4085-9822-63e80fd94a09)` | + * | `account_member_id` | `string` | `eq` / `like` | `eq(account_member_id,2a8a3a92-2ccd-4b2b-a7af-52d3896eaecb)` | + * | `contact.name` | `string` | `eq` / `like` | `eq(name,John Doe)` | + * | `contact.email` | `string` | `eq` / `like` | `eq(email,John Doe)` | + * | `shipping_postcode` | `string` | `eq` / `like` | `like(shipping_postcode,117*)` | + * | `billing_postcode` | `string` | `eq` / `like` | `like(billing_postcode,117*)` | + * | `with_tax` | `integer` | `gt`/`ge`/`lt`/`le` | `ge(with_tax,10000)` | + * | `without_tax` | `integer` | `gt`/`ge`/`lt`/`le` | `ge(without_tax,10000)` | + * | `currency` | `string` | `eq` | `eq(currency,USD)` | + * | `product_id` | `string` | `eq` | `eq(product_id,6837058c-ae42-46db-b3c6-7f01e0c34b40)` | + * | `product_sku` | `string` | `eq` | `eq(product_sku,deck-shoe-001)` | + * | `created_at` | `date` | `eq` / `gt` / `ge`/ `le` / `lt` | `gt(created_at,YYYY-MM-DD)` | + * | `updated_at` | `date` | `eq` / `gt` / `ge`/ `le`/ `lt` | `lt(updated_at,YYYY-MM-DD)` | + * | `external_ref` | `string` | `eq` / `like` | `like(external_ref, 16be*)` | * - * | Operator | Description | Supported Attributes | Example | - * |:---|:------------------------------------------------------------------------------------------------|:---------------------------------------------------------|:--- | - * | `Eq` | Checks if the values of two operands are equal. If they are, the condition is true. For `product_types` and `tags`, you can only specify one. For example, `filter=eq(product_types,child)`. | `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=eq(name,some-name)` | - * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types` and `tags`, you can specify more than one. For example, `filter=in(product_types,child,bundle)`. | `id`, `name`, `sku`, `slug`, `manufacturer_part_num`, `upc_ean`, `product_types`, `tags` | `filter=in(id,some-id)` | + */ +export const getCustomerOrders = (options?: Options) => { + return (options?.client ?? client).get< + GetCustomerOrdersResponse, + GetCustomerOrdersError + >({ + ...options, + url: "/v2/orders", + }) +} + +/** + * Get an Order + * Use this endpoint to retrieve a specific order. + */ +export const getAnOrder = (options: Options) => { + return (options?.client ?? client).get({ + ...options, + url: "/v2/orders/{orderID}", + }) +} + +/** + * Update an Order + * You can only update custom data, `shipping`, `shipping_address`, and status on orders. All other settings in the order object are immutable. * - * ### Building breadcrumbs in a storefront + * :::caution * - * In a catalog, you can use a filter to return a list of nodes in a hierarchy structure that a product belongs to. You can use this to build breadcrumbs in your storefront. An example is shown below. + * You can update `shipping`, `shipping_address`, and status of an order only if the order is not fulfilled. You can use the refund API to refund an order only if the payment status is `paid`. Canceling an order does not automatically refund a payment. You must refund the orders manually. * - * `filter=in(id,c83bfe55-0d87-4302-a86d-ab19e7e323f1,6003d7ef-84f3-49bb-a8bd-4cbfa203dcbb)` + * ::: * - * - Specify the node Ids in the filter expression. - * - You can have as many node Ids as you want. - * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. + * :::note * - * ### Including Resources + * - This request is only accessible to client credentials token users with Seller Admin role. + * - Non client credentials token users cannot access this endpoint. See [Permissions](/docs/authentication/Tokens/permissions). * - * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + * ::: * - * | Parameter | Required | Description | - * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| - * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | - * | `main_image` | Optional | The main images associated with a product. | - * | `files` | Optional | Any files associated with a product. | + */ +export const updateAnOrder = (options: Options) => { + return (options?.client ?? client).put< + UpdateAnOrderResponse, + UpdateAnOrderError + >({ + ...options, + url: "/v2/orders/{orderID}", + }) +} + +/** + * Get Order Items + * Use this endpoint to retrieve order items. + */ +export const getOrderItems = (options: Options) => { + return (options?.client ?? client).get< + GetOrderItemsResponse, + GetOrderItemsError + >({ + ...options, + url: "/v2/orders/{orderID}/items", + }) +} + +/** + * Anonymize Orders + * You can anonymize an order when it is fulfilled, canceled, or fully refunded. * - * See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + * When anonymization is successful, Personal Identifiable Information such as customer details, `shipping_address`, and `billing_address` are replaced with *. * */ -export const getByContextProductsForNode = ( - options: Options, +export const anonymizeOrders = (options?: Options) => { + return (options?.client ?? client).post< + AnonymizeOrdersResponse, + AnonymizeOrdersError + >({ + ...options, + url: "/v2/orders/anonymize", + }) +} + +/** + * Authorize Setup + * Authorize setup + */ +export const authorizeSetup = (options: Options) => { + return (options?.client ?? client).post< + AuthorizeSetupResponse, + AuthorizeSetupError + >({ + ...options, + url: "/v2/orders/{orderID}/payments", + }) +} + +/** + * Confirm Setup + * Confirm setup + */ +export const confirmSetup = (options: Options) => { + return (options?.client ?? client).post< + ConfirmSetupResponse, + ConfirmSetupError + >({ + ...options, + url: "/v2/orders/{orderID}/transactions/{transactionID}/confirm", + }) +} + +/** + * Capture a Transaction + * Use this endpoint to capture a previously authorized payment. In this step, you can also pass in a custom reference, such as the payment reference from your chosen gateway. + */ +export const captureAtransaction = ( + options: Options, ) => { - return (options?.client ?? client).get< - GetByContextProductsForNodeResponse, - GetByContextProductsForNodeError + return (options?.client ?? client).post< + CaptureAtransactionResponse, + CaptureAtransactionError >({ ...options, - url: "/catalog/nodes/{node_id}/relationships/products", - responseTransformer: GetByContextProductsForNodeResponseTransformer, + url: "/v2/orders/{orderID}/transactions/{transactionID}/capture", }) } /** - * Configure a Shopper Bundle - * Once you have configured your product bundles, you can display them in your storefront in your published catalog. Depending on how you have configured the minimum and maximum values for the product options in your components, you can allow your shoppers to choose which products they want to select. For example, you can enable a shopper to select 1 or more product options from a list of 10, giving your shoppers greater flexibility when selecting products in your store front. + * Refund a Transaction + * There are two ways to refund; through your payment gateway and mark it refunded in Commerce Manager, or directly through Commerce Manager or API. * - * - Products must be in a `live` status. - * - If you have not specified any minimum or maximum values for the product options in your components, your shoppers can select any combination of product options. + * * Mark as Refunded: You can manually mark a transaction as refunded. Before you can mark the order as refunded, you need to handle the actual refund on your side with your payment provider. Mark as Refunded is a full refund made to the transaction. + * * Refund through Composable Commerce: You can process a full or partial refund to a supported payment provider directly from Commerce Manager or API by providing the refund amount. When you start the refund process, the request is directly sent to the payment gateway. * - * If you have configured minimum and maximum values using [Create a Bundle](/docs/api/pxm/products/create-product), this becomes part of the `bundle_configuration`. You can check how your bundle is configured using [Get a product in a catalog release](/docs/api/pxm/catalog/get-product) in `bundle_configuration` under `meta`. The `bundle_configuration` forms the body of the request. + * :::caution * - * The response updates the `bundle_configuration` with the product options the shopper selects. The `meta` data is updated with the `meta` data of the selected product options. In your storefront, you could display this as a summary of the product options a shopper has selected. + * If you use manual gateway for partial or full refund, you need to handle the actual refund on your side with your payment provider. * - * ### Including Resources + * ::: * - * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products and product attributes, such as SKU or slug. + */ +export const refundAtransaction = ( + options: Options, +) => { + return (options?.client ?? client).post< + RefundAtransactionResponse, + RefundAtransactionError + >({ + ...options, + url: "/v2/orders/{orderID}/transactions/{transactionID}/refund", + }) +} + +/** + * Get Order Transactions + * Get order transactions + */ +export const getOrderTransactions = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetOrderTransactionsResponse, + GetOrderTransactionsError + >({ + ...options, + url: "/v2/orders/{orderID}/transactions", + }) +} + +/** + * Get a Transaction + * Retrieves a transaction + */ +export const getAtransaction = (options: Options) => { + return (options?.client ?? client).get< + GetAtransactionResponse, + GetAtransactionError + >({ + ...options, + url: "/v2/orders/{orderID}/transactions/{transactionID}", + }) +} + +/** + * Cancel a Transaction + * Use this endpoint to cancel or void a pending or authorized transaction. The transaction can be canceled or voided when it is in `pending` and `completed` statuses. * - * | Parameter | Required | Description | - * | :---------------------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| - * | `component_products` | Optional | The component product data and key attribute data, such as SKU or slug, to return for component products in a product bundle. | - * | `main_image` | Optional | The main images associated with a product. | - * | `files` | Optional | Any files associated with a product. | + * :::caution * - * See [**Including Resources**](https://elasticpath.dev/docs/commerce-cloud/api-overview/includes). + * This endpoint works only for Stripe and PayPal and does not work for manual gateway. + * + * ::: * */ -export const configureByContextProduct = ( - options: Options, +export const cancelAtransaction = ( + options: Options, ) => { return (options?.client ?? client).post< - ConfigureByContextProductResponse, - ConfigureByContextProductError + CancelAtransactionResponse, + CancelAtransactionError >({ ...options, - url: "/catalog/products/{product_id}/configure", - responseTransformer: ConfigureByContextProductResponseTransformer, + url: "/v2/orders/{orderID}/transactions/{transactionID}/cancel", }) } diff --git a/packages/sdks/shopper/src/client/types.gen.ts b/packages/sdks/shopper/src/client/types.gen.ts index 3b91c05a..7387c8fe 100644 --- a/packages/sdks/shopper/src/client/types.gen.ts +++ b/packages/sdks/shopper/src/client/types.gen.ts @@ -106,8 +106,6 @@ export type Catalog = { */ export type owner = "store" | "organization" -export type type = "catalog" - /** * Creates a catalog with the following attributes. */ @@ -259,11 +257,6 @@ export type ComponentProductOption = { default?: boolean | null } -/** - * This represents the type of object being returned. Always `product`. - */ -export type type2 = "product" - /** * A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. */ @@ -292,11 +285,6 @@ export type CustomInputValidationRule = { options?: CustomInputValidationRuleOptions } -/** - * This represents the type of object being returned. Must be `string`. - */ -export type type3 = "string" - /** * The name of the custom input. You can rename the input to something more representative of the input that shoppers are adding, for example, `message` or `front`. */ @@ -407,11 +395,6 @@ export type FileReference = { created_at?: Date } -/** - * This represents the type of object being returned. Always `file`. - */ -export type type4 = "file" - /** * In Product Experience Manager, products can have associated rich media assets, such as product images or a file containing additional product details. */ @@ -569,24 +552,6 @@ export type Links = { next?: string | null } -/** - * Included is an array of resources that are included in the response. - */ -export type Included = { - /** - * The main images associated with a product. - */ - main_images?: Array - /** - * The component products associated with a product. - */ - component_products?: Array - /** - * The files associated with a product. - */ - files?: Array -} - /** * In Product Experience Manager, products can also have associated product images. */ @@ -606,11 +571,6 @@ export type MainImageRelationship = { } } -/** - * This represents the type of object being returned. Always `main_image`. - */ -export type type5 = "main_image" - /** * A category node in a catalog. Nodes can have child nodes, as well as a list of attached products. */ @@ -786,8 +746,6 @@ export type NodeRelationships = { } } -export type type6 = "node" - /** * Container for node relationships. */ @@ -849,11 +807,6 @@ export type Pricebook = { } } -/** - * This represents the type of object being returned. Always `pricebook`. - */ -export type type7 = "pricebook" - /** * Container for pricebooks. */ @@ -892,8 +845,6 @@ export type PricebookPrice = { id: string } -export type type8 = "product-price" - /** * Container for pricebook prices. */ @@ -1215,11 +1166,6 @@ export type ProductMeta = { language?: string } -/** - * The source of a catalog. Always `pim`. - */ -export type catalog_source = "pim" - /** * The options available for a variation. */ @@ -1583,11 +1529,6 @@ export type Rule = { type: "catalog_rule" } -/** - * This represents the type of object being returned. Always `catalog_rule`. - */ -export type type9 = "catalog_rule" - /** * A catalog rule specifies which catalog to use for a given shopper context. */ @@ -1829,6 +1770,24 @@ export type CatalogReleaseCreateData = { } } +/** + * Included is an array of resources that are included in the response. + */ +export type Included = { + /** + * The main images associated with a product. + */ + main_images?: Array + /** + * The component products associated with a product. + */ + component_products?: Array + /** + * The files associated with a product. + */ + files?: Array +} + export type ElasticPathFile = { /** * The unique identifier for this file. @@ -1894,771 +1853,1687 @@ export type FileLink = { href?: string } -/** - * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. - */ -export type ParameterChannel = string - -/** - * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). - */ -export type ParameterAcceptLanguage = string - -/** - * Product tags are used to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. You can enhance your product list using tags, enabling you to refine your product list and run targeted promotions. Tags are used to refine the eligibility criteria for a rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. - */ -export type ParameterTag = string - -/** - * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. - */ -export type ParameterLimit = number - -/** - * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. - */ -export type ParameterOffset = number - -/** - * This endpoint supports filtering. See [Filtering](#filtering). - * - */ -export type ParameterFilterRule = string - -/** - * - * This endpoints supports filtering. See [Filtering](#filtering). - * - */ -export type ParameterFilterHierarchy = string - -/** - * This endpoint supports filtering, see [Filtering](#filtering). - * - */ -export type ParameterFilterNode = string - -/** - * This endpoints support filtering. See [Filtering](#filtering). - * - */ -export type ParameterFilterProduct = string - -/** - * Using the `include=component_products` parameter, you can retrieve key attribute data for the bundle component products in the product bundle, such as SKU or slug . - * - */ -export type ParameterIncludeComponentProducts = string - -/** - * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products. - * - */ -export type ParameterInclude = Array< - "main_images" | "files" | "component_products" -> - -export type CreateCatalogData = { +export type CartsRequest = { /** - * Creates a catalog with the following attributes. + * The cart description. */ - body: CatalogCreateData + description?: string + discount_settings?: DiscountSettings + /** + * The cart name provided by the shopper. A cart name must contain 1 to 255 characters. You cannot use whitespace characters, but special characters are permitted. For more information, see the [Safe Characters](/guides/Getting-Started/safe-characters) section. + */ + name?: string + /** + * This optional parameter sets a reference date for the cart. If this parameter is set, it allows the cart to act as one that might occur on that specified date. For example, such future carts might acquire future-enabled discounts, allowing users to test and validate future interactions with carts. The snapshot_date must be in the format 2026-02-21T15:07:25Z. By default, this parameter is left empty. + */ + snapshot_date?: string + custom_attributes?: CustomAttributes + /** + * To remove the Stripe payment intent from a cart, pass the empty value in the `payment_intent_id` field. You must use an empty value for this field. You cannot use this endpoint to directly update the cart to use an existing Payment Intent. + */ + payment_intent_id?: string } -export type CreateCatalogResponse = CatalogData - -export type CreateCatalogError = ErrorResponse - -export type GetCatalogsResponse = CatalogListData - -export type GetCatalogsError = ErrorResponse +export type DiscountSettings = { + /** + * This parameter enables custom discounts for a cart. When set to true, Elastic Path promotions will not be applied to the new carts. Default is set from cart discount settings for the store. See [Cart Settings](/docs/api/settings/put-v-2-settings-cart). + */ + custom_discounts_enabled?: boolean + /** + * When set to true, this parameter allows the cart to use rule promotions. + */ + use_rule_promotions?: boolean +} -export type GetCatalogByIdData = { - path: { +export type CustomAttributes = { + /** + * Specifies the custom attributes for the cart object. The attribute can be any string, numerical, and underscore. A cart can have maximum of 20 custom attributes. + */ + custom_attributes?: { /** - * The catalog ID. + * Specifies the attribute `type` and `value`. */ - catalog_id: string + attribute?: { + /** + * Specifies the type of the attribute such as string, integer, boolean, and float. + */ + type?: string + /** + * Specifies the value of the attribute. + */ + value?: string | number | boolean + } } } -export type GetCatalogByIdResponse = CatalogData - -export type GetCatalogByIdError = ErrorResponse - -export type UpdateCatalogData = { +export type CartResponse = { /** - * Updated catalog. + * The unique identifier for the cart. Use SDK or create it yourself. */ - body: CatalogUpdateData - path: { + id?: string + /** + * The type of object being returned. + */ + type?: string + /** + * The name of this cart. + */ + name?: string + /** + * A description of the cart. + */ + description?: string + discount_settings?: DiscountSettings + /** + * Stripe-assigned unique identifier for the linked Payment Intent + */ + payment_intent_id?: string + links?: { /** - * The catalog ID. + * A link to that specific resource. */ - catalog_id: string + self?: string + } + meta?: { + display_price?: { + with_tax?: FormattedPriceData + without_tax?: FormattedPriceData + tax?: FormattedPriceData + discount?: FormattedPriceData + without_discount?: FormattedPriceData + shipping?: FormattedPriceData + } + timestamps?: Timestamps + } + relationships?: { + customers?: { + data?: { + /** + * The type of related object. + */ + type?: string + /** + * The ID of the customer. + */ + readonly id?: string + } + } + items?: { + data?: { + /** + * The type of related object. + */ + type?: string + /** + * The unique identifier for the cart item + */ + readonly id?: string + } + } } } -export type UpdateCatalogResponse = CatalogData +export type CartItemsObjectRequest = + | CartItemObject + | CartMergeObjectRequest + | CustomItemObject + | ReOrderObjectRequest + | PromotionItemObject -export type UpdateCatalogError = ErrorResponse +export type CartItemObject = { + data?: CartItemObjectData & CartItemResponse +} -export type DeleteCatalogByIdData = { - path: { +export type CartItemObjectData = { + /** + * The type of object being returned. + */ + type: "cart_item" + /** + * The number of items added to the cart. + */ + quantity: number + /** + * Specifies the ID of the product you want to add to cart. (use this OR sku) + */ + id?: string + /** + * Specifies the item SKU that you want to add to cart. (use this OR id) + */ + sku?: string + /** + * The custom text to be added to a product. + */ + custom_inputs?: { + [key: string]: unknown + } + /** + * Object used to describe the bundle options selected. + */ + bundle_configuration?: { /** - * The catalog ID. + * Specifies selected options. */ - catalog_id: string + selected_options?: { + [key: string]: unknown + } } + /** + * Identifier for a created Cart Shipping Group + */ + shipping_group_id?: string } -export type DeleteCatalogByIdResponse = void +/** + * The type of object being returned. + */ +export type type = "cart_item" -export type DeleteCatalogByIdError = ErrorResponse +export type CartMergeObjectRequest = { + data?: Array + options?: AddAllOrNothingOptionsObject +} -export type PublishReleaseData = { +export type CartMergeObject = { /** - * Options for catalog release publishing + * The type of object being returned. Must be `cart_items`. */ - body?: CatalogReleaseCreateData - path: { - /** - * The catalog ID. - */ - catalog_id: string - } + type: "cart_items" + /** + * The original cart to be merged from. + */ + cart_id: string } -export type PublishReleaseResponse = ReleaseData +/** + * The type of object being returned. Must be `cart_items`. + */ +export type type2 = "cart_items" -export type PublishReleaseError = ErrorResponse +export type CustomItemObject = { + data?: CustomItemObjectData +} -export type GetReleasesData = { - headers?: { +export type CustomItemObjectData = { + /** + * The type of object being returned. Must be `custom_item`. + */ + type: "custom_item" + /** + * The number of custom items to add to cart. + */ + quantity: number + price: { /** - * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + * The unit price of the custom item. */ - "accept-language"?: string - } - path: { + amount: number /** - * The catalog ID. + * Set to`true` if relevant taxes have been included in the price, `false` if not. Defaults to `true`. */ - catalog_id: string + includes_tax?: boolean } -} - -export type GetReleasesResponse = ReleaseListData - -export type GetReleasesError = ErrorResponse - -export type DeleteReleasesData = { - path: { - /** - * The catalog ID. - */ - catalog_id: string + /** + * A description of the custom item. + */ + description?: string + /** + * The `SKU` code to use for the custom item. See [best practices](https://elasticpath.dev/docs/commerce-cloud/carts/cart-items/add-custom-item-to-cart#best-practices) to use the `SKU` code. + */ + sku?: string + /** + * The name of the custom item. + */ + name: string + /** + * The custom text to be added to a product. + */ + custom_inputs?: { + [key: string]: unknown } + /** + * Identifier for a created Cart Shipping Group + */ + shipping_group_id?: string } -export type DeleteReleasesResponse = void - -export type DeleteReleasesError = ErrorResponse +/** + * The type of object being returned. Must be `custom_item`. + */ +export type type3 = "custom_item" -export type GetReleaseByIdData = { - headers?: { - /** - * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). - */ - "accept-language"?: string - } - path: { - /** - * The catalog ID. - */ - catalog_id: string - /** - * The catalog release ID. - */ - release_id: string - } +export type ReOrderObjectRequest = { + data?: ReOrderObject + options?: AddAllOrNothingOptionsObject } -export type GetReleaseByIdResponse = ReleaseData +export type ReOrderObject = { + /** + * The type of resource being returned. Use `order_items`. + */ + type: "order_items" + /** + * The unique identifier of the order. + */ + order_id: string +} -export type GetReleaseByIdError = ErrorResponse +/** + * The type of resource being returned. Use `order_items`. + */ +export type type4 = "order_items" -export type DeleteReleaseByIdData = { - path: { - /** - * The catalog ID. - */ - catalog_id: string - /** - * The catalog release ID. - */ - release_id: string - } +export type BulkAddItemsRequest = { + data?: + | CartItemsObjectRequest + | CartMergeObjectRequest + | CustomItemObject + | ReOrderObjectRequest + | PromotionItemObject } -export type DeleteReleaseByIdResponse = void - -export type DeleteReleaseByIdError = ErrorResponse +export type PromotionItemObject = { + data?: PromotionItemObjectData +} -export type CreateRuleData = { +export type PromotionItemObjectData = { /** - * Creates a catalog rule with the following attributes. + * Specifies the type of resource, which is `promotion_item`. */ - body: RuleCreateData + type: "promotion_item" + /** + * Specifies the promotion code. For more information about codes[].user[], see the [Create Promotion codes](/docs/api/promotions/create-promotion-codes) section. + */ + code: string } -export type CreateRuleResponse = RuleData - -export type CreateRuleError = ErrorResponse +/** + * Specifies the type of resource, which is `promotion_item`. + */ +export type type5 = "promotion_item" -export type GetRulesData = { - query?: { +export type BulkUpdateCartsItems = { + data?: Array<{ /** - * This endpoint supports filtering. See [Filtering](#filtering). - * + * Specifies the ID of the cart item that you want to update in cart. */ - filter?: string + id?: string /** - * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * Specifies the amount of items to update in the cart. */ - "page[limit]"?: number + quantity?: number /** - * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * Specifies the custom text to be added to a product. See [custom inputs](https://elasticpath.dev/docs/pxm/products/ep-pxm-products-api/update-a-product#using-custom-inputs-attribute). */ - "page[offset]"?: number - } + custom_inputs?: { + [key: string]: unknown + } + }> + options?: UpdateAllOrNothingOptionsObject } -export type GetRulesResponse = RuleListData - -export type GetRulesError = ErrorResponse - -export type GetRuleByIdData = { - path: { +export type UpdateCartsItems = { + data?: { /** - * The catalog rule ID. + * The unique identifier of the cart item. */ - catalog_rule_id: string - } -} - -export type GetRuleByIdResponse = RuleData - -export type GetRuleByIdError = ErrorResponse - -export type UpdateRuleData = { - /** - * An updated catalog rule with the following attributes. - */ - body: RuleUpdateData - path: { + id?: string /** - * The catalog rule ID. + * The amount of products to add to cart. */ - catalog_rule_id: string - } -} - -export type UpdateRuleResponse = RuleData - -export type UpdateRuleError = ErrorResponse - -export type DeleteRuleByIdData = { - path: { + quantity?: number /** - * The catalog rule ID. + * The custom text to be added to a product. */ - catalog_rule_id: string + custom_inputs?: { + [key: string]: unknown + } + /** + * The unique identifier of the shipping group to be added to the cart. + */ + shipping_group_id?: string } } -export type DeleteRuleByIdResponse = void +export type AddAllOrNothingOptionsObject = { + /** + * When `true`, if an error occurs for any item, no items are added to the cart. When `false`, valid items are added to the cart and the items with errors are reported in the response. Default is `false`. + */ + add_all_or_nothing?: boolean +} -export type DeleteRuleByIdError = ErrorResponse +export type UpdateAllOrNothingOptionsObject = { + /** + * When set to`true`, if an error occurs for any item, no items are updated in the cart. When set to `false`, valid items are updated in the cart and the items with errors are reported in the response. Default is `true`. + */ + update_all_or_nothing?: boolean +} -export type GetAllHierarchiesData = { - headers?: { +export type CartItemResponse = { + /** + * The unique ID of the product. + */ + readonly product_id?: string + /** + * The name of this item + */ + readonly name?: string + /** + * A description of the cart item. + */ + readonly description?: string + /** + * The unique identifier of the catalog associated with the product is shown if catalog_source=pim is set. + */ + readonly catalog_id?: string + /** + * The catalog source. Always `pim` or `legacy`. + */ + readonly catalog_source?: string + readonly image?: { /** - * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + * The MIME type for the uploaded file. */ - "accept-language"?: string - } - path: { + readonly mime_type?: string /** - * The catalog ID. + * The name of the image file that was uploaded. */ - catalog_id: string + readonly file_name?: string /** - * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + * The link to the image. */ - release_id: string + readonly href?: string } - query?: { - /** - * - * This endpoints supports filtering. See [Filtering](#filtering). - * - */ - filter?: string - /** - * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. - */ - "page[limit]"?: number + readonly manage_stock?: boolean + readonly unit_price?: ItemPriceData + readonly value?: ItemPriceData + readonly links?: { /** - * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * A URL related to the resource. */ - "page[offset]"?: number + product?: string + } + readonly meta?: { + display_price?: { + with_tax?: FormattedPriceData + without_tax?: FormattedPriceData + tax?: FormattedPriceData + discount?: FormattedPriceData + without_discount?: FormattedPriceData + } + timestamps?: Timestamps } } -export type GetAllHierarchiesResponse = HierarchyListData +export type CartsResponse = { + data?: Array + meta?: { + display_price?: { + with_tax?: FormattedPriceData + without_tax?: FormattedPriceData + tax?: FormattedPriceData + discount?: FormattedPriceData + without_discount?: FormattedPriceData + discounts?: { + [key: string]: { + amount?: number + currency?: string + formatted?: string + } + } + } + timestamps?: CartTimestamps + } +} -export type GetAllHierarchiesError = ErrorResponse +export type ItemPriceData = { + /** + * The amount for this item as an integer. + */ + readonly amount?: number + /** + * The currency this item was added to the cart as. + */ + readonly currency?: string + /** + * Whether or not this price is tax inclusive. + */ + readonly includes_tax?: boolean +} -export type GetHierarchyData = { - headers?: { +export type CartsRelationshipsAccountsData = { + data?: Array<{ /** - * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + * The ID of the account. */ - "accept-language"?: string - } - path: { + id?: string /** - * The catalog ID. + * The type of related object. Ensure that it is account. */ - catalog_id: string + type?: string + }> +} + +export type CartsRelationshipsCustomersData = { + data?: Array<{ /** - * The catalog hierarchy ID. + * The ID of the customer. */ - hierarchy_id: string + id?: string /** - * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + * The type of related object. Ensure that it is customer. */ - release_id: string - } + type?: string + }> } -export type GetHierarchyResponse = HierarchyData +export type CartsItemsTaxesObject = { + /** + * A unique tax code in this jurisdiction. + */ + code?: string + /** + * The relevant tax jurisdiction. + */ + jurisdiction?: string + /** + * The name of the tax item. + */ + name?: string + /** + * The tax rate represented as a decimal (12.5% -> 0.125). + */ + rate: number + /** + * The type of object being returned. Use `tax_item`. + */ + type: string + /** + * The unique identifier for this tax item. + */ + readonly id?: string +} -export type GetHierarchyError = ErrorResponse +export type CartsBulkCustomDiscounts = { + data?: Array + options?: AddAllOrNothingOptionsObject +} -export type GetHierarchyNodesData = { - headers?: { - /** - * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). - */ - "accept-language"?: string - } - path: { +export type CartsBulkCustomDiscountsResponse = { + data?: Array + options?: AddAllOrNothingOptionsObject +} + +export type CartItemBulkCustomDiscountObject = CartsCustomDiscountsObject & + CustomDiscountRelationshipsCartItemRequest + +export type ArtItemBulkCustomDiscountResponse = CartsCustomDiscountsResponse & + CustomDiscountRelationshipsCartItemRequest + +export type CartsCustomDiscountsObject = { + /** + * Specifies an amount to be applied for the custom discount. It must be less than zero. + */ + amount: number + /** + * Specifies a description for the custom discount. + */ + description: string + /** + * Specifies the discount code used for the custom discount. + */ + discount_code: string + /** + * Specifies from where the custom discount is applied. For example, Talon.one. + */ + discount_engine: string + /** + * Specifies an external id for the custom discount. + */ + external_id: string + /** + * Specifies the type of the resource. Always `custom_discount`. + */ + type: string +} + +export type CartsCustomDiscountsResponse = { + amount?: { /** - * The catalog ID. + * Specifies an amount to be applied for the custom discount. It must be less than zero. */ - catalog_id: string + amount?: number /** - * The catalog hierarchy ID. + * The currency set for the custom discount. */ - hierarchy_id: string + currency?: string /** - * The catalog release ID. + * The formatted value for the custom discount. */ - release_id: string + formatted?: string } - query?: { - /** - * This endpoint supports filtering, see [Filtering](#filtering). - * - */ - filter?: string - /** - * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. - */ - "page[limit]"?: number - /** - * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. - */ - "page[offset]"?: number + /** + * Specifies a description for the custom discount. + */ + description?: string + /** + * Specifies the discount code used for the custom discount. + */ + discount_code?: string + /** + * Specifies from where the custom discount is applied. For example, Talon.one. + */ + discount_engine?: string + /** + * Specifies an external id for the custom discount. + */ + external_id?: string + /** + * Specifies the type of the resource. Always `custom_discount`. + */ + type?: string + /** + * Specifies the UUID of the custom discount. + */ + readonly id?: string +} + +export type CustomDiscountRelationshipsCartItemRequest = { + relationships?: { + item?: { + data?: { + /** + * Specifies the type of item. For example, `custom_item` or `cart_item`. + */ + type?: string + /** + * Specifies the unique identifier of the `cart_item` or `custom_item` in the cart. + */ + id?: string + } + } } } -export type GetHierarchyNodesResponse = NodeListData +export type CartItemRelationship = { + relationships?: { + order?: { + data?: { + /** + * This specifies the type of item. + */ + type?: string + /** + * This specifies the ID of the cart_item or custom_item in the cart. + */ + id?: string + } + } + } +} -export type GetHierarchyNodesError = ErrorResponse +export type CartsBulkTaxes = { + data?: Array + options?: AddAllOrNothingOptionsObject +} -export type GetHierarchyChildNodesData = { - headers?: { - /** - * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). - */ - "accept-language"?: string - } - path: { +export type OrdersAnonymizeRequest = { + data?: OrdersAnonymizeData +} + +export type OrdersAnonymizeData = { + /** + * The unique identifiers of the orders to be anonymized. You can anonymize multiple orders at the same time. + */ + order_ids?: Array +} + +export type OrdersUpdateRequest = { + data?: OrdersAddressData | OrdersCancelData | OrdersFulfulledData +} + +export type OrdersAddressData = { + /** + * Represents an optional external ID reference for an order. It can contain alphanumeric characters, special characters, and spaces, and does not required to be unique. The maximum allowed length is 64 characters. It can be used to include an external reference from a separate company system. + */ + external_ref?: string + shipping_address: { /** - * The catalog ID. + * Specifies the first name of the address holder. */ - catalog_id: string + first_name?: string /** - * The catalog hierarchy ID. + * Specifies the last name of the address holder. */ - hierarchy_id: string + last_name?: string /** - * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + * Specifies the phone number of the address holder. */ - release_id: string - } - query?: { + phone_number?: string /** - * This endpoint supports filtering, see [Filtering](#filtering). - * + * Specifies the company name. */ - filter?: string + company_name?: string /** - * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * Specifies the first line of the address. */ - "page[limit]"?: number + line_1?: string /** - * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * Specifies the second line of the address. */ - "page[offset]"?: number - } -} - -export type GetHierarchyChildNodesResponse = NodeListData - -export type GetHierarchyChildNodesError = ErrorResponse - -export type GetAllNodesData = { - headers?: { + line_2?: string /** - * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + * Specifies the name of the city in the shipping address. */ - "accept-language"?: string - } - path: { + city?: string /** - * The catalog ID. + * Specifies the county of the shipping address. */ - catalog_id: string + county?: string /** - * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + * Specifies the state, province, or region of the shipping address. */ - release_id: string - } - query?: { + region?: string /** - * This endpoint supports filtering, see [Filtering](#filtering). - * + * Specifies the postcode or ZIP code of the address. */ - filter?: string + postcode?: string /** - * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * Specifies the country in the shipping address. */ - "page[limit]"?: number + country?: string /** - * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * Specifies any instructions provided with the shipping address. */ - "page[offset]"?: number + instructions?: string } } -export type GetAllNodesResponse = NodeListData +export type OrdersCancelData = { + /** + * The status of the order. You can only update the status to `cancelled`. + */ + status: string + /** + * The type of the resource. You must use order. + */ + type: string + /** + * Represents an optional external ID reference for an order. It can contain alphanumeric characters, special characters, and spaces, and does not required to be unique. The maximum allowed length is 64 characters. It can be used to include an external reference from a separate company system. + */ + external_ref?: string +} -export type GetAllNodesError = ErrorResponse +export type OrdersFulfulledData = { + /** + * The shipping status of the order. You can only update the shipping status to `fulfilled`. + */ + shipping: string + /** + * The type of the resource. You must use order. + */ + type: string + /** + * Represents an optional external ID reference for an order. It can contain alphanumeric characters, special characters, and spaces, and does not required to be unique. The maximum allowed length is 64 characters. It can be used to include an external reference from a separate company system. + */ + external_ref?: string +} -export type GetNodeData = { - headers?: { - /** - * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). - */ - "accept-language"?: string - } - path: { - /** - * The catalog ID. - */ - catalog_id: string +export type PaymentsRequest = { + data?: DataPaymentObject +} + +export type DataBasePayments = { + gateway: + | "adyen" + | "authorize_net" + | "braintree" + | "card_connect" + | "cyber_source" + | "elastic_path_payments_stripe" + | "manual" + | "paypal_express_checkout" + | "stripe" + | "stripe_connect" + | "stripe_payment_intents" + /** + * Specifies the transaction method, such as `purchase` or `authorize`. + */ + method: "authorize" | "purchase" | "purchase_setup" | "authorize_setup" + /** + * The amount to be paid for the transaction. + */ + amount?: number +} + +export type gateway = + | "adyen" + | "authorize_net" + | "braintree" + | "card_connect" + | "cyber_source" + | "elastic_path_payments_stripe" + | "manual" + | "paypal_express_checkout" + | "stripe" + | "stripe_connect" + | "stripe_payment_intents" + +/** + * Specifies the transaction method, such as `purchase` or `authorize`. + */ +export type method = + | "authorize" + | "purchase" + | "purchase_setup" + | "authorize_setup" + +export type DataAdyenPayment = DataBasePayments & { + /** + * Specifies the gateway. You must use `adyen`. + */ + gateway?: "adyen" + options?: { /** - * The catalog node ID. + * The shopper reference token associated with the saved payment method. */ - node_id: string + shopper_reference?: string /** - * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + * Enter CardOnFile for a one-time purchase. */ - release_id: string + recurring_processing_model?: string } + /** + * The Adyen recurringDetailReference payment method identifier. + */ + payment?: string +} & { + /** + * Specifies the gateway. You must use `adyen`. + */ + gateway: "adyen" + /** + * The Adyen recurringDetailReference payment method identifier. + */ + payment: string } -export type GetNodeResponse = NodeData - -export type GetNodeError = ErrorResponse +/** + * Specifies the gateway. You must use `adyen`. + */ +export type gateway2 = "adyen" -export type GetChildNodesData = { - headers?: { +export type DataAuthorizeNetPayment = DataBasePayments & { + /** + * Specifies the gateway. You must use `authorize_net`. + */ + gateway?: "authorize_net" + options?: { /** - * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + * The Authorize.net customer payment profile ID. */ - "accept-language"?: string + customer_payment_profile_id?: string } - path: { - /** - * The catalog ID. - */ - catalog_id: string + /** + * The Authorize.net customer profile ID. + */ + payment?: string +} & { + /** + * Specifies the gateway. You must use `authorize_net`. + */ + gateway: "authorize_net" + /** + * The Authorize.net customer profile ID. + */ + payment: string +} + +/** + * Specifies the gateway. You must use `authorize_net`. + */ +export type gateway3 = "authorize_net" + +export type DataBraintreePayment = DataBasePayments & { + /** + * Specifies the gateway. You must use `braintree`. + */ + gateway?: "braintree" + /** + * The Braintree Customer ID that you want to bill. + */ + payment?: string +} & { + /** + * Specifies the gateway. You must use `braintree`. + */ + gateway: "braintree" + /** + * The Braintree Customer ID that you want to bill. + */ + payment: string +} + +/** + * Specifies the gateway. You must use `braintree`. + */ +export type gateway4 = "braintree" + +export type DataCardConnectPayment = DataBasePayments & { + /** + * Specifies the gateway. You must use `card_connect`. + */ + gateway?: "card_connect" + /** + * Enter account_id, profile_id from CardPointe API. For example, 1|16178397535388255208. + */ + payment?: string +} & { + /** + * Specifies the gateway. You must use `card_connect`. + */ + gateway: "card_connect" + /** + * Enter account_id, profile_id from CardPointe API. For example, 1|16178397535388255208. + */ + payment: string +} + +/** + * Specifies the gateway. You must use `card_connect`. + */ +export type gateway5 = "card_connect" + +export type DataCyberSourcePayment = DataBasePayments & { + /** + * Specifies the gateway. You must use `cyber_source`. + */ + gateway?: "cyber_source" + /** + * The CyberSource token. + */ + payment?: string +} & { + /** + * Specifies the gateway. You must use `cyber_source`. + */ + gateway: "cyber_source" + /** + * The CyberSource token. + */ + payment: string +} + +/** + * Specifies the gateway. You must use `cyber_source`. + */ +export type gateway6 = "cyber_source" + +export type ElasticPathPaymentsPoweredByStripePayment = DataBasePayments & { + /** + * Specifies the gateway. You must use `elastic_path_payments_stripe`. + */ + gateway?: "elastic_path_payments_stripe" + options?: { /** - * The catalog node ID. + * Provides the email address to which you want to send the Stripe receipts for the transactions within the store. This feature is available only in the live mode. */ - node_id: string + receipt_email?: string /** - * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + * Parent object determining whether to use Stripe's `automatic_payment_methods` setting. */ - release_id: string + automatic_payment_methods?: { + /** + * When set to true, it displays all enabled payment methods from the Stripe dashboard. When set to false, the Stripe default, which is card, is used. + */ + enabled?: boolean + } } - query?: { - /** - * This endpoint supports filtering, see [Filtering](#filtering). - * - */ - filter?: string + /** + * Specifies the Stripe payment method types configured for the store. See [Stripe Documentation](https://docs.stripe.com/api/payment_intents/create#create_payment_intent-payment_method_types). + */ + payment_method_types?: Array + /** + * Specifies the Stripe token or source. + */ + payment?: string +} & { + /** + * Specifies the gateway. You must use `elastic_path_payments_stripe`. + */ + gateway: "elastic_path_payments_stripe" +} + +/** + * Specifies the gateway. You must use `elastic_path_payments_stripe`. + */ +export type gateway7 = "elastic_path_payments_stripe" + +export type DataManualPayment = DataBasePayments & { + /** + * Specifies the type of payment gateway. You must use `manual`. + */ + gateway?: "manual" + paymentmethod_meta?: { /** - * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * A reference associated with the payment method. This might include loyalty points or gift card identifiers. We recommend not to include personal information in this field. */ - "page[limit]"?: number + custom_reference?: string /** - * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * A custom name associated with the payment method. */ - "page[offset]"?: number + name?: string } +} & { + /** + * Specifies the type of payment gateway. You must use `manual`. + */ + gateway: "manual" } -export type GetChildNodesResponse = NodeListData - -export type GetChildNodesError = ErrorResponse +/** + * Specifies the type of payment gateway. You must use `manual`. + */ +export type gateway8 = "manual" -export type GetAllProductsData = { - headers?: { - /** - * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). - */ - "accept-language"?: string - } - path: { - /** - * The catalog ID. - */ - catalog_id: string - /** - * The unique identifier of a published release of the catalog or `latest` for the most recently published version. - */ - release_id: string - } - query?: { - /** - * This endpoints support filtering. See [Filtering](#filtering). - * - */ - filter?: string +export type DataPayPalExpressCheckoutPayment = DataBasePayments & { + /** + * Specifies the type of payment gateway. You must use `paypal_express_checkout`. + */ + gateway?: "paypal_express_checkout" + options?: { /** - * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * The description for the payment. */ - "page[limit]"?: number + description?: string /** - * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * The descriptor appended to PayPal generated descriptor that is visible on the card statement of the payer. */ - "page[offset]"?: number + soft_descriptor?: string + application_context?: { + /** + * The label that overrides the business name in the PayPal account on the payPal site. + */ + brand_name?: string + /** + * The locale pages that appear based on language and country code. PayPal supports a five-character code. For example, ja-JP. + */ + locale?: string + /** + * The type of landing page to show on the PayPal site for customer checkout. Use values LOGIN, BILLING, or NO_PREFERENCE. + */ + landing_page?: string + /** + * The shipping preference. Use SET_PROVIDED_ADDRESS value. This parameter does allow the user to change their address on PayPal site. + */ + shipping_preference?: string + /** + * If you set `useraction=commit` in the query string, the flow redirects the buyer to the PayPal payment page and displays a Pay Now button. When the shopper clicks **Pay Now**, call `DoExpressCheckoutPayment` to complete the payment without additional interaction from the shopper. Choose this flow when you know the final payment amount when you initiate the checkout flow. + */ + user_action?: string + /** + * The callback URL for PayPal to redirect the user in the case of approved payment. + */ + return_url?: string + /** + * The callback URL for PayPal to redirect user in the case a cancelled payment. + */ + cancel_url?: string + } } +} & { + /** + * Specifies the type of payment gateway. You must use `paypal_express_checkout`. + */ + gateway: "paypal_express_checkout" } -export type GetAllProductsResponse = ProductListData - -export type GetAllProductsError = ErrorResponse +/** + * Specifies the type of payment gateway. You must use `paypal_express_checkout`. + */ +export type gateway9 = "paypal_express_checkout" -export type GetProductData = { - headers?: { - /** - * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). - */ - "accept-language"?: string - } - path: { - /** - * The catalog ID. - */ - catalog_id: string - /** - * The product ID. - */ - product_id: string +export type DataStripePayment = DataBasePayments & { + /** + * Specifies the type of payment gateway. You must use `stripe`. + */ + gateway?: "stripe" + options?: { /** - * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + * The option to provide an email for Stripe receipts. Specify live mode to access this feature. */ - release_id: string + receipt_email?: string } + /** + * The Stripe token or source. + */ + payment?: string +} & { + /** + * Specifies the type of payment gateway. You must use `stripe`. + */ + gateway: "stripe" } -export type GetProductResponse = ProductData - -export type GetProductError = ErrorResponse +/** + * Specifies the type of payment gateway. You must use `stripe`. + */ +export type gateway10 = "stripe" -export type GetComponentProductIdsData = { - path: { - /** - * The catalog ID. - */ - catalog_id: string - /** - * The product ID. - */ - product_id: string +export type DataStripeConnectPayment = DataBasePayments & { + /** + * Specifies the type of payment gateway. You must use `stripe_connect`. + */ + gateway?: "stripe_connect" + options?: { /** - * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + * Provides the email address to which you want to send the Stripe receipts for the transactions within the store. This feature is available only in the live mode. */ - release_id: string + receipt_email?: string } - query?: { - /** - * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. - */ - "page[limit]"?: number + /** + * Specifies the Stripe token or source. + */ + payment?: string +} & { + /** + * Specifies the type of payment gateway. You must use `stripe_connect`. + */ + gateway: "stripe_connect" +} + +/** + * Specifies the type of payment gateway. You must use `stripe_connect`. + */ +export type gateway11 = "stripe_connect" + +export type DataStripePaymentIntentsPayment = DataBasePayments & { + /** + * Specifies the type of payment gateway. You must use `stripe_payment_intents`. + */ + gateway?: "stripe_payment_intents" + options?: { /** - * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * Provides the email address to which you want to send the Stripe receipts for the transactions within the store. This feature is available only in the live mode. */ - "page[offset]"?: number + receipt_email?: string } + /** + * Specifies the Stripe token or source. + */ + payment?: string +} & { + /** + * Specifies the type of payment gateway. You must use `stripe_payment_intents`. + */ + gateway: "stripe_payment_intents" } -export type GetComponentProductIdsResponse = ProductReferenceListData +/** + * Specifies the type of payment gateway. You must use `stripe_payment_intents`. + */ +export type gateway12 = "stripe_payment_intents" -export type GetComponentProductIdsError = ErrorResponse +export type DataPaymentObject = + | DataAdyenPayment + | DataAuthorizeNetPayment + | DataBraintreePayment + | DataCardConnectPayment + | DataCyberSourcePayment + | ElasticPathPaymentsPoweredByStripePayment + | DataManualPayment + | DataPayPalExpressCheckoutPayment + | DataStripePayment + | DataStripeConnectPayment + | DataStripePaymentIntentsPayment -export type GetChildProductsData = { - headers?: { - /** - * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). - */ - "accept-language"?: string - } - path: { - /** - * The catalog ID. - */ - catalog_id: string - /** - * The product ID. - */ - product_id: string - /** - * The unique identifier of a published release of the catalog or `latest` for the most recently published version. - */ - release_id: string +export type TransactionResponse = { + /** + * The ID of the transaction. + */ + readonly id?: string + /** + * The payment gateway reference. + */ + reference?: string + /** + * A custom name associated with the payment method. + */ + name?: string + /** + * A reference associated with the payment method. This might include loyalty points or gift card identifiers. We recommend you not to include personal information in this field. + */ + custom_reference?: string + /** + * The name of the payment gateway used. + */ + gateway?: + | "adyen" + | "authorize_net" + | "braintree" + | "card_connect" + | "cyber_source" + | "elastic_path_payments_stripe" + | "manual" + | "paypal_express_checkout" + | "stripe" + | "stripe_connect" + | "stripe_payment_intents" + /** + * The amount for this transaction. + */ + amount?: number + /** + * The refunded amount. + */ + refunded_amount?: number + /** + * The transaction currency. + */ + currency?: string + /** + * The type of transaction, such as `purchase`, `capture`, `authorize` or `refund`. + */ + "transaction-type"?: string + /** + * The status provided by the gateway for this transaction, such as `complete` or `failed`. + */ + status?: string + relationships?: { + order?: { + data?: { + /** + * Represents the type of the object being returned. It is always `order`. + */ + type?: string + /** + * The ID of the order. + */ + id?: string + } + } } - query?: { - /** - * This endpoints support filtering. See [Filtering](#filtering). - * - */ - filter?: string - /** - * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. - */ - "page[limit]"?: number - /** - * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. - */ - "page[offset]"?: number + meta?: { + display_price?: FormattedPriceData + display_refunded_amount?: FormattedPriceData + timestamps?: Timestamps } } -export type GetChildProductsResponse = ProductListData - -export type GetChildProductsError = ErrorResponse +export type OrdersTransactionsConfirmRequest = { + data?: { + [key: string]: unknown + } +} -export type GetProductsForHierarchyData = { - headers?: { - /** - * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). - */ - "accept-language"?: string +export type OrdersTransactionsCaptureRequest = { + data?: { + options?: { + soft_descriptor?: string + note_to_payer?: string + } } - path: { - /** - * The catalog ID. - */ - catalog_id: string - /** - * The catalog hierarchy ID. - */ - hierarchy_id: string +} + +export type OrdersTransactionsRefundRequest = { + data?: { /** - * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + * The amount value to be refunded. If this field is not provided, it will be considered as manual refund (Mark as Refunded) and the refund process must be manually handled via payment provider. If the amount value is same as payment value, then it will be treated as a full refund and sent to the payment provider to process refund automatically. */ - release_id: string + amount?: number + options?: { + /** + * Provides comments about the refund. It is used by PayPal Express. + */ + note?: string + } } - query?: { - /** - * This endpoints support filtering. See [Filtering](#filtering). - * - */ - filter?: string - /** - * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. - */ - "page[limit]"?: number +} + +export type OrdersTransactionsCancelRequest = { + data?: { + options?: { + [key: string]: unknown + } /** - * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * Specifies the reason for canceling the transaction. The reason may include `duplicate`, `fraudulent`, `requested_by_customer`, or `abandoned`. */ - "page[offset]"?: number + reason?: string } } -export type GetProductsForHierarchyResponse = ProductListData +export type OrderPriceData = { + /** + * The amount for this item. + */ + amount?: number + /** + * The currency this item. + */ + currency?: string + /** + * Whether or not this price is tax inclusive. + */ + includes_tax?: boolean +} -export type GetProductsForHierarchyError = ErrorResponse +export type FormattedPriceData = { + /** + * The raw total of this cart. + */ + amount?: number + /** + * The currency set for this cart. + */ + currency?: string + /** + * The tax inclusive formatted total based on the currency. + */ + formatted?: string +} -export type GetProductsForNodeData = { - headers?: { - /** - * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). - */ - "accept-language"?: string - } - path: { - /** - * The catalog ID. - */ - catalog_id: string - /** - * The catalog node ID. - */ - node_id: string - /** - * The unique identifier of a published release of the catalog or `latest` for the most recently published version. - */ - release_id: string +export type OrderItemFormattedUnitPriceData = { + unit?: FormattedPriceData + value?: FormattedPriceData +} + +export type DiscountData = { + amount?: OrderPriceData + code?: string + readonly id?: string +} + +export type OrderItemResponse = { + /** + * The type represents the object being returned. + */ + type?: string + /** + * The unique identifier for this order item. + */ + readonly id?: string + /** + * The quantity of this item were ordered. + */ + quantity?: number + /** + * The unique identifier for this order item. + */ + readonly product_id?: string + /** + * The name of this order item. + */ + name?: string + /** + * The SKU code for the order item. + */ + sku?: string + unit_price?: OrderPriceData + value?: OrderPriceData + discounts?: Array + links?: { + [key: string]: unknown } - query?: { - /** - * This endpoints support filtering. See [Filtering](#filtering). - * - */ - filter?: string - /** - * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. - */ - "page[limit]"?: number - /** - * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. - */ - "page[offset]"?: number + meta?: { + display_price?: { + with_tax?: OrderItemFormattedUnitPriceData + without_tax?: OrderItemFormattedUnitPriceData + tax?: OrderItemFormattedUnitPriceData + discount?: OrderItemFormattedUnitPriceData + without_discount?: OrderItemFormattedUnitPriceData + discounts?: { + [key: string]: { + amount?: number + currency?: string + formatted?: string + } + } + } + timestamps?: Timestamps + } + relationships?: { + cart_item?: { + data?: { + /** + * The type represents the object being returned. + */ + type?: string + /** + * The unique identifier for this item. + */ + readonly id?: string + } + } } + /** + * The unique identifier of the catalog associated with the product is shown if `catalog_source=pim` is set. + */ + catalog_id?: string + /** + * The catalog source. Always `pim` or `legacy`. + */ + catalog_source?: string } -export type GetProductsForNodeResponse = ProductListData +export type OrderResponse = { + /** + * Specifies the type of object being returned. You must use `order`. + */ + type?: string + /** + * Specifies the unique identifier of the order. + */ + readonly id?: string + /** + * Specifies the status of the order, such as `incomplete`, `complete`, `processing`, or `cancelled`. + */ + status?: string + /** + * Specifies the status of the payment, such as `unpaid`, `authorized`, `paid`, or `refunded`. + */ + payment?: string + /** + * Specifies the status of the shipment, such as `fulfilled` or `unfulfilled`. + */ + shipping?: string + /** + * Specifies if the order is anonymized. + */ + anonymized?: boolean + meta?: OrderMeta + billing_address?: BillingAddress + contact?: Contact + shipping_address?: ShippingAddress +} -export type GetProductsForNodeError = ErrorResponse +export type OrderMeta = { + timestamps?: Timestamps + with_tax?: FormattedPriceData + without_tax?: FormattedPriceData + tax?: FormattedPriceData + discount?: FormattedPriceData + paid?: FormattedPriceData + authorized?: FormattedPriceData + without_discount?: FormattedPriceData +} + +export type CustomerCheckout = { + data?: { + customer?: { + /** + * The ID of the customer. + */ + id?: string + } + billing_address?: BillingAddress + shipping_address?: ShippingAddress + } +} + +export type AccountCheckout = { + data?: { + account?: { + /** + * The account ID. + */ + id?: string + /** + * The account member ID. + */ + member_id?: string + } + contact?: { + /** + * The name of the account member. + */ + name?: string + /** + * The email address of the account member. + */ + email?: string + } + billing_address?: BillingAddress + shipping_address?: ShippingAddress + } +} + +export type BillingAddress = { + /** + * Company name of the billing recipient. + */ + company_name?: string + /** + * Specifies the country of the billing address. + */ + country: string + /** + * Specifies the county of the billing address. + */ + county?: string + /** + * First name of the billing recipient. + */ + first_name: string + /** + * Last name of the billing recipient. + */ + last_name: string + /** + * First line of the billing address. + */ + line_1: string + /** + * Second line of the billing address. + */ + line_2?: string + /** + * Postcode of the billing address. + */ + postcode: string + /** + * Specifies state, province, or region of the billing address. + */ + region: string +} + +export type Contact = { + /** + * The email address of the contact. + */ + email?: string + /** + * The name of the contact. + */ + name?: string +} + +export type ShippingAddress = { + /** + * Company of the shipping recipient. + */ + company_name?: string + /** + * Specifies the country of the shipping address. + */ + country: string + /** + * Specifies the county of the shipping address. + */ + county?: string + /** + * First name of the shipping recipient. + */ + first_name: string + /** + * Last name of the shipping recipient. + */ + last_name: string + /** + * First line of the shipping address. + */ + line_1: string + /** + * Second line of the shipping address. + */ + line_2?: string + /** + * Post code of the shipping address. + */ + postcode: string + /** + * Specifies the state, province, or region of the shipping address. + */ + region: string +} + +export type ResponseMetaCarts = { + page?: ResponsePaginationPage + results?: ResponsePaginationResults +} + +export type ResponseMetaOrders = { + page?: ResponsePaginationPage + results?: ResponsePaginationResults +} + +export type ResponsePaginationPage = { + /** + * The current page. + */ + current?: number + /** + * The maximum number of records per page for this response. You can set this value up to 100. + */ + limit?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. + */ + offset?: number + /** + * The total page count. + */ + total?: number +} + +export type ResponsePaginationResults = { + /** + * The total page count. + */ + total?: number +} + +export type ResponsePageLinks = { + /** + * Always the current page. + */ + current?: string + /** + * Always the first page. + */ + first?: string + /** + * If there is only one page, it is `null`. + */ + last?: string + /** + * If there is only one page, it is `null`. + */ + next?: string + /** + * if the user is on the first page, it is `null`. + */ + prev?: string +} + +export type ResponseData = { + data?: unknown +} + +export type ResponseError = { + detail?: string + status?: string + title?: string +} + +export type Timestamps = { + /** + * The date this was created. + */ + created_at?: string + /** + * The date this was last updated. + */ + updated_at?: unknown +} + +export type CartTimestamps = { + created_at?: string + updated_at?: unknown + expires_at?: unknown +} + +/** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ +export type ParameterAcceptLanguage = string + +/** + * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. + */ +export type ParameterChannel = string + +/** + * This endpoints supports filtering. See [Filtering](#filtering). + * + */ +export type ParameterFilterHierarchy = string + +/** + * This endpoint supports filtering, see [Filtering](#filtering). + * + */ +export type ParameterFilterNode = string + +/** + * This endpoints support filtering. See [Filtering](#filtering). + * + */ +export type ParameterFilterProduct = string + +/** + * This endpoint supports filtering. See [Filtering](#filtering). + * + */ +export type ParameterFilterRule = string + +/** + * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products. + * + */ +export type ParameterInclude = Array< + "main_images" | "files" | "component_products" +> + +/** + * Using the `include=component_products` parameter, you can retrieve key attribute data for the bundle component products in the product bundle, such as SKU or slug . + * + */ +export type ParameterIncludeComponentProducts = string + +/** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. + */ +export type ParameterLimit = number + +/** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. + */ +export type ParameterOffset = number + +/** + * Product tags are used to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. You can enhance your product list using tags, enabling you to refine your product list and run targeted promotions. Tags are used to refine the eligibility criteria for a rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. + */ +export type ParameterTag = string export type GetByContextReleaseData = { headers?: { @@ -2698,17 +3573,16 @@ export type GetByContextAllHierarchiesData = { } query?: { /** - * * This endpoints supports filtering. See [Filtering](#filtering). * */ filter?: string /** - * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ "page[limit]"?: number /** - * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ "page[offset]"?: number } @@ -2773,11 +3647,11 @@ export type GetByContextHierarchyNodesData = { */ filter?: string /** - * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ "page[limit]"?: number /** - * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ "page[offset]"?: number } @@ -2815,11 +3689,11 @@ export type GetByContextHierarchyChildNodesData = { */ filter?: string /** - * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ "page[limit]"?: number /** - * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ "page[offset]"?: number } @@ -2851,11 +3725,11 @@ export type GetByContextAllNodesData = { */ filter?: string /** - * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ "page[limit]"?: number /** - * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ "page[offset]"?: number } @@ -2920,11 +3794,11 @@ export type GetByContextChildNodesData = { */ filter?: string /** - * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ "page[limit]"?: number /** - * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ "page[offset]"?: number } @@ -2956,11 +3830,11 @@ export type GetByContextAllProductsData = { */ filter?: string /** - * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ "page[limit]"?: number /** - * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ "page[offset]"?: number } @@ -2972,10 +3846,6 @@ export type GetByContextAllProductsError = ErrorResponse export type GetByContextProductData = { headers?: { - /** - * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). - */ - "accept-language"?: string /** * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. */ @@ -3023,11 +3893,11 @@ export type GetByContextComponentProductIdsData = { } query?: { /** - * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ "page[limit]"?: number /** - * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ "page[offset]"?: number } @@ -3065,11 +3935,11 @@ export type GetByContextChildProductsData = { */ filter?: string /** - * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ "page[limit]"?: number /** - * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ "page[offset]"?: number } @@ -3107,11 +3977,11 @@ export type GetByContextProductsForHierarchyData = { */ filter?: string /** - * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ "page[limit]"?: number /** - * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ "page[offset]"?: number } @@ -3149,11 +4019,11 @@ export type GetByContextProductsForNodeData = { */ filter?: string /** - * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ "page[limit]"?: number /** - * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/settings-overview#page-length) store setting is used. + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ "page[offset]"?: number } @@ -3182,27 +4052,1822 @@ export type ConfigureByContextProductData = { */ "EP-Context-Tag"?: string } - path: { - /** - * The product ID. - */ - product_id: string + path: { + /** + * The product ID. + */ + product_id: string + } +} + +export type ConfigureByContextProductResponse = ProductData + +export type ConfigureByContextProductError = ErrorResponse + +export type CreateCatalogData = { + /** + * Creates a catalog with the following attributes. + */ + body: CatalogCreateData +} + +export type CreateCatalogResponse = CatalogData + +export type CreateCatalogError = ErrorResponse + +export type GetCatalogsResponse = CatalogListData + +export type GetCatalogsError = ErrorResponse + +export type GetCatalogByIdData = { + path: { + /** + * The catalog ID. + */ + catalog_id: string + } +} + +export type GetCatalogByIdResponse = CatalogData + +export type GetCatalogByIdError = ErrorResponse + +export type UpdateCatalogData = { + /** + * Updated catalog. + */ + body: CatalogUpdateData + path: { + /** + * The catalog ID. + */ + catalog_id: string + } +} + +export type UpdateCatalogResponse = CatalogData + +export type UpdateCatalogError = ErrorResponse + +export type DeleteCatalogByIdData = { + path: { + /** + * The catalog ID. + */ + catalog_id: string + } +} + +export type DeleteCatalogByIdResponse = void + +export type DeleteCatalogByIdError = ErrorResponse + +export type PublishReleaseData = { + /** + * Options for catalog release publishing + */ + body?: CatalogReleaseCreateData + path: { + /** + * The catalog ID. + */ + catalog_id: string + } +} + +export type PublishReleaseResponse = ReleaseData + +export type PublishReleaseError = ErrorResponse + +export type GetReleasesData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + } + path: { + /** + * The catalog ID. + */ + catalog_id: string + } +} + +export type GetReleasesResponse = ReleaseListData + +export type GetReleasesError = ErrorResponse + +export type DeleteReleasesData = { + path: { + /** + * The catalog ID. + */ + catalog_id: string + } +} + +export type DeleteReleasesResponse = void + +export type DeleteReleasesError = ErrorResponse + +export type GetReleaseByIdData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + } + path: { + /** + * The catalog ID. + */ + catalog_id: string + /** + * The catalog release ID. + */ + release_id: string + } +} + +export type GetReleaseByIdResponse = ReleaseData + +export type GetReleaseByIdError = ErrorResponse + +export type DeleteReleaseByIdData = { + path: { + /** + * The catalog ID. + */ + catalog_id: string + /** + * The catalog release ID. + */ + release_id: string + } +} + +export type DeleteReleaseByIdResponse = void + +export type DeleteReleaseByIdError = ErrorResponse + +export type CreateRuleData = { + /** + * Creates a catalog rule with the following attributes. + */ + body: RuleCreateData +} + +export type CreateRuleResponse = RuleData + +export type CreateRuleError = ErrorResponse + +export type GetRulesData = { + query?: { + /** + * This endpoint supports filtering. See [Filtering](#filtering). + * + */ + filter?: string + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetRulesResponse = RuleListData + +export type GetRulesError = ErrorResponse + +export type GetRuleByIdData = { + path: { + /** + * The catalog rule ID. + */ + catalog_rule_id: string + } +} + +export type GetRuleByIdResponse = RuleData + +export type GetRuleByIdError = ErrorResponse + +export type UpdateRuleData = { + /** + * An updated catalog rule with the following attributes. + */ + body: RuleUpdateData + path: { + /** + * The catalog rule ID. + */ + catalog_rule_id: string + } +} + +export type UpdateRuleResponse = RuleData + +export type UpdateRuleError = ErrorResponse + +export type DeleteRuleByIdData = { + path: { + /** + * The catalog rule ID. + */ + catalog_rule_id: string + } +} + +export type DeleteRuleByIdResponse = void + +export type DeleteRuleByIdError = ErrorResponse + +export type GetAllHierarchiesData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + } + path: { + /** + * The catalog ID. + */ + catalog_id: string + /** + * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + */ + release_id: string + } + query?: { + /** + * This endpoints supports filtering. See [Filtering](#filtering). + * + */ + filter?: string + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetAllHierarchiesResponse = HierarchyListData + +export type GetAllHierarchiesError = ErrorResponse + +export type GetHierarchyData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + } + path: { + /** + * The catalog ID. + */ + catalog_id: string + /** + * The catalog hierarchy ID. + */ + hierarchy_id: string + /** + * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + */ + release_id: string + } +} + +export type GetHierarchyResponse = HierarchyData + +export type GetHierarchyError = ErrorResponse + +export type GetHierarchyNodesData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + } + path: { + /** + * The catalog ID. + */ + catalog_id: string + /** + * The catalog hierarchy ID. + */ + hierarchy_id: string + /** + * The catalog release ID. + */ + release_id: string + } + query?: { + /** + * This endpoint supports filtering, see [Filtering](#filtering). + * + */ + filter?: string + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetHierarchyNodesResponse = NodeListData + +export type GetHierarchyNodesError = ErrorResponse + +export type GetHierarchyChildNodesData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + } + path: { + /** + * The catalog ID. + */ + catalog_id: string + /** + * The catalog hierarchy ID. + */ + hierarchy_id: string + /** + * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + */ + release_id: string + } + query?: { + /** + * This endpoint supports filtering, see [Filtering](#filtering). + * + */ + filter?: string + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetHierarchyChildNodesResponse = NodeListData + +export type GetHierarchyChildNodesError = ErrorResponse + +export type GetAllNodesData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + } + path: { + /** + * The catalog ID. + */ + catalog_id: string + /** + * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + */ + release_id: string + } + query?: { + /** + * This endpoint supports filtering, see [Filtering](#filtering). + * + */ + filter?: string + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetAllNodesResponse = NodeListData + +export type GetAllNodesError = ErrorResponse + +export type GetNodeData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + } + path: { + /** + * The catalog ID. + */ + catalog_id: string + /** + * The catalog node ID. + */ + node_id: string + /** + * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + */ + release_id: string + } +} + +export type GetNodeResponse = NodeData + +export type GetNodeError = ErrorResponse + +export type GetChildNodesData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + } + path: { + /** + * The catalog ID. + */ + catalog_id: string + /** + * The catalog node ID. + */ + node_id: string + /** + * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + */ + release_id: string + } + query?: { + /** + * This endpoint supports filtering, see [Filtering](#filtering). + * + */ + filter?: string + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetChildNodesResponse = NodeListData + +export type GetChildNodesError = ErrorResponse + +export type GetAllProductsData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + } + path: { + /** + * The catalog ID. + */ + catalog_id: string + /** + * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + */ + release_id: string + } + query?: { + /** + * This endpoints support filtering. See [Filtering](#filtering). + * + */ + filter?: string + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetAllProductsResponse = ProductListData + +export type GetAllProductsError = ErrorResponse + +export type GetProductData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + } + path: { + /** + * The catalog ID. + */ + catalog_id: string + /** + * The product ID. + */ + product_id: string + /** + * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + */ + release_id: string + } +} + +export type GetProductResponse = ProductData + +export type GetProductError = ErrorResponse + +export type GetComponentProductIdsData = { + path: { + /** + * The catalog ID. + */ + catalog_id: string + /** + * The product ID. + */ + product_id: string + /** + * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + */ + release_id: string + } + query?: { + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetComponentProductIdsResponse = ProductReferenceListData + +export type GetComponentProductIdsError = ErrorResponse + +export type GetChildProductsData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + } + path: { + /** + * The catalog ID. + */ + catalog_id: string + /** + * The product ID. + */ + product_id: string + /** + * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + */ + release_id: string + } + query?: { + /** + * This endpoints support filtering. See [Filtering](#filtering). + * + */ + filter?: string + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetChildProductsResponse = ProductListData + +export type GetChildProductsError = ErrorResponse + +export type GetProductsForHierarchyData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + } + path: { + /** + * The catalog ID. + */ + catalog_id: string + /** + * The catalog hierarchy ID. + */ + hierarchy_id: string + /** + * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + */ + release_id: string + } + query?: { + /** + * This endpoints support filtering. See [Filtering](#filtering). + * + */ + filter?: string + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetProductsForHierarchyResponse = ProductListData + +export type GetProductsForHierarchyError = ErrorResponse + +export type GetProductsForNodeData = { + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + } + path: { + /** + * The catalog ID. + */ + catalog_id: string + /** + * The catalog node ID. + */ + node_id: string + /** + * The unique identifier of a published release of the catalog or `latest` for the most recently published version. + */ + release_id: string + } + query?: { + /** + * This endpoints support filtering. See [Filtering](#filtering). + * + */ + filter?: string + /** + * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. + */ + "page[limit]"?: number + /** + * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. + */ + "page[offset]"?: number + } +} + +export type GetProductsForNodeResponse = ProductListData + +export type GetProductsForNodeError = ErrorResponse + +export type GetCartsData = { + headers?: { + /** + * An Account Management Authentication token to access a specific account's carts. + */ + "EP-Account-Management-Authentication-Token"?: string + /** + * A customer token to access a specific customer's carts. + */ + "x-moltin-customer-token"?: string + } +} + +export type GetCartsResponse = ResponseData & { + data?: Array + links?: ResponsePageLinks + meta?: ResponseMetaCarts +} + +export type GetCartsError = ResponseError + +export type CreateAcartData = { + body?: CartsRequest + headers?: { + /** + * A customer token to be associated with the cart. + */ + "x-moltin-customer-token"?: string + } +} + +export type CreateAcartResponse = ResponseData & { + data?: CartResponse +} + +export type CreateAcartError = ResponseError + +export type GetCartData = { + path: { + /** + * The unique identifier for this cart that you created. + */ + cartID: string + } +} + +export type GetCartResponse = ResponseData & { + data?: CartResponse +} + +export type GetCartError = ResponseError + +export type UpdateAcartData = { + body?: CartsRequest + path: { + /** + * The unique identifier of a cart created by you. + */ + cartID: string + } +} + +export type UpdateAcartResponse = ResponseData & { + data?: CartResponse +} + +export type UpdateAcartError = ResponseError + +export type DeleteAcartData = { + path: { + /** + * The unique identifier of the cart that you want to delete. + */ + cartID: string + } +} + +export type DeleteAcartResponse = void + +export type DeleteAcartError = ResponseError + +export type GetCartItemsData = { + path: { + /** + * The unique identifier of the cart that you created. + */ + cartID: string + } +} + +export type GetCartItemsResponse = CartsResponse + +export type GetCartItemsError = ResponseError + +export type BulkUpdateItemsInCartData = { + body?: BulkUpdateCartsItems + path: { + /** + * The unique identifier of the cart that you created. + */ + cartID: string + } +} + +export type BulkUpdateItemsInCartResponse = unknown + +export type BulkUpdateItemsInCartError = ResponseError + +export type ManageCartsData = { + body?: + | CartItemsObjectRequest + | CartMergeObjectRequest + | CustomItemObject + | ReOrderObjectRequest + | PromotionItemObject + | BulkAddItemsRequest + path: { + /** + * The unique identifier of the cart that you created. + */ + cartID: string + } +} + +export type ManageCartsResponse = CartsResponse + +export type ManageCartsError = ResponseError + +export type DeleteAllCartItemsData = { + path: { + /** + * The unique identifier of the cart created by you. + */ + cartID: string + } +} + +export type DeleteAllCartItemsResponse = void + +export type DeleteAllCartItemsError = ResponseError + +export type UpdateAcartItemData = { + body?: UpdateCartsItems + path: { + /** + * A unique identifier of the cart that you created. + */ + cartID: string + /** + * A unique identifier of the cart item. + */ + cartitemID: string + } +} + +export type UpdateAcartItemResponse = CartsResponse + +export type UpdateAcartItemError = ResponseError + +export type DeleteAcartItemData = { + path: { + /** + * The unique identifier of the cart created by you. + */ + cartID: string + /** + * The unique identifier of the cart that you want to delete. + */ + cartitemID: string + } +} + +export type DeleteAcartItemResponse = void + +export type DeleteAcartItemError = ResponseError + +export type CreateAccountCartAssociationData = { + body?: CartsRelationshipsAccountsData + headers?: { + /** + * An Account Management Authentication token to access a specific account's carts. + */ + "EP-Account-Management-Authentication-Token"?: string + } + path: { + /** + * The ID for the cart created by the account. Ensure that you follow the guidelines for [Safe Characters](/guides/Getting-Started/safe-characters). + */ + cartID: string + } +} + +export type CreateAccountCartAssociationResponse = + CartsRelationshipsAccountsData | void + +export type CreateAccountCartAssociationError = ResponseError + +export type DeleteAccountCartAssociationData = { + body?: CartsRelationshipsAccountsData + headers?: { + /** + * An Account Management Authentication token to access a specific account's carts. + */ + "EP-Account-Management-Authentication-Token"?: string + } + path: { + /** + * The ID for the cart created by the account. + */ + cartID: string + } +} + +export type DeleteAccountCartAssociationResponse = void + +export type DeleteAccountCartAssociationError = ResponseError + +export type CreateCustomerCartAssociationData = { + body?: CartsRelationshipsCustomersData + headers?: { + /** + * A customer token to access a specific customer's carts. + */ + "x-moltin-customer-token"?: string + } + path: { + /** + * The ID for the cart created by the customer. Ensure that you follow the guidelines for [Safe Characters](/guides/Getting-Started/safe-characters). + */ + cartID: string + } +} + +export type CreateCustomerCartAssociationResponse = + CartsRelationshipsCustomersData + +export type CreateCustomerCartAssociationError = ResponseError + +export type DeleteCustomerCartAssociationData = { + body?: CartsRelationshipsCustomersData + headers?: { + /** + * A customer token to access a specific customer's carts. + */ + "x-moltin-customer-token"?: string + } + path: { + /** + * The ID for the cart created by the customer. + */ + cartID: string + } +} + +export type DeleteCustomerCartAssociationResponse = void + +export type DeleteCustomerCartAssociationError = ResponseError + +export type DeleteApromotionViaPromotionCodeData = { + path: { + /** + * Specifies the unique identifier of a cart created by you. + */ + cartID: string + /** + * Specifies the promotion code to be deleted. + */ + promoCode: string + } +} + +export type DeleteApromotionViaPromotionCodeResponse = void + +export type DeleteApromotionViaPromotionCodeError = ResponseError + +export type AddTaxItemToCartData = { + body?: ResponseData & { + data?: CartsItemsTaxesObject + } + path: { + /** + * The unique identifier of the cart. + */ + cartID: string + /** + * The unique identifier of the cart item. + */ + cartitemID: string + } +} + +export type AddTaxItemToCartResponse = ResponseData & { + data?: CartsItemsTaxesObject +} + +export type AddTaxItemToCartError = ResponseError + +export type BulkAddTaxItemsToCartData = { + body?: CartsBulkTaxes + path: { + /** + * The unique identifier of the cart. + */ + cartID: string + } +} + +export type BulkAddTaxItemsToCartResponse = CartsBulkTaxes + +export type BulkAddTaxItemsToCartError = ResponseError + +export type BulkDeleteTaxItemsFromCartData = { + path: { + /** + * The unique identifier of the cart. + */ + cartID: string + } +} + +export type BulkDeleteTaxItemsFromCartResponse = void + +export type BulkDeleteTaxItemsFromCartError = ResponseError + +export type UpdateAtaxItemData = { + body?: ResponseData & { + data?: CartsItemsTaxesObject + } + path: { + /** + * The unique identifier of the cart. + */ + cartID: string + /** + * The unique identifier of the cart item. + */ + cartitemID: string + /** + * The unique identifier of the tax item. + */ + taxitemID: string + } +} + +export type UpdateAtaxItemResponse = ResponseData & { + data?: CartsItemsTaxesObject +} + +export type UpdateAtaxItemError = ResponseError + +export type DeleteAtaxItemData = { + path: { + /** + * The unique identifier of the cart. + */ + cartID: string + /** + * The unique identifier of the cart item. + */ + cartitemID: string + /** + * The unique identifier of the tax item. + */ + taxitemID: string + } +} + +export type DeleteAtaxItemResponse = void + +export type DeleteAtaxItemError = ResponseError + +export type BulkAddCustomDiscountsToCartData = { + body?: CartsBulkCustomDiscounts + path: { + /** + * Specifies the system generated ID for the cart that the shopper created. + */ + cartID: string + } +} + +export type BulkAddCustomDiscountsToCartResponse = + CartsBulkCustomDiscountsResponse + +export type BulkAddCustomDiscountsToCartError = ResponseError + +export type BulkDeleteCustomDiscountsFromCartData = { + path: { + /** + * Specifies the unique ID for the cart. + */ + cartID: string + } +} + +export type BulkDeleteCustomDiscountsFromCartResponse = void + +export type BulkDeleteCustomDiscountsFromCartError = ResponseError + +export type UpdateCustomDiscountForCartData = { + body?: ResponseData & { + data?: CartsCustomDiscountsObject + } + path: { + /** + * Specifies the unique ID for the cart. + */ + cartID: string + /** + * Specifies the ID for the custom discount to be updated. + */ + customdiscountID: string + } +} + +export type UpdateCustomDiscountForCartResponse = ResponseData & { + data?: CartsCustomDiscountsResponse +} + +export type UpdateCustomDiscountForCartError = ResponseError + +export type DeleteCustomDiscountFromCartData = { + path: { + /** + * Specifies the unique ID for the cart. + */ + cartID: string + /** + * Specifies the ID for the custom discount to be deleted. + */ + customdiscountID: string + } +} + +export type DeleteCustomDiscountFromCartResponse = void + +export type DeleteCustomDiscountFromCartError = ResponseError + +export type AddCustomDiscountToCartItemData = { + body?: CartsCustomDiscountsObject + path: { + /** + * Specifies the ID for the cart. + */ + cartID: string + /** + * Specifies the unique identifier for the cart item. + */ + cartitemID: string + } +} + +export type UpdateCustomDiscountForCartItemData = { + body?: ResponseData & { + data?: CartsCustomDiscountsObject + } + path: { + /** + * Specifies the ID for the cart. + */ + cartID: string + /** + * Specifies the ID for the cart item. + */ + cartitemID: string + /** + * Specifies the ID for the custom discount to be updated. + */ + customdiscountID: string + } +} + +export type DeleteCustomDiscountFromCartItemData = { + path: { + /** + * Specifies the ID for the cart. + */ + cartID: string + /** + * Specifies the ID for the cart item. + */ + cartitemID: string + /** + * Specifies the ID for the custom discount to be deleted. + */ + customdiscountID: string + } +} + +export type DeleteCustomDiscountFromCartItemResponse = void + +export type DeleteCustomDiscountFromCartItemError = ResponseError + +export type CreateCartPaymentIntentData = { + body?: ElasticPathPaymentsPoweredByStripePayment + path: { + /** + * The universally unique identifier of the cart for which you want to create a payment intent. + */ + cartID: string + } +} + +export type CreateCartPaymentIntentResponse = CartResponse + +export type CreateCartPaymentIntentError = ResponseError + +export type CheckoutApiData = { + body?: CustomerCheckout | AccountCheckout + headers?: { + /** + * An account management authentication token that identifies the authenticated account member. + */ + "EP-Account-Management-Authentication-Token"?: string + } + path: { + /** + * The ID of the cart that you want to checkout. + */ + cartID: string + } +} + +export type CheckoutApiResponse = ResponseData & { + data?: OrderResponse +} + +export type CheckoutApiError = ResponseError + +export type GetCustomerOrdersData = { + headers?: { + /** + * A customer token to access a specific customer's orders. + */ + "x-moltin-customer-token"?: string + } +} + +export type GetCustomerOrdersResponse = ResponseData & { + data?: Array + links?: ResponsePageLinks + meta?: ResponseMetaOrders +} + +export type GetCustomerOrdersError = ResponseError + +export type GetAnOrderData = { + path: { + /** + * The ID of the order. + */ + orderID: string + } +} + +export type GetAnOrderResponse = ResponseData & { + data?: OrderResponse +} + +export type GetAnOrderError = ResponseError + +export type UpdateAnOrderData = { + body?: OrdersUpdateRequest + path: { + /** + * The unique identifier of the order. + */ + orderID: string + } +} + +export type UpdateAnOrderResponse = ResponseData & { + data?: OrderResponse +} + +export type UpdateAnOrderError = ResponseError + +export type GetOrderItemsData = { + path: { + /** + * The ID of the order. + */ + orderID: string + } +} + +export type GetOrderItemsResponse = ResponseData & { + data?: Array +} + +export type GetOrderItemsError = ResponseError + +export type AnonymizeOrdersData = { + body?: OrdersAnonymizeRequest +} + +export type AnonymizeOrdersResponse = ResponseData & { + data?: OrderResponse +} + +export type AnonymizeOrdersError = ResponseError + +export type AuthorizeSetupData = { + body?: PaymentsRequest + path: { + /** + * The Universally Unique Identifier (UUID) of the order you want to pay for. + */ + orderID: string + } +} + +export type AuthorizeSetupResponse = ResponseData & { + data?: TransactionResponse +} + +export type AuthorizeSetupError = ResponseError + +export type ConfirmSetupData = { + body?: OrdersTransactionsConfirmRequest + path: { + /** + * The unique identifier of the order. + */ + orderID: string + /** + * The unique identifier of the transaction. + */ + transactionID: string + } +} + +export type ConfirmSetupResponse = ResponseData & { + data?: TransactionResponse +} + +export type ConfirmSetupError = ResponseError + +export type CaptureAtransactionData = { + body?: OrdersTransactionsCaptureRequest + path: { + /** + * The UUID of the order. + */ + orderID: string + /** + * The UUID of the transaction to capture. + */ + transactionID: string + } +} + +export type CaptureAtransactionResponse = ResponseData & { + data?: TransactionResponse +} + +export type CaptureAtransactionError = ResponseError + +export type RefundAtransactionData = { + body?: OrdersTransactionsRefundRequest + path: { + /** + * The UUID of the order. + */ + orderID: string + /** + * The UUID of the transaction you want to refund. + */ + transactionID: string + } +} + +export type RefundAtransactionResponse = ResponseData & { + data?: TransactionResponse +} + +export type RefundAtransactionError = ResponseError + +export type GetOrderTransactionsData = { + path: { + /** + * The unique identifier of the order. + */ + orderID: string + } +} + +export type GetOrderTransactionsResponse = ResponseData & { + data?: Array +} + +export type GetOrderTransactionsError = ResponseError + +export type GetAtransactionData = { + path: { + /** + * The unique identifier of the order that you require transactions for. + */ + orderID: string + /** + * The unique identifier of the transaction. + */ + transactionID: string + } +} + +export type GetAtransactionResponse = ResponseData & { + data?: TransactionResponse +} + +export type GetAtransactionError = ResponseError + +export type CancelAtransactionData = { + body?: OrdersTransactionsCancelRequest + path: { + /** + * The unique identifier of the order. + */ + orderID: string + /** + * The unique identifier of the transaction to be canceled or voided. + */ + transactionID: string + } +} + +export type CancelAtransactionResponse = ResponseData & { + data?: TransactionResponse +} + +export type CancelAtransactionError = ResponseError + +export type $OpenApiTs = { + "/catalog": { + get: { + req: GetByContextReleaseData + res: { + /** + * The catalog. + */ + "200": ReleaseData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalog/hierarchies": { + get: { + req: GetByContextAllHierarchiesData + res: { + /** + * The hierarchies of the catalog. + */ + "200": HierarchyListData + /** + * An unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalog/hierarchies/{hierarchy_id}": { + get: { + req: GetByContextHierarchyData + res: { + /** + * The catalog hierarchy. + */ + "200": HierarchyData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalog/hierarchies/{hierarchy_id}/nodes": { + get: { + req: GetByContextHierarchyNodesData + res: { + /** + * The child nodes of a catalog hierarchy. + */ + "200": NodeListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalog/hierarchies/{hierarchy_id}/children": { + get: { + req: GetByContextHierarchyChildNodesData + res: { + /** + * The child nodes of a catalog hierarchy. + */ + "200": NodeListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalog/nodes": { + get: { + req: GetByContextAllNodesData + res: { + /** + * The nodes of the catalog. + */ + "200": NodeListData + /** + * An unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalog/nodes/{node_id}": { + get: { + req: GetByContextNodeData + res: { + /** + * The catalog node. + */ + "200": NodeData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalog/nodes/{node_id}/relationships/children": { + get: { + req: GetByContextChildNodesData + res: { + /** + * The child nodes of a catalog node. + */ + "200": NodeListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalog/products": { + get: { + req: GetByContextAllProductsData + res: { + /** + * The products of a catalog. + */ + "200": ProductListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalog/products/{product_id}": { + get: { + req: GetByContextProductData + res: { + /** + * The product of a catalog. + */ + "200": ProductData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalog/products/{product_id}/relationships/component_products": { + get: { + req: GetByContextComponentProductIdsData + res: { + /** + * The list of component product IDs of a bundle product from a catalog. + */ + "200": ProductReferenceListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalog/products/{product_id}/relationships/children": { + get: { + req: GetByContextChildProductsData + res: { + /** + * The list of child products of a parent product from a catalog. + */ + "200": ProductListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalog/hierarchies/{hierarchy_id}/products": { + get: { + req: GetByContextProductsForHierarchyData + res: { + /** + * The products of a catalog hierarchy. + */ + "200": ProductListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalog/nodes/{node_id}/relationships/products": { + get: { + req: GetByContextProductsForNodeData + res: { + /** + * The products of a catalog node. + */ + "200": ProductListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalog/products/{product_id}/configure": { + post: { + req: ConfigureByContextProductData + res: { + /** + * The configured product of a catalog. + */ + "200": ProductData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalogs": { + post: { + req: CreateCatalogData + res: { + /** + * The created catalog + */ + "201": CatalogData + /** + * Unexpected error. + */ + default: ErrorResponse + } + } + get: { + res: { + /** + * The list of catalogs. + */ + "200": CatalogListData + /** + * An unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalogs/{catalog_id}": { + get: { + req: GetCatalogByIdData + res: { + /** + * The catalog. + */ + "200": CatalogData + /** + * An unexpected error. + */ + default: ErrorResponse + } + } + put: { + req: UpdateCatalogData + res: { + /** + * An updated catalog with the following attributes. + */ + "200": CatalogData + /** + * Unexpected error. + */ + default: ErrorResponse + } + } + delete: { + req: DeleteCatalogByIdData + res: { + /** + * A 204 response indicates that the catalog has been deleted. + */ + "204": void + /** + * Unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalogs/{catalog_id}/releases": { + post: { + req: PublishReleaseData + res: { + /** + * Publishes a catalog release with the following attributes. + */ + "201": ReleaseData + /** + * Unexpected error. + */ + default: ErrorResponse + } + } + get: { + req: GetReleasesData + res: { + /** + * The list of catalogs. + */ + "200": ReleaseListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + delete: { + req: DeleteReleasesData + res: { + /** + * A 204 response indicates that the releases have been deleted. + */ + "204": void + /** + * Unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalogs/{catalog_id}/releases/{release_id}": { + get: { + req: GetReleaseByIdData + res: { + /** + * The catalog. + */ + "200": ReleaseData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + delete: { + req: DeleteReleaseByIdData + res: { + /** + * A 204 response indicates that the release has been deleted. + */ + "204": void + /** + * Unexpected error. + */ + default: ErrorResponse + } + } } -} - -export type ConfigureByContextProductResponse = ProductData - -export type ConfigureByContextProductError = ErrorResponse - -export type $OpenApiTs = { - "/pcm/catalogs": { + "/catalogs/rules": { post: { - req: CreateCatalogData + req: CreateRuleData res: { /** - * The created catalog + * The created catalog rule */ - "201": CatalogData + "201": RuleData /** * Unexpected error. */ @@ -3210,11 +5875,12 @@ export type $OpenApiTs = { } } get: { + req: GetRulesData res: { /** - * The list of catalogs. + * The list of catalog rules. */ - "200": CatalogListData + "200": RuleListData /** * An unexpected error. */ @@ -3222,14 +5888,14 @@ export type $OpenApiTs = { } } } - "/pcm/catalogs/{catalog_id}": { + "/catalogs/rules/{catalog_rule_id}": { get: { - req: GetCatalogByIdData + req: GetRuleByIdData res: { /** - * The catalog. + * The catalog rile. */ - "200": CatalogData + "200": RuleData /** * An unexpected error. */ @@ -3237,12 +5903,12 @@ export type $OpenApiTs = { } } put: { - req: UpdateCatalogData + req: UpdateRuleData res: { /** - * An updated catalog with the following attributes. + * An Updated catalog rule with the following attributes. */ - "200": CatalogData + "200": RuleData /** * Unexpected error. */ @@ -3250,10 +5916,10 @@ export type $OpenApiTs = { } } delete: { - req: DeleteCatalogByIdData + req: DeleteRuleByIdData res: { /** - * A 204 response indicates that the catalog has been deleted. + * A 204 response indicates that the catalog rule has been deleted. */ "204": void /** @@ -3263,644 +5929,782 @@ export type $OpenApiTs = { } } } - "/pcm/catalogs/{catalog_id}/releases": { - post: { - req: PublishReleaseData + "/catalogs/{catalog_id}/releases/{release_id}/hierarchies": { + get: { + req: GetAllHierarchiesData res: { /** - * Publishes a catalog release with the following attributes. + * The hierarchies of a catalog. */ - "201": ReleaseData + "200": HierarchyListData /** - * Unexpected error. + * An unexpected error. */ default: ErrorResponse } } + } + "/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}": { get: { - req: GetReleasesData + req: GetHierarchyData res: { /** - * The list of catalogs. + * The catalog hierarchy. */ - "200": ReleaseListData + "200": HierarchyData /** * The unexpected error. */ default: ErrorResponse } } - delete: { - req: DeleteReleasesData + } + "/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/nodes": { + get: { + req: GetHierarchyNodesData res: { /** - * A 204 response indicates that the releases have been deleted. + * The child nodes of a catalog hierarchy. */ - "204": void + "200": NodeListData /** - * Unexpected error. + * The unexpected error. */ default: ErrorResponse } } } - "/pcm/catalogs/{catalog_id}/releases/{release_id}": { + "/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/children": { get: { - req: GetReleaseByIdData + req: GetHierarchyChildNodesData res: { /** - * The catalog. + * The child nodes of a catalog hierarchy. */ - "200": ReleaseData + "200": NodeListData /** * The unexpected error. */ default: ErrorResponse } } - delete: { - req: DeleteReleaseByIdData + } + "/catalogs/{catalog_id}/releases/{release_id}/nodes": { + get: { + req: GetAllNodesData res: { /** - * A 204 response indicates that the release has been deleted. + * The nodes of a catalog. */ - "204": void + "200": NodeListData /** - * Unexpected error. + * An unexpected error. */ default: ErrorResponse } } } - "/pcm/catalogs/rules": { - post: { - req: CreateRuleData + "/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}": { + get: { + req: GetNodeData res: { /** - * The created catalog rule + * The catalog node. */ - "201": RuleData + "200": NodeData /** - * Unexpected error. + * The unexpected error. */ default: ErrorResponse } } + } + "/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/children": { get: { - req: GetRulesData + req: GetChildNodesData + res: { + /** + * The child nodes of a catalog node. + */ + "200": NodeListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalogs/{catalog_id}/releases/{release_id}/products": { + get: { + req: GetAllProductsData + res: { + /** + * The products of a catalog. + */ + "200": ProductListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}": { + get: { + req: GetProductData + res: { + /** + * The product of a catalog. + */ + "200": ProductData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/component_products": { + get: { + req: GetComponentProductIdsData + res: { + /** + * The list of component product IDs of a specific bundle product from a catalog. + */ + "200": ProductReferenceListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/children": { + get: { + req: GetChildProductsData + res: { + /** + * The list of child products of a specific base product from a catalog. + */ + "200": ProductListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/products": { + get: { + req: GetProductsForHierarchyData + res: { + /** + * The products of a catalog hierarchy. + */ + "200": ProductListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/products": { + get: { + req: GetProductsForNodeData + res: { + /** + * The products of a catalog node. + */ + "200": ProductListData + /** + * The unexpected error. + */ + default: ErrorResponse + } + } + } + "/v2/carts": { + get: { + req: GetCartsData + res: { + "200": ResponseData & { + data?: Array + links?: ResponsePageLinks + meta?: ResponseMetaCarts + } + /** + * Unauthorized + */ + "401": ResponseError + } + } + post: { + req: CreateAcartData + res: { + "200": ResponseData & { + data?: CartResponse + } + /** + * Unauthorized + */ + "401": ResponseError + } + } + } + "/v2/carts/{cartID}": { + get: { + req: GetCartData + res: { + /** + * OK + */ + "200": ResponseData & { + data?: CartResponse + } + /** + * Unauthorized + */ + "401": ResponseError + } + } + put: { + req: UpdateAcartData + res: { + "200": ResponseData & { + data?: CartResponse + } + /** + * Unauthorized + */ + "401": ResponseError + } + } + delete: { + req: DeleteAcartData res: { /** - * The list of catalog rules. + * No Content */ - "200": RuleListData + "204": void /** - * An unexpected error. + * Unauthorized */ - default: ErrorResponse + "401": ResponseError } } } - "/pcm/catalogs/rules/{catalog_rule_id}": { + "/v2/carts/{cartID}/items": { get: { - req: GetRuleByIdData + req: GetCartItemsData res: { + "200": CartsResponse /** - * The catalog rile. - */ - "200": RuleData - /** - * An unexpected error. + * Unauthorized */ - default: ErrorResponse + "401": ResponseError } } put: { - req: UpdateRuleData + req: BulkUpdateItemsInCartData res: { + "200": unknown /** - * An Updated catalog rule with the following attributes. + * Unauthorized */ - "200": RuleData + "401": ResponseError + } + } + post: { + req: ManageCartsData + res: { + "200": CartsResponse /** - * Unexpected error. + * Unauthorized */ - default: ErrorResponse + "401": ResponseError } } delete: { - req: DeleteRuleByIdData + req: DeleteAllCartItemsData res: { /** - * A 204 response indicates that the catalog rule has been deleted. + * No Content */ "204": void /** - * Unexpected error. + * Unauthorized */ - default: ErrorResponse + "401": ResponseError } } } - "/pcm/catalogs/{catalog_id}/releases/{release_id}/hierarchies": { - get: { - req: GetAllHierarchiesData + "/v2/carts/{cartID}/items/{cartitemID}": { + put: { + req: UpdateAcartItemData res: { + "200": CartsResponse /** - * The hierarchies of a catalog. - */ - "200": HierarchyListData - /** - * An unexpected error. + * Unauthorized */ - default: ErrorResponse + "401": ResponseError } } - } - "/pcm/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}": { - get: { - req: GetHierarchyData + delete: { + req: DeleteAcartItemData res: { /** - * The catalog hierarchy. + * No Content */ - "200": HierarchyData + "204": void /** - * The unexpected error. + * Unauthorized */ - default: ErrorResponse + "401": ResponseError } } } - "/pcm/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/nodes": { - get: { - req: GetHierarchyNodesData + "/v2/carts/{cartID}/relationships/accounts": { + post: { + req: CreateAccountCartAssociationData res: { /** - * The child nodes of a catalog hierarchy. + * OK */ - "200": NodeListData + "200": CartsRelationshipsAccountsData /** - * The unexpected error. + * No Content is sent back in case the account has already been associated to the cart. */ - default: ErrorResponse + "204": void + /** + * Unauthorized + */ + "401": ResponseError } } - } - "/pcm/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/children": { - get: { - req: GetHierarchyChildNodesData + delete: { + req: DeleteAccountCartAssociationData res: { /** - * The child nodes of a catalog hierarchy. + * No Content */ - "200": NodeListData + "204": void /** - * The unexpected error. + * Unauthorized */ - default: ErrorResponse + "401": ResponseError } } } - "/pcm/catalogs/{catalog_id}/releases/{release_id}/nodes": { - get: { - req: GetAllNodesData + "/v2/carts/{cartID}/relationships/customers": { + post: { + req: CreateCustomerCartAssociationData res: { /** - * The nodes of a catalog. + * OK */ - "200": NodeListData + "200": CartsRelationshipsCustomersData /** - * An unexpected error. + * Unauthorized */ - default: ErrorResponse + "401": ResponseError } } - } - "/pcm/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}": { - get: { - req: GetNodeData + delete: { + req: DeleteCustomerCartAssociationData res: { /** - * The catalog node. + * No Content */ - "200": NodeData + "204": void /** - * The unexpected error. + * Unauthorized */ - default: ErrorResponse + "401": ResponseError } } } - "/pcm/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/children": { - get: { - req: GetChildNodesData + "/v2/carts/{cartID}/discounts/{promoCode}": { + delete: { + req: DeleteApromotionViaPromotionCodeData res: { /** - * The child nodes of a catalog node. + * No Content */ - "200": NodeListData + "204": void /** - * The unexpected error. + * Unauthorized */ - default: ErrorResponse + "401": ResponseError } } } - "/pcm/catalogs/{catalog_id}/releases/{release_id}/products": { - get: { - req: GetAllProductsData + "/v2/carts/{cartID}/items/{cartitemID}/taxes": { + post: { + req: AddTaxItemToCartData res: { + "200": ResponseData & { + data?: CartsItemsTaxesObject + } /** - * The products of a catalog. + * Unauthorized */ - "200": ProductListData + "401": ResponseError /** - * The unexpected error. + * Unauthorized */ - default: ErrorResponse + "422": ResponseError } } } - "/pcm/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}": { - get: { - req: GetProductData + "/v2/carts/{cartID}/taxes": { + post: { + req: BulkAddTaxItemsToCartData res: { + "200": CartsBulkTaxes /** - * The product of a catalog. - */ - "200": ProductData - /** - * The unexpected error. + * Unauthorized */ - default: ErrorResponse + "401": ResponseError } } - } - "/pcm/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/component_products": { - get: { - req: GetComponentProductIdsData + delete: { + req: BulkDeleteTaxItemsFromCartData res: { /** - * The list of component product IDs of a specific bundle product from a catalog. + * No Content */ - "200": ProductReferenceListData + "204": void /** - * The unexpected error. + * Unauthorized */ - default: ErrorResponse + "401": ResponseError } } } - "/pcm/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/children": { - get: { - req: GetChildProductsData + "/v2/carts/{cartID}/items/{cartitemID}/taxes/{taxitemID}": { + put: { + req: UpdateAtaxItemData res: { + "200": ResponseData & { + data?: CartsItemsTaxesObject + } /** - * The list of child products of a specific base product from a catalog. - */ - "200": ProductListData - /** - * The unexpected error. + * Unauthorized */ - default: ErrorResponse + "401": ResponseError } } - } - "/pcm/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/products": { - get: { - req: GetProductsForHierarchyData + delete: { + req: DeleteAtaxItemData res: { /** - * The products of a catalog hierarchy. + * No Content */ - "200": ProductListData + "204": void /** - * The unexpected error. + * Unauthorized */ - default: ErrorResponse + "401": ResponseError } } } - "/pcm/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/products": { - get: { - req: GetProductsForNodeData + "/v2/carts/{cartID}/custom-discounts": { + post: { + req: BulkAddCustomDiscountsToCartData res: { + "200": CartsBulkCustomDiscountsResponse /** - * The products of a catalog node. + * Unauthorized */ - "200": ProductListData + "401": ResponseError + } + } + delete: { + req: BulkDeleteCustomDiscountsFromCartData + res: { /** - * The unexpected error. + * No Content */ - default: ErrorResponse + "204": void + /** + * Unauthorized + */ + "401": ResponseError } } } - "/catalog": { - get: { - req: GetByContextReleaseData + "/v2/carts/{cartID}/custom-discounts/{customdiscountID}": { + put: { + req: UpdateCustomDiscountForCartData res: { + "200": ResponseData & { + data?: CartsCustomDiscountsResponse + } /** - * The catalog. + * Unauthorized */ - "200": ReleaseData + "401": ResponseError + } + } + delete: { + req: DeleteCustomDiscountFromCartData + res: { /** - * The unexpected error. + * No Content */ - default: ErrorResponse + "204": void + /** + * Unauthorized + */ + "401": ResponseError } } } - "/catalog/hierarchies": { - get: { - req: GetByContextAllHierarchiesData + "/v2/carts/{cartID}/items/{cartitemID}/custom-discounts": { + post: { + req: AddCustomDiscountToCartItemData + } + } + "/v2/carts/{cartID}/items/{cartitemID}/custom-discounts/{customdiscountID}": { + put: { + req: UpdateCustomDiscountForCartItemData + } + delete: { + req: DeleteCustomDiscountFromCartItemData res: { /** - * The hierarchies of the catalog. + * No Content */ - "200": HierarchyListData + "204": void /** - * An unexpected error. + * Unauthorized */ - default: ErrorResponse + "401": ResponseError } } } - "/catalog/hierarchies/{hierarchy_id}": { - get: { - req: GetByContextHierarchyData + "/v2/carts/{cartID}/payments": { + post: { + req: CreateCartPaymentIntentData res: { /** - * The catalog hierarchy. + * Payment Intent created successfully. */ - "200": HierarchyData + "201": CartResponse /** - * The unexpected error. + * Unauthorized */ - default: ErrorResponse + "401": ResponseError } } } - "/catalog/hierarchies/{hierarchy_id}/nodes": { - get: { - req: GetByContextHierarchyNodesData + "/v2/carts/{cartID}/checkout": { + post: { + req: CheckoutApiData res: { /** - * The child nodes of a catalog hierarchy. + * OK */ - "200": NodeListData + "200": ResponseData & { + data?: OrderResponse + } /** - * The unexpected error. + * Unauthorized */ - default: ErrorResponse + "401": ResponseError } } } - "/catalog/hierarchies/{hierarchy_id}/children": { + "/v2/orders": { get: { - req: GetByContextHierarchyChildNodesData + req: GetCustomerOrdersData res: { + "200": ResponseData & { + data?: Array + links?: ResponsePageLinks + meta?: ResponseMetaOrders + } /** - * The child nodes of a catalog hierarchy. - */ - "200": NodeListData - /** - * The unexpected error. + * Unauthorized */ - default: ErrorResponse + "401": ResponseError } } } - "/catalog/nodes": { + "/v2/orders/{orderID}": { get: { - req: GetByContextAllNodesData + req: GetAnOrderData res: { /** - * The nodes of the catalog. + * OK */ - "200": NodeListData + "200": ResponseData & { + data?: OrderResponse + } /** - * An unexpected error. + * Unauthorized */ - default: ErrorResponse + "401": ResponseError } } - } - "/catalog/nodes/{node_id}": { - get: { - req: GetByContextNodeData + put: { + req: UpdateAnOrderData res: { /** - * The catalog node. + * OK */ - "200": NodeData + "200": ResponseData & { + data?: OrderResponse + } /** - * The unexpected error. + * Unauthorized */ - default: ErrorResponse + "401": ResponseError } } } - "/catalog/nodes/{node_id}/relationships/children": { + "/v2/orders/{orderID}/items": { get: { - req: GetByContextChildNodesData + req: GetOrderItemsData res: { + "200": ResponseData & { + data?: Array + } /** - * The child nodes of a catalog node. - */ - "200": NodeListData - /** - * The unexpected error. + * Unauthorized */ - default: ErrorResponse + "401": ResponseError } } } - "/catalog/products": { - get: { - req: GetByContextAllProductsData + "/v2/orders/anonymize": { + post: { + req: AnonymizeOrdersData res: { /** - * The products of a catalog. + * OK */ - "200": ProductListData + "200": ResponseData & { + data?: OrderResponse + } /** - * The unexpected error. + * Unauthorized */ - default: ErrorResponse + "401": ResponseError + /** + * Not Found + */ + "422": ResponseError } } } - "/catalog/products/{product_id}": { - get: { - req: GetByContextProductData + "/v2/orders/{orderID}/payments": { + post: { + req: AuthorizeSetupData res: { /** - * The product of a catalog. + * OK */ - "200": ProductData + "200": ResponseData & { + data?: TransactionResponse + } /** - * The unexpected error. + * Unauthorized */ - default: ErrorResponse + "401": ResponseError } } } - "/catalog/products/{product_id}/relationships/component_products": { - get: { - req: GetByContextComponentProductIdsData + "/v2/orders/{orderID}/transactions/{transactionID}/confirm": { + post: { + req: ConfirmSetupData res: { + "200": ResponseData & { + data?: TransactionResponse + } /** - * The list of component product IDs of a bundle product from a catalog. - */ - "200": ProductReferenceListData - /** - * The unexpected error. + * Unauthorized */ - default: ErrorResponse + "401": ResponseError } } } - "/catalog/products/{product_id}/relationships/children": { - get: { - req: GetByContextChildProductsData + "/v2/orders/{orderID}/transactions/{transactionID}/capture": { + post: { + req: CaptureAtransactionData res: { + "200": ResponseData & { + data?: TransactionResponse + } /** - * The list of child products of a parent product from a catalog. + * Unauthorized */ - "200": ProductListData + "401": ResponseError + } + } + } + "/v2/orders/{orderID}/transactions/{transactionID}/refund": { + post: { + req: RefundAtransactionData + res: { + "200": ResponseData & { + data?: TransactionResponse + } /** - * The unexpected error. + * Unauthorized */ - default: ErrorResponse + "401": ResponseError } } } - "/catalog/hierarchies/{hierarchy_id}/products": { + "/v2/orders/{orderID}/transactions": { get: { - req: GetByContextProductsForHierarchyData + req: GetOrderTransactionsData res: { + "200": ResponseData & { + data?: Array + } /** - * The products of a catalog hierarchy. - */ - "200": ProductListData - /** - * The unexpected error. + * Unauthorized */ - default: ErrorResponse + "401": ResponseError } } } - "/catalog/nodes/{node_id}/relationships/products": { + "/v2/orders/{orderID}/transactions/{transactionID}": { get: { - req: GetByContextProductsForNodeData + req: GetAtransactionData res: { + "200": ResponseData & { + data?: TransactionResponse + } /** - * The products of a catalog node. - */ - "200": ProductListData - /** - * The unexpected error. + * Unauthorized */ - default: ErrorResponse + "401": ResponseError } } } - "/catalog/products/{product_id}/configure": { + "/v2/orders/{orderID}/transactions/{transactionID}/cancel": { post: { - req: ConfigureByContextProductData + req: CancelAtransactionData res: { + "200": ResponseData & { + data?: TransactionResponse + } /** - * The configured product of a catalog. - */ - "200": ProductData - /** - * The unexpected error. + * Unauthorized */ - default: ErrorResponse + "401": ResponseError } } } } -export type CreateCatalogResponseTransformer = ( - data: any, -) => Promise - -export type CatalogDataModelResponseTransformer = (data: any) => CatalogData - -export type CatalogModelResponseTransformer = (data: any) => Catalog - -export const CatalogModelResponseTransformer: CatalogModelResponseTransformer = - (data) => { - if (data?.attributes?.created_at) { - data.attributes.created_at = new Date(data.attributes.created_at) - } - if (data?.attributes?.updated_at) { - data.attributes.updated_at = new Date(data.attributes.updated_at) - } - return data - } - -export const CatalogDataModelResponseTransformer: CatalogDataModelResponseTransformer = - (data) => { - if (data?.data) { - CatalogModelResponseTransformer(data.data) - } - return data - } - -export const CreateCatalogResponseTransformer: CreateCatalogResponseTransformer = - async (data) => { - CatalogDataModelResponseTransformer(data) - return data - } - -export type GetCatalogsResponseTransformer = ( - data: any, -) => Promise - -export type CatalogListDataModelResponseTransformer = ( - data: any, -) => CatalogListData - -export const CatalogListDataModelResponseTransformer: CatalogListDataModelResponseTransformer = - (data) => { - if (Array.isArray(data?.data)) { - data.data.forEach(CatalogModelResponseTransformer) - } - return data - } - -export const GetCatalogsResponseTransformer: GetCatalogsResponseTransformer = - async (data) => { - CatalogListDataModelResponseTransformer(data) - return data - } - -export type GetCatalogByIdResponseTransformer = ( - data: any, -) => Promise - -export const GetCatalogByIdResponseTransformer: GetCatalogByIdResponseTransformer = - async (data) => { - CatalogDataModelResponseTransformer(data) - return data - } - -export type UpdateCatalogResponseTransformer = ( - data: any, -) => Promise - -export const UpdateCatalogResponseTransformer: UpdateCatalogResponseTransformer = - async (data) => { - CatalogDataModelResponseTransformer(data) - return data - } - -export type PublishReleaseResponseTransformer = ( +export type GetByContextReleaseResponseTransformer = ( data: any, -) => Promise +) => Promise export type ReleaseDataModelResponseTransformer = (data: any) => ReleaseData @@ -3920,159 +6724,36 @@ export const ReleaseMetaModelResponseTransformer: ReleaseMetaModelResponseTransf data.updated_at = new Date(data.updated_at) } return data - } - -export const ReleaseModelResponseTransformer: ReleaseModelResponseTransformer = - (data) => { - if (data?.attributes?.published_at) { - data.attributes.published_at = new Date(data.attributes.published_at) - } - if (data?.meta) { - ReleaseMetaModelResponseTransformer(data.meta) - } - return data - } - -export const ReleaseDataModelResponseTransformer: ReleaseDataModelResponseTransformer = - (data) => { - if (data?.data) { - ReleaseModelResponseTransformer(data.data) - } - return data - } - -export const PublishReleaseResponseTransformer: PublishReleaseResponseTransformer = - async (data) => { - ReleaseDataModelResponseTransformer(data) - return data - } - -export type GetReleasesResponseTransformer = ( - data: any, -) => Promise - -export type ReleaseListDataModelResponseTransformer = ( - data: any, -) => ReleaseListData - -export const ReleaseListDataModelResponseTransformer: ReleaseListDataModelResponseTransformer = - (data) => { - if (Array.isArray(data?.data)) { - data.data.forEach(ReleaseModelResponseTransformer) - } - return data - } - -export const GetReleasesResponseTransformer: GetReleasesResponseTransformer = - async (data) => { - ReleaseListDataModelResponseTransformer(data) - return data - } - -export type GetReleaseByIdResponseTransformer = ( - data: any, -) => Promise - -export const GetReleaseByIdResponseTransformer: GetReleaseByIdResponseTransformer = - async (data) => { - ReleaseDataModelResponseTransformer(data) - return data - } - -export type CreateRuleResponseTransformer = ( - data: any, -) => Promise - -export type RuleDataModelResponseTransformer = (data: any) => RuleData - -export type RuleModelResponseTransformer = (data: any) => Rule - -export type RuleScheduleModelResponseTransformer = (data: any) => RuleSchedule - -export const RuleScheduleModelResponseTransformer: RuleScheduleModelResponseTransformer = - (data) => { - if (data?.valid_from) { - data.valid_from = new Date(data.valid_from) - } - if (data?.valid_to) { - data.valid_to = new Date(data.valid_to) - } - return data - } - -export const RuleModelResponseTransformer: RuleModelResponseTransformer = ( - data, -) => { - if (Array.isArray(data?.attributes?.schedules)) { - data.attributes.schedules.forEach(RuleScheduleModelResponseTransformer) - } - if (data?.attributes?.created_at) { - data.attributes.created_at = new Date(data.attributes.created_at) - } - if (data?.attributes?.updated_at) { - data.attributes.updated_at = new Date(data.attributes.updated_at) - } - return data -} - -export const RuleDataModelResponseTransformer: RuleDataModelResponseTransformer = - (data) => { - if (data?.data) { - RuleModelResponseTransformer(data.data) - } - return data - } - -export const CreateRuleResponseTransformer: CreateRuleResponseTransformer = - async (data) => { - RuleDataModelResponseTransformer(data) - return data - } - -export type GetRulesResponseTransformer = ( - data: any, -) => Promise - -export type RuleListDataModelResponseTransformer = (data: any) => RuleListData - -export const RuleListDataModelResponseTransformer: RuleListDataModelResponseTransformer = - (data) => { - if (Array.isArray(data?.data)) { - data.data.forEach(RuleModelResponseTransformer) - } - return data - } - -export const GetRulesResponseTransformer: GetRulesResponseTransformer = async ( - data, -) => { - RuleListDataModelResponseTransformer(data) - return data -} - -export type GetRuleByIdResponseTransformer = ( - data: any, -) => Promise + } -export const GetRuleByIdResponseTransformer: GetRuleByIdResponseTransformer = - async (data) => { - RuleDataModelResponseTransformer(data) +export const ReleaseModelResponseTransformer: ReleaseModelResponseTransformer = + (data) => { + if (data?.attributes?.published_at) { + data.attributes.published_at = new Date(data.attributes.published_at) + } + if (data?.meta) { + ReleaseMetaModelResponseTransformer(data.meta) + } return data } -export type UpdateRuleResponseTransformer = ( - data: any, -) => Promise +export const ReleaseDataModelResponseTransformer: ReleaseDataModelResponseTransformer = + (data) => { + if (data?.data) { + ReleaseModelResponseTransformer(data.data) + } + return data + } -export const UpdateRuleResponseTransformer: UpdateRuleResponseTransformer = +export const GetByContextReleaseResponseTransformer: GetByContextReleaseResponseTransformer = async (data) => { - RuleDataModelResponseTransformer(data) + ReleaseDataModelResponseTransformer(data) return data } -export type GetAllHierarchiesResponseTransformer = ( +export type GetByContextAllHierarchiesResponseTransformer = ( data: any, -) => Promise +) => Promise export type HierarchyListDataModelResponseTransformer = ( data: any, @@ -4114,15 +6795,15 @@ export const HierarchyListDataModelResponseTransformer: HierarchyListDataModelRe return data } -export const GetAllHierarchiesResponseTransformer: GetAllHierarchiesResponseTransformer = +export const GetByContextAllHierarchiesResponseTransformer: GetByContextAllHierarchiesResponseTransformer = async (data) => { HierarchyListDataModelResponseTransformer(data) return data } -export type GetHierarchyResponseTransformer = ( +export type GetByContextHierarchyResponseTransformer = ( data: any, -) => Promise +) => Promise export type HierarchyDataModelResponseTransformer = (data: any) => HierarchyData @@ -4134,15 +6815,15 @@ export const HierarchyDataModelResponseTransformer: HierarchyDataModelResponseTr return data } -export const GetHierarchyResponseTransformer: GetHierarchyResponseTransformer = +export const GetByContextHierarchyResponseTransformer: GetByContextHierarchyResponseTransformer = async (data) => { HierarchyDataModelResponseTransformer(data) return data } -export type GetHierarchyNodesResponseTransformer = ( +export type GetByContextHierarchyNodesResponseTransformer = ( data: any, -) => Promise +) => Promise export type NodeListDataModelResponseTransformer = (data: any) => NodeListData @@ -4183,33 +6864,35 @@ export const NodeListDataModelResponseTransformer: NodeListDataModelResponseTran return data } -export const GetHierarchyNodesResponseTransformer: GetHierarchyNodesResponseTransformer = +export const GetByContextHierarchyNodesResponseTransformer: GetByContextHierarchyNodesResponseTransformer = async (data) => { NodeListDataModelResponseTransformer(data) return data } -export type GetHierarchyChildNodesResponseTransformer = ( +export type GetByContextHierarchyChildNodesResponseTransformer = ( data: any, -) => Promise +) => Promise -export const GetHierarchyChildNodesResponseTransformer: GetHierarchyChildNodesResponseTransformer = +export const GetByContextHierarchyChildNodesResponseTransformer: GetByContextHierarchyChildNodesResponseTransformer = async (data) => { NodeListDataModelResponseTransformer(data) return data } -export type GetAllNodesResponseTransformer = ( +export type GetByContextAllNodesResponseTransformer = ( data: any, -) => Promise +) => Promise -export const GetAllNodesResponseTransformer: GetAllNodesResponseTransformer = +export const GetByContextAllNodesResponseTransformer: GetByContextAllNodesResponseTransformer = async (data) => { NodeListDataModelResponseTransformer(data) return data } -export type GetNodeResponseTransformer = (data: any) => Promise +export type GetByContextNodeResponseTransformer = ( + data: any, +) => Promise export type NodeDataModelResponseTransformer = (data: any) => NodeData @@ -4221,26 +6904,25 @@ export const NodeDataModelResponseTransformer: NodeDataModelResponseTransformer return data } -export const GetNodeResponseTransformer: GetNodeResponseTransformer = async ( - data, -) => { - NodeDataModelResponseTransformer(data) - return data -} +export const GetByContextNodeResponseTransformer: GetByContextNodeResponseTransformer = + async (data) => { + NodeDataModelResponseTransformer(data) + return data + } -export type GetChildNodesResponseTransformer = ( +export type GetByContextChildNodesResponseTransformer = ( data: any, -) => Promise +) => Promise -export const GetChildNodesResponseTransformer: GetChildNodesResponseTransformer = +export const GetByContextChildNodesResponseTransformer: GetByContextChildNodesResponseTransformer = async (data) => { NodeListDataModelResponseTransformer(data) return data } -export type GetAllProductsResponseTransformer = ( +export type GetByContextAllProductsResponseTransformer = ( data: any, -) => Promise +) => Promise export type ProductListDataModelResponseTransformer = ( data: any, @@ -4292,254 +6974,451 @@ export const FilesRelationshipModelResponseTransformer: FilesRelationshipModelRe return data } -export const ProductRelationshipsModelResponseTransformer: ProductRelationshipsModelResponseTransformer = - (data) => { - if (data?.files) { - FilesRelationshipModelResponseTransformer(data.files) - } +export const ProductRelationshipsModelResponseTransformer: ProductRelationshipsModelResponseTransformer = + (data) => { + if (data?.files) { + FilesRelationshipModelResponseTransformer(data.files) + } + return data + } + +export type ProductMetaModelResponseTransformer = (data: any) => ProductMeta + +export const ProductMetaModelResponseTransformer: ProductMetaModelResponseTransformer = + (data) => { + if (data?.sale_expires) { + data.sale_expires = new Date(data.sale_expires) + } + return data + } + +export const ProductModelResponseTransformer: ProductModelResponseTransformer = + (data) => { + if (data?.attributes) { + ProductAttributesModelResponseTransformer(data.attributes) + } + if (data?.relationships) { + ProductRelationshipsModelResponseTransformer(data.relationships) + } + if (data?.meta) { + ProductMetaModelResponseTransformer(data.meta) + } + return data + } + +export type IncludedModelResponseTransformer = (data: any) => Included + +export const IncludedModelResponseTransformer: IncludedModelResponseTransformer = + (data) => { + if (Array.isArray(data?.component_products)) { + data.component_products.forEach(ProductModelResponseTransformer) + } + return data + } + +export const ProductListDataModelResponseTransformer: ProductListDataModelResponseTransformer = + (data) => { + if (Array.isArray(data?.data)) { + data.data.forEach(ProductModelResponseTransformer) + } + if (data?.included) { + IncludedModelResponseTransformer(data.included) + } + return data + } + +export const GetByContextAllProductsResponseTransformer: GetByContextAllProductsResponseTransformer = + async (data) => { + ProductListDataModelResponseTransformer(data) + return data + } + +export type GetByContextProductResponseTransformer = ( + data: any, +) => Promise + +export type ProductDataModelResponseTransformer = (data: any) => ProductData + +export const ProductDataModelResponseTransformer: ProductDataModelResponseTransformer = + (data) => { + if (data?.data) { + ProductModelResponseTransformer(data.data) + } + if (data?.included) { + IncludedModelResponseTransformer(data.included) + } + return data + } + +export const GetByContextProductResponseTransformer: GetByContextProductResponseTransformer = + async (data) => { + ProductDataModelResponseTransformer(data) + return data + } + +export type GetByContextChildProductsResponseTransformer = ( + data: any, +) => Promise + +export const GetByContextChildProductsResponseTransformer: GetByContextChildProductsResponseTransformer = + async (data) => { + ProductListDataModelResponseTransformer(data) + return data + } + +export type GetByContextProductsForHierarchyResponseTransformer = ( + data: any, +) => Promise + +export const GetByContextProductsForHierarchyResponseTransformer: GetByContextProductsForHierarchyResponseTransformer = + async (data) => { + ProductListDataModelResponseTransformer(data) + return data + } + +export type GetByContextProductsForNodeResponseTransformer = ( + data: any, +) => Promise + +export const GetByContextProductsForNodeResponseTransformer: GetByContextProductsForNodeResponseTransformer = + async (data) => { + ProductListDataModelResponseTransformer(data) + return data + } + +export type ConfigureByContextProductResponseTransformer = ( + data: any, +) => Promise + +export const ConfigureByContextProductResponseTransformer: ConfigureByContextProductResponseTransformer = + async (data) => { + ProductDataModelResponseTransformer(data) + return data + } + +export type CreateCatalogResponseTransformer = ( + data: any, +) => Promise + +export type CatalogDataModelResponseTransformer = (data: any) => CatalogData + +export type CatalogModelResponseTransformer = (data: any) => Catalog + +export const CatalogModelResponseTransformer: CatalogModelResponseTransformer = + (data) => { + if (data?.attributes?.created_at) { + data.attributes.created_at = new Date(data.attributes.created_at) + } + if (data?.attributes?.updated_at) { + data.attributes.updated_at = new Date(data.attributes.updated_at) + } + return data + } + +export const CatalogDataModelResponseTransformer: CatalogDataModelResponseTransformer = + (data) => { + if (data?.data) { + CatalogModelResponseTransformer(data.data) + } + return data + } + +export const CreateCatalogResponseTransformer: CreateCatalogResponseTransformer = + async (data) => { + CatalogDataModelResponseTransformer(data) + return data + } + +export type GetCatalogsResponseTransformer = ( + data: any, +) => Promise + +export type CatalogListDataModelResponseTransformer = ( + data: any, +) => CatalogListData + +export const CatalogListDataModelResponseTransformer: CatalogListDataModelResponseTransformer = + (data) => { + if (Array.isArray(data?.data)) { + data.data.forEach(CatalogModelResponseTransformer) + } + return data + } + +export const GetCatalogsResponseTransformer: GetCatalogsResponseTransformer = + async (data) => { + CatalogListDataModelResponseTransformer(data) + return data + } + +export type GetCatalogByIdResponseTransformer = ( + data: any, +) => Promise + +export const GetCatalogByIdResponseTransformer: GetCatalogByIdResponseTransformer = + async (data) => { + CatalogDataModelResponseTransformer(data) return data } -export type ProductMetaModelResponseTransformer = (data: any) => ProductMeta +export type UpdateCatalogResponseTransformer = ( + data: any, +) => Promise -export const ProductMetaModelResponseTransformer: ProductMetaModelResponseTransformer = - (data) => { - if (data?.sale_expires) { - data.sale_expires = new Date(data.sale_expires) - } +export const UpdateCatalogResponseTransformer: UpdateCatalogResponseTransformer = + async (data) => { + CatalogDataModelResponseTransformer(data) return data } -export const ProductModelResponseTransformer: ProductModelResponseTransformer = - (data) => { - if (data?.attributes) { - ProductAttributesModelResponseTransformer(data.attributes) - } - if (data?.relationships) { - ProductRelationshipsModelResponseTransformer(data.relationships) - } - if (data?.meta) { - ProductMetaModelResponseTransformer(data.meta) - } +export type PublishReleaseResponseTransformer = ( + data: any, +) => Promise + +export const PublishReleaseResponseTransformer: PublishReleaseResponseTransformer = + async (data) => { + ReleaseDataModelResponseTransformer(data) return data } -export type IncludedModelResponseTransformer = (data: any) => Included +export type GetReleasesResponseTransformer = ( + data: any, +) => Promise -export const IncludedModelResponseTransformer: IncludedModelResponseTransformer = +export type ReleaseListDataModelResponseTransformer = ( + data: any, +) => ReleaseListData + +export const ReleaseListDataModelResponseTransformer: ReleaseListDataModelResponseTransformer = (data) => { - if (Array.isArray(data?.component_products)) { - data.component_products.forEach(ProductModelResponseTransformer) + if (Array.isArray(data?.data)) { + data.data.forEach(ReleaseModelResponseTransformer) } return data } -export const ProductListDataModelResponseTransformer: ProductListDataModelResponseTransformer = - (data) => { - if (Array.isArray(data?.data)) { - data.data.forEach(ProductModelResponseTransformer) - } - if (data?.included) { - IncludedModelResponseTransformer(data.included) - } +export const GetReleasesResponseTransformer: GetReleasesResponseTransformer = + async (data) => { + ReleaseListDataModelResponseTransformer(data) return data } -export const GetAllProductsResponseTransformer: GetAllProductsResponseTransformer = +export type GetReleaseByIdResponseTransformer = ( + data: any, +) => Promise + +export const GetReleaseByIdResponseTransformer: GetReleaseByIdResponseTransformer = async (data) => { - ProductListDataModelResponseTransformer(data) + ReleaseDataModelResponseTransformer(data) return data } -export type GetProductResponseTransformer = ( +export type CreateRuleResponseTransformer = ( data: any, -) => Promise +) => Promise -export type ProductDataModelResponseTransformer = (data: any) => ProductData +export type RuleDataModelResponseTransformer = (data: any) => RuleData -export const ProductDataModelResponseTransformer: ProductDataModelResponseTransformer = +export type RuleModelResponseTransformer = (data: any) => Rule + +export type RuleScheduleModelResponseTransformer = (data: any) => RuleSchedule + +export const RuleScheduleModelResponseTransformer: RuleScheduleModelResponseTransformer = (data) => { - if (data?.data) { - ProductModelResponseTransformer(data.data) + if (data?.valid_from) { + data.valid_from = new Date(data.valid_from) } - if (data?.included) { - IncludedModelResponseTransformer(data.included) + if (data?.valid_to) { + data.valid_to = new Date(data.valid_to) } return data } -export const GetProductResponseTransformer: GetProductResponseTransformer = - async (data) => { - ProductDataModelResponseTransformer(data) - return data +export const RuleModelResponseTransformer: RuleModelResponseTransformer = ( + data, +) => { + if (Array.isArray(data?.attributes?.schedules)) { + data.attributes.schedules.forEach(RuleScheduleModelResponseTransformer) + } + if (data?.attributes?.created_at) { + data.attributes.created_at = new Date(data.attributes.created_at) + } + if (data?.attributes?.updated_at) { + data.attributes.updated_at = new Date(data.attributes.updated_at) } + return data +} -export type GetChildProductsResponseTransformer = ( - data: any, -) => Promise +export const RuleDataModelResponseTransformer: RuleDataModelResponseTransformer = + (data) => { + if (data?.data) { + RuleModelResponseTransformer(data.data) + } + return data + } -export const GetChildProductsResponseTransformer: GetChildProductsResponseTransformer = +export const CreateRuleResponseTransformer: CreateRuleResponseTransformer = async (data) => { - ProductListDataModelResponseTransformer(data) + RuleDataModelResponseTransformer(data) return data } -export type GetProductsForHierarchyResponseTransformer = ( +export type GetRulesResponseTransformer = ( data: any, -) => Promise +) => Promise -export const GetProductsForHierarchyResponseTransformer: GetProductsForHierarchyResponseTransformer = - async (data) => { - ProductListDataModelResponseTransformer(data) +export type RuleListDataModelResponseTransformer = (data: any) => RuleListData + +export const RuleListDataModelResponseTransformer: RuleListDataModelResponseTransformer = + (data) => { + if (Array.isArray(data?.data)) { + data.data.forEach(RuleModelResponseTransformer) + } return data } -export type GetProductsForNodeResponseTransformer = ( +export const GetRulesResponseTransformer: GetRulesResponseTransformer = async ( + data, +) => { + RuleListDataModelResponseTransformer(data) + return data +} + +export type GetRuleByIdResponseTransformer = ( data: any, -) => Promise +) => Promise -export const GetProductsForNodeResponseTransformer: GetProductsForNodeResponseTransformer = +export const GetRuleByIdResponseTransformer: GetRuleByIdResponseTransformer = async (data) => { - ProductListDataModelResponseTransformer(data) + RuleDataModelResponseTransformer(data) return data } -export type GetByContextReleaseResponseTransformer = ( +export type UpdateRuleResponseTransformer = ( data: any, -) => Promise +) => Promise -export const GetByContextReleaseResponseTransformer: GetByContextReleaseResponseTransformer = +export const UpdateRuleResponseTransformer: UpdateRuleResponseTransformer = async (data) => { - ReleaseDataModelResponseTransformer(data) + RuleDataModelResponseTransformer(data) return data } -export type GetByContextAllHierarchiesResponseTransformer = ( +export type GetAllHierarchiesResponseTransformer = ( data: any, -) => Promise +) => Promise -export const GetByContextAllHierarchiesResponseTransformer: GetByContextAllHierarchiesResponseTransformer = +export const GetAllHierarchiesResponseTransformer: GetAllHierarchiesResponseTransformer = async (data) => { HierarchyListDataModelResponseTransformer(data) return data } -export type GetByContextHierarchyResponseTransformer = ( +export type GetHierarchyResponseTransformer = ( data: any, -) => Promise +) => Promise -export const GetByContextHierarchyResponseTransformer: GetByContextHierarchyResponseTransformer = +export const GetHierarchyResponseTransformer: GetHierarchyResponseTransformer = async (data) => { HierarchyDataModelResponseTransformer(data) return data } -export type GetByContextHierarchyNodesResponseTransformer = ( +export type GetHierarchyNodesResponseTransformer = ( data: any, -) => Promise +) => Promise -export const GetByContextHierarchyNodesResponseTransformer: GetByContextHierarchyNodesResponseTransformer = +export const GetHierarchyNodesResponseTransformer: GetHierarchyNodesResponseTransformer = async (data) => { NodeListDataModelResponseTransformer(data) return data } -export type GetByContextHierarchyChildNodesResponseTransformer = ( +export type GetHierarchyChildNodesResponseTransformer = ( data: any, -) => Promise +) => Promise -export const GetByContextHierarchyChildNodesResponseTransformer: GetByContextHierarchyChildNodesResponseTransformer = +export const GetHierarchyChildNodesResponseTransformer: GetHierarchyChildNodesResponseTransformer = async (data) => { NodeListDataModelResponseTransformer(data) return data } -export type GetByContextAllNodesResponseTransformer = ( +export type GetAllNodesResponseTransformer = ( data: any, -) => Promise +) => Promise -export const GetByContextAllNodesResponseTransformer: GetByContextAllNodesResponseTransformer = +export const GetAllNodesResponseTransformer: GetAllNodesResponseTransformer = async (data) => { NodeListDataModelResponseTransformer(data) return data } -export type GetByContextNodeResponseTransformer = ( - data: any, -) => Promise +export type GetNodeResponseTransformer = (data: any) => Promise -export const GetByContextNodeResponseTransformer: GetByContextNodeResponseTransformer = - async (data) => { - NodeDataModelResponseTransformer(data) - return data - } +export const GetNodeResponseTransformer: GetNodeResponseTransformer = async ( + data, +) => { + NodeDataModelResponseTransformer(data) + return data +} -export type GetByContextChildNodesResponseTransformer = ( +export type GetChildNodesResponseTransformer = ( data: any, -) => Promise +) => Promise -export const GetByContextChildNodesResponseTransformer: GetByContextChildNodesResponseTransformer = +export const GetChildNodesResponseTransformer: GetChildNodesResponseTransformer = async (data) => { NodeListDataModelResponseTransformer(data) return data } -export type GetByContextAllProductsResponseTransformer = ( +export type GetAllProductsResponseTransformer = ( data: any, -) => Promise +) => Promise -export const GetByContextAllProductsResponseTransformer: GetByContextAllProductsResponseTransformer = +export const GetAllProductsResponseTransformer: GetAllProductsResponseTransformer = async (data) => { ProductListDataModelResponseTransformer(data) return data } -export type GetByContextProductResponseTransformer = ( +export type GetProductResponseTransformer = ( data: any, -) => Promise +) => Promise -export const GetByContextProductResponseTransformer: GetByContextProductResponseTransformer = +export const GetProductResponseTransformer: GetProductResponseTransformer = async (data) => { ProductDataModelResponseTransformer(data) return data } -export type GetByContextChildProductsResponseTransformer = ( +export type GetChildProductsResponseTransformer = ( data: any, -) => Promise +) => Promise -export const GetByContextChildProductsResponseTransformer: GetByContextChildProductsResponseTransformer = +export const GetChildProductsResponseTransformer: GetChildProductsResponseTransformer = async (data) => { ProductListDataModelResponseTransformer(data) return data } -export type GetByContextProductsForHierarchyResponseTransformer = ( +export type GetProductsForHierarchyResponseTransformer = ( data: any, -) => Promise +) => Promise -export const GetByContextProductsForHierarchyResponseTransformer: GetByContextProductsForHierarchyResponseTransformer = +export const GetProductsForHierarchyResponseTransformer: GetProductsForHierarchyResponseTransformer = async (data) => { ProductListDataModelResponseTransformer(data) return data } -export type GetByContextProductsForNodeResponseTransformer = ( +export type GetProductsForNodeResponseTransformer = ( data: any, -) => Promise +) => Promise -export const GetByContextProductsForNodeResponseTransformer: GetByContextProductsForNodeResponseTransformer = +export const GetProductsForNodeResponseTransformer: GetProductsForNodeResponseTransformer = async (data) => { ProductListDataModelResponseTransformer(data) return data } - -export type ConfigureByContextProductResponseTransformer = ( - data: any, -) => Promise - -export const ConfigureByContextProductResponseTransformer: ConfigureByContextProductResponseTransformer = - async (data) => { - ProductDataModelResponseTransformer(data) - return data - } From 39976a3b6f2376e60510ab359b070a96acca2806 Mon Sep 17 00:00:00 2001 From: Robert Field Date: Mon, 26 Aug 2024 17:59:10 +0100 Subject: [PATCH 14/30] build: bump latest hey api --- packages/sdks/shopper/package.json | 4 +- pnpm-lock.yaml | 59 +++++++++++++++++++----------- 2 files changed, 40 insertions(+), 23 deletions(-) diff --git a/packages/sdks/shopper/package.json b/packages/sdks/shopper/package.json index 9d4a381f..9f75a07c 100644 --- a/packages/sdks/shopper/package.json +++ b/packages/sdks/shopper/package.json @@ -30,13 +30,13 @@ ], "keywords": [], "devDependencies": { - "@hey-api/openapi-ts": "^0.48.2", + "@hey-api/openapi-ts": "^0.52.10", "@redocly/cli": "^1.21.0", "@redocly/openapi-core": "^1.21.0", "lodash": "^4.17.21", "typescript": "^5.5.3" }, "dependencies": { - "@hey-api/client-fetch": "^0.1.7" + "@hey-api/client-fetch": "^0.2.4" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 32a62b04..6fe8aad1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1284,12 +1284,12 @@ importers: packages/sdks/shopper: dependencies: '@hey-api/client-fetch': - specifier: ^0.1.7 - version: 0.1.14 + specifier: ^0.2.4 + version: 0.2.4 devDependencies: '@hey-api/openapi-ts': - specifier: ^0.48.2 - version: 0.48.3(typescript@5.5.4) + specifier: ^0.52.10 + version: 0.52.10(typescript@5.5.4) '@redocly/cli': specifier: ^1.21.0 version: 1.21.0(enzyme@3.11.0) @@ -1616,6 +1616,15 @@ packages: js-yaml: 4.1.0 dev: true + /@apidevtools/json-schema-ref-parser@11.7.0: + resolution: {integrity: sha512-pRrmXMCwnmrkS3MLgAIW5dXRzeTv6GLjkjb4HmxNnvAKXN1Nfzp4KmGADBQvlVUcqi+a5D+hfGDLLnd5NnYxog==} + engines: {node: '>= 16'} + dependencies: + '@jsdevtools/ono': 7.1.3 + '@types/json-schema': 7.0.15 + js-yaml: 4.1.0 + dev: true + /@ardatan/relay-compiler@12.0.0(graphql@16.8.1): resolution: {integrity: sha512-9anThAaj1dQr6IGmzBMcfzOQKTa5artjuPmw8NYK/fiGEMjADbSguBY2FMDykt+QhilR3wc9VA/3yVju7JHg7Q==} hasBin: true @@ -7652,6 +7661,10 @@ packages: resolution: {integrity: sha512-6RoO2prOVrQfx2wClJ7DkeIVWQokiRLIdqiuxvFTfWEQVfOc+hQhAw6/IijYrSM9cA7A7DzmHpzTLc/gbQ7/2Q==} dev: false + /@hey-api/client-fetch@0.2.4: + resolution: {integrity: sha512-SGTVAVw3PlKDLw+IyhNhb/jCH3P1P2xJzLxA8Kyz1g95HrkYOJdRpl9F5I7LLwo9aCIB7nwR2NrSeX7QaQD7vQ==} + dev: false + /@hey-api/openapi-ts@0.48.3(typescript@5.5.4): resolution: {integrity: sha512-R53Nr4Gicz77icS+RiH0fwHa9A0uFPtzsjC8SBaGwtOel5ZyxeBbayWE6HhE789hp3dok9pegwWncwwOrr4WFA==} engines: {node: ^18.0.0 || >=20.0.0} @@ -7669,6 +7682,22 @@ packages: - magicast dev: true + /@hey-api/openapi-ts@0.52.10(typescript@5.5.4): + resolution: {integrity: sha512-ZjCETgc85VOEQvqObLxM0NUx87niv5LUfPk9N9BeVZ2zgvfFX8oT4LAzojc8UEyKDakI3elZKPPY843W3a+aFA==} + engines: {node: ^18.0.0 || >=20.0.0} + hasBin: true + peerDependencies: + typescript: ^5.x + dependencies: + '@apidevtools/json-schema-ref-parser': 11.7.0 + c12: 1.11.1 + commander: 12.1.0 + handlebars: 4.7.8 + typescript: 5.5.4 + transitivePeerDependencies: + - magicast + dev: true + /@hookform/error-message@2.0.1(react-dom@18.3.1)(react-hook-form@7.49.3)(react@18.3.1): resolution: {integrity: sha512-U410sAr92xgxT1idlu9WWOVjndxLdgPUHEB8Schr27C9eh7/xUnITWpCMF93s+lGiG++D4JnbSnrb5A21AdSNg==} peerDependencies: @@ -9676,7 +9705,7 @@ packages: glob: 7.2.3 handlebars: 4.7.8 mobx: 6.13.1 - node-fetch: 2.7.0 + node-fetch: 2.7.0(encoding@0.1.13) pluralize: 8.0.0 react: 18.3.1 react-dom: 18.3.1(react@18.3.1) @@ -9710,7 +9739,7 @@ packages: js-yaml: 4.1.0 lodash.isequal: 4.5.0 minimatch: 5.1.6 - node-fetch: 2.7.0 + node-fetch: 2.7.0(encoding@0.1.13) pluralize: 8.0.0 yaml-ast-parser: 0.0.43 transitivePeerDependencies: @@ -21486,18 +21515,6 @@ packages: is-stream: 1.1.0 dev: true - /node-fetch@2.7.0: - resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} - engines: {node: 4.x || >=6.0.0} - peerDependencies: - encoding: ^0.1.0 - peerDependenciesMeta: - encoding: - optional: true - dependencies: - whatwg-url: 5.0.0 - dev: true - /node-fetch@2.7.0(encoding@0.1.13): resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} engines: {node: 4.x || >=6.0.0} @@ -22245,7 +22262,7 @@ packages: resolution: {integrity: sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==} dependencies: jsonc-parser: 3.2.0 - mlly: 1.4.2 + mlly: 1.7.1 pathe: 1.1.2 dev: true @@ -25593,7 +25610,7 @@ packages: hasBin: true dependencies: call-me-maybe: 1.0.2 - node-fetch: 2.7.0 + node-fetch: 2.7.0(encoding@0.1.13) node-fetch-h2: 2.3.0 node-readfiles: 0.2.0 oas-kit-common: 1.0.8 @@ -26733,7 +26750,7 @@ packages: resolution: {integrity: sha512-0QkvG13z6RD+1L1FoibQqnvTwVBXvS4XSPwAyinVgoOCl2jAgwzdUKmEj05o4Lt8xwQI85Hb6mSyYkcAGwZPew==} dependencies: acorn: 8.12.1 - chokidar: 3.5.3 + chokidar: 3.6.0 webpack-sources: 3.2.3 webpack-virtual-modules: 0.6.1 dev: true From 81eb124fc830e7173f6e7d3e5555944b507ebd91 Mon Sep 17 00:00:00 2001 From: Robert Field Date: Mon, 26 Aug 2024 18:44:11 +0100 Subject: [PATCH 15/30] build: generate tanstack query options --- .../src/client/@tanstack/react-query.gen.ts | 3219 +++++++++++++++++ 1 file changed, 3219 insertions(+) create mode 100644 packages/sdks/shopper/src/client/@tanstack/react-query.gen.ts diff --git a/packages/sdks/shopper/src/client/@tanstack/react-query.gen.ts b/packages/sdks/shopper/src/client/@tanstack/react-query.gen.ts new file mode 100644 index 00000000..3ada802e --- /dev/null +++ b/packages/sdks/shopper/src/client/@tanstack/react-query.gen.ts @@ -0,0 +1,3219 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Options } from "@hey-api/client-fetch" +import { + queryOptions, + infiniteQueryOptions, + type InfiniteData, + type UseMutationOptions, + type DefaultError, +} from "@tanstack/react-query" +import type { + GetByContextReleaseData, + GetByContextAllHierarchiesData, + GetByContextAllHierarchiesError, + GetByContextAllHierarchiesResponse, + GetByContextHierarchyData, + GetByContextHierarchyNodesData, + GetByContextHierarchyNodesError, + GetByContextHierarchyNodesResponse, + GetByContextHierarchyChildNodesData, + GetByContextHierarchyChildNodesError, + GetByContextHierarchyChildNodesResponse, + GetByContextAllNodesData, + GetByContextAllNodesError, + GetByContextAllNodesResponse, + GetByContextNodeData, + GetByContextChildNodesData, + GetByContextChildNodesError, + GetByContextChildNodesResponse, + GetByContextAllProductsData, + GetByContextAllProductsError, + GetByContextAllProductsResponse, + GetByContextProductData, + GetByContextComponentProductIdsData, + GetByContextComponentProductIdsError, + GetByContextComponentProductIdsResponse, + GetByContextChildProductsData, + GetByContextChildProductsError, + GetByContextChildProductsResponse, + GetByContextProductsForHierarchyData, + GetByContextProductsForHierarchyError, + GetByContextProductsForHierarchyResponse, + GetByContextProductsForNodeData, + GetByContextProductsForNodeError, + GetByContextProductsForNodeResponse, + ConfigureByContextProductData, + ConfigureByContextProductError, + ConfigureByContextProductResponse, + CreateCatalogData, + CreateCatalogError, + CreateCatalogResponse, + GetCatalogByIdData, + UpdateCatalogData, + UpdateCatalogError, + UpdateCatalogResponse, + DeleteCatalogByIdData, + DeleteCatalogByIdError, + DeleteCatalogByIdResponse, + PublishReleaseData, + PublishReleaseError, + PublishReleaseResponse, + GetReleasesData, + DeleteReleasesData, + DeleteReleasesError, + DeleteReleasesResponse, + GetReleaseByIdData, + DeleteReleaseByIdData, + DeleteReleaseByIdError, + DeleteReleaseByIdResponse, + CreateRuleData, + CreateRuleError, + CreateRuleResponse, + GetRulesData, + GetRulesError, + GetRulesResponse, + GetRuleByIdData, + UpdateRuleData, + UpdateRuleError, + UpdateRuleResponse, + DeleteRuleByIdData, + DeleteRuleByIdError, + DeleteRuleByIdResponse, + GetAllHierarchiesData, + GetAllHierarchiesError, + GetAllHierarchiesResponse, + GetHierarchyData, + GetHierarchyNodesData, + GetHierarchyNodesError, + GetHierarchyNodesResponse, + GetHierarchyChildNodesData, + GetHierarchyChildNodesError, + GetHierarchyChildNodesResponse, + GetAllNodesData, + GetAllNodesError, + GetAllNodesResponse, + GetNodeData, + GetChildNodesData, + GetChildNodesError, + GetChildNodesResponse, + GetAllProductsData, + GetAllProductsError, + GetAllProductsResponse, + GetProductData, + GetComponentProductIdsData, + GetComponentProductIdsError, + GetComponentProductIdsResponse, + GetChildProductsData, + GetChildProductsError, + GetChildProductsResponse, + GetProductsForHierarchyData, + GetProductsForHierarchyError, + GetProductsForHierarchyResponse, + GetProductsForNodeData, + GetProductsForNodeError, + GetProductsForNodeResponse, + GetCartsData, + CreateAcartData, + CreateAcartError, + CreateAcartResponse, + GetCartData, + UpdateAcartData, + UpdateAcartError, + UpdateAcartResponse, + DeleteAcartData, + DeleteAcartError, + DeleteAcartResponse, + GetCartItemsData, + BulkUpdateItemsInCartData, + BulkUpdateItemsInCartError, + BulkUpdateItemsInCartResponse, + ManageCartsData, + ManageCartsError, + ManageCartsResponse, + DeleteAllCartItemsData, + DeleteAllCartItemsError, + DeleteAllCartItemsResponse, + UpdateAcartItemData, + UpdateAcartItemError, + UpdateAcartItemResponse, + DeleteAcartItemData, + DeleteAcartItemError, + DeleteAcartItemResponse, + CreateAccountCartAssociationData, + CreateAccountCartAssociationError, + CreateAccountCartAssociationResponse, + DeleteAccountCartAssociationData, + DeleteAccountCartAssociationError, + DeleteAccountCartAssociationResponse, + CreateCustomerCartAssociationData, + CreateCustomerCartAssociationError, + CreateCustomerCartAssociationResponse, + DeleteCustomerCartAssociationData, + DeleteCustomerCartAssociationError, + DeleteCustomerCartAssociationResponse, + DeleteApromotionViaPromotionCodeData, + DeleteApromotionViaPromotionCodeError, + DeleteApromotionViaPromotionCodeResponse, + AddTaxItemToCartData, + AddTaxItemToCartError, + AddTaxItemToCartResponse, + BulkAddTaxItemsToCartData, + BulkAddTaxItemsToCartError, + BulkAddTaxItemsToCartResponse, + BulkDeleteTaxItemsFromCartData, + BulkDeleteTaxItemsFromCartError, + BulkDeleteTaxItemsFromCartResponse, + UpdateAtaxItemData, + UpdateAtaxItemError, + UpdateAtaxItemResponse, + DeleteAtaxItemData, + DeleteAtaxItemError, + DeleteAtaxItemResponse, + BulkAddCustomDiscountsToCartData, + BulkAddCustomDiscountsToCartError, + BulkAddCustomDiscountsToCartResponse, + BulkDeleteCustomDiscountsFromCartData, + BulkDeleteCustomDiscountsFromCartError, + BulkDeleteCustomDiscountsFromCartResponse, + UpdateCustomDiscountForCartData, + UpdateCustomDiscountForCartError, + UpdateCustomDiscountForCartResponse, + DeleteCustomDiscountFromCartData, + DeleteCustomDiscountFromCartError, + DeleteCustomDiscountFromCartResponse, + AddCustomDiscountToCartItemData, + UpdateCustomDiscountForCartItemData, + DeleteCustomDiscountFromCartItemData, + DeleteCustomDiscountFromCartItemError, + DeleteCustomDiscountFromCartItemResponse, + CreateCartPaymentIntentData, + CreateCartPaymentIntentError, + CreateCartPaymentIntentResponse, + CheckoutApiData, + CheckoutApiError, + CheckoutApiResponse, + GetCustomerOrdersData, + GetAnOrderData, + UpdateAnOrderData, + UpdateAnOrderError, + UpdateAnOrderResponse, + GetOrderItemsData, + AnonymizeOrdersData, + AnonymizeOrdersError, + AnonymizeOrdersResponse, + AuthorizeSetupData, + AuthorizeSetupError, + AuthorizeSetupResponse, + ConfirmSetupData, + ConfirmSetupError, + ConfirmSetupResponse, + CaptureAtransactionData, + CaptureAtransactionError, + CaptureAtransactionResponse, + RefundAtransactionData, + RefundAtransactionError, + RefundAtransactionResponse, + GetOrderTransactionsData, + GetAtransactionData, + CancelAtransactionData, + CancelAtransactionError, + CancelAtransactionResponse, +} from "../types.gen" +import { + client, + getByContextRelease, + getByContextAllHierarchies, + getByContextHierarchy, + getByContextHierarchyNodes, + getByContextHierarchyChildNodes, + getByContextAllNodes, + getByContextNode, + getByContextChildNodes, + getByContextAllProducts, + getByContextProduct, + getByContextComponentProductIds, + getByContextChildProducts, + getByContextProductsForHierarchy, + getByContextProductsForNode, + configureByContextProduct, + createCatalog, + getCatalogs, + getCatalogById, + updateCatalog, + deleteCatalogById, + publishRelease, + getReleases, + deleteReleases, + getReleaseById, + deleteReleaseById, + createRule, + getRules, + getRuleById, + updateRule, + deleteRuleById, + getAllHierarchies, + getHierarchy, + getHierarchyNodes, + getHierarchyChildNodes, + getAllNodes, + getNode, + getChildNodes, + getAllProducts, + getProduct, + getComponentProductIds, + getChildProducts, + getProductsForHierarchy, + getProductsForNode, + getCarts, + createAcart, + getCart, + updateAcart, + deleteAcart, + getCartItems, + bulkUpdateItemsInCart, + manageCarts, + deleteAllCartItems, + updateAcartItem, + deleteAcartItem, + createAccountCartAssociation, + deleteAccountCartAssociation, + createCustomerCartAssociation, + deleteCustomerCartAssociation, + deleteApromotionViaPromotionCode, + addTaxItemToCart, + bulkAddTaxItemsToCart, + bulkDeleteTaxItemsFromCart, + updateAtaxItem, + deleteAtaxItem, + bulkAddCustomDiscountsToCart, + bulkDeleteCustomDiscountsFromCart, + updateCustomDiscountForCart, + deleteCustomDiscountFromCart, + addCustomDiscountToCartItem, + updateCustomDiscountForCartItem, + deleteCustomDiscountFromCartItem, + createCartPaymentIntent, + checkoutApi, + getCustomerOrders, + getAnOrder, + updateAnOrder, + getOrderItems, + anonymizeOrders, + authorizeSetup, + confirmSetup, + captureAtransaction, + refundAtransaction, + getOrderTransactions, + getAtransaction, + cancelAtransaction, +} from "../services.gen" + +type QueryKey = [ + Pick & { + _id: string + _infinite?: boolean + }, +] + +const createQueryKey = ( + id: string, + options?: TOptions, + infinite?: boolean, +): QueryKey[0] => { + const params: QueryKey[0] = { + _id: id, + baseUrl: client.getConfig().baseUrl, + } as QueryKey[0] + if (infinite) { + params._infinite = infinite + } + if (options?.body) { + params.body = options.body + } + if (options?.headers) { + params.headers = options.headers + } + if (options?.path) { + params.path = options.path + } + if (options?.query) { + params.query = options.query + } + return params +} + +export const getByContextReleaseOptions = ( + options?: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getByContextRelease({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getByContextRelease", options)], + }) +} + +export const getByContextAllHierarchiesOptions = ( + options?: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getByContextAllHierarchies({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getByContextAllHierarchies", options)], + }) +} + +export const getByContextAllHierarchiesInfiniteOptions = ( + options?: Options, +) => { + return infiniteQueryOptions< + GetByContextAllHierarchiesResponse, + GetByContextAllHierarchiesError, + InfiniteData, + QueryKey>, + | number + | Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > + >( + // @ts-ignore + { + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > = + typeof pageParam === "object" + ? pageParam + : { + query: { + "page[limit]": pageParam, + }, + } + const { data } = await getByContextAllHierarchies({ + ...options, + ...queryKey[0], + body: { + ...(queryKey[0].body as any), + ...(page.body as any), + }, + headers: { + ...queryKey[0].headers, + ...page.headers, + }, + path: { + ...queryKey[0].path, + ...page.path, + }, + query: { + ...queryKey[0].query, + ...page.query, + }, + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getByContextAllHierarchies", options, true)], + }, + ) +} + +export const getByContextHierarchyOptions = ( + options: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getByContextHierarchy({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getByContextHierarchy", options)], + }) +} + +export const getByContextHierarchyNodesOptions = ( + options: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getByContextHierarchyNodes({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getByContextHierarchyNodes", options)], + }) +} + +export const getByContextHierarchyNodesInfiniteOptions = ( + options: Options, +) => { + return infiniteQueryOptions< + GetByContextHierarchyNodesResponse, + GetByContextHierarchyNodesError, + InfiniteData, + QueryKey>, + | number + | Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > + >( + // @ts-ignore + { + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > = + typeof pageParam === "object" + ? pageParam + : { + query: { + "page[limit]": pageParam, + }, + } + const { data } = await getByContextHierarchyNodes({ + ...options, + ...queryKey[0], + body: { + ...(queryKey[0].body as any), + ...(page.body as any), + }, + headers: { + ...queryKey[0].headers, + ...page.headers, + }, + path: { + ...queryKey[0].path, + ...page.path, + }, + query: { + ...queryKey[0].query, + ...page.query, + }, + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getByContextHierarchyNodes", options, true)], + }, + ) +} + +export const getByContextHierarchyChildNodesOptions = ( + options: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getByContextHierarchyChildNodes({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getByContextHierarchyChildNodes", options)], + }) +} + +export const getByContextHierarchyChildNodesInfiniteOptions = ( + options: Options, +) => { + return infiniteQueryOptions< + GetByContextHierarchyChildNodesResponse, + GetByContextHierarchyChildNodesError, + InfiniteData, + QueryKey>, + | number + | Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > + >( + // @ts-ignore + { + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > = + typeof pageParam === "object" + ? pageParam + : { + query: { + "page[limit]": pageParam, + }, + } + const { data } = await getByContextHierarchyChildNodes({ + ...options, + ...queryKey[0], + body: { + ...(queryKey[0].body as any), + ...(page.body as any), + }, + headers: { + ...queryKey[0].headers, + ...page.headers, + }, + path: { + ...queryKey[0].path, + ...page.path, + }, + query: { + ...queryKey[0].query, + ...page.query, + }, + throwOnError: true, + }) + return data + }, + queryKey: [ + createQueryKey("getByContextHierarchyChildNodes", options, true), + ], + }, + ) +} + +export const getByContextAllNodesOptions = ( + options?: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getByContextAllNodes({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getByContextAllNodes", options)], + }) +} + +export const getByContextAllNodesInfiniteOptions = ( + options?: Options, +) => { + return infiniteQueryOptions< + GetByContextAllNodesResponse, + GetByContextAllNodesError, + InfiniteData, + QueryKey>, + | number + | Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > + >( + // @ts-ignore + { + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > = + typeof pageParam === "object" + ? pageParam + : { + query: { + "page[limit]": pageParam, + }, + } + const { data } = await getByContextAllNodes({ + ...options, + ...queryKey[0], + body: { + ...(queryKey[0].body as any), + ...(page.body as any), + }, + headers: { + ...queryKey[0].headers, + ...page.headers, + }, + path: { + ...queryKey[0].path, + ...page.path, + }, + query: { + ...queryKey[0].query, + ...page.query, + }, + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getByContextAllNodes", options, true)], + }, + ) +} + +export const getByContextNodeOptions = ( + options: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getByContextNode({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getByContextNode", options)], + }) +} + +export const getByContextChildNodesOptions = ( + options: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getByContextChildNodes({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getByContextChildNodes", options)], + }) +} + +export const getByContextChildNodesInfiniteOptions = ( + options: Options, +) => { + return infiniteQueryOptions< + GetByContextChildNodesResponse, + GetByContextChildNodesError, + InfiniteData, + QueryKey>, + | number + | Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > + >( + // @ts-ignore + { + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > = + typeof pageParam === "object" + ? pageParam + : { + query: { + "page[limit]": pageParam, + }, + } + const { data } = await getByContextChildNodes({ + ...options, + ...queryKey[0], + body: { + ...(queryKey[0].body as any), + ...(page.body as any), + }, + headers: { + ...queryKey[0].headers, + ...page.headers, + }, + path: { + ...queryKey[0].path, + ...page.path, + }, + query: { + ...queryKey[0].query, + ...page.query, + }, + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getByContextChildNodes", options, true)], + }, + ) +} + +export const getByContextAllProductsOptions = ( + options?: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getByContextAllProducts({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getByContextAllProducts", options)], + }) +} + +export const getByContextAllProductsInfiniteOptions = ( + options?: Options, +) => { + return infiniteQueryOptions< + GetByContextAllProductsResponse, + GetByContextAllProductsError, + InfiniteData, + QueryKey>, + | number + | Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > + >( + // @ts-ignore + { + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > = + typeof pageParam === "object" + ? pageParam + : { + query: { + "page[limit]": pageParam, + }, + } + const { data } = await getByContextAllProducts({ + ...options, + ...queryKey[0], + body: { + ...(queryKey[0].body as any), + ...(page.body as any), + }, + headers: { + ...queryKey[0].headers, + ...page.headers, + }, + path: { + ...queryKey[0].path, + ...page.path, + }, + query: { + ...queryKey[0].query, + ...page.query, + }, + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getByContextAllProducts", options, true)], + }, + ) +} + +export const getByContextProductOptions = ( + options: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getByContextProduct({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getByContextProduct", options)], + }) +} + +export const getByContextComponentProductIdsOptions = ( + options: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getByContextComponentProductIds({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getByContextComponentProductIds", options)], + }) +} + +export const getByContextComponentProductIdsInfiniteOptions = ( + options: Options, +) => { + return infiniteQueryOptions< + GetByContextComponentProductIdsResponse, + GetByContextComponentProductIdsError, + InfiniteData, + QueryKey>, + | number + | Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > + >( + // @ts-ignore + { + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > = + typeof pageParam === "object" + ? pageParam + : { + query: { + "page[limit]": pageParam, + }, + } + const { data } = await getByContextComponentProductIds({ + ...options, + ...queryKey[0], + body: { + ...(queryKey[0].body as any), + ...(page.body as any), + }, + headers: { + ...queryKey[0].headers, + ...page.headers, + }, + path: { + ...queryKey[0].path, + ...page.path, + }, + query: { + ...queryKey[0].query, + ...page.query, + }, + throwOnError: true, + }) + return data + }, + queryKey: [ + createQueryKey("getByContextComponentProductIds", options, true), + ], + }, + ) +} + +export const getByContextChildProductsOptions = ( + options: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getByContextChildProducts({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getByContextChildProducts", options)], + }) +} + +export const getByContextChildProductsInfiniteOptions = ( + options: Options, +) => { + return infiniteQueryOptions< + GetByContextChildProductsResponse, + GetByContextChildProductsError, + InfiniteData, + QueryKey>, + | number + | Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > + >( + // @ts-ignore + { + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > = + typeof pageParam === "object" + ? pageParam + : { + query: { + "page[limit]": pageParam, + }, + } + const { data } = await getByContextChildProducts({ + ...options, + ...queryKey[0], + body: { + ...(queryKey[0].body as any), + ...(page.body as any), + }, + headers: { + ...queryKey[0].headers, + ...page.headers, + }, + path: { + ...queryKey[0].path, + ...page.path, + }, + query: { + ...queryKey[0].query, + ...page.query, + }, + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getByContextChildProducts", options, true)], + }, + ) +} + +export const getByContextProductsForHierarchyOptions = ( + options: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getByContextProductsForHierarchy({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getByContextProductsForHierarchy", options)], + }) +} + +export const getByContextProductsForHierarchyInfiniteOptions = ( + options: Options, +) => { + return infiniteQueryOptions< + GetByContextProductsForHierarchyResponse, + GetByContextProductsForHierarchyError, + InfiniteData, + QueryKey>, + | number + | Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > + >( + // @ts-ignore + { + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > = + typeof pageParam === "object" + ? pageParam + : { + query: { + "page[limit]": pageParam, + }, + } + const { data } = await getByContextProductsForHierarchy({ + ...options, + ...queryKey[0], + body: { + ...(queryKey[0].body as any), + ...(page.body as any), + }, + headers: { + ...queryKey[0].headers, + ...page.headers, + }, + path: { + ...queryKey[0].path, + ...page.path, + }, + query: { + ...queryKey[0].query, + ...page.query, + }, + throwOnError: true, + }) + return data + }, + queryKey: [ + createQueryKey("getByContextProductsForHierarchy", options, true), + ], + }, + ) +} + +export const getByContextProductsForNodeOptions = ( + options: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getByContextProductsForNode({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getByContextProductsForNode", options)], + }) +} + +export const getByContextProductsForNodeInfiniteOptions = ( + options: Options, +) => { + return infiniteQueryOptions< + GetByContextProductsForNodeResponse, + GetByContextProductsForNodeError, + InfiniteData, + QueryKey>, + | number + | Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > + >( + // @ts-ignore + { + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > = + typeof pageParam === "object" + ? pageParam + : { + query: { + "page[limit]": pageParam, + }, + } + const { data } = await getByContextProductsForNode({ + ...options, + ...queryKey[0], + body: { + ...(queryKey[0].body as any), + ...(page.body as any), + }, + headers: { + ...queryKey[0].headers, + ...page.headers, + }, + path: { + ...queryKey[0].path, + ...page.path, + }, + query: { + ...queryKey[0].query, + ...page.query, + }, + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getByContextProductsForNode", options, true)], + }, + ) +} + +export const configureByContextProductOptions = ( + options: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await configureByContextProduct({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("configureByContextProduct", options)], + }) +} + +export const configureByContextProductMutation = () => { + const mutationOptions: UseMutationOptions< + ConfigureByContextProductResponse, + ConfigureByContextProductError, + Options + > = { + mutationFn: async (options) => { + const { data } = await configureByContextProduct({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const createCatalogOptions = (options: Options) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await createCatalog({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("createCatalog", options)], + }) +} + +export const createCatalogMutation = () => { + const mutationOptions: UseMutationOptions< + CreateCatalogResponse, + CreateCatalogError, + Options + > = { + mutationFn: async (options) => { + const { data } = await createCatalog({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const getCatalogsOptions = (options?: Options) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getCatalogs({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getCatalogs", options)], + }) +} + +export const getCatalogByIdOptions = (options: Options) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getCatalogById({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getCatalogById", options)], + }) +} + +export const updateCatalogMutation = () => { + const mutationOptions: UseMutationOptions< + UpdateCatalogResponse, + UpdateCatalogError, + Options + > = { + mutationFn: async (options) => { + const { data } = await updateCatalog({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const deleteCatalogByIdMutation = () => { + const mutationOptions: UseMutationOptions< + DeleteCatalogByIdResponse, + DeleteCatalogByIdError, + Options + > = { + mutationFn: async (options) => { + const { data } = await deleteCatalogById({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const publishReleaseOptions = (options: Options) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await publishRelease({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("publishRelease", options)], + }) +} + +export const publishReleaseMutation = () => { + const mutationOptions: UseMutationOptions< + PublishReleaseResponse, + PublishReleaseError, + Options + > = { + mutationFn: async (options) => { + const { data } = await publishRelease({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const getReleasesOptions = (options: Options) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getReleases({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getReleases", options)], + }) +} + +export const deleteReleasesMutation = () => { + const mutationOptions: UseMutationOptions< + DeleteReleasesResponse, + DeleteReleasesError, + Options + > = { + mutationFn: async (options) => { + const { data } = await deleteReleases({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const getReleaseByIdOptions = (options: Options) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getReleaseById({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getReleaseById", options)], + }) +} + +export const deleteReleaseByIdMutation = () => { + const mutationOptions: UseMutationOptions< + DeleteReleaseByIdResponse, + DeleteReleaseByIdError, + Options + > = { + mutationFn: async (options) => { + const { data } = await deleteReleaseById({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const createRuleOptions = (options: Options) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await createRule({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("createRule", options)], + }) +} + +export const createRuleMutation = () => { + const mutationOptions: UseMutationOptions< + CreateRuleResponse, + CreateRuleError, + Options + > = { + mutationFn: async (options) => { + const { data } = await createRule({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const getRulesOptions = (options?: Options) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getRules({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getRules", options)], + }) +} + +export const getRulesInfiniteOptions = (options?: Options) => { + return infiniteQueryOptions< + GetRulesResponse, + GetRulesError, + InfiniteData, + QueryKey>, + | number + | Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > + >( + // @ts-ignore + { + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > = + typeof pageParam === "object" + ? pageParam + : { + query: { + "page[limit]": pageParam, + }, + } + const { data } = await getRules({ + ...options, + ...queryKey[0], + body: { + ...(queryKey[0].body as any), + ...(page.body as any), + }, + headers: { + ...queryKey[0].headers, + ...page.headers, + }, + path: { + ...queryKey[0].path, + ...page.path, + }, + query: { + ...queryKey[0].query, + ...page.query, + }, + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getRules", options, true)], + }, + ) +} + +export const getRuleByIdOptions = (options: Options) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getRuleById({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getRuleById", options)], + }) +} + +export const updateRuleMutation = () => { + const mutationOptions: UseMutationOptions< + UpdateRuleResponse, + UpdateRuleError, + Options + > = { + mutationFn: async (options) => { + const { data } = await updateRule({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const deleteRuleByIdMutation = () => { + const mutationOptions: UseMutationOptions< + DeleteRuleByIdResponse, + DeleteRuleByIdError, + Options + > = { + mutationFn: async (options) => { + const { data } = await deleteRuleById({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const getAllHierarchiesOptions = ( + options: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getAllHierarchies({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getAllHierarchies", options)], + }) +} + +export const getAllHierarchiesInfiniteOptions = ( + options: Options, +) => { + return infiniteQueryOptions< + GetAllHierarchiesResponse, + GetAllHierarchiesError, + InfiniteData, + QueryKey>, + | number + | Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > + >( + // @ts-ignore + { + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > = + typeof pageParam === "object" + ? pageParam + : { + query: { + "page[limit]": pageParam, + }, + } + const { data } = await getAllHierarchies({ + ...options, + ...queryKey[0], + body: { + ...(queryKey[0].body as any), + ...(page.body as any), + }, + headers: { + ...queryKey[0].headers, + ...page.headers, + }, + path: { + ...queryKey[0].path, + ...page.path, + }, + query: { + ...queryKey[0].query, + ...page.query, + }, + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getAllHierarchies", options, true)], + }, + ) +} + +export const getHierarchyOptions = (options: Options) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getHierarchy({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getHierarchy", options)], + }) +} + +export const getHierarchyNodesOptions = ( + options: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getHierarchyNodes({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getHierarchyNodes", options)], + }) +} + +export const getHierarchyNodesInfiniteOptions = ( + options: Options, +) => { + return infiniteQueryOptions< + GetHierarchyNodesResponse, + GetHierarchyNodesError, + InfiniteData, + QueryKey>, + | number + | Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > + >( + // @ts-ignore + { + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > = + typeof pageParam === "object" + ? pageParam + : { + query: { + "page[limit]": pageParam, + }, + } + const { data } = await getHierarchyNodes({ + ...options, + ...queryKey[0], + body: { + ...(queryKey[0].body as any), + ...(page.body as any), + }, + headers: { + ...queryKey[0].headers, + ...page.headers, + }, + path: { + ...queryKey[0].path, + ...page.path, + }, + query: { + ...queryKey[0].query, + ...page.query, + }, + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getHierarchyNodes", options, true)], + }, + ) +} + +export const getHierarchyChildNodesOptions = ( + options: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getHierarchyChildNodes({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getHierarchyChildNodes", options)], + }) +} + +export const getHierarchyChildNodesInfiniteOptions = ( + options: Options, +) => { + return infiniteQueryOptions< + GetHierarchyChildNodesResponse, + GetHierarchyChildNodesError, + InfiniteData, + QueryKey>, + | number + | Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > + >( + // @ts-ignore + { + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > = + typeof pageParam === "object" + ? pageParam + : { + query: { + "page[limit]": pageParam, + }, + } + const { data } = await getHierarchyChildNodes({ + ...options, + ...queryKey[0], + body: { + ...(queryKey[0].body as any), + ...(page.body as any), + }, + headers: { + ...queryKey[0].headers, + ...page.headers, + }, + path: { + ...queryKey[0].path, + ...page.path, + }, + query: { + ...queryKey[0].query, + ...page.query, + }, + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getHierarchyChildNodes", options, true)], + }, + ) +} + +export const getAllNodesOptions = (options: Options) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getAllNodes({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getAllNodes", options)], + }) +} + +export const getAllNodesInfiniteOptions = ( + options: Options, +) => { + return infiniteQueryOptions< + GetAllNodesResponse, + GetAllNodesError, + InfiniteData, + QueryKey>, + | number + | Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > + >( + // @ts-ignore + { + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > = + typeof pageParam === "object" + ? pageParam + : { + query: { + "page[limit]": pageParam, + }, + } + const { data } = await getAllNodes({ + ...options, + ...queryKey[0], + body: { + ...(queryKey[0].body as any), + ...(page.body as any), + }, + headers: { + ...queryKey[0].headers, + ...page.headers, + }, + path: { + ...queryKey[0].path, + ...page.path, + }, + query: { + ...queryKey[0].query, + ...page.query, + }, + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getAllNodes", options, true)], + }, + ) +} + +export const getNodeOptions = (options: Options) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getNode({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getNode", options)], + }) +} + +export const getChildNodesOptions = (options: Options) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getChildNodes({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getChildNodes", options)], + }) +} + +export const getChildNodesInfiniteOptions = ( + options: Options, +) => { + return infiniteQueryOptions< + GetChildNodesResponse, + GetChildNodesError, + InfiniteData, + QueryKey>, + | number + | Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > + >( + // @ts-ignore + { + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > = + typeof pageParam === "object" + ? pageParam + : { + query: { + "page[limit]": pageParam, + }, + } + const { data } = await getChildNodes({ + ...options, + ...queryKey[0], + body: { + ...(queryKey[0].body as any), + ...(page.body as any), + }, + headers: { + ...queryKey[0].headers, + ...page.headers, + }, + path: { + ...queryKey[0].path, + ...page.path, + }, + query: { + ...queryKey[0].query, + ...page.query, + }, + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getChildNodes", options, true)], + }, + ) +} + +export const getAllProductsOptions = (options: Options) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getAllProducts({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getAllProducts", options)], + }) +} + +export const getAllProductsInfiniteOptions = ( + options: Options, +) => { + return infiniteQueryOptions< + GetAllProductsResponse, + GetAllProductsError, + InfiniteData, + QueryKey>, + | number + | Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > + >( + // @ts-ignore + { + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > = + typeof pageParam === "object" + ? pageParam + : { + query: { + "page[limit]": pageParam, + }, + } + const { data } = await getAllProducts({ + ...options, + ...queryKey[0], + body: { + ...(queryKey[0].body as any), + ...(page.body as any), + }, + headers: { + ...queryKey[0].headers, + ...page.headers, + }, + path: { + ...queryKey[0].path, + ...page.path, + }, + query: { + ...queryKey[0].query, + ...page.query, + }, + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getAllProducts", options, true)], + }, + ) +} + +export const getProductOptions = (options: Options) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getProduct({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getProduct", options)], + }) +} + +export const getComponentProductIdsOptions = ( + options: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getComponentProductIds({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getComponentProductIds", options)], + }) +} + +export const getComponentProductIdsInfiniteOptions = ( + options: Options, +) => { + return infiniteQueryOptions< + GetComponentProductIdsResponse, + GetComponentProductIdsError, + InfiniteData, + QueryKey>, + | number + | Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > + >( + // @ts-ignore + { + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > = + typeof pageParam === "object" + ? pageParam + : { + query: { + "page[limit]": pageParam, + }, + } + const { data } = await getComponentProductIds({ + ...options, + ...queryKey[0], + body: { + ...(queryKey[0].body as any), + ...(page.body as any), + }, + headers: { + ...queryKey[0].headers, + ...page.headers, + }, + path: { + ...queryKey[0].path, + ...page.path, + }, + query: { + ...queryKey[0].query, + ...page.query, + }, + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getComponentProductIds", options, true)], + }, + ) +} + +export const getChildProductsOptions = ( + options: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getChildProducts({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getChildProducts", options)], + }) +} + +export const getChildProductsInfiniteOptions = ( + options: Options, +) => { + return infiniteQueryOptions< + GetChildProductsResponse, + GetChildProductsError, + InfiniteData, + QueryKey>, + | number + | Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > + >( + // @ts-ignore + { + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > = + typeof pageParam === "object" + ? pageParam + : { + query: { + "page[limit]": pageParam, + }, + } + const { data } = await getChildProducts({ + ...options, + ...queryKey[0], + body: { + ...(queryKey[0].body as any), + ...(page.body as any), + }, + headers: { + ...queryKey[0].headers, + ...page.headers, + }, + path: { + ...queryKey[0].path, + ...page.path, + }, + query: { + ...queryKey[0].query, + ...page.query, + }, + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getChildProducts", options, true)], + }, + ) +} + +export const getProductsForHierarchyOptions = ( + options: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getProductsForHierarchy({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getProductsForHierarchy", options)], + }) +} + +export const getProductsForHierarchyInfiniteOptions = ( + options: Options, +) => { + return infiniteQueryOptions< + GetProductsForHierarchyResponse, + GetProductsForHierarchyError, + InfiniteData, + QueryKey>, + | number + | Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > + >( + // @ts-ignore + { + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > = + typeof pageParam === "object" + ? pageParam + : { + query: { + "page[limit]": pageParam, + }, + } + const { data } = await getProductsForHierarchy({ + ...options, + ...queryKey[0], + body: { + ...(queryKey[0].body as any), + ...(page.body as any), + }, + headers: { + ...queryKey[0].headers, + ...page.headers, + }, + path: { + ...queryKey[0].path, + ...page.path, + }, + query: { + ...queryKey[0].query, + ...page.query, + }, + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getProductsForHierarchy", options, true)], + }, + ) +} + +export const getProductsForNodeOptions = ( + options: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getProductsForNode({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getProductsForNode", options)], + }) +} + +export const getProductsForNodeInfiniteOptions = ( + options: Options, +) => { + return infiniteQueryOptions< + GetProductsForNodeResponse, + GetProductsForNodeError, + InfiniteData, + QueryKey>, + | number + | Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > + >( + // @ts-ignore + { + queryFn: async ({ pageParam, queryKey }) => { + // @ts-ignore + const page: Pick< + QueryKey>[0], + "body" | "headers" | "path" | "query" + > = + typeof pageParam === "object" + ? pageParam + : { + query: { + "page[limit]": pageParam, + }, + } + const { data } = await getProductsForNode({ + ...options, + ...queryKey[0], + body: { + ...(queryKey[0].body as any), + ...(page.body as any), + }, + headers: { + ...queryKey[0].headers, + ...page.headers, + }, + path: { + ...queryKey[0].path, + ...page.path, + }, + query: { + ...queryKey[0].query, + ...page.query, + }, + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getProductsForNode", options, true)], + }, + ) +} + +export const getCartsOptions = (options?: Options) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getCarts({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getCarts", options)], + }) +} + +export const createAcartOptions = (options?: Options) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await createAcart({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("createAcart", options)], + }) +} + +export const createAcartMutation = () => { + const mutationOptions: UseMutationOptions< + CreateAcartResponse, + CreateAcartError, + Options + > = { + mutationFn: async (options) => { + const { data } = await createAcart({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const getCartOptions = (options: Options) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getCart({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getCart", options)], + }) +} + +export const updateAcartMutation = () => { + const mutationOptions: UseMutationOptions< + UpdateAcartResponse, + UpdateAcartError, + Options + > = { + mutationFn: async (options) => { + const { data } = await updateAcart({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const deleteAcartMutation = () => { + const mutationOptions: UseMutationOptions< + DeleteAcartResponse, + DeleteAcartError, + Options + > = { + mutationFn: async (options) => { + const { data } = await deleteAcart({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const getCartItemsOptions = (options: Options) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getCartItems({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getCartItems", options)], + }) +} + +export const bulkUpdateItemsInCartMutation = () => { + const mutationOptions: UseMutationOptions< + BulkUpdateItemsInCartResponse, + BulkUpdateItemsInCartError, + Options + > = { + mutationFn: async (options) => { + const { data } = await bulkUpdateItemsInCart({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const manageCartsOptions = (options: Options) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await manageCarts({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("manageCarts", options)], + }) +} + +export const manageCartsMutation = () => { + const mutationOptions: UseMutationOptions< + ManageCartsResponse, + ManageCartsError, + Options + > = { + mutationFn: async (options) => { + const { data } = await manageCarts({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const deleteAllCartItemsMutation = () => { + const mutationOptions: UseMutationOptions< + DeleteAllCartItemsResponse, + DeleteAllCartItemsError, + Options + > = { + mutationFn: async (options) => { + const { data } = await deleteAllCartItems({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const updateAcartItemMutation = () => { + const mutationOptions: UseMutationOptions< + UpdateAcartItemResponse, + UpdateAcartItemError, + Options + > = { + mutationFn: async (options) => { + const { data } = await updateAcartItem({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const deleteAcartItemMutation = () => { + const mutationOptions: UseMutationOptions< + DeleteAcartItemResponse, + DeleteAcartItemError, + Options + > = { + mutationFn: async (options) => { + const { data } = await deleteAcartItem({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const createAccountCartAssociationOptions = ( + options: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await createAccountCartAssociation({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("createAccountCartAssociation", options)], + }) +} + +export const createAccountCartAssociationMutation = () => { + const mutationOptions: UseMutationOptions< + CreateAccountCartAssociationResponse, + CreateAccountCartAssociationError, + Options + > = { + mutationFn: async (options) => { + const { data } = await createAccountCartAssociation({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const deleteAccountCartAssociationMutation = () => { + const mutationOptions: UseMutationOptions< + DeleteAccountCartAssociationResponse, + DeleteAccountCartAssociationError, + Options + > = { + mutationFn: async (options) => { + const { data } = await deleteAccountCartAssociation({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const createCustomerCartAssociationOptions = ( + options: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await createCustomerCartAssociation({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("createCustomerCartAssociation", options)], + }) +} + +export const createCustomerCartAssociationMutation = () => { + const mutationOptions: UseMutationOptions< + CreateCustomerCartAssociationResponse, + CreateCustomerCartAssociationError, + Options + > = { + mutationFn: async (options) => { + const { data } = await createCustomerCartAssociation({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const deleteCustomerCartAssociationMutation = () => { + const mutationOptions: UseMutationOptions< + DeleteCustomerCartAssociationResponse, + DeleteCustomerCartAssociationError, + Options + > = { + mutationFn: async (options) => { + const { data } = await deleteCustomerCartAssociation({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const deleteApromotionViaPromotionCodeMutation = () => { + const mutationOptions: UseMutationOptions< + DeleteApromotionViaPromotionCodeResponse, + DeleteApromotionViaPromotionCodeError, + Options + > = { + mutationFn: async (options) => { + const { data } = await deleteApromotionViaPromotionCode({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const addTaxItemToCartOptions = ( + options: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await addTaxItemToCart({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("addTaxItemToCart", options)], + }) +} + +export const addTaxItemToCartMutation = () => { + const mutationOptions: UseMutationOptions< + AddTaxItemToCartResponse, + AddTaxItemToCartError, + Options + > = { + mutationFn: async (options) => { + const { data } = await addTaxItemToCart({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const bulkAddTaxItemsToCartOptions = ( + options: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await bulkAddTaxItemsToCart({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("bulkAddTaxItemsToCart", options)], + }) +} + +export const bulkAddTaxItemsToCartMutation = () => { + const mutationOptions: UseMutationOptions< + BulkAddTaxItemsToCartResponse, + BulkAddTaxItemsToCartError, + Options + > = { + mutationFn: async (options) => { + const { data } = await bulkAddTaxItemsToCart({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const bulkDeleteTaxItemsFromCartMutation = () => { + const mutationOptions: UseMutationOptions< + BulkDeleteTaxItemsFromCartResponse, + BulkDeleteTaxItemsFromCartError, + Options + > = { + mutationFn: async (options) => { + const { data } = await bulkDeleteTaxItemsFromCart({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const updateAtaxItemMutation = () => { + const mutationOptions: UseMutationOptions< + UpdateAtaxItemResponse, + UpdateAtaxItemError, + Options + > = { + mutationFn: async (options) => { + const { data } = await updateAtaxItem({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const deleteAtaxItemMutation = () => { + const mutationOptions: UseMutationOptions< + DeleteAtaxItemResponse, + DeleteAtaxItemError, + Options + > = { + mutationFn: async (options) => { + const { data } = await deleteAtaxItem({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const bulkAddCustomDiscountsToCartOptions = ( + options: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await bulkAddCustomDiscountsToCart({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("bulkAddCustomDiscountsToCart", options)], + }) +} + +export const bulkAddCustomDiscountsToCartMutation = () => { + const mutationOptions: UseMutationOptions< + BulkAddCustomDiscountsToCartResponse, + BulkAddCustomDiscountsToCartError, + Options + > = { + mutationFn: async (options) => { + const { data } = await bulkAddCustomDiscountsToCart({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const bulkDeleteCustomDiscountsFromCartMutation = () => { + const mutationOptions: UseMutationOptions< + BulkDeleteCustomDiscountsFromCartResponse, + BulkDeleteCustomDiscountsFromCartError, + Options + > = { + mutationFn: async (options) => { + const { data } = await bulkDeleteCustomDiscountsFromCart({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const updateCustomDiscountForCartMutation = () => { + const mutationOptions: UseMutationOptions< + UpdateCustomDiscountForCartResponse, + UpdateCustomDiscountForCartError, + Options + > = { + mutationFn: async (options) => { + const { data } = await updateCustomDiscountForCart({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const deleteCustomDiscountFromCartMutation = () => { + const mutationOptions: UseMutationOptions< + DeleteCustomDiscountFromCartResponse, + DeleteCustomDiscountFromCartError, + Options + > = { + mutationFn: async (options) => { + const { data } = await deleteCustomDiscountFromCart({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const addCustomDiscountToCartItemOptions = ( + options: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await addCustomDiscountToCartItem({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("addCustomDiscountToCartItem", options)], + }) +} + +export const addCustomDiscountToCartItemMutation = () => { + const mutationOptions: UseMutationOptions< + void, + DefaultError, + Options + > = { + mutationFn: async (options) => { + const { data } = await addCustomDiscountToCartItem({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const updateCustomDiscountForCartItemMutation = () => { + const mutationOptions: UseMutationOptions< + void, + DefaultError, + Options + > = { + mutationFn: async (options) => { + const { data } = await updateCustomDiscountForCartItem({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const deleteCustomDiscountFromCartItemMutation = () => { + const mutationOptions: UseMutationOptions< + DeleteCustomDiscountFromCartItemResponse, + DeleteCustomDiscountFromCartItemError, + Options + > = { + mutationFn: async (options) => { + const { data } = await deleteCustomDiscountFromCartItem({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const createCartPaymentIntentOptions = ( + options: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await createCartPaymentIntent({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("createCartPaymentIntent", options)], + }) +} + +export const createCartPaymentIntentMutation = () => { + const mutationOptions: UseMutationOptions< + CreateCartPaymentIntentResponse, + CreateCartPaymentIntentError, + Options + > = { + mutationFn: async (options) => { + const { data } = await createCartPaymentIntent({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const checkoutApiOptions = (options: Options) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await checkoutApi({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("checkoutApi", options)], + }) +} + +export const checkoutApiMutation = () => { + const mutationOptions: UseMutationOptions< + CheckoutApiResponse, + CheckoutApiError, + Options + > = { + mutationFn: async (options) => { + const { data } = await checkoutApi({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const getCustomerOrdersOptions = ( + options?: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getCustomerOrders({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getCustomerOrders", options)], + }) +} + +export const getAnOrderOptions = (options: Options) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getAnOrder({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getAnOrder", options)], + }) +} + +export const updateAnOrderMutation = () => { + const mutationOptions: UseMutationOptions< + UpdateAnOrderResponse, + UpdateAnOrderError, + Options + > = { + mutationFn: async (options) => { + const { data } = await updateAnOrder({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const getOrderItemsOptions = (options: Options) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getOrderItems({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getOrderItems", options)], + }) +} + +export const anonymizeOrdersOptions = ( + options?: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await anonymizeOrders({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("anonymizeOrders", options)], + }) +} + +export const anonymizeOrdersMutation = () => { + const mutationOptions: UseMutationOptions< + AnonymizeOrdersResponse, + AnonymizeOrdersError, + Options + > = { + mutationFn: async (options) => { + const { data } = await anonymizeOrders({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const authorizeSetupOptions = (options: Options) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await authorizeSetup({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("authorizeSetup", options)], + }) +} + +export const authorizeSetupMutation = () => { + const mutationOptions: UseMutationOptions< + AuthorizeSetupResponse, + AuthorizeSetupError, + Options + > = { + mutationFn: async (options) => { + const { data } = await authorizeSetup({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const confirmSetupOptions = (options: Options) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await confirmSetup({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("confirmSetup", options)], + }) +} + +export const confirmSetupMutation = () => { + const mutationOptions: UseMutationOptions< + ConfirmSetupResponse, + ConfirmSetupError, + Options + > = { + mutationFn: async (options) => { + const { data } = await confirmSetup({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const captureAtransactionOptions = ( + options: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await captureAtransaction({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("captureAtransaction", options)], + }) +} + +export const captureAtransactionMutation = () => { + const mutationOptions: UseMutationOptions< + CaptureAtransactionResponse, + CaptureAtransactionError, + Options + > = { + mutationFn: async (options) => { + const { data } = await captureAtransaction({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const refundAtransactionOptions = ( + options: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await refundAtransaction({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("refundAtransaction", options)], + }) +} + +export const refundAtransactionMutation = () => { + const mutationOptions: UseMutationOptions< + RefundAtransactionResponse, + RefundAtransactionError, + Options + > = { + mutationFn: async (options) => { + const { data } = await refundAtransaction({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const getOrderTransactionsOptions = ( + options: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getOrderTransactions({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getOrderTransactions", options)], + }) +} + +export const getAtransactionOptions = ( + options: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await getAtransaction({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("getAtransaction", options)], + }) +} + +export const cancelAtransactionOptions = ( + options: Options, +) => { + return queryOptions({ + queryFn: async ({ queryKey }) => { + const { data } = await cancelAtransaction({ + ...options, + ...queryKey[0], + throwOnError: true, + }) + return data + }, + queryKey: [createQueryKey("cancelAtransaction", options)], + }) +} + +export const cancelAtransactionMutation = () => { + const mutationOptions: UseMutationOptions< + CancelAtransactionResponse, + CancelAtransactionError, + Options + > = { + mutationFn: async (options) => { + const { data } = await cancelAtransaction({ + ...options, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} From 996b863002db1a320ce771f4504f3080dfd710d0 Mon Sep 17 00:00:00 2001 From: Robert Field Date: Mon, 26 Aug 2024 18:44:42 +0100 Subject: [PATCH 16/30] feat: support new client --- packages/shopper-common/package.json | 1 + .../src/navigation/build-navigation.ts | 108 +++++++++++++----- .../src/navigation/services/hierarchy.ts | 30 ----- pnpm-lock.yaml | 23 +++- 4 files changed, 101 insertions(+), 61 deletions(-) delete mode 100644 packages/shopper-common/src/navigation/services/hierarchy.ts diff --git a/packages/shopper-common/package.json b/packages/shopper-common/package.json index d7e6e5ef..35719e1d 100644 --- a/packages/shopper-common/package.json +++ b/packages/shopper-common/package.json @@ -38,6 +38,7 @@ }, "dependencies": { "@elasticpath/js-sdk": "5.0.0", + "@epcc-sdk/sdks-shopper": "workspace:*", "tslib": "^2.6.2" }, "publishConfig": { diff --git a/packages/shopper-common/src/navigation/build-navigation.ts b/packages/shopper-common/src/navigation/build-navigation.ts index 5e0678fb..7cfe685e 100644 --- a/packages/shopper-common/src/navigation/build-navigation.ts +++ b/packages/shopper-common/src/navigation/build-navigation.ts @@ -1,17 +1,31 @@ -import type { Hierarchy, ElasticPath } from "@elasticpath/js-sdk" -import { - getHierarchies, - getHierarchyChildren, - getHierarchyNodes, -} from "./services/hierarchy" +import type { Client, Hierarchy } from "@epcc-sdk/sdks-shopper" import { ISchema, NavigationNode } from "./navigation-types" +import { + getByContextAllHierarchies, + getByContextHierarchyChildNodes, + getByContextHierarchyNodes, +} from "@epcc-sdk/sdks-shopper" export async function buildSiteNavigation( - client: ElasticPath, + client?: Client, ): Promise { // Fetch hierarchies to be used as top level nav - const hierarchies = await getHierarchies(client) - return constructTree(hierarchies, client) + const hierarchiesResponse = await getByContextAllHierarchies({ + client, + body: undefined, + query: { + "page[limit]": 100, + "page[offset]": 0, + }, + }) + + if (!hierarchiesResponse.response.ok) { + throw new Error("Failed to fetch hierarchies") + } + + const hierarchies = hierarchiesResponse.data?.data + + return hierarchies ? constructTree(hierarchies, client) : [] } /** @@ -19,40 +33,76 @@ export async function buildSiteNavigation( */ function constructTree( hierarchies: Hierarchy[], - client: ElasticPath, + client?: Client, ): Promise { const tree = hierarchies .slice(0, 4) .map((hierarchy) => createNode({ - name: hierarchy.attributes.name, - id: hierarchy.id, - slug: hierarchy.attributes.slug, + name: hierarchy.attributes?.name!, + id: hierarchy.id!, + slug: hierarchy.attributes?.slug, }), ) .map(async (hierarchy) => { // Fetch first-level nav ('parent nodes') - the direct children of each hierarchy - const directChildren = await getHierarchyChildren(hierarchy.id, client) + const directChildrenResponse = await getByContextHierarchyChildNodes({ + client, + body: undefined, + path: { + hierarchy_id: hierarchy.id, + }, + query: { + "page[limit]": 100, + "page[offset]": 0, + }, + }) + + if (!directChildrenResponse.response.ok) { + throw new Error("Failed to fetch hierarchy children") + } + + const directChildren = directChildrenResponse.data?.data ?? [] + // Fetch all nodes in each hierarchy (i.e. all 'child nodes' belonging to a hierarchy) - const allNodes = await getHierarchyNodes(hierarchy.id, client) + const allNodesResponse = await getByContextHierarchyNodes({ + client, + body: undefined, + path: { + hierarchy_id: hierarchy.id, + }, + query: { + "page[limit]": 100, + "page[offset]": 0, + }, + }) + + if (!allNodesResponse.response.ok) { + throw new Error("Failed to fetch hierarchy nodes") + } + + const allNodes = allNodesResponse.data?.data ?? [] // Build 2nd level by finding all 'child nodes' belonging to each first level featured-nodes - const directs = directChildren.slice(0, 4).map((child) => { - const children: ISchema[] = allNodes - .filter((node) => node?.relationships?.parent.data.id === child.id) - .map((node) => - createNode({ - name: node.attributes.name, - id: node.id, - slug: node.attributes.slug, - hrefBase: `${hierarchy.href}/${child.attributes.slug}`, - }), - ) + const directs = directChildren?.slice(0, 4).map((child) => { + const children: ISchema[] = + allNodes + ?.filter( + (node) => node?.relationships?.parent?.data.id === child.id, + ) + .map((node) => + createNode({ + name: node.attributes?.name!, + id: node.id!, + slug: node.attributes?.slug, + hrefBase: `${hierarchy.href}/${child.attributes?.slug}`, + }), + ) ?? [] return createNode({ - name: child.attributes.name, - id: child.id, - slug: child.attributes.slug, + name: child.attributes?.name!, + id: child.id!, + slug: child.attributes?.slug, hrefBase: hierarchy.href, children, }) diff --git a/packages/shopper-common/src/navigation/services/hierarchy.ts b/packages/shopper-common/src/navigation/services/hierarchy.ts deleted file mode 100644 index ed346b49..00000000 --- a/packages/shopper-common/src/navigation/services/hierarchy.ts +++ /dev/null @@ -1,30 +0,0 @@ -import type { Node, Hierarchy } from "@elasticpath/js-sdk" -import { ElasticPath } from "@elasticpath/js-sdk" - -export async function getHierarchies( - client: ElasticPath, -): Promise { - const result = await client.ShopperCatalog.Hierarchies.All() - return result.data -} - -export async function getHierarchyChildren( - hierarchyId: string, - client: ElasticPath, -): Promise { - const result = await client.ShopperCatalog.Hierarchies.GetHierarchyChildren({ - hierarchyId, - }) - return result.data -} - -export async function getHierarchyNodes( - hierarchyId: string, - client: ElasticPath, -): Promise { - const result = await client.ShopperCatalog.Hierarchies.GetHierarchyNodes({ - hierarchyId, - }) - - return result.data -} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6fe8aad1..35f62616 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1258,8 +1258,8 @@ importers: packages/sdks/nextjs: dependencies: '@hey-api/client-fetch': - specifier: ^0.1.7 - version: 0.1.14 + specifier: ^0.2.4 + version: 0.2.4 devDependencies: next: specifier: ^14.0.0 @@ -1296,6 +1296,9 @@ importers: '@redocly/openapi-core': specifier: ^1.21.0 version: 1.21.0 + '@tanstack/react-query': + specifier: ^5.52.1 + version: 5.52.1(react@18.3.1) lodash: specifier: ^4.17.21 version: 4.17.21 @@ -1308,6 +1311,9 @@ importers: '@elasticpath/js-sdk': specifier: 5.0.0 version: 5.0.0(encoding@0.1.13) + '@epcc-sdk/sdks-shopper': + specifier: workspace:* + version: link:../sdks/shopper tslib: specifier: ^2.6.2 version: 2.6.2 @@ -10933,6 +10939,10 @@ packages: /@tanstack/query-core@5.51.21: resolution: {integrity: sha512-POQxm42IUp6n89kKWF4IZi18v3fxQWFRolvBA6phNVmA8psdfB1MvDnGacCJdS+EOX12w/CyHM62z//rHmYmvw==} + /@tanstack/query-core@5.52.0: + resolution: {integrity: sha512-U1DOEgltjUwalN6uWYTewSnA14b+tE7lSylOiASKCAO61ENJeCq9VVD/TXHA6O5u9+6v5+UgGYBSccTKDoyMqw==} + dev: true + /@tanstack/query-devtools@5.32.1: resolution: {integrity: sha512-7Xq57Ctopiy/4atpb0uNY5VRuCqRS/1fi/WBCKKX6jHMa6cCgDuV/AQuiwRXcKARbq2OkVAOrW2v4xK9nTbcCA==} dev: true @@ -10956,6 +10966,15 @@ packages: '@tanstack/query-core': 5.51.21 react: 18.3.1 + /@tanstack/react-query@5.52.1(react@18.3.1): + resolution: {integrity: sha512-soyn4dNIUZ8US8NaPVXv06gkZFHaZnPfKWPDjRJjFRW3Y7WZ0jx72eT6zhw3VQlkMPysmXye8l35ewPHspKgbQ==} + peerDependencies: + react: ^18 || ^19 + dependencies: + '@tanstack/query-core': 5.52.0 + react: 18.3.1 + dev: true + /@testing-library/dom@9.3.3: resolution: {integrity: sha512-fB0R+fa3AUqbLHWyxXa2kGVtf1Fe1ZZFr0Zp6AIbIAzXb2mKbEXl+PCQNUOaq5lbTab5tfctfXRNsWXxa2f7Aw==} engines: {node: '>=14'} From 7ef7094a1397cab1f8ee665fbc546fd38e4bdeec Mon Sep 17 00:00:00 2001 From: Robert Field Date: Mon, 26 Aug 2024 18:44:53 +0100 Subject: [PATCH 17/30] feat: update to latest client --- packages/sdks/nextjs/package.json | 2 +- .../interceptors/auth-cookie-interceptor.ts | 8 +- packages/sdks/shopper/openapi-ts.config.ts | 1 + packages/sdks/shopper/package.json | 9 + .../sdks/shopper/src/client/services.gen.ts | 722 ++++++---- packages/sdks/shopper/src/client/types.gen.ts | 1209 +---------------- packages/sdks/shopper/src/index.ts | 5 +- 7 files changed, 503 insertions(+), 1453 deletions(-) diff --git a/packages/sdks/nextjs/package.json b/packages/sdks/nextjs/package.json index f8f0e671..5ed4a3d0 100644 --- a/packages/sdks/nextjs/package.json +++ b/packages/sdks/nextjs/package.json @@ -29,6 +29,6 @@ "next": "^14.0.0" }, "dependencies": { - "@hey-api/client-fetch": "^0.1.7" + "@hey-api/client-fetch": "^0.2.4" } } diff --git a/packages/sdks/nextjs/src/interceptors/auth-cookie-interceptor.ts b/packages/sdks/nextjs/src/interceptors/auth-cookie-interceptor.ts index 5a4a37c5..35bb1be6 100644 --- a/packages/sdks/nextjs/src/interceptors/auth-cookie-interceptor.ts +++ b/packages/sdks/nextjs/src/interceptors/auth-cookie-interceptor.ts @@ -1,13 +1,13 @@ -import { client } from "@hey-api/client-fetch" +import type { Client } from "@hey-api/client-fetch" import { cookies } from "next/headers" import { CREDENTIALS_COOKIE_NAME } from "../constants/crendentials" export type RequestMiddleware = Parameters< - (typeof client)["interceptors"]["request"]["use"] + Client["interceptors"]["request"]["use"] >[0] export type ResponseMiddleware = Parameters< - (typeof client)["interceptors"]["response"]["use"] + Client["interceptors"]["response"]["use"] >[0] export function createAuthCookieInterceptor(creatOptions?: { @@ -53,7 +53,7 @@ export const defaultNextMiddleware: MiddlewareStack = [ }, ] -export function applyDefaultNextMiddleware(): void { +export function applyDefaultNextMiddleware(client: Client): void { for (const middlewareEntry of defaultNextMiddleware) { if (middlewareEntry.type === "request") { client.interceptors.request.use(middlewareEntry.middleware) diff --git a/packages/sdks/shopper/openapi-ts.config.ts b/packages/sdks/shopper/openapi-ts.config.ts index e9987bd7..2a9d0fad 100644 --- a/packages/sdks/shopper/openapi-ts.config.ts +++ b/packages/sdks/shopper/openapi-ts.config.ts @@ -9,4 +9,5 @@ export default defineConfig({ enums: false, dates: "types+transform", }, + plugins: ["@tanstack/react-query"], }) diff --git a/packages/sdks/shopper/package.json b/packages/sdks/shopper/package.json index 9f75a07c..4a88e218 100644 --- a/packages/sdks/shopper/package.json +++ b/packages/sdks/shopper/package.json @@ -30,6 +30,7 @@ ], "keywords": [], "devDependencies": { + "@tanstack/react-query": "^5.52.1", "@hey-api/openapi-ts": "^0.52.10", "@redocly/cli": "^1.21.0", "@redocly/openapi-core": "^1.21.0", @@ -38,5 +39,13 @@ }, "dependencies": { "@hey-api/client-fetch": "^0.2.4" + }, + "peerDependencies": { + "@tanstack/react-query": "^5.52.1" + }, + "peerDependenciesMeta": { + "@tanstack/react-query": { + "optional": true + } } } diff --git a/packages/sdks/shopper/src/client/services.gen.ts b/packages/sdks/shopper/src/client/services.gen.ts index 37a60a4e..1b5091be 100644 --- a/packages/sdks/shopper/src/client/services.gen.ts +++ b/packages/sdks/shopper/src/client/services.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import { client, type Options } from "@hey-api/client-fetch" +import { createClient, createConfig, type Options } from "@hey-api/client-fetch" import { type GetByContextReleaseData, type GetByContextReleaseError, @@ -291,16 +291,19 @@ import { GetProductsForNodeResponseTransformer, } from "./types.gen" +export const client = createClient(createConfig()) + /** * Get the catalog release as shoppers * Returns a list of all published releases of the specified catalog. */ -export const getByContextRelease = ( - options?: Options, +export const getByContextRelease = ( + options?: Options, ) => { return (options?.client ?? client).get< GetByContextReleaseResponse, - GetByContextReleaseError + GetByContextReleaseError, + ThrowOnError >({ ...options, url: "/catalog", @@ -334,12 +337,15 @@ export const getByContextRelease = ( * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. * */ -export const getByContextAllHierarchies = ( - options?: Options, +export const getByContextAllHierarchies = < + ThrowOnError extends boolean = false, +>( + options?: Options, ) => { return (options?.client ?? client).get< GetByContextAllHierarchiesResponse, - GetByContextAllHierarchiesError + GetByContextAllHierarchiesError, + ThrowOnError >({ ...options, url: "/catalog/hierarchies", @@ -354,12 +360,13 @@ export const getByContextAllHierarchies = ( * If you have multiple catalog rules defined, the rule that best matches the shoppers context is used to determine which catalog to retrieve. For information about how catalog rules are matched, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules). * */ -export const getByContextHierarchy = ( - options: Options, +export const getByContextHierarchy = ( + options: Options, ) => { return (options?.client ?? client).get< GetByContextHierarchyResponse, - GetByContextHierarchyError + GetByContextHierarchyError, + ThrowOnError >({ ...options, url: "/catalog/hierarchies/{hierarchy_id}", @@ -395,12 +402,15 @@ export const getByContextHierarchy = ( * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. * */ -export const getByContextHierarchyNodes = ( - options: Options, +export const getByContextHierarchyNodes = < + ThrowOnError extends boolean = false, +>( + options: Options, ) => { return (options?.client ?? client).get< GetByContextHierarchyNodesResponse, - GetByContextHierarchyNodesError + GetByContextHierarchyNodesError, + ThrowOnError >({ ...options, url: "/catalog/hierarchies/{hierarchy_id}/nodes", @@ -440,12 +450,15 @@ export const getByContextHierarchyNodes = ( * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. * */ -export const getByContextHierarchyChildNodes = ( - options: Options, +export const getByContextHierarchyChildNodes = < + ThrowOnError extends boolean = false, +>( + options: Options, ) => { return (options?.client ?? client).get< GetByContextHierarchyChildNodesResponse, - GetByContextHierarchyChildNodesError + GetByContextHierarchyChildNodesError, + ThrowOnError >({ ...options, url: "/catalog/hierarchies/{hierarchy_id}/children", @@ -489,12 +502,13 @@ export const getByContextHierarchyChildNodes = ( * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. * */ -export const getByContextAllNodes = ( - options?: Options, +export const getByContextAllNodes = ( + options?: Options, ) => { return (options?.client ?? client).get< GetByContextAllNodesResponse, - GetByContextAllNodesError + GetByContextAllNodesError, + ThrowOnError >({ ...options, url: "/catalog/nodes", @@ -519,10 +533,13 @@ export const getByContextAllNodes = ( * - If a curated product is removed from a node, the product is also removed from the `curated_products` list. * */ -export const getByContextNode = (options: Options) => { +export const getByContextNode = ( + options: Options, +) => { return (options?.client ?? client).get< GetByContextNodeResponse, - GetByContextNodeError + GetByContextNodeError, + ThrowOnError >({ ...options, url: "/catalog/nodes/{node_id}", @@ -567,12 +584,13 @@ export const getByContextNode = (options: Options) => { * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. * */ -export const getByContextChildNodes = ( - options: Options, +export const getByContextChildNodes = ( + options: Options, ) => { return (options?.client ?? client).get< GetByContextChildNodesResponse, - GetByContextChildNodesError + GetByContextChildNodesError, + ThrowOnError >({ ...options, url: "/catalog/nodes/{node_id}/relationships/children", @@ -625,12 +643,13 @@ export const getByContextChildNodes = ( * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. * */ -export const getByContextAllProducts = ( - options?: Options, +export const getByContextAllProducts = ( + options?: Options, ) => { return (options?.client ?? client).get< GetByContextAllProductsResponse, - GetByContextAllProductsError + GetByContextAllProductsError, + ThrowOnError >({ ...options, url: "/catalog/products", @@ -657,12 +676,13 @@ export const getByContextAllProducts = ( * See [**Including Resources**](/guides/Getting-Started/includes). * */ -export const getByContextProduct = ( - options: Options, +export const getByContextProduct = ( + options: Options, ) => { return (options?.client ?? client).get< GetByContextProductResponse, - GetByContextProductError + GetByContextProductError, + ThrowOnError >({ ...options, url: "/catalog/products/{product_id}", @@ -679,12 +699,15 @@ export const getByContextProduct = ( * This endpoint returns a list of component product IDs for the specified bundle. * */ -export const getByContextComponentProductIds = ( - options: Options, +export const getByContextComponentProductIds = < + ThrowOnError extends boolean = false, +>( + options: Options, ) => { return (options?.client ?? client).get< GetByContextComponentProductIdsResponse, - GetByContextComponentProductIdsError + GetByContextComponentProductIdsError, + ThrowOnError >({ ...options, url: "/catalog/products/{product_id}/relationships/component_products", @@ -731,12 +754,13 @@ export const getByContextComponentProductIds = ( * See [**Including Resources**](/guides/Getting-Started/includes). * */ -export const getByContextChildProducts = ( - options: Options, +export const getByContextChildProducts = ( + options: Options, ) => { return (options?.client ?? client).get< GetByContextChildProductsResponse, - GetByContextChildProductsError + GetByContextChildProductsError, + ThrowOnError >({ ...options, url: "/catalog/products/{product_id}/relationships/children", @@ -785,12 +809,15 @@ export const getByContextChildProducts = ( * See [**Including Resources**](/guides/Getting-Started/includes). * */ -export const getByContextProductsForHierarchy = ( - options: Options, +export const getByContextProductsForHierarchy = < + ThrowOnError extends boolean = false, +>( + options: Options, ) => { return (options?.client ?? client).get< GetByContextProductsForHierarchyResponse, - GetByContextProductsForHierarchyError + GetByContextProductsForHierarchyError, + ThrowOnError >({ ...options, url: "/catalog/hierarchies/{hierarchy_id}/products", @@ -838,12 +865,15 @@ export const getByContextProductsForHierarchy = ( * See [**Including Resources**](/guides/Getting-Started/includes). * */ -export const getByContextProductsForNode = ( - options: Options, +export const getByContextProductsForNode = < + ThrowOnError extends boolean = false, +>( + options: Options, ) => { return (options?.client ?? client).get< GetByContextProductsForNodeResponse, - GetByContextProductsForNodeError + GetByContextProductsForNodeError, + ThrowOnError >({ ...options, url: "/catalog/nodes/{node_id}/relationships/products", @@ -875,12 +905,13 @@ export const getByContextProductsForNode = ( * See [**Including Resources**](/guides/Getting-Started/includes). * */ -export const configureByContextProduct = ( - options: Options, +export const configureByContextProduct = ( + options: Options, ) => { return (options?.client ?? client).post< ConfigureByContextProductResponse, - ConfigureByContextProductError + ConfigureByContextProductError, + ThrowOnError >({ ...options, url: "/catalog/products/{product_id}/configure", @@ -897,10 +928,13 @@ export const configureByContextProduct = ( * - Price Books - prices for the products associated with the hierarchies. You can create multiple price books for different scenarios, such as seasonal sales, business versus retail customer pricing, and reward programs. When creating a catalog, you can specify up to five price books. You must configure a priority for your price books. Product prices are displayed in the catalog according to the priority of the price books. Priority is a number and the price book with the highest number has the highest priority. * */ -export const createCatalog = (options: Options) => { +export const createCatalog = ( + options: Options, +) => { return (options?.client ?? client).post< CreateCatalogResponse, - CreateCatalogError + CreateCatalogError, + ThrowOnError >({ ...options, url: "/catalogs", @@ -917,24 +951,31 @@ export const createCatalog = (options: Options) => { * If the `is_full_publish` attribute returned in the response is `false`, data from the previous catalog release overlaid the existing data in the delta file. The `is_full_publish` attribute is always `true` the first time a catalog is published. * */ -export const getCatalogs = (options?: Options) => { - return (options?.client ?? client).get( - { - ...options, - url: "/catalogs", - responseTransformer: GetCatalogsResponseTransformer, - }, - ) +export const getCatalogs = ( + options?: Options, +) => { + return (options?.client ?? client).get< + GetCatalogsResponse, + GetCatalogsError, + ThrowOnError + >({ + ...options, + url: "/catalogs", + responseTransformer: GetCatalogsResponseTransformer, + }) } /** * Get a catalog by ID * Retrieves the specified catalog. */ -export const getCatalogById = (options: Options) => { +export const getCatalogById = ( + options: Options, +) => { return (options?.client ?? client).get< GetCatalogByIdResponse, - GetCatalogByIdError + GetCatalogByIdError, + ThrowOnError >({ ...options, url: "/catalogs/{catalog_id}", @@ -946,10 +987,13 @@ export const getCatalogById = (options: Options) => { * Updates a catalog * Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the catalog is not updated. */ -export const updateCatalog = (options: Options) => { +export const updateCatalog = ( + options: Options, +) => { return (options?.client ?? client).put< UpdateCatalogResponse, - UpdateCatalogError + UpdateCatalogError, + ThrowOnError >({ ...options, url: "/catalogs/{catalog_id}", @@ -961,10 +1005,13 @@ export const updateCatalog = (options: Options) => { * Deletes a catalog * Deletes an unpublished catalog. Use [**Delete a Release**](/docs/api/pxm/catalog/delete-release-by-id) and [**Delete All Releases**](/docs/api/pxm/catalog/delete-releases) to delete releases of a catalog. If the catalog is associated with any catalog rules, you must first update the catalog rules to remove the catalog. */ -export const deleteCatalogById = (options: Options) => { +export const deleteCatalogById = ( + options: Options, +) => { return (options?.client ?? client).delete< DeleteCatalogByIdResponse, - DeleteCatalogByIdError + DeleteCatalogByIdError, + ThrowOnError >({ ...options, url: "/catalogs/{catalog_id}", @@ -1019,10 +1066,13 @@ export const deleteCatalogById = (options: Options) => { * 4. Select the **Include Organization Resources in Catalog Publishes** checkbox. * */ -export const publishRelease = (options: Options) => { +export const publishRelease = ( + options: Options, +) => { return (options?.client ?? client).post< PublishReleaseResponse, - PublishReleaseError + PublishReleaseError, + ThrowOnError >({ ...options, url: "/catalogs/{catalog_id}/releases", @@ -1039,24 +1089,31 @@ export const publishRelease = (options: Options) => { * If the `is_full_publish` attribute returned in the response is `false`, data from the previous catalog release overlaid the existing data in the delta file. The `is_full_publish` attribute is always `true` the first time a catalog is published. * */ -export const getReleases = (options: Options) => { - return (options?.client ?? client).get( - { - ...options, - url: "/catalogs/{catalog_id}/releases", - responseTransformer: GetReleasesResponseTransformer, - }, - ) +export const getReleases = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetReleasesResponse, + GetReleasesError, + ThrowOnError + >({ + ...options, + url: "/catalogs/{catalog_id}/releases", + responseTransformer: GetReleasesResponseTransformer, + }) } /** * Deletes all releases * Deletes all releases of the specified published catalog. */ -export const deleteReleases = (options: Options) => { +export const deleteReleases = ( + options: Options, +) => { return (options?.client ?? client).delete< DeleteReleasesResponse, - DeleteReleasesError + DeleteReleasesError, + ThrowOnError >({ ...options, url: "/catalogs/{catalog_id}/releases", @@ -1067,10 +1124,13 @@ export const deleteReleases = (options: Options) => { * Get a catalog release by ID * Retrieves the specified catalog release. */ -export const getReleaseById = (options: Options) => { +export const getReleaseById = ( + options: Options, +) => { return (options?.client ?? client).get< GetReleaseByIdResponse, - GetReleaseByIdError + GetReleaseByIdError, + ThrowOnError >({ ...options, url: "/catalogs/{catalog_id}/releases/{release_id}", @@ -1082,10 +1142,13 @@ export const getReleaseById = (options: Options) => { * Deletes a release * Deletes the specified published catalog release. */ -export const deleteReleaseById = (options: Options) => { +export const deleteReleaseById = ( + options: Options, +) => { return (options?.client ?? client).delete< DeleteReleaseByIdResponse, - DeleteReleaseByIdError + DeleteReleaseByIdError, + ThrowOnError >({ ...options, url: "/catalogs/{catalog_id}/releases/{release_id}", @@ -1107,8 +1170,14 @@ export const deleteReleaseById = (options: Options) => { * For ideas about the kinds of business scenarios you can achieve with catalog rules, see [Catalog Rules](/docs/api/pxm/catalog/rules). To understand how catalogs are matched to shoppers by using rules, see [Resolving Catalog Rules](/docs/api/pxm/catalog/rules#resolving-catalog-rules). * */ -export const createRule = (options: Options) => { - return (options?.client ?? client).post({ +export const createRule = ( + options: Options, +) => { + return (options?.client ?? client).post< + CreateRuleResponse, + CreateRuleError, + ThrowOnError + >({ ...options, url: "/catalogs/rules", responseTransformer: CreateRuleResponseTransformer, @@ -1128,8 +1197,14 @@ export const createRule = (options: Options) => { * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | * */ -export const getRules = (options?: Options) => { - return (options?.client ?? client).get({ +export const getRules = ( + options?: Options, +) => { + return (options?.client ?? client).get< + GetRulesResponse, + GetRulesError, + ThrowOnError + >({ ...options, url: "/catalogs/rules", responseTransformer: GetRulesResponseTransformer, @@ -1139,22 +1214,32 @@ export const getRules = (options?: Options) => { /** * Get a catalog rule by ID */ -export const getRuleById = (options: Options) => { - return (options?.client ?? client).get( - { - ...options, - url: "/catalogs/rules/{catalog_rule_id}", - responseTransformer: GetRuleByIdResponseTransformer, - }, - ) +export const getRuleById = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetRuleByIdResponse, + GetRuleByIdError, + ThrowOnError + >({ + ...options, + url: "/catalogs/rules/{catalog_rule_id}", + responseTransformer: GetRuleByIdResponseTransformer, + }) } /** * Updates a catalog rule * Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the catalog rule is not updated. */ -export const updateRule = (options: Options) => { - return (options?.client ?? client).put({ +export const updateRule = ( + options: Options, +) => { + return (options?.client ?? client).put< + UpdateRuleResponse, + UpdateRuleError, + ThrowOnError + >({ ...options, url: "/catalogs/rules/{catalog_rule_id}", responseTransformer: UpdateRuleResponseTransformer, @@ -1164,10 +1249,13 @@ export const updateRule = (options: Options) => { /** * Deletes a catalog rule */ -export const deleteRuleById = (options: Options) => { +export const deleteRuleById = ( + options: Options, +) => { return (options?.client ?? client).delete< DeleteRuleByIdResponse, - DeleteRuleByIdError + DeleteRuleByIdError, + ThrowOnError >({ ...options, url: "/catalogs/rules/{catalog_rule_id}", @@ -1204,10 +1292,13 @@ export const deleteRuleById = (options: Options) => { * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. * */ -export const getAllHierarchies = (options: Options) => { +export const getAllHierarchies = ( + options: Options, +) => { return (options?.client ?? client).get< GetAllHierarchiesResponse, - GetAllHierarchiesError + GetAllHierarchiesError, + ThrowOnError >({ ...options, url: "/catalogs/{catalog_id}/releases/{release_id}/hierarchies", @@ -1226,10 +1317,13 @@ export const getAllHierarchies = (options: Options) => { * ::: * */ -export const getHierarchy = (options: Options) => { +export const getHierarchy = ( + options: Options, +) => { return (options?.client ?? client).get< GetHierarchyResponse, - GetHierarchyError + GetHierarchyError, + ThrowOnError >({ ...options, url: "/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}", @@ -1269,10 +1363,13 @@ export const getHierarchy = (options: Options) => { * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. * */ -export const getHierarchyNodes = (options: Options) => { +export const getHierarchyNodes = ( + options: Options, +) => { return (options?.client ?? client).get< GetHierarchyNodesResponse, - GetHierarchyNodesError + GetHierarchyNodesError, + ThrowOnError >({ ...options, url: "/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/nodes", @@ -1314,12 +1411,13 @@ export const getHierarchyNodes = (options: Options) => { * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. * */ -export const getHierarchyChildNodes = ( - options: Options, +export const getHierarchyChildNodes = ( + options: Options, ) => { return (options?.client ?? client).get< GetHierarchyChildNodesResponse, - GetHierarchyChildNodesError + GetHierarchyChildNodesError, + ThrowOnError >({ ...options, url: "/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/children", @@ -1370,14 +1468,18 @@ export const getHierarchyChildNodes = ( * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. * */ -export const getAllNodes = (options: Options) => { - return (options?.client ?? client).get( - { - ...options, - url: "/catalogs/{catalog_id}/releases/{release_id}/nodes", - responseTransformer: GetAllNodesResponseTransformer, - }, - ) +export const getAllNodes = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetAllNodesResponse, + GetAllNodesError, + ThrowOnError + >({ + ...options, + url: "/catalogs/{catalog_id}/releases/{release_id}/nodes", + responseTransformer: GetAllNodesResponseTransformer, + }) } /** @@ -1401,8 +1503,14 @@ export const getAllNodes = (options: Options) => { * - A product that is curated has the `"curated_product": true` attribute displayed. * */ -export const getNode = (options: Options) => { - return (options?.client ?? client).get({ +export const getNode = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetNodeResponse, + GetNodeError, + ThrowOnError + >({ ...options, url: "/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}", responseTransformer: GetNodeResponseTransformer, @@ -1452,10 +1560,13 @@ export const getNode = (options: Options) => { * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. * */ -export const getChildNodes = (options: Options) => { +export const getChildNodes = ( + options: Options, +) => { return (options?.client ?? client).get< GetChildNodesResponse, - GetChildNodesError + GetChildNodesError, + ThrowOnError >({ ...options, url: "/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/children", @@ -1503,10 +1614,13 @@ export const getChildNodes = (options: Options) => { * - It does not matter what order you specify the node Ids. The nodes are returned in the order they were last updated. * */ -export const getAllProducts = (options: Options) => { +export const getAllProducts = ( + options: Options, +) => { return (options?.client ?? client).get< GetAllProductsResponse, - GetAllProductsError + GetAllProductsError, + ThrowOnError >({ ...options, url: "/catalogs/{catalog_id}/releases/{release_id}/products", @@ -1539,8 +1653,14 @@ export const getAllProducts = (options: Options) => { * See [**Including Resources**](/guides/Getting-Started/includes). * */ -export const getProduct = (options: Options) => { - return (options?.client ?? client).get({ +export const getProduct = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetProductResponse, + GetProductError, + ThrowOnError + >({ ...options, url: "/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}", responseTransformer: GetProductResponseTransformer, @@ -1568,12 +1688,13 @@ export const getProduct = (options: Options) => { * See [**Including Resources**](/guides/Getting-Started/includes). * */ -export const getComponentProductIds = ( - options: Options, +export const getComponentProductIds = ( + options: Options, ) => { return (options?.client ?? client).get< GetComponentProductIdsResponse, - GetComponentProductIdsError + GetComponentProductIdsError, + ThrowOnError >({ ...options, url: "/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/component_products", @@ -1620,10 +1741,13 @@ export const getComponentProductIds = ( * See [**Including Resources**](/guides/Getting-Started/includes). * */ -export const getChildProducts = (options: Options) => { +export const getChildProducts = ( + options: Options, +) => { return (options?.client ?? client).get< GetChildProductsResponse, - GetChildProductsError + GetChildProductsError, + ThrowOnError >({ ...options, url: "/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/children", @@ -1673,12 +1797,13 @@ export const getChildProducts = (options: Options) => { * See [**Including Resources**](/guides/Getting-Started/includes). * */ -export const getProductsForHierarchy = ( - options: Options, +export const getProductsForHierarchy = ( + options: Options, ) => { return (options?.client ?? client).get< GetProductsForHierarchyResponse, - GetProductsForHierarchyError + GetProductsForHierarchyError, + ThrowOnError >({ ...options, url: "/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/products", @@ -1734,12 +1859,13 @@ export const getProductsForHierarchy = ( * See [**Including Resources**](/guides/Getting-Started/includes). * */ -export const getProductsForNode = ( - options: Options, +export const getProductsForNode = ( + options: Options, ) => { return (options?.client ?? client).get< GetProductsForNodeResponse, - GetProductsForNodeError + GetProductsForNodeError, + ThrowOnError >({ ...options, url: "/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/products", @@ -1760,8 +1886,14 @@ export const getProductsForNode = ( * ::: * */ -export const getCarts = (options?: Options) => { - return (options?.client ?? client).get({ +export const getCarts = ( + options?: Options, +) => { + return (options?.client ?? client).get< + GetCartsResponse, + GetCartsError, + ThrowOnError + >({ ...options, url: "/v2/carts", }) @@ -1799,10 +1931,13 @@ export const getCarts = (options?: Options) => { * - In the case of preview carts (those with `snapshot_date`), an error is returned for invalid actions, such as removing the preview date, setting a preview date in the past, or attempting to checkout a cart with a `snapshot_date`. * */ -export const createAcart = (options?: Options) => { +export const createAcart = ( + options?: Options, +) => { return (options?.client ?? client).post< CreateAcartResponse, - CreateAcartError + CreateAcartError, + ThrowOnError >({ ...options, url: "/v2/carts", @@ -1836,8 +1971,14 @@ export const createAcart = (options?: Options) => { * | `include` | Optional | `string` | Comma-delimited string of entities that can be included. The information included are `items`,`tax_items`, `custom_discounts`, or `promotions`. | * */ -export const getCart = (options: Options) => { - return (options?.client ?? client).get({ +export const getCart = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetCartResponse, + GetCartError, + ThrowOnError + >({ ...options, url: "/v2/carts/{cartID}", }) @@ -1850,13 +1991,17 @@ export const getCart = (options: Options) => { * You can also update a cart to specify custom discounts. You can enable custom discounts when the `discount_settings.custom_discounts_enabled` field is set to `true`. Default is set from cart discount settings for the store. See [Cart Settings](/docs/api/settings/put-v-2-settings-cart). * */ -export const updateAcart = (options: Options) => { - return (options?.client ?? client).put( - { - ...options, - url: "/v2/carts/{cartID}", - }, - ) +export const updateAcart = ( + options: Options, +) => { + return (options?.client ?? client).put< + UpdateAcartResponse, + UpdateAcartError, + ThrowOnError + >({ + ...options, + url: "/v2/carts/{cartID}", + }) } /** @@ -1880,10 +2025,13 @@ export const updateAcart = (options: Options) => { * ```` * */ -export const deleteAcart = (options: Options) => { +export const deleteAcart = ( + options: Options, +) => { return (options?.client ?? client).delete< DeleteAcartResponse, - DeleteAcartError + DeleteAcartError, + ThrowOnError >({ ...options, url: "/v2/carts/{cartID}", @@ -2073,10 +2221,13 @@ export const deleteAcart = (options: Options) => { * ``` * */ -export const getCartItems = (options: Options) => { +export const getCartItems = ( + options: Options, +) => { return (options?.client ?? client).get< GetCartItemsResponse, - GetCartItemsError + GetCartItemsError, + ThrowOnError >({ ...options, url: "/v2/carts/{cartID}/items", @@ -2090,12 +2241,13 @@ export const getCartItems = (options: Options) => { * When you update multiple items that qualify for free gifts in the cart, the corresponding free gifts for all eligible products are also automatically updated in the cart. * */ -export const bulkUpdateItemsInCart = ( - options: Options, +export const bulkUpdateItemsInCart = ( + options: Options, ) => { return (options?.client ?? client).put< BulkUpdateItemsInCartResponse, - BulkUpdateItemsInCartError + BulkUpdateItemsInCartError, + ThrowOnError >({ ...options, url: "/v2/carts/{cartID}/items", @@ -2357,10 +2509,13 @@ export const bulkUpdateItemsInCart = ( * ``` * */ -export const manageCarts = (options: Options) => { +export const manageCarts = ( + options: Options, +) => { return (options?.client ?? client).post< ManageCartsResponse, - ManageCartsError + ManageCartsError, + ThrowOnError >({ ...options, url: "/v2/carts/{cartID}/items", @@ -2372,12 +2527,13 @@ export const manageCarts = (options: Options) => { * A shopper can clean up their cart, deleting custom items, promotions, and so on, while the empty cart remains available. The cart id, name, description, and any account or customer associations persist. The shopper can continue to add items to the cart. * */ -export const deleteAllCartItems = ( - options: Options, +export const deleteAllCartItems = ( + options: Options, ) => { return (options?.client ?? client).delete< DeleteAllCartItemsResponse, - DeleteAllCartItemsError + DeleteAllCartItemsError, + ThrowOnError >({ ...options, url: "/v2/carts/{cartID}/items", @@ -2388,10 +2544,13 @@ export const deleteAllCartItems = ( * Update a Cart Item * You can easily update a cart item. A successful update returns the cart items. */ -export const updateAcartItem = (options: Options) => { +export const updateAcartItem = ( + options: Options, +) => { return (options?.client ?? client).put< UpdateAcartItemResponse, - UpdateAcartItemError + UpdateAcartItemError, + ThrowOnError >({ ...options, url: "/v2/carts/{cartID}/items/{cartitemID}", @@ -2402,10 +2561,13 @@ export const updateAcartItem = (options: Options) => { * Delete a Cart Item * Use this endpoint to delete a cart item. */ -export const deleteAcartItem = (options: Options) => { +export const deleteAcartItem = ( + options: Options, +) => { return (options?.client ?? client).delete< DeleteAcartItemResponse, - DeleteAcartItemError + DeleteAcartItemError, + ThrowOnError >({ ...options, url: "/v2/carts/{cartID}/items/{cartitemID}", @@ -2416,12 +2578,15 @@ export const deleteAcartItem = (options: Options) => { * Create an Account Cart Association * You can create associations between an account and one or more carts. After cart associations exist for an account, the account can access those carts across any device. */ -export const createAccountCartAssociation = ( - options: Options, +export const createAccountCartAssociation = < + ThrowOnError extends boolean = false, +>( + options: Options, ) => { return (options?.client ?? client).post< CreateAccountCartAssociationResponse, - CreateAccountCartAssociationError + CreateAccountCartAssociationError, + ThrowOnError >({ ...options, url: "/v2/carts/{cartID}/relationships/accounts", @@ -2432,12 +2597,15 @@ export const createAccountCartAssociation = ( * Delete Account Cart Association * You can delete an association between an account and a cart. */ -export const deleteAccountCartAssociation = ( - options: Options, +export const deleteAccountCartAssociation = < + ThrowOnError extends boolean = false, +>( + options: Options, ) => { return (options?.client ?? client).delete< DeleteAccountCartAssociationResponse, - DeleteAccountCartAssociationError + DeleteAccountCartAssociationError, + ThrowOnError >({ ...options, url: "/v2/carts/{cartID}/relationships/accounts", @@ -2448,12 +2616,15 @@ export const deleteAccountCartAssociation = ( * Create a Customer Cart Association * You can create associations between a customer and one or more carts. After cart associations exist for a customer, the customer can access those carts across any device. */ -export const createCustomerCartAssociation = ( - options: Options, +export const createCustomerCartAssociation = < + ThrowOnError extends boolean = false, +>( + options: Options, ) => { return (options?.client ?? client).post< CreateCustomerCartAssociationResponse, - CreateCustomerCartAssociationError + CreateCustomerCartAssociationError, + ThrowOnError >({ ...options, url: "/v2/carts/{cartID}/relationships/customers", @@ -2464,12 +2635,15 @@ export const createCustomerCartAssociation = ( * Delete Customer Cart Association * You can delete an association between a customer and a cart. */ -export const deleteCustomerCartAssociation = ( - options: Options, +export const deleteCustomerCartAssociation = < + ThrowOnError extends boolean = false, +>( + options: Options, ) => { return (options?.client ?? client).delete< DeleteCustomerCartAssociationResponse, - DeleteCustomerCartAssociationError + DeleteCustomerCartAssociationError, + ThrowOnError >({ ...options, url: "/v2/carts/{cartID}/relationships/customers", @@ -2480,12 +2654,15 @@ export const deleteCustomerCartAssociation = ( * Delete a Promotion via Promotion Code * You can remove promotion code from a cart if it was applied manually. This endpoint does not work if the promotion is applied automatically. */ -export const deleteApromotionViaPromotionCode = ( - options: Options, +export const deleteApromotionViaPromotionCode = < + ThrowOnError extends boolean = false, +>( + options: Options, ) => { return (options?.client ?? client).delete< DeleteApromotionViaPromotionCodeResponse, - DeleteApromotionViaPromotionCodeError + DeleteApromotionViaPromotionCodeError, + ThrowOnError >({ ...options, url: "/v2/carts/{cartID}/discounts/{promoCode}", @@ -2504,10 +2681,13 @@ export const deleteApromotionViaPromotionCode = ( * ::: * */ -export const addTaxItemToCart = (options: Options) => { +export const addTaxItemToCart = ( + options: Options, +) => { return (options?.client ?? client).post< AddTaxItemToCartResponse, - AddTaxItemToCartError + AddTaxItemToCartError, + ThrowOnError >({ ...options, url: "/v2/carts/{cartID}/items/{cartitemID}/taxes", @@ -2579,12 +2759,13 @@ export const addTaxItemToCart = (options: Options) => { * ``` * */ -export const bulkAddTaxItemsToCart = ( - options: Options, +export const bulkAddTaxItemsToCart = ( + options: Options, ) => { return (options?.client ?? client).post< BulkAddTaxItemsToCartResponse, - BulkAddTaxItemsToCartError + BulkAddTaxItemsToCartError, + ThrowOnError >({ ...options, url: "/v2/carts/{cartID}/taxes", @@ -2595,12 +2776,15 @@ export const bulkAddTaxItemsToCart = ( * Bulk Delete Tax Items from Cart * Use this endpoint to bulk delete tax items from cart. */ -export const bulkDeleteTaxItemsFromCart = ( - options: Options, +export const bulkDeleteTaxItemsFromCart = < + ThrowOnError extends boolean = false, +>( + options: Options, ) => { return (options?.client ?? client).delete< BulkDeleteTaxItemsFromCartResponse, - BulkDeleteTaxItemsFromCartError + BulkDeleteTaxItemsFromCartError, + ThrowOnError >({ ...options, url: "/v2/carts/{cartID}/taxes", @@ -2611,10 +2795,13 @@ export const bulkDeleteTaxItemsFromCart = ( * Update a TaxItem * Use this endpoint to update a tax item. */ -export const updateAtaxItem = (options: Options) => { +export const updateAtaxItem = ( + options: Options, +) => { return (options?.client ?? client).put< UpdateAtaxItemResponse, - UpdateAtaxItemError + UpdateAtaxItemError, + ThrowOnError >({ ...options, url: "/v2/carts/{cartID}/items/{cartitemID}/taxes/{taxitemID}", @@ -2625,10 +2812,13 @@ export const updateAtaxItem = (options: Options) => { * Delete a Tax Item * Use this endpoint to delete a tax item. */ -export const deleteAtaxItem = (options: Options) => { +export const deleteAtaxItem = ( + options: Options, +) => { return (options?.client ?? client).delete< DeleteAtaxItemResponse, - DeleteAtaxItemError + DeleteAtaxItemError, + ThrowOnError >({ ...options, url: "/v2/carts/{cartID}/items/{cartitemID}/taxes/{taxitemID}", @@ -2642,12 +2832,15 @@ export const deleteAtaxItem = (options: Options) => { * To increase the custom discount value, contact [Elastic Path Support team](https://support.elasticpath.com/hc/en-us). * */ -export const bulkAddCustomDiscountsToCart = ( - options: Options, +export const bulkAddCustomDiscountsToCart = < + ThrowOnError extends boolean = false, +>( + options: Options, ) => { return (options?.client ?? client).post< BulkAddCustomDiscountsToCartResponse, - BulkAddCustomDiscountsToCartError + BulkAddCustomDiscountsToCartError, + ThrowOnError >({ ...options, url: "/v2/carts/{cartID}/custom-discounts", @@ -2658,12 +2851,15 @@ export const bulkAddCustomDiscountsToCart = ( * Bulk Delete Custom Discounts From Cart * Use this endpoint to bulk delete custom discounts from cart. */ -export const bulkDeleteCustomDiscountsFromCart = ( - options: Options, +export const bulkDeleteCustomDiscountsFromCart = < + ThrowOnError extends boolean = false, +>( + options: Options, ) => { return (options?.client ?? client).delete< BulkDeleteCustomDiscountsFromCartResponse, - BulkDeleteCustomDiscountsFromCartError + BulkDeleteCustomDiscountsFromCartError, + ThrowOnError >({ ...options, url: "/v2/carts/{cartID}/custom-discounts", @@ -2674,12 +2870,15 @@ export const bulkDeleteCustomDiscountsFromCart = ( * Update Custom Discount For Cart * Use this endpoint to update a custom discount in your cart. */ -export const updateCustomDiscountForCart = ( - options: Options, +export const updateCustomDiscountForCart = < + ThrowOnError extends boolean = false, +>( + options: Options, ) => { return (options?.client ?? client).put< UpdateCustomDiscountForCartResponse, - UpdateCustomDiscountForCartError + UpdateCustomDiscountForCartError, + ThrowOnError >({ ...options, url: "/v2/carts/{cartID}/custom-discounts/{customdiscountID}", @@ -2690,12 +2889,15 @@ export const updateCustomDiscountForCart = ( * Delete Custom Discount From Cart * Use this endpoint to delete custom discount from cart. */ -export const deleteCustomDiscountFromCart = ( - options: Options, +export const deleteCustomDiscountFromCart = < + ThrowOnError extends boolean = false, +>( + options: Options, ) => { return (options?.client ?? client).delete< DeleteCustomDiscountFromCartResponse, - DeleteCustomDiscountFromCartError + DeleteCustomDiscountFromCartError, + ThrowOnError >({ ...options, url: "/v2/carts/{cartID}/custom-discounts/{customdiscountID}", @@ -2706,10 +2908,12 @@ export const deleteCustomDiscountFromCart = ( * Add Custom Discount To Cart Item * Use this endpoint to add a custom discount to cart item. */ -export const addCustomDiscountToCartItem = ( - options: Options, +export const addCustomDiscountToCartItem = < + ThrowOnError extends boolean = false, +>( + options: Options, ) => { - return (options?.client ?? client).post({ + return (options?.client ?? client).post({ ...options, url: "/v2/carts/{cartID}/items/{cartitemID}/custom-discounts", }) @@ -2719,10 +2923,12 @@ export const addCustomDiscountToCartItem = ( * Update Custom Discount For Cart Item * Use this endpoint to update a custom discount in your cart item. */ -export const updateCustomDiscountForCartItem = ( - options: Options, +export const updateCustomDiscountForCartItem = < + ThrowOnError extends boolean = false, +>( + options: Options, ) => { - return (options?.client ?? client).put({ + return (options?.client ?? client).put({ ...options, url: "/v2/carts/{cartID}/items/{cartitemID}/custom-discounts/{customdiscountID}", }) @@ -2732,12 +2938,15 @@ export const updateCustomDiscountForCartItem = ( * Delete Custom Discount From Cart Item * Use this endpoint to delete custom discount from cart item. */ -export const deleteCustomDiscountFromCartItem = ( - options: Options, +export const deleteCustomDiscountFromCartItem = < + ThrowOnError extends boolean = false, +>( + options: Options, ) => { return (options?.client ?? client).delete< DeleteCustomDiscountFromCartItemResponse, - DeleteCustomDiscountFromCartItemError + DeleteCustomDiscountFromCartItemError, + ThrowOnError >({ ...options, url: "/v2/carts/{cartID}/items/{cartitemID}/custom-discounts/{customdiscountID}", @@ -2772,12 +2981,13 @@ export const deleteCustomDiscountFromCartItem = ( * - To pay the entire amount at once, use the [Update Cart Payment Intent](/docs/carts-orders/update-cart-payment-intent) endpoint to update the Stripe Payment Intent with the final cart details when preparing to take the payment. Doing so, ensures that the Payment Intent accurately reflects the current cart details when processing payments on the front end. We do not recommend calling the [Update Cart Payment Intent](/docs/carts-orders/update-cart-payment-intent) for each individual change in the cart, as this can lead to more requests and may slow down the front-end performance. * */ -export const createCartPaymentIntent = ( - options: Options, +export const createCartPaymentIntent = ( + options: Options, ) => { return (options?.client ?? client).post< CreateCartPaymentIntentResponse, - CreateCartPaymentIntentError + CreateCartPaymentIntentError, + ThrowOnError >({ ...options, url: "/v2/carts/{cartID}/payments", @@ -2838,10 +3048,13 @@ export const createCartPaymentIntent = ( * ``` * */ -export const checkoutApi = (options: Options) => { +export const checkoutApi = ( + options: Options, +) => { return (options?.client ?? client).post< CheckoutApiResponse, - CheckoutApiError + CheckoutApiError, + ThrowOnError >({ ...options, url: "/v2/carts/{cartID}/checkout", @@ -2888,10 +3101,13 @@ export const checkoutApi = (options: Options) => { * | `external_ref` | `string` | `eq` / `like` | `like(external_ref, 16be*)` | * */ -export const getCustomerOrders = (options?: Options) => { +export const getCustomerOrders = ( + options?: Options, +) => { return (options?.client ?? client).get< GetCustomerOrdersResponse, - GetCustomerOrdersError + GetCustomerOrdersError, + ThrowOnError >({ ...options, url: "/v2/orders", @@ -2902,8 +3118,14 @@ export const getCustomerOrders = (options?: Options) => { * Get an Order * Use this endpoint to retrieve a specific order. */ -export const getAnOrder = (options: Options) => { - return (options?.client ?? client).get({ +export const getAnOrder = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetAnOrderResponse, + GetAnOrderError, + ThrowOnError + >({ ...options, url: "/v2/orders/{orderID}", }) @@ -2927,10 +3149,13 @@ export const getAnOrder = (options: Options) => { * ::: * */ -export const updateAnOrder = (options: Options) => { +export const updateAnOrder = ( + options: Options, +) => { return (options?.client ?? client).put< UpdateAnOrderResponse, - UpdateAnOrderError + UpdateAnOrderError, + ThrowOnError >({ ...options, url: "/v2/orders/{orderID}", @@ -2941,10 +3166,13 @@ export const updateAnOrder = (options: Options) => { * Get Order Items * Use this endpoint to retrieve order items. */ -export const getOrderItems = (options: Options) => { +export const getOrderItems = ( + options: Options, +) => { return (options?.client ?? client).get< GetOrderItemsResponse, - GetOrderItemsError + GetOrderItemsError, + ThrowOnError >({ ...options, url: "/v2/orders/{orderID}/items", @@ -2958,10 +3186,13 @@ export const getOrderItems = (options: Options) => { * When anonymization is successful, Personal Identifiable Information such as customer details, `shipping_address`, and `billing_address` are replaced with *. * */ -export const anonymizeOrders = (options?: Options) => { +export const anonymizeOrders = ( + options?: Options, +) => { return (options?.client ?? client).post< AnonymizeOrdersResponse, - AnonymizeOrdersError + AnonymizeOrdersError, + ThrowOnError >({ ...options, url: "/v2/orders/anonymize", @@ -2972,10 +3203,13 @@ export const anonymizeOrders = (options?: Options) => { * Authorize Setup * Authorize setup */ -export const authorizeSetup = (options: Options) => { +export const authorizeSetup = ( + options: Options, +) => { return (options?.client ?? client).post< AuthorizeSetupResponse, - AuthorizeSetupError + AuthorizeSetupError, + ThrowOnError >({ ...options, url: "/v2/orders/{orderID}/payments", @@ -2986,10 +3220,13 @@ export const authorizeSetup = (options: Options) => { * Confirm Setup * Confirm setup */ -export const confirmSetup = (options: Options) => { +export const confirmSetup = ( + options: Options, +) => { return (options?.client ?? client).post< ConfirmSetupResponse, - ConfirmSetupError + ConfirmSetupError, + ThrowOnError >({ ...options, url: "/v2/orders/{orderID}/transactions/{transactionID}/confirm", @@ -3000,12 +3237,13 @@ export const confirmSetup = (options: Options) => { * Capture a Transaction * Use this endpoint to capture a previously authorized payment. In this step, you can also pass in a custom reference, such as the payment reference from your chosen gateway. */ -export const captureAtransaction = ( - options: Options, +export const captureAtransaction = ( + options: Options, ) => { return (options?.client ?? client).post< CaptureAtransactionResponse, - CaptureAtransactionError + CaptureAtransactionError, + ThrowOnError >({ ...options, url: "/v2/orders/{orderID}/transactions/{transactionID}/capture", @@ -3026,12 +3264,13 @@ export const captureAtransaction = ( * ::: * */ -export const refundAtransaction = ( - options: Options, +export const refundAtransaction = ( + options: Options, ) => { return (options?.client ?? client).post< RefundAtransactionResponse, - RefundAtransactionError + RefundAtransactionError, + ThrowOnError >({ ...options, url: "/v2/orders/{orderID}/transactions/{transactionID}/refund", @@ -3042,12 +3281,13 @@ export const refundAtransaction = ( * Get Order Transactions * Get order transactions */ -export const getOrderTransactions = ( - options: Options, +export const getOrderTransactions = ( + options: Options, ) => { return (options?.client ?? client).get< GetOrderTransactionsResponse, - GetOrderTransactionsError + GetOrderTransactionsError, + ThrowOnError >({ ...options, url: "/v2/orders/{orderID}/transactions", @@ -3058,10 +3298,13 @@ export const getOrderTransactions = ( * Get a Transaction * Retrieves a transaction */ -export const getAtransaction = (options: Options) => { +export const getAtransaction = ( + options: Options, +) => { return (options?.client ?? client).get< GetAtransactionResponse, - GetAtransactionError + GetAtransactionError, + ThrowOnError >({ ...options, url: "/v2/orders/{orderID}/transactions/{transactionID}", @@ -3079,12 +3322,13 @@ export const getAtransaction = (options: Options) => { * ::: * */ -export const cancelAtransaction = ( - options: Options, +export const cancelAtransaction = ( + options: Options, ) => { return (options?.client ?? client).post< CancelAtransactionResponse, - CancelAtransactionError + CancelAtransactionError, + ThrowOnError >({ ...options, url: "/v2/orders/{orderID}/transactions/{transactionID}/cancel", diff --git a/packages/sdks/shopper/src/client/types.gen.ts b/packages/sdks/shopper/src/client/types.gen.ts index 7387c8fe..b2fa74fd 100644 --- a/packages/sdks/shopper/src/client/types.gen.ts +++ b/packages/sdks/shopper/src/client/types.gen.ts @@ -73,7 +73,7 @@ export type Catalog = { /** * The owner of this resource, can be either `organization` or `store`. */ - owner?: "store" | "organization" | null + owner?: ("store" | "organization") | null } /** * Relationships are established between different catalog entities. For example, a catalog rule and a price book are related to a catalog, as both are associated with it. @@ -1431,7 +1431,7 @@ export type ReleaseMeta = { /** * The owner of the resource, can be either `organization` or `store`. */ - owner?: "store" | "organization" | null + owner?: ("store" | "organization") | null } /** @@ -5497,1211 +5497,6 @@ export type CancelAtransactionResponse = ResponseData & { export type CancelAtransactionError = ResponseError -export type $OpenApiTs = { - "/catalog": { - get: { - req: GetByContextReleaseData - res: { - /** - * The catalog. - */ - "200": ReleaseData - /** - * The unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalog/hierarchies": { - get: { - req: GetByContextAllHierarchiesData - res: { - /** - * The hierarchies of the catalog. - */ - "200": HierarchyListData - /** - * An unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalog/hierarchies/{hierarchy_id}": { - get: { - req: GetByContextHierarchyData - res: { - /** - * The catalog hierarchy. - */ - "200": HierarchyData - /** - * The unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalog/hierarchies/{hierarchy_id}/nodes": { - get: { - req: GetByContextHierarchyNodesData - res: { - /** - * The child nodes of a catalog hierarchy. - */ - "200": NodeListData - /** - * The unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalog/hierarchies/{hierarchy_id}/children": { - get: { - req: GetByContextHierarchyChildNodesData - res: { - /** - * The child nodes of a catalog hierarchy. - */ - "200": NodeListData - /** - * The unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalog/nodes": { - get: { - req: GetByContextAllNodesData - res: { - /** - * The nodes of the catalog. - */ - "200": NodeListData - /** - * An unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalog/nodes/{node_id}": { - get: { - req: GetByContextNodeData - res: { - /** - * The catalog node. - */ - "200": NodeData - /** - * The unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalog/nodes/{node_id}/relationships/children": { - get: { - req: GetByContextChildNodesData - res: { - /** - * The child nodes of a catalog node. - */ - "200": NodeListData - /** - * The unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalog/products": { - get: { - req: GetByContextAllProductsData - res: { - /** - * The products of a catalog. - */ - "200": ProductListData - /** - * The unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalog/products/{product_id}": { - get: { - req: GetByContextProductData - res: { - /** - * The product of a catalog. - */ - "200": ProductData - /** - * The unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalog/products/{product_id}/relationships/component_products": { - get: { - req: GetByContextComponentProductIdsData - res: { - /** - * The list of component product IDs of a bundle product from a catalog. - */ - "200": ProductReferenceListData - /** - * The unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalog/products/{product_id}/relationships/children": { - get: { - req: GetByContextChildProductsData - res: { - /** - * The list of child products of a parent product from a catalog. - */ - "200": ProductListData - /** - * The unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalog/hierarchies/{hierarchy_id}/products": { - get: { - req: GetByContextProductsForHierarchyData - res: { - /** - * The products of a catalog hierarchy. - */ - "200": ProductListData - /** - * The unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalog/nodes/{node_id}/relationships/products": { - get: { - req: GetByContextProductsForNodeData - res: { - /** - * The products of a catalog node. - */ - "200": ProductListData - /** - * The unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalog/products/{product_id}/configure": { - post: { - req: ConfigureByContextProductData - res: { - /** - * The configured product of a catalog. - */ - "200": ProductData - /** - * The unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalogs": { - post: { - req: CreateCatalogData - res: { - /** - * The created catalog - */ - "201": CatalogData - /** - * Unexpected error. - */ - default: ErrorResponse - } - } - get: { - res: { - /** - * The list of catalogs. - */ - "200": CatalogListData - /** - * An unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalogs/{catalog_id}": { - get: { - req: GetCatalogByIdData - res: { - /** - * The catalog. - */ - "200": CatalogData - /** - * An unexpected error. - */ - default: ErrorResponse - } - } - put: { - req: UpdateCatalogData - res: { - /** - * An updated catalog with the following attributes. - */ - "200": CatalogData - /** - * Unexpected error. - */ - default: ErrorResponse - } - } - delete: { - req: DeleteCatalogByIdData - res: { - /** - * A 204 response indicates that the catalog has been deleted. - */ - "204": void - /** - * Unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalogs/{catalog_id}/releases": { - post: { - req: PublishReleaseData - res: { - /** - * Publishes a catalog release with the following attributes. - */ - "201": ReleaseData - /** - * Unexpected error. - */ - default: ErrorResponse - } - } - get: { - req: GetReleasesData - res: { - /** - * The list of catalogs. - */ - "200": ReleaseListData - /** - * The unexpected error. - */ - default: ErrorResponse - } - } - delete: { - req: DeleteReleasesData - res: { - /** - * A 204 response indicates that the releases have been deleted. - */ - "204": void - /** - * Unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalogs/{catalog_id}/releases/{release_id}": { - get: { - req: GetReleaseByIdData - res: { - /** - * The catalog. - */ - "200": ReleaseData - /** - * The unexpected error. - */ - default: ErrorResponse - } - } - delete: { - req: DeleteReleaseByIdData - res: { - /** - * A 204 response indicates that the release has been deleted. - */ - "204": void - /** - * Unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalogs/rules": { - post: { - req: CreateRuleData - res: { - /** - * The created catalog rule - */ - "201": RuleData - /** - * Unexpected error. - */ - default: ErrorResponse - } - } - get: { - req: GetRulesData - res: { - /** - * The list of catalog rules. - */ - "200": RuleListData - /** - * An unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalogs/rules/{catalog_rule_id}": { - get: { - req: GetRuleByIdData - res: { - /** - * The catalog rile. - */ - "200": RuleData - /** - * An unexpected error. - */ - default: ErrorResponse - } - } - put: { - req: UpdateRuleData - res: { - /** - * An Updated catalog rule with the following attributes. - */ - "200": RuleData - /** - * Unexpected error. - */ - default: ErrorResponse - } - } - delete: { - req: DeleteRuleByIdData - res: { - /** - * A 204 response indicates that the catalog rule has been deleted. - */ - "204": void - /** - * Unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalogs/{catalog_id}/releases/{release_id}/hierarchies": { - get: { - req: GetAllHierarchiesData - res: { - /** - * The hierarchies of a catalog. - */ - "200": HierarchyListData - /** - * An unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}": { - get: { - req: GetHierarchyData - res: { - /** - * The catalog hierarchy. - */ - "200": HierarchyData - /** - * The unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/nodes": { - get: { - req: GetHierarchyNodesData - res: { - /** - * The child nodes of a catalog hierarchy. - */ - "200": NodeListData - /** - * The unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/children": { - get: { - req: GetHierarchyChildNodesData - res: { - /** - * The child nodes of a catalog hierarchy. - */ - "200": NodeListData - /** - * The unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalogs/{catalog_id}/releases/{release_id}/nodes": { - get: { - req: GetAllNodesData - res: { - /** - * The nodes of a catalog. - */ - "200": NodeListData - /** - * An unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}": { - get: { - req: GetNodeData - res: { - /** - * The catalog node. - */ - "200": NodeData - /** - * The unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/children": { - get: { - req: GetChildNodesData - res: { - /** - * The child nodes of a catalog node. - */ - "200": NodeListData - /** - * The unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalogs/{catalog_id}/releases/{release_id}/products": { - get: { - req: GetAllProductsData - res: { - /** - * The products of a catalog. - */ - "200": ProductListData - /** - * The unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}": { - get: { - req: GetProductData - res: { - /** - * The product of a catalog. - */ - "200": ProductData - /** - * The unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/component_products": { - get: { - req: GetComponentProductIdsData - res: { - /** - * The list of component product IDs of a specific bundle product from a catalog. - */ - "200": ProductReferenceListData - /** - * The unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/children": { - get: { - req: GetChildProductsData - res: { - /** - * The list of child products of a specific base product from a catalog. - */ - "200": ProductListData - /** - * The unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/products": { - get: { - req: GetProductsForHierarchyData - res: { - /** - * The products of a catalog hierarchy. - */ - "200": ProductListData - /** - * The unexpected error. - */ - default: ErrorResponse - } - } - } - "/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/products": { - get: { - req: GetProductsForNodeData - res: { - /** - * The products of a catalog node. - */ - "200": ProductListData - /** - * The unexpected error. - */ - default: ErrorResponse - } - } - } - "/v2/carts": { - get: { - req: GetCartsData - res: { - "200": ResponseData & { - data?: Array - links?: ResponsePageLinks - meta?: ResponseMetaCarts - } - /** - * Unauthorized - */ - "401": ResponseError - } - } - post: { - req: CreateAcartData - res: { - "200": ResponseData & { - data?: CartResponse - } - /** - * Unauthorized - */ - "401": ResponseError - } - } - } - "/v2/carts/{cartID}": { - get: { - req: GetCartData - res: { - /** - * OK - */ - "200": ResponseData & { - data?: CartResponse - } - /** - * Unauthorized - */ - "401": ResponseError - } - } - put: { - req: UpdateAcartData - res: { - "200": ResponseData & { - data?: CartResponse - } - /** - * Unauthorized - */ - "401": ResponseError - } - } - delete: { - req: DeleteAcartData - res: { - /** - * No Content - */ - "204": void - /** - * Unauthorized - */ - "401": ResponseError - } - } - } - "/v2/carts/{cartID}/items": { - get: { - req: GetCartItemsData - res: { - "200": CartsResponse - /** - * Unauthorized - */ - "401": ResponseError - } - } - put: { - req: BulkUpdateItemsInCartData - res: { - "200": unknown - /** - * Unauthorized - */ - "401": ResponseError - } - } - post: { - req: ManageCartsData - res: { - "200": CartsResponse - /** - * Unauthorized - */ - "401": ResponseError - } - } - delete: { - req: DeleteAllCartItemsData - res: { - /** - * No Content - */ - "204": void - /** - * Unauthorized - */ - "401": ResponseError - } - } - } - "/v2/carts/{cartID}/items/{cartitemID}": { - put: { - req: UpdateAcartItemData - res: { - "200": CartsResponse - /** - * Unauthorized - */ - "401": ResponseError - } - } - delete: { - req: DeleteAcartItemData - res: { - /** - * No Content - */ - "204": void - /** - * Unauthorized - */ - "401": ResponseError - } - } - } - "/v2/carts/{cartID}/relationships/accounts": { - post: { - req: CreateAccountCartAssociationData - res: { - /** - * OK - */ - "200": CartsRelationshipsAccountsData - /** - * No Content is sent back in case the account has already been associated to the cart. - */ - "204": void - /** - * Unauthorized - */ - "401": ResponseError - } - } - delete: { - req: DeleteAccountCartAssociationData - res: { - /** - * No Content - */ - "204": void - /** - * Unauthorized - */ - "401": ResponseError - } - } - } - "/v2/carts/{cartID}/relationships/customers": { - post: { - req: CreateCustomerCartAssociationData - res: { - /** - * OK - */ - "200": CartsRelationshipsCustomersData - /** - * Unauthorized - */ - "401": ResponseError - } - } - delete: { - req: DeleteCustomerCartAssociationData - res: { - /** - * No Content - */ - "204": void - /** - * Unauthorized - */ - "401": ResponseError - } - } - } - "/v2/carts/{cartID}/discounts/{promoCode}": { - delete: { - req: DeleteApromotionViaPromotionCodeData - res: { - /** - * No Content - */ - "204": void - /** - * Unauthorized - */ - "401": ResponseError - } - } - } - "/v2/carts/{cartID}/items/{cartitemID}/taxes": { - post: { - req: AddTaxItemToCartData - res: { - "200": ResponseData & { - data?: CartsItemsTaxesObject - } - /** - * Unauthorized - */ - "401": ResponseError - /** - * Unauthorized - */ - "422": ResponseError - } - } - } - "/v2/carts/{cartID}/taxes": { - post: { - req: BulkAddTaxItemsToCartData - res: { - "200": CartsBulkTaxes - /** - * Unauthorized - */ - "401": ResponseError - } - } - delete: { - req: BulkDeleteTaxItemsFromCartData - res: { - /** - * No Content - */ - "204": void - /** - * Unauthorized - */ - "401": ResponseError - } - } - } - "/v2/carts/{cartID}/items/{cartitemID}/taxes/{taxitemID}": { - put: { - req: UpdateAtaxItemData - res: { - "200": ResponseData & { - data?: CartsItemsTaxesObject - } - /** - * Unauthorized - */ - "401": ResponseError - } - } - delete: { - req: DeleteAtaxItemData - res: { - /** - * No Content - */ - "204": void - /** - * Unauthorized - */ - "401": ResponseError - } - } - } - "/v2/carts/{cartID}/custom-discounts": { - post: { - req: BulkAddCustomDiscountsToCartData - res: { - "200": CartsBulkCustomDiscountsResponse - /** - * Unauthorized - */ - "401": ResponseError - } - } - delete: { - req: BulkDeleteCustomDiscountsFromCartData - res: { - /** - * No Content - */ - "204": void - /** - * Unauthorized - */ - "401": ResponseError - } - } - } - "/v2/carts/{cartID}/custom-discounts/{customdiscountID}": { - put: { - req: UpdateCustomDiscountForCartData - res: { - "200": ResponseData & { - data?: CartsCustomDiscountsResponse - } - /** - * Unauthorized - */ - "401": ResponseError - } - } - delete: { - req: DeleteCustomDiscountFromCartData - res: { - /** - * No Content - */ - "204": void - /** - * Unauthorized - */ - "401": ResponseError - } - } - } - "/v2/carts/{cartID}/items/{cartitemID}/custom-discounts": { - post: { - req: AddCustomDiscountToCartItemData - } - } - "/v2/carts/{cartID}/items/{cartitemID}/custom-discounts/{customdiscountID}": { - put: { - req: UpdateCustomDiscountForCartItemData - } - delete: { - req: DeleteCustomDiscountFromCartItemData - res: { - /** - * No Content - */ - "204": void - /** - * Unauthorized - */ - "401": ResponseError - } - } - } - "/v2/carts/{cartID}/payments": { - post: { - req: CreateCartPaymentIntentData - res: { - /** - * Payment Intent created successfully. - */ - "201": CartResponse - /** - * Unauthorized - */ - "401": ResponseError - } - } - } - "/v2/carts/{cartID}/checkout": { - post: { - req: CheckoutApiData - res: { - /** - * OK - */ - "200": ResponseData & { - data?: OrderResponse - } - /** - * Unauthorized - */ - "401": ResponseError - } - } - } - "/v2/orders": { - get: { - req: GetCustomerOrdersData - res: { - "200": ResponseData & { - data?: Array - links?: ResponsePageLinks - meta?: ResponseMetaOrders - } - /** - * Unauthorized - */ - "401": ResponseError - } - } - } - "/v2/orders/{orderID}": { - get: { - req: GetAnOrderData - res: { - /** - * OK - */ - "200": ResponseData & { - data?: OrderResponse - } - /** - * Unauthorized - */ - "401": ResponseError - } - } - put: { - req: UpdateAnOrderData - res: { - /** - * OK - */ - "200": ResponseData & { - data?: OrderResponse - } - /** - * Unauthorized - */ - "401": ResponseError - } - } - } - "/v2/orders/{orderID}/items": { - get: { - req: GetOrderItemsData - res: { - "200": ResponseData & { - data?: Array - } - /** - * Unauthorized - */ - "401": ResponseError - } - } - } - "/v2/orders/anonymize": { - post: { - req: AnonymizeOrdersData - res: { - /** - * OK - */ - "200": ResponseData & { - data?: OrderResponse - } - /** - * Unauthorized - */ - "401": ResponseError - /** - * Not Found - */ - "422": ResponseError - } - } - } - "/v2/orders/{orderID}/payments": { - post: { - req: AuthorizeSetupData - res: { - /** - * OK - */ - "200": ResponseData & { - data?: TransactionResponse - } - /** - * Unauthorized - */ - "401": ResponseError - } - } - } - "/v2/orders/{orderID}/transactions/{transactionID}/confirm": { - post: { - req: ConfirmSetupData - res: { - "200": ResponseData & { - data?: TransactionResponse - } - /** - * Unauthorized - */ - "401": ResponseError - } - } - } - "/v2/orders/{orderID}/transactions/{transactionID}/capture": { - post: { - req: CaptureAtransactionData - res: { - "200": ResponseData & { - data?: TransactionResponse - } - /** - * Unauthorized - */ - "401": ResponseError - } - } - } - "/v2/orders/{orderID}/transactions/{transactionID}/refund": { - post: { - req: RefundAtransactionData - res: { - "200": ResponseData & { - data?: TransactionResponse - } - /** - * Unauthorized - */ - "401": ResponseError - } - } - } - "/v2/orders/{orderID}/transactions": { - get: { - req: GetOrderTransactionsData - res: { - "200": ResponseData & { - data?: Array - } - /** - * Unauthorized - */ - "401": ResponseError - } - } - } - "/v2/orders/{orderID}/transactions/{transactionID}": { - get: { - req: GetAtransactionData - res: { - "200": ResponseData & { - data?: TransactionResponse - } - /** - * Unauthorized - */ - "401": ResponseError - } - } - } - "/v2/orders/{orderID}/transactions/{transactionID}/cancel": { - post: { - req: CancelAtransactionData - res: { - "200": ResponseData & { - data?: TransactionResponse - } - /** - * Unauthorized - */ - "401": ResponseError - } - } - } -} - export type GetByContextReleaseResponseTransformer = ( data: any, ) => Promise diff --git a/packages/sdks/shopper/src/index.ts b/packages/sdks/shopper/src/index.ts index 95283e62..7d27f04a 100644 --- a/packages/sdks/shopper/src/index.ts +++ b/packages/sdks/shopper/src/index.ts @@ -1,4 +1,5 @@ export * from "./client" -import { createClient, client } from "@hey-api/client-fetch" -export { createClient, client } +import { Client, createClient } from "@hey-api/client-fetch" +export { createClient, Client } +export { client } from "./client/services.gen" export { extractProductImage } from "./utils" From ca90991de1555769b162c3f6b9430e58561dc2f2 Mon Sep 17 00:00:00 2001 From: Robert Field Date: Mon, 26 Aug 2024 18:45:40 +0100 Subject: [PATCH 18/30] feat: add util for extracting image --- .../sdks/shopper/src/utils/extract-product-image.ts | 12 ++++++++++++ packages/sdks/shopper/src/utils/index.ts | 1 + 2 files changed, 13 insertions(+) create mode 100644 packages/sdks/shopper/src/utils/extract-product-image.ts create mode 100644 packages/sdks/shopper/src/utils/index.ts diff --git a/packages/sdks/shopper/src/utils/extract-product-image.ts b/packages/sdks/shopper/src/utils/extract-product-image.ts new file mode 100644 index 00000000..4290be26 --- /dev/null +++ b/packages/sdks/shopper/src/utils/extract-product-image.ts @@ -0,0 +1,12 @@ +import { Included, Product } from "../client" + +export const extractProductImage = ( + product: Product, + images: Included["main_images"], +) => { + return images?.find((file) => { + if (file.id === product.relationships?.main_image?.data?.id) { + return file + } + }) +} diff --git a/packages/sdks/shopper/src/utils/index.ts b/packages/sdks/shopper/src/utils/index.ts new file mode 100644 index 00000000..a3175f1d --- /dev/null +++ b/packages/sdks/shopper/src/utils/index.ts @@ -0,0 +1 @@ +export { extractProductImage } from "./extract-product-image" From 9b07496a98c9eff8dbff96c6a32c5488fa8b0be6 Mon Sep 17 00:00:00 2001 From: Robert Field Date: Mon, 26 Aug 2024 18:45:58 +0100 Subject: [PATCH 19/30] feat: migrate to new client --- examples/simple/e2e/product-list-page.spec.ts | 9 +- .../app/(store)/products/[productId]/page.tsx | 6 +- .../featured-products/FeaturedProducts.tsx | 79 +++++++------ .../header/navigation/MobileNavBar.tsx | 2 +- .../header/navigation/NavBarPopover.tsx | 2 +- .../header/navigation/NavItemContent.tsx | 2 +- .../simple/src/lib/build-breadcrumb-lookup.ts | 2 +- .../simple/src/lib/build-site-navigation.ts | 104 ------------------ .../lib/epcc-server-side-implicit-client.ts | 20 ++-- .../simple/src/lib/get-store-initial-state.ts | 15 ++- examples/simple/src/services/cart.ts | 20 +++- examples/simple/src/services/hierarchy.ts | 52 ++++++--- 12 files changed, 128 insertions(+), 185 deletions(-) delete mode 100644 examples/simple/src/lib/build-site-navigation.ts diff --git a/examples/simple/e2e/product-list-page.spec.ts b/examples/simple/e2e/product-list-page.spec.ts index 9d193c82..f6c29613 100644 --- a/examples/simple/e2e/product-list-page.spec.ts +++ b/examples/simple/e2e/product-list-page.spec.ts @@ -1,6 +1,6 @@ import { test, expect } from "@playwright/test"; import { gateway } from "@elasticpath/js-sdk"; -import { buildSiteNavigation } from "../src/lib/build-site-navigation"; +import { buildSiteNavigation } from "@elasticpath/react-shopper-hooks"; const host = process.env.NEXT_PUBLIC_EPCC_ENDPOINT_URL; const client_id = process.env.NEXT_PUBLIC_EPCC_CLIENT_ID; @@ -19,9 +19,8 @@ test("should be able to use quick view to view full product details", async ({ /* Get the cart id from the cookie */ const allCookies = await page.context().cookies(); - const cartId = allCookies.find( - (cookie) => cookie.name === "_store_ep_cart", - )?.value; + const cartId = allCookies.find((cookie) => cookie.name === "_store_ep_cart") + ?.value; const nav = await buildSiteNavigation(client); @@ -34,7 +33,7 @@ test("should be able to use quick view to view full product details", async ({ ); } - await page.getByRole("button", {name: "Shop Now"}).click(); + await page.getByRole("button", { name: "Shop Now" }).click(); /* Check to make sure the page has navigated to the product list page for Men's / T-Shirts */ await expect(page).toHaveURL(`/search`); diff --git a/examples/simple/src/app/(store)/products/[productId]/page.tsx b/examples/simple/src/app/(store)/products/[productId]/page.tsx index 0cb8b013..2fde0aed 100644 --- a/examples/simple/src/app/(store)/products/[productId]/page.tsx +++ b/examples/simple/src/app/(store)/products/[productId]/page.tsx @@ -4,7 +4,7 @@ import { getServerSideImplicitClient } from "../../../../lib/epcc-server-side-im import { notFound } from "next/navigation"; import { parseProductResponse } from "@elasticpath/react-shopper-hooks"; import React from "react"; -import { getByContextProduct, createClient } from "@epcc-sdk/sdks-shopper"; +import { getByContextProduct, client } from "@epcc-sdk/sdks-shopper"; import { applyDefaultNextMiddleware } from "@epcc-sdk/sdks-nextjs"; import { epccEnv } from "../../../../lib/resolve-epcc-env"; import { ProductResponse, ShopperCatalogResource } from "@elasticpath/js-sdk"; @@ -15,11 +15,11 @@ type Props = { params: { productId: string }; }; -createClient({ +client.setConfig({ baseUrl: `https://${epccEnv.host}`, }); -applyDefaultNextMiddleware(); +applyDefaultNextMiddleware(client); export async function generateMetadata({ params: { productId }, diff --git a/examples/simple/src/components/featured-products/FeaturedProducts.tsx b/examples/simple/src/components/featured-products/FeaturedProducts.tsx index 909ec1ef..317652f3 100644 --- a/examples/simple/src/components/featured-products/FeaturedProducts.tsx +++ b/examples/simple/src/components/featured-products/FeaturedProducts.tsx @@ -5,6 +5,7 @@ import { ArrowRightIcon, EyeSlashIcon } from "@heroicons/react/24/outline"; import Image from "next/image"; import { getServerSideImplicitClient } from "../../lib/epcc-server-side-implicit-client"; import { fetchFeaturedProducts } from "./fetchFeaturedProducts"; +import { extractProductImage } from "@epcc-sdk/sdks-shopper"; interface IFeaturedProductsProps { title: string; @@ -19,7 +20,13 @@ export default async function FeaturedProducts({ linkProps, }: IFeaturedProductsProps) { const client = getServerSideImplicitClient(); - const products = await fetchFeaturedProducts(client); + const featuredProductResponse = await fetchFeaturedProducts(client); + + if (!featuredProductResponse.response.ok) { + return null; + } + + const products = featuredProductResponse.data?.data ?? []; return (
- {products.map((product) => ( - -
  • -
    -
    - {product.main_image?.link.href ? ( - {product.main_image?.file_name!} - ) : ( -
    - -
    - )} + {products.map((product) => { + const mainImage = extractProductImage( + product, + featuredProductResponse.data?.included?.main_images, + ); + return ( + +
  • +
    +
    + {mainImage?.link?.href ? ( + {mainImage?.file_name!} + ) : ( +
    + +
    + )} +
    -
  • -

    - {product.attributes.name} -

    -

    - {product.meta.display_price?.without_tax?.formatted} -

    - - - ))} +

    + {product.attributes?.name} +

    +

    + {product.meta?.display_price?.without_tax?.formatted} +

    + + + ); + })}
    ); diff --git a/examples/simple/src/components/header/navigation/MobileNavBar.tsx b/examples/simple/src/components/header/navigation/MobileNavBar.tsx index 06f832d4..10c9d449 100644 --- a/examples/simple/src/components/header/navigation/MobileNavBar.tsx +++ b/examples/simple/src/components/header/navigation/MobileNavBar.tsx @@ -3,8 +3,8 @@ import Link from "next/link"; import EpIcon from "../../icons/ep-icon"; import { MobileNavBarButton } from "./MobileNavBarButton"; import { getServerSideImplicitClient } from "../../../lib/epcc-server-side-implicit-client"; -import { buildSiteNavigation } from "../../../lib/build-site-navigation"; import { Cart } from "../../cart/CartSheet"; +import { buildSiteNavigation } from "@elasticpath/react-shopper-hooks"; export default async function MobileNavBar() { const client = getServerSideImplicitClient(); diff --git a/examples/simple/src/components/header/navigation/NavBarPopover.tsx b/examples/simple/src/components/header/navigation/NavBarPopover.tsx index 1409d5c7..04331f9a 100644 --- a/examples/simple/src/components/header/navigation/NavBarPopover.tsx +++ b/examples/simple/src/components/header/navigation/NavBarPopover.tsx @@ -1,6 +1,6 @@ "use client"; import { ReactElement } from "react"; -import { NavigationNode } from "../../../lib/build-site-navigation"; +import { NavigationNode } from "@elasticpath/react-shopper-hooks"; import { NavigationMenu, NavigationMenuContent, diff --git a/examples/simple/src/components/header/navigation/NavItemContent.tsx b/examples/simple/src/components/header/navigation/NavItemContent.tsx index dec7fce9..ffd0d015 100644 --- a/examples/simple/src/components/header/navigation/NavItemContent.tsx +++ b/examples/simple/src/components/header/navigation/NavItemContent.tsx @@ -1,5 +1,5 @@ import Link from "next/link"; -import { NavigationNode } from "../../../lib/build-site-navigation"; +import { NavigationNode } from "@elasticpath/react-shopper-hooks"; import { ArrowRightIcon } from "@heroicons/react/20/solid"; interface IProps { diff --git a/examples/simple/src/lib/build-breadcrumb-lookup.ts b/examples/simple/src/lib/build-breadcrumb-lookup.ts index 4d170da9..7f5f3f9d 100644 --- a/examples/simple/src/lib/build-breadcrumb-lookup.ts +++ b/examples/simple/src/lib/build-breadcrumb-lookup.ts @@ -1,4 +1,4 @@ -import { NavigationNode } from "./build-site-navigation"; +import { NavigationNode } from "@elasticpath/react-shopper-hooks"; import { BreadcrumbLookup } from "./types/breadcrumb-lookup"; export function buildBreadcrumbLookup( diff --git a/examples/simple/src/lib/build-site-navigation.ts b/examples/simple/src/lib/build-site-navigation.ts deleted file mode 100644 index d50c7f34..00000000 --- a/examples/simple/src/lib/build-site-navigation.ts +++ /dev/null @@ -1,104 +0,0 @@ -import type { Hierarchy,ElasticPath } from "@elasticpath/js-sdk"; -import { - getHierarchies, - getHierarchyChildren, - getHierarchyNodes, -} from "../services/hierarchy"; - -interface ISchema { - name: string; - slug: string; - href: string; - id: string; - children: ISchema[]; -} - -export interface NavigationNode { - name: string; - slug: string; - href: string; - id: string; - children: NavigationNode[]; -} - -export async function buildSiteNavigation( - client: ElasticPath, -): Promise { - // Fetch hierarchies to be used as top level nav - const hierarchies = await getHierarchies(client); - return constructTree(hierarchies, client); -} - -/** - * Construct hierarchy tree, limited to 5 hierarchies at the top level - */ -function constructTree( - hierarchies: Hierarchy[], - client: ElasticPath, -): Promise { - const tree = hierarchies - .slice(0, 4) - .map((hierarchy) => - createNode({ - name: hierarchy.attributes.name, - id: hierarchy.id, - slug: hierarchy.attributes.slug, - }), - ) - .map(async (hierarchy) => { - // Fetch first-level nav ('parent nodes') - the direct children of each hierarchy - const directChildren = await getHierarchyChildren(hierarchy.id, client); - // Fetch all nodes in each hierarchy (i.e. all 'child nodes' belonging to a hierarchy) - const allNodes = await getHierarchyNodes(hierarchy.id, client); - - // Build 2nd level by finding all 'child nodes' belonging to each first level featured-nodes - const directs = directChildren.slice(0, 4).map((child) => { - const children: ISchema[] = allNodes - .filter((node) => node?.relationships?.parent.data.id === child.id) - .map((node) => - createNode({ - name: node.attributes.name, - id: node.id, - slug: node.attributes.slug, - hrefBase: `${hierarchy.href}/${child.attributes.slug}`, - }), - ); - - return createNode({ - name: child.attributes.name, - id: child.id, - slug: child.attributes.slug, - hrefBase: hierarchy.href, - children, - }); - }); - - return { ...hierarchy, children: directs }; - }); - - return Promise.all(tree); -} - -interface CreateNodeDefinition { - name: string; - id: string; - slug?: string; - hrefBase?: string; - children?: ISchema[]; -} - -function createNode({ - name, - id, - slug = "missing-slug", - hrefBase = "", - children = [], -}: CreateNodeDefinition): ISchema { - return { - name, - id, - slug, - href: `${hrefBase}/${slug}`, - children, - }; -} diff --git a/examples/simple/src/lib/epcc-server-side-implicit-client.ts b/examples/simple/src/lib/epcc-server-side-implicit-client.ts index dfba3600..768b9b7d 100644 --- a/examples/simple/src/lib/epcc-server-side-implicit-client.ts +++ b/examples/simple/src/lib/epcc-server-side-implicit-client.ts @@ -6,23 +6,21 @@ import { COOKIE_PREFIX_KEY } from "./resolve-cart-env"; import { EP_CURRENCY_CODE } from "./resolve-ep-currency-code"; import { CREDENTIALS_COOKIE_NAME } from "./cookie-constants"; import { cookies } from "next/headers"; +import { client, createClient } from "@epcc-sdk/sdks-shopper"; +import { applyDefaultNextMiddleware } from "@epcc-sdk/sdks-nextjs"; const customHeaders = resolveEpccCustomRuleHeaders(); const { client_id, host } = epccEnv; +client.setConfig({ + baseUrl: `https://${epccEnv.host}`, +}); + +applyDefaultNextMiddleware(client); + export function getServerSideImplicitClient() { - const credentialsCookie = cookies().get(CREDENTIALS_COOKIE_NAME); - - return gateway({ - name: COOKIE_PREFIX_KEY, - client_id, - host, - currency: EP_CURRENCY_CODE, - ...(customHeaders ? { headers: customHeaders } : {}), - reauth: false, - storage: createServerSideNextCookieStorageFactory(credentialsCookie?.value), - }); + return client; } function createServerSideNextCookieStorageFactory( diff --git a/examples/simple/src/lib/get-store-initial-state.ts b/examples/simple/src/lib/get-store-initial-state.ts index dafe837b..8b775904 100644 --- a/examples/simple/src/lib/get-store-initial-state.ts +++ b/examples/simple/src/lib/get-store-initial-state.ts @@ -1,17 +1,24 @@ -import { ElasticPath } from "@elasticpath/js-sdk"; import { InitialState } from "@elasticpath/react-shopper-hooks"; -import { buildSiteNavigation } from "./build-site-navigation"; +import { buildSiteNavigation } from "@elasticpath/react-shopper-hooks"; import { getCartCookieServer } from "./cart-cookie-server"; import { getCart } from "../services/cart"; +import type { Client } from "@epcc-sdk/sdks-shopper"; +import { Cart, CartIncluded, ResourceIncluded } from "@elasticpath/js-sdk"; export async function getStoreInitialState( - client: ElasticPath, + client: Client, ): Promise { const nav = await buildSiteNavigation(client); const cartCookie = getCartCookieServer(); - const cart = await getCart(cartCookie, client); + const cartResponse = await getCart(cartCookie, client); + + if (!cartResponse.response.ok) { + throw new Error("Failed to get cart"); + } + + const cart = cartResponse.data as ResourceIncluded; return { cart, diff --git a/examples/simple/src/services/cart.ts b/examples/simple/src/services/cart.ts index e92757e4..0e23c0bb 100644 --- a/examples/simple/src/services/cart.ts +++ b/examples/simple/src/services/cart.ts @@ -1,9 +1,19 @@ -import type {ElasticPath } from "@elasticpath/js-sdk"; -import { Cart, CartIncluded, ResourceIncluded } from "@elasticpath/js-sdk"; +import { + client as elasticPathClient, + getCart as getCartClient, +} from "@epcc-sdk/sdks-shopper"; export async function getCart( cartId: string, - client: ElasticPath, -): Promise> { - return client.Cart(cartId).With("items").Get(); + client?: typeof elasticPathClient, +) { + return await getCartClient({ + client, + path: { + cartID: cartId, + }, + query: { + include: "items", + }, + }); } diff --git a/examples/simple/src/services/hierarchy.ts b/examples/simple/src/services/hierarchy.ts index 6fafee61..22063afc 100644 --- a/examples/simple/src/services/hierarchy.ts +++ b/examples/simple/src/services/hierarchy.ts @@ -1,28 +1,48 @@ -import type { Node, Hierarchy } from "@elasticpath/js-sdk"; -import {ElasticPath } from "@elasticpath/js-sdk"; +import type { client as elasticPathClient } from "@epcc-sdk/sdks-shopper"; +import { + getByContextAllHierarchies, + getByContextHierarchyChildNodes, + getByContextHierarchyNodes, +} from "@epcc-sdk/sdks-shopper"; -export async function getHierarchies(client: ElasticPath): Promise { - const result = await client.ShopperCatalog.Hierarchies.All(); - return result.data; +export async function getHierarchies(client?: typeof elasticPathClient) { + return await getByContextAllHierarchies({ + client, + query: { + "page[limit]": 100, + "page[offset]": 0, + }, + }); } export async function getHierarchyChildren( hierarchyId: string, - client: ElasticPath, -): Promise { - const result = await client.ShopperCatalog.Hierarchies.GetHierarchyChildren({ - hierarchyId, + client?: typeof elasticPathClient, +) { + return await getByContextHierarchyChildNodes({ + client, + path: { + hierarchy_id: hierarchyId, + }, + query: { + "page[limit]": 100, + "page[offset]": 0, + }, }); - return result.data; } export async function getHierarchyNodes( hierarchyId: string, - client: ElasticPath, -): Promise { - const result = await client.ShopperCatalog.Hierarchies.GetHierarchyNodes({ - hierarchyId, + client?: typeof elasticPathClient, +) { + return await getByContextHierarchyNodes({ + client, + path: { + hierarchy_id: hierarchyId, + }, + query: { + "page[limit]": 100, + "page[offset]": 0, + }, }); - - return result.data; } From ebb3422f4206190f823ad3213e9f65e2aa011007 Mon Sep 17 00:00:00 2001 From: Robert Field Date: Tue, 27 Aug 2024 13:34:06 +0100 Subject: [PATCH 20/30] feat: update add promo item to cart using new client --- .../src/components/checkout-sidebar/actions.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/examples/simple/src/components/checkout-sidebar/actions.ts b/examples/simple/src/components/checkout-sidebar/actions.ts index e2d283b8..7d2b4825 100644 --- a/examples/simple/src/components/checkout-sidebar/actions.ts +++ b/examples/simple/src/components/checkout-sidebar/actions.ts @@ -5,6 +5,7 @@ import { revalidatePath } from "next/cache"; import { z } from "zod"; import { COOKIE_PREFIX_KEY } from "../../lib/resolve-cart-env"; import { getErrorMessage } from "../../lib/get-error-message"; +import { manageCarts } from "@epcc-sdk/sdks-shopper"; const applyDiscountSchema = z.object({ code: z.string(), @@ -30,7 +31,18 @@ export async function applyDiscount(formData: FormData) { } try { - await client.Cart(cartCookie).AddPromotion(validatedFormData.data.code); + await manageCarts({ + client, + body: { + data: { + type: "promotion_item", + code: validatedFormData.data.code, + }, + }, + path: { + cartID: cartCookie, + }, + }); revalidatePath("/cart"); } catch (error) { console.error(error); From b0afa67317c1bac8fc8aa02c94ad731a772d1461 Mon Sep 17 00:00:00 2001 From: Robert Field Date: Tue, 7 Jan 2025 10:20:49 +0000 Subject: [PATCH 21/30] feat: wip new client --- .../app/(store)/search/[[...node]]/page.tsx | 60 +++++++++++++------ .../simple/src/app/(store)/search/search.tsx | 9 +-- .../components/search/ProductsProvider.tsx | 19 +++--- .../src/components/search/SearchResults.tsx | 3 +- packages/react-shopper-hooks/package.json | 4 +- pnpm-lock.yaml | 14 ++++- 6 files changed, 67 insertions(+), 42 deletions(-) diff --git a/examples/simple/src/app/(store)/search/[[...node]]/page.tsx b/examples/simple/src/app/(store)/search/[[...node]]/page.tsx index ff6de2f9..2d8b8c74 100644 --- a/examples/simple/src/app/(store)/search/[[...node]]/page.tsx +++ b/examples/simple/src/app/(store)/search/[[...node]]/page.tsx @@ -1,18 +1,19 @@ import { Search } from "../search"; import { Metadata } from "next"; import { getServerSideImplicitClient } from "../../../../lib/epcc-server-side-implicit-client"; -import { - Hierarchy, - ElasticPath, - ProductResponse, - ShopperCatalogResourcePage, -} from "@elasticpath/js-sdk"; import { notFound } from "next/navigation"; import { ShopperProduct } from "@elasticpath/react-shopper-hooks"; import { getMainImageForProductResponse, getOtherImagesForProductResponse, } from "../../../../lib/file-lookup"; +import { + Client, + Hierarchy, + getByContextAllProducts, + GetByContextAllProductsResponse, + getByContextAllHierarchies, +} from "@epcc-sdk/sdks-shopper"; export const metadata: Metadata = { title: "Search", @@ -42,11 +43,22 @@ export default async function SearchPage({ const { limit, offset } = searchParams; if (!params.node || params.node.length === 0) { - const products = await client.ShopperCatalog.Products.With(["main_image"]) - .Limit(processLimit(limit)) - .Offset(processOffset(offset)) - .All(); - return ; + const products = await getByContextAllProducts({ + client, + body: {}, + query: { + "page[limit]": processLimit(limit), + "page[offset]": processOffset(offset), + include: "main_image", + }, + }); + + if (!products.response.ok || !products.data) { + console.error("Failed to get all products", products.response); + return notFound(); + } + + return ; } const rootNodeSlug = params.node?.[0]; @@ -65,7 +77,7 @@ export default async function SearchPage({ if (params.node.length === 1) { const products = await getNodeProducts( client, - rootHierarchy.id, + rootHierarchy.id!, limit, offset, ); @@ -97,20 +109,30 @@ export default async function SearchPage({ * Behavior for more than 25 hierarchies is unpredictable. */ async function findHierarchyFromSlug( - client: ElasticPath, + client: Client, slug: string, ): Promise { - const allHierarchies = await client.ShopperCatalog.Hierarchies.All(); + const allHierarchies = await getByContextAllHierarchies({ + client, + query: { + "page[limit]": 25, + }, + }); - return allHierarchies.data.find((hierarchy) => { - return hierarchy.attributes.slug === slug; + if (!allHierarchies.response.ok || !allHierarchies.data) { + console.error("Failed to get all hierarchies", allHierarchies.response); + return; + } + + return allHierarchies.data.data?.find((hierarchy) => { + return hierarchy.attributes?.slug === slug; }); } function processResult( - page: ShopperCatalogResourcePage, + page: GetByContextAllProductsResponse, ): ShopperCatalogResourcePage { - const processedData: ShopperProduct[] = page.data.map((product) => { + const processedData: ShopperProduct[] = page.data?.map((product) => { const mainImage = page.included?.main_images ? getMainImageForProductResponse(product, page.included.main_images) ?? null @@ -161,7 +183,7 @@ function getLastArrayElement(array: T[]): T | undefined { } async function getNodeProducts( - client: ElasticPath, + client: Client, nodeId: string, limit?: string, offset?: string, diff --git a/examples/simple/src/app/(store)/search/search.tsx b/examples/simple/src/app/(store)/search/search.tsx index 00183dbd..74f6bb22 100644 --- a/examples/simple/src/app/(store)/search/search.tsx +++ b/examples/simple/src/app/(store)/search/search.tsx @@ -1,15 +1,10 @@ "use client"; import SearchResults from "../../../components/search/SearchResults"; import React from "react"; -import { ShopperProduct } from "@elasticpath/react-shopper-hooks"; -import { ShopperCatalogResourcePage } from "@elasticpath/js-sdk"; import { usePathname } from "next/navigation"; +import { GetByContextAllProductsResponse } from "@epcc-sdk/sdks-shopper"; -export function Search({ - page, -}: { - page?: ShopperCatalogResourcePage; -}) { +export function Search({ page }: { page?: GetByContextAllProductsResponse }) { const pathname = usePathname(); const nodes = pathname.split("/search/")?.[1]?.split("/"); diff --git a/examples/simple/src/components/search/ProductsProvider.tsx b/examples/simple/src/components/search/ProductsProvider.tsx index 488e8046..4f71a50c 100644 --- a/examples/simple/src/components/search/ProductsProvider.tsx +++ b/examples/simple/src/components/search/ProductsProvider.tsx @@ -5,16 +5,15 @@ import { useContext, useState, } from "react"; -import type { - ElasticPath, - ShopperCatalogResourcePage, -} from "@elasticpath/js-sdk"; -import { ShopperProduct } from "@elasticpath/react-shopper-hooks"; +import { + GetByContextAllProductsResponse, + Client, +} from "@epcc-sdk/sdks-shopper"; interface ProductsState { - client: ElasticPath; - setClient: Dispatch>; - page?: ShopperCatalogResourcePage; + client: Client; + setClient: Dispatch>; + page?: GetByContextAllProductsResponse; } export const ProductsProviderContext = createContext( @@ -23,8 +22,8 @@ export const ProductsProviderContext = createContext( export type ProductsProviderProps = { children: React.ReactNode; - page?: ShopperCatalogResourcePage; - client: ElasticPath; + page?: GetByContextAllProductsResponse; + client: Client; }; export const ProductsProvider = ({ diff --git a/examples/simple/src/components/search/SearchResults.tsx b/examples/simple/src/components/search/SearchResults.tsx index 42a11eef..4f7a4dfa 100644 --- a/examples/simple/src/components/search/SearchResults.tsx +++ b/examples/simple/src/components/search/SearchResults.tsx @@ -10,9 +10,10 @@ import { ShopperCatalogResourcePage } from "@elasticpath/js-sdk"; import { BreadcrumbLookup } from "../../lib/types/breadcrumb-lookup"; import { buildBreadcrumbLookup } from "../../lib/build-breadcrumb-lookup"; import MobileFilters from "./MobileFilters"; +import { GetByContextAllProductsResponse } from "@epcc-sdk/sdks-shopper"; interface ISearchResults { - page?: ShopperCatalogResourcePage; + page?: GetByContextAllProductsResponse; nodes?: string[]; } diff --git a/packages/react-shopper-hooks/package.json b/packages/react-shopper-hooks/package.json index 169e0d29..52b35251 100644 --- a/packages/react-shopper-hooks/package.json +++ b/packages/react-shopper-hooks/package.json @@ -31,7 +31,7 @@ "dist" ], "devDependencies": { - "@elasticpath/js-sdk": "5.0.0", + "@epcc-sdk/sdks-shopper": "workspace:*", "@storybook/addon-essentials": "^7.5.3", "@storybook/addon-interactions": "^7.5.3", "@storybook/addon-links": "^7.5.3", @@ -60,7 +60,7 @@ "vitest": "^0.31.1" }, "peerDependencies": { - "@elasticpath/js-sdk": "5.0.0", + "@epcc-sdk/sdks-shopper": "workspace:*", "@tanstack/react-query": "^5.51.23", "react": "^18.3.1", "react-dom": "^18.3.1" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 35f62616..7f216fad 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1173,9 +1173,9 @@ importers: specifier: ^3.1.2 version: 3.1.2 devDependencies: - '@elasticpath/js-sdk': - specifier: 5.0.0 - version: 5.0.0(encoding@0.1.13) + '@epcc-sdk/sdks-shopper': + specifier: workspace:* + version: link:../sdks/shopper '@storybook/addon-essentials': specifier: ^7.5.3 version: 7.5.3(@types/react-dom@18.3.0)(@types/react@18.3.3)(react-dom@18.3.1)(react@18.3.1) @@ -6233,6 +6233,7 @@ packages: throttled-queue: 2.1.4 transitivePeerDependencies: - encoding + dev: false /@emotion/is-prop-valid@1.2.2: resolution: {integrity: sha512-uNsoYd37AFmaCdXlg6EYD1KaPOaRWRByMCYzbKUX4+hhMfrxdVSelShywL4JVaAeM/eHUOSprYBQls+/neX3pw==} @@ -15534,6 +15535,7 @@ packages: /es6-promise@4.2.8: resolution: {integrity: sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==} + dev: false /es6-symbol@3.1.3: resolution: {integrity: sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==} @@ -18286,6 +18288,7 @@ packages: /inflected@2.1.0: resolution: {integrity: sha512-hAEKNxvHf2Iq3H60oMBHkB4wl5jn3TPF3+fXek/sRwAB5gP9xWs4r7aweSF95f99HFoz69pnZTcu8f0SIHV18w==} + dev: false /inflight@1.0.6: resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} @@ -19656,6 +19659,7 @@ packages: /js-cookie@3.0.5: resolution: {integrity: sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw==} engines: {node: '>=14'} + dev: false /js-levenshtein@1.1.6: resolution: {integrity: sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==} @@ -21569,6 +21573,7 @@ packages: engines: {node: '>=0.12'} dependencies: write-file-atomic: 1.3.4 + dev: false /node-readfiles@0.2.0: resolution: {integrity: sha512-SU00ZarexNlE4Rjdm83vglt5Y9yiQ+XI1XpflWlb7q7UTN1JUItm69xMeiQCTxtTfnzt+83T8Cx+vI2ED++VDA==} @@ -24989,6 +24994,7 @@ packages: /slide@1.1.6: resolution: {integrity: sha512-NwrtjCg+lZoqhFU8fOwl4ay2ei8PaqCBOUV3/ektPY9trO1yQ1oXEfmHAhKArUVUr/hOHvy5f6AdP17dCM0zMw==} + dev: false /slugify@1.4.7: resolution: {integrity: sha512-tf+h5W1IrjNm/9rKKj0JU2MDMruiopx0jjVA5zCdBtcGjfp0+c5rHw/zADLC3IeKlGHtVbHtpfzvYA0OYT+HKg==} @@ -25889,6 +25895,7 @@ packages: /throttled-queue@2.1.4: resolution: {integrity: sha512-YGdk8sdmr4ge3g+doFj/7RLF5kLM+Mi7DEciu9PHxnMJZMeVuZeTj31g4VE7ekUffx/IdbvrtOCiz62afg0mkg==} + dev: false /through2@2.0.5: resolution: {integrity: sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==} @@ -27963,6 +27970,7 @@ packages: graceful-fs: 4.2.11 imurmurhash: 0.1.4 slide: 1.1.6 + dev: false /write-file-atomic@2.4.3: resolution: {integrity: sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ==} From c1213b84a5ccedf7164f33b3083dcc58a63f13cc Mon Sep 17 00:00:00 2001 From: Robert Field Date: Thu, 9 Jan 2025 13:30:04 +0000 Subject: [PATCH 22/30] chore: lock file --- pnpm-lock.yaml | 986 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 670 insertions(+), 316 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3d5cd203..d55c77f1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1477,7 +1477,7 @@ importers: devDependencies: next: specifier: ^14.0.0 - version: 14.0.0(@babel/core@7.23.2)(react-dom@18.3.1)(react@18.3.1) + version: 14.0.0(@babel/core@7.25.2)(react-dom@18.3.1)(react@18.3.1) typescript: specifier: ^5.5.3 version: 5.5.4 @@ -1503,16 +1503,16 @@ importers: devDependencies: '@hey-api/openapi-ts': specifier: ^0.52.10 - version: 0.52.10(typescript@5.5.4) + version: 0.52.11(typescript@5.5.4) '@redocly/cli': specifier: ^1.21.0 - version: 1.21.0(enzyme@3.11.0) + version: 1.27.1(enzyme@3.11.0) '@redocly/openapi-core': specifier: ^1.21.0 - version: 1.21.0 + version: 1.27.1 '@tanstack/react-query': specifier: ^5.52.1 - version: 5.52.1(react@18.3.1) + version: 5.63.0(react@18.3.1) lodash: specifier: ^4.17.21 version: 4.17.21 @@ -2046,21 +2046,6 @@ packages: '@babel/helper-annotate-as-pure': 7.22.5 regexpu-core: 5.3.2 semver: 6.3.1 - dev: true - - /@babel/helper-define-polyfill-provider@0.4.3(@babel/core@7.23.2): - resolution: {integrity: sha512-WBrLmuPP47n7PNwsZ57pqam6G/RGo1vw/87b0Blc53tZNGZ4x7YvZ6HgQe2vo1W/FR20OgjeZuGXzudPiXHFug==} - peerDependencies: - '@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0 - dependencies: - '@babel/core': 7.23.2 - '@babel/helper-compilation-targets': 7.22.15 - '@babel/helper-plugin-utils': 7.22.5 - debug: 4.3.6 - lodash.debounce: 4.0.8 - resolve: 1.22.8 - transitivePeerDependencies: - - supports-color /@babel/helper-define-polyfill-provider@0.4.3(@babel/core@7.23.3): resolution: {integrity: sha512-WBrLmuPP47n7PNwsZ57pqam6G/RGo1vw/87b0Blc53tZNGZ4x7YvZ6HgQe2vo1W/FR20OgjeZuGXzudPiXHFug==} @@ -5441,6 +5426,7 @@ packages: throttled-queue: 2.1.4 transitivePeerDependencies: - encoding + dev: false /@elasticpath/react-shopper-hooks@0.14.0(@elasticpath/js-sdk@5.0.0)(@tanstack/react-query@5.51.23)(encoding@0.1.13)(react-dom@18.3.1)(react@18.3.1): resolution: {integrity: sha512-N/jH+phTATHOaD4KCBZZb5i0yJzK+KIdMQidhzfx2kQqbl6AjpFH/WG4e2mT96cZZsIETfrGiQF/ByAQKA1WgA==} @@ -5469,7 +5455,6 @@ packages: transitivePeerDependencies: - encoding dev: false - dev: false /@emotion/is-prop-valid@1.2.2: resolution: {integrity: sha512-uNsoYd37AFmaCdXlg6EYD1KaPOaRWRByMCYzbKUX4+hhMfrxdVSelShywL4JVaAeM/eHUOSprYBQls+/neX3pw==} @@ -6897,8 +6882,8 @@ packages: - magicast dev: true - /@hey-api/openapi-ts@0.52.10(typescript@5.5.4): - resolution: {integrity: sha512-ZjCETgc85VOEQvqObLxM0NUx87niv5LUfPk9N9BeVZ2zgvfFX8oT4LAzojc8UEyKDakI3elZKPPY843W3a+aFA==} + /@hey-api/openapi-ts@0.52.11(typescript@5.5.4): + resolution: {integrity: sha512-S3NrCQDxy7AtW5sx8OVoBaqpaYNqYsD0y6YNwhUXPUahbrW7Wxm/N4RIEsRtXVbcjUqdAjo1FmFmeyEKYziJkw==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: @@ -8903,38 +8888,38 @@ packages: dependencies: '@babel/runtime': 7.25.0 - /@redocly/ajv@8.11.0: - resolution: {integrity: sha512-9GWx27t7xWhDIR02PA18nzBdLcKQRgc46xNQvjFkrYk4UOmvKhJ/dawwiX0cCOeetN5LcaaiqQbVOWYK62SGHw==} + /@redocly/ajv@8.11.2: + resolution: {integrity: sha512-io1JpnwtIcvojV7QKDUSIuMN/ikdOUd1ReEnUnMKGfDVridQZ31J0MmIuqwuRjWDZfmvr+Q0MqCcfHM2gTivOg==} dependencies: fast-deep-equal: 3.1.3 json-schema-traverse: 1.0.0 require-from-string: 2.0.2 - uri-js: 4.4.1 + uri-js-replace: 1.0.1 dev: true - /@redocly/cli@1.21.0(enzyme@3.11.0): - resolution: {integrity: sha512-KPCHWrTXnIV01rgpgwnyQuwKhSol5pnNor20f6/szVrUcZ+vRCqKeZDR1CSMBYIXEsi0AknLV7WR8BCYyfYbog==} + /@redocly/cli@1.27.1(enzyme@3.11.0): + resolution: {integrity: sha512-IgFzIKgWDaGY8jOlWYVp7VyIwElIjqrVLvZWzdDS/vdQlJ0DdISQ1nRy/YSh0Rqw69hJOpgn5cXMH/SS/qO33Q==} engines: {node: '>=14.19.0', npm: '>=7.0.0'} hasBin: true dependencies: - '@redocly/openapi-core': 1.21.0 + '@redocly/openapi-core': 1.27.1 abort-controller: 3.0.0 - chokidar: 3.6.0 + chokidar: 3.5.3 colorette: 1.4.0 core-js: 3.33.1 form-data: 4.0.0 get-port-please: 3.1.2 glob: 7.2.3 handlebars: 4.7.8 - mobx: 6.13.1 + mobx: 6.13.5 node-fetch: 2.7.0(encoding@0.1.13) pluralize: 8.0.0 react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - redoc: 2.1.5(core-js@3.33.1)(enzyme@3.11.0)(mobx@6.13.1)(react-dom@18.3.1)(react@18.3.1)(styled-components@6.1.12) + redoc: 2.2.0(core-js@3.33.1)(enzyme@3.11.0)(mobx@6.13.5)(react-dom@18.3.1)(react@18.3.1)(styled-components@6.1.14) semver: 7.5.4 simple-websocket: 9.1.0 - styled-components: 6.1.12(react-dom@18.3.1)(react@18.3.1) + styled-components: 6.1.14(react-dom@18.3.1)(react@18.3.1) yargs: 17.0.1 transitivePeerDependencies: - bufferutil @@ -8945,21 +8930,20 @@ packages: - utf-8-validate dev: true - /@redocly/config@0.9.0: - resolution: {integrity: sha512-rRd0pSiPC68AQGud2VbrHqUov1VHospfcYE2pFYmGYfZhzZfHBSiVaeiTY+CZmrhf5RB9aVdOHRCm25Vb6GFkQ==} + /@redocly/config@0.17.1: + resolution: {integrity: sha512-CEmvaJuG7pm2ylQg53emPmtgm4nW2nxBgwXzbVEHpGas/lGnMyN8Zlkgiz6rPw0unASg6VW3wlz27SOL5XFHYQ==} dev: true - /@redocly/openapi-core@1.21.0: - resolution: {integrity: sha512-8KwL/0jiQBSJMNp1lSMLM1UeV2FW9DdqcjO0J9s5w7yL7ZN+SNh11MTp0zU4om/pGYExQ64hxLM/+7VdjznHRQ==} + /@redocly/openapi-core@1.27.1: + resolution: {integrity: sha512-zQ47/A+Drk2Y75/af69MD3Oad4H9LxkUDzcm7XBkyLNDKIWQrDKDnS5476oDq77+zciymNxgMVtxxVXlnGS8kw==} engines: {node: '>=14.19.0', npm: '>=7.0.0'} dependencies: - '@redocly/ajv': 8.11.0 - '@redocly/config': 0.9.0 + '@redocly/ajv': 8.11.2 + '@redocly/config': 0.17.1 colorette: 1.4.0 - https-proxy-agent: 7.0.5 + https-proxy-agent: 7.0.6 js-levenshtein: 1.1.6 js-yaml: 4.1.0 - lodash.isequal: 4.5.0 minimatch: 5.1.6 node-fetch: 2.7.0(encoding@0.1.13) pluralize: 8.0.0 @@ -10155,8 +10139,8 @@ packages: /@tanstack/query-core@5.51.21: resolution: {integrity: sha512-POQxm42IUp6n89kKWF4IZi18v3fxQWFRolvBA6phNVmA8psdfB1MvDnGacCJdS+EOX12w/CyHM62z//rHmYmvw==} - /@tanstack/query-core@5.52.0: - resolution: {integrity: sha512-U1DOEgltjUwalN6uWYTewSnA14b+tE7lSylOiASKCAO61ENJeCq9VVD/TXHA6O5u9+6v5+UgGYBSccTKDoyMqw==} + /@tanstack/query-core@5.62.16: + resolution: {integrity: sha512-9Sgft7Qavcd+sN0V25xVyo0nfmcZXBuODy3FVG7BMWTg1HMLm8wwG5tNlLlmSic1u7l1v786oavn+STiFaPH2g==} dev: true /@tanstack/query-devtools@5.32.1: @@ -10182,12 +10166,12 @@ packages: '@tanstack/query-core': 5.51.21 react: 18.3.1 - /@tanstack/react-query@5.52.1(react@18.3.1): - resolution: {integrity: sha512-soyn4dNIUZ8US8NaPVXv06gkZFHaZnPfKWPDjRJjFRW3Y7WZ0jx72eT6zhw3VQlkMPysmXye8l35ewPHspKgbQ==} + /@tanstack/react-query@5.63.0(react@18.3.1): + resolution: {integrity: sha512-QWizLzSiog8xqIRYmuJRok9VELlXVBAwtINgVCgW1SNvamQwWDO5R0XFSkjoBEj53x9Of1KAthLRBUC5xmtVLQ==} peerDependencies: react: ^18 || ^19 dependencies: - '@tanstack/query-core': 5.52.0 + '@tanstack/query-core': 5.62.16 react: 18.3.1 dev: true @@ -10846,6 +10830,12 @@ packages: resolution: {integrity: sha512-uLJijDHN5E6j5n1qefF9oaeplgszXglWXWTviMoFr/YxgvbyrkFil20yDT7ljhCiTQ/BfCYtxfJS81LdTro5DQ==} dev: false + /@types/trusted-types@2.0.7: + resolution: {integrity: sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==} + requiresBuild: true + dev: true + optional: true + /@types/unist@2.0.10: resolution: {integrity: sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==} @@ -11536,6 +11526,12 @@ packages: engines: {node: '>=0.4.0'} hasBin: true + /acorn@8.14.0: + resolution: {integrity: sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==} + engines: {node: '>=0.4.0'} + hasBin: true + dev: true + /address@1.2.2: resolution: {integrity: sha512-4B/qKCfeE/ODUaAUpSwfzazo5x29WD4r3vXiWsB7I2mSDAihwEqKO+g8GELZUQSSAo5e1XTYh3ZVfLyxBc12nA==} engines: {node: '>= 10.0.0'} @@ -11554,6 +11550,11 @@ packages: - supports-color dev: true + /agent-base@7.1.3: + resolution: {integrity: sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==} + engines: {node: '>= 14'} + dev: true + /aggregate-error@3.1.0: resolution: {integrity: sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==} engines: {node: '>=8'} @@ -11794,12 +11795,12 @@ packages: is-array-buffer: 3.0.2 dev: true - /array-buffer-byte-length@1.0.1: - resolution: {integrity: sha512-ahC5W1xgou+KTXix4sAO8Ki12Q+jf4i0+tmk3sC+zgcynshkHxzpXdImBehiUYKKKDwvfFiJl1tZt6ewscS1Mg==} + /array-buffer-byte-length@1.0.2: + resolution: {integrity: sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.7 - is-array-buffer: 3.0.4 + call-bound: 1.0.3 + is-array-buffer: 3.0.5 dev: true /array-flatten@1.1.1: @@ -11828,9 +11829,9 @@ packages: resolution: {integrity: sha512-r+mCJ7zXgXElgR4IRC+fkvNCeoaavWBs6EdCso5Tbcf+iEMKzBU/His60lt34WEZ9vlb8wDkZvQGcVI5GwkfoQ==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 define-properties: 1.2.1 - es-abstract: 1.23.3 + es-abstract: 1.23.9 es-array-method-boxes-properly: 1.0.0 es-object-atoms: 1.0.0 is-string: 1.0.7 @@ -11851,9 +11852,9 @@ packages: resolution: {integrity: sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.7 + call-bind: 1.0.5 define-properties: 1.2.1 - es-abstract: 1.23.3 + es-abstract: 1.22.3 es-shim-unscopables: 1.0.2 dev: true @@ -11890,18 +11891,17 @@ packages: is-shared-array-buffer: 1.0.2 dev: true - /arraybuffer.prototype.slice@1.0.3: - resolution: {integrity: sha512-bMxMKAjg13EBSVscxTaYA4mRc5t1UAXa2kXiGTNfZ079HIWXEkKmkgFrh/nJqamaLSrXO5H4WFFkPEaLJWbs3A==} + /arraybuffer.prototype.slice@1.0.4: + resolution: {integrity: sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ==} engines: {node: '>= 0.4'} dependencies: - array-buffer-byte-length: 1.0.1 - call-bind: 1.0.7 + array-buffer-byte-length: 1.0.2 + call-bind: 1.0.8 define-properties: 1.2.1 - es-abstract: 1.23.3 + es-abstract: 1.23.9 es-errors: 1.3.0 - get-intrinsic: 1.2.4 - is-array-buffer: 3.0.4 - is-shared-array-buffer: 1.0.3 + get-intrinsic: 1.2.7 + is-array-buffer: 3.0.5 dev: true /arrify@1.0.1: @@ -12480,7 +12480,7 @@ packages: engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001554 + caniuse-lite: 1.0.30001651 electron-to-chromium: 1.4.566 node-releases: 2.0.13 update-browserslist-db: 1.0.13(browserslist@4.22.1) @@ -12569,16 +12569,16 @@ packages: optional: true dependencies: chokidar: 3.6.0 - confbox: 0.1.7 + confbox: 0.1.8 defu: 6.1.4 - dotenv: 16.4.5 + dotenv: 16.4.7 giget: 1.2.3 - jiti: 1.21.6 - mlly: 1.7.1 - ohash: 1.1.3 + jiti: 1.21.7 + mlly: 1.7.3 + ohash: 1.1.4 pathe: 1.1.2 perfect-debounce: 1.0.0 - pkg-types: 1.2.0 + pkg-types: 1.3.0 rc9: 2.1.2 dev: true @@ -12605,6 +12605,14 @@ packages: responselike: 3.0.0 dev: false + /call-bind-apply-helpers@1.0.1: + resolution: {integrity: sha512-BhYE+WDaywFg2TBWYNXAE+8B1ATnThNBqXHP5nQu0jWJdVvY2hvkpyB3qOmtmDePiS5/BDQ8wASEWGMWRG148g==} + engines: {node: '>= 0.4'} + dependencies: + es-errors: 1.3.0 + function-bind: 1.1.2 + dev: true + /call-bind@1.0.5: resolution: {integrity: sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==} dependencies: @@ -12612,17 +12620,24 @@ packages: get-intrinsic: 1.2.2 set-function-length: 1.1.1 - /call-bind@1.0.7: - resolution: {integrity: sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==} + /call-bind@1.0.8: + resolution: {integrity: sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==} engines: {node: '>= 0.4'} dependencies: - es-define-property: 1.0.0 - es-errors: 1.3.0 - function-bind: 1.1.2 - get-intrinsic: 1.2.4 + call-bind-apply-helpers: 1.0.1 + es-define-property: 1.0.1 + get-intrinsic: 1.2.7 set-function-length: 1.2.2 dev: true + /call-bound@1.0.3: + resolution: {integrity: sha512-YTd+6wGlNlPxSuri7Y6X8tY2dmm12UMH66RpKMhiX6rsk5wXXnYgbUcOt8kiS31/AjfoTOvCsE+w8nZQLQnzHA==} + engines: {node: '>= 0.4'} + dependencies: + call-bind-apply-helpers: 1.0.1 + get-intrinsic: 1.2.7 + dev: true + /call-me-maybe@1.0.2: resolution: {integrity: sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==} dev: true @@ -12693,9 +12708,6 @@ packages: lodash.uniq: 4.5.0 dev: false - /caniuse-lite@1.0.30001554: - resolution: {integrity: sha512-A2E3U//MBwbJVzebddm1YfNp7Nud5Ip+IPn4BozBmn4KqVX7AvluoIDFWjsv5OkGnKUXQVmMSoMKLa3ScCblcQ==} - /caniuse-lite@1.0.30001651: resolution: {integrity: sha512-9Cf+Xv1jJNe1xPZLGuUXLNkE1BoDkqRqYyFJ9TDYSqhduqA4hu4oR9HluGoWYQC/aj8WHjsGVV+bwkh0+tegRg==} @@ -12910,7 +12922,7 @@ packages: /citty@0.1.6: resolution: {integrity: sha512-tskPPKEs8D2KPafUypv2gxwJP8h/OaJmC82QQGGDQcHvXX43xF2VDACcJVmZ0EuSxkpO9Kc4MlrA3q0+FG58AQ==} dependencies: - consola: 3.2.3 + consola: 3.3.3 dev: true /cjs-module-lexer@1.2.3: @@ -12925,10 +12937,6 @@ packages: /classnames@2.3.2: resolution: {integrity: sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw==} - dev: false - - /classnames@2.5.1: - resolution: {integrity: sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==} /clean-css@5.3.2: resolution: {integrity: sha512-JVJbM+f3d3Q704rF4bqQ5UUyTtuJ0JRKNbTKVEeujCCBoMdkEi+V+e8oktO9qGQNSvHrFTM6JZRXrUvGR1czww==} @@ -13292,8 +13300,8 @@ packages: semver: 7.5.4 dev: false - /confbox@0.1.7: - resolution: {integrity: sha512-uJcB/FKZtBMCJpK8MQji6bJHgu1tixKPxRLeGkNzBoOZzpnZUJm0jm2/sBDWcuBx1dYgxV4JU+g5hmNxCyAmdA==} + /confbox@0.1.8: + resolution: {integrity: sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==} dev: true /config-chain@1.1.13: @@ -13323,8 +13331,8 @@ packages: resolution: {integrity: sha512-9vAdYbHj6x2fLKC4+oPH0kFzY/orMZyG2Aj+kNylHxKGJ/Ed4dpNyAQYwJOdqO4zdM7XpVHmyejQDcQHrnuXbw==} dev: false - /consola@3.2.3: - resolution: {integrity: sha512-I5qxpzLv+sJhTVEoLYNcTW+bThDCPsit0vLNKShZx6rLtpilNpmmeTPaeqJb9ZE9dV3DGaeby6Vuhrw38WjeyQ==} + /consola@3.3.3: + resolution: {integrity: sha512-Qil5KwghMzlqd51UXM0b6fyaGHtOC22scxrwrz4A2882LyUMwQjnvaedN1HAeXzphspQ6CpHkzMAWxBTUruDLg==} engines: {node: ^14.18.0 || >=16.10.0} dev: true @@ -13769,31 +13777,31 @@ packages: engines: {node: '>= 12'} dev: true - /data-view-buffer@1.0.1: - resolution: {integrity: sha512-0lht7OugA5x3iJLOWFhWK/5ehONdprk0ISXqVFn/NFrDu+cuc8iADFrGQz5BnRK7LLU3JmkbXSxaqX+/mXYtUA==} + /data-view-buffer@1.0.2: + resolution: {integrity: sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.7 + call-bound: 1.0.3 es-errors: 1.3.0 - is-data-view: 1.0.1 + is-data-view: 1.0.2 dev: true - /data-view-byte-length@1.0.1: - resolution: {integrity: sha512-4J7wRJD3ABAzr8wP+OcIcqq2dlUKp4DVflx++hs5h5ZKydWMI6/D/fAot+yh6g2tHh8fLFTvNOaVN357NvSrOQ==} + /data-view-byte-length@1.0.2: + resolution: {integrity: sha512-tuhGbE6CfTM9+5ANGf+oQb72Ky/0+s3xKUpHvShfiz2RxMFgFPjsXuRLBVMtvMs15awe45SRb83D6wH4ew6wlQ==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.7 + call-bound: 1.0.3 es-errors: 1.3.0 - is-data-view: 1.0.1 + is-data-view: 1.0.2 dev: true - /data-view-byte-offset@1.0.0: - resolution: {integrity: sha512-t/Ygsytq+R995EJ5PZlD4Cu56sWa8InXySaViRzw9apusqsOO2bQP+SbYzAhR0pFKoB+43lYy8rWban9JSuXnA==} + /data-view-byte-offset@1.0.1: + resolution: {integrity: sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.7 + call-bound: 1.0.3 es-errors: 1.3.0 - is-data-view: 1.0.1 + is-data-view: 1.0.2 dev: true /dataloader@2.2.2: @@ -13994,7 +14002,7 @@ packages: resolution: {integrity: sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==} engines: {node: '>= 0.4'} dependencies: - es-define-property: 1.0.0 + es-define-property: 1.0.1 es-errors: 1.3.0 gopd: 1.0.1 dev: true @@ -14220,8 +14228,10 @@ packages: dependencies: domelementtype: 2.3.0 - /dompurify@3.1.6: - resolution: {integrity: sha512-cTOAhc36AalkjtBpfG6O8JimdTMWNXjiePT2xQH/ppBGi/4uIpmj8eKyIkMJErXWARyINV/sB38yf8JCLF5pbQ==} + /dompurify@3.2.3: + resolution: {integrity: sha512-U1U5Hzc2MO0oW3DF+G9qYN0aT7atAou4AgI0XjWz061nyBPbdxkfdhfy5uMgGn6+oLFCfn44ZGbdDqCzVmlOWA==} + optionalDependencies: + '@types/trusted-types': 2.0.7 dev: true /domutils@2.8.0: @@ -14271,8 +14281,8 @@ packages: engines: {node: '>=12'} dev: true - /dotenv@16.4.5: - resolution: {integrity: sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==} + /dotenv@16.4.7: + resolution: {integrity: sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==} engines: {node: '>=12'} dev: true @@ -14281,6 +14291,15 @@ packages: engines: {node: '>=4'} dev: true + /dunder-proto@1.0.1: + resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} + engines: {node: '>= 0.4'} + dependencies: + call-bind-apply-helpers: 1.0.1 + es-errors: 1.3.0 + gopd: 1.2.0 + dev: true + /duplexer2@0.1.4: resolution: {integrity: sha512-asLFVfWWtJ90ZyOUHMqk7/S2w2guQKxUI2itj3d92ADHhxUSbCMGi1f1cBcJ7xM1To+pE/Khbwo1yuNbMEPKeA==} dependencies: @@ -14432,12 +14451,12 @@ packages: lodash.isequal: 4.5.0 object-inspect: 1.13.1 object-is: 1.1.5 - object.assign: 4.1.5 + object.assign: 4.1.4 object.entries: 1.1.7 object.values: 1.1.7 raf: 3.4.1 rst-selector-parser: 2.2.3 - string.prototype.trim: 1.2.9 + string.prototype.trim: 1.2.8 dev: true /equals@1.0.5: @@ -14496,67 +14515,70 @@ packages: which-typed-array: 1.1.13 dev: true - /es-abstract@1.23.3: - resolution: {integrity: sha512-e+HfNH61Bj1X9/jLc5v1owaLYuHdeHHSQlkhCBiTK8rBvKaULl/beGMxwrMXjpYrv4pz22BlY570vVePA2ho4A==} + /es-abstract@1.23.9: + resolution: {integrity: sha512-py07lI0wjxAC/DcfK1S6G7iANonniZwTISvdPzk9hzeH0IZIshbuuFxLIU96OyF89Yb9hiqWn8M/bY83KY5vzA==} engines: {node: '>= 0.4'} dependencies: - array-buffer-byte-length: 1.0.1 - arraybuffer.prototype.slice: 1.0.3 + array-buffer-byte-length: 1.0.2 + arraybuffer.prototype.slice: 1.0.4 available-typed-arrays: 1.0.7 - call-bind: 1.0.7 - data-view-buffer: 1.0.1 - data-view-byte-length: 1.0.1 - data-view-byte-offset: 1.0.0 - es-define-property: 1.0.0 + call-bind: 1.0.8 + call-bound: 1.0.3 + data-view-buffer: 1.0.2 + data-view-byte-length: 1.0.2 + data-view-byte-offset: 1.0.1 + es-define-property: 1.0.1 es-errors: 1.3.0 es-object-atoms: 1.0.0 - es-set-tostringtag: 2.0.3 - es-to-primitive: 1.2.1 - function.prototype.name: 1.1.6 - get-intrinsic: 1.2.4 - get-symbol-description: 1.0.2 - globalthis: 1.0.3 - gopd: 1.0.1 + es-set-tostringtag: 2.1.0 + es-to-primitive: 1.3.0 + function.prototype.name: 1.1.8 + get-intrinsic: 1.2.7 + get-proto: 1.0.1 + get-symbol-description: 1.1.0 + globalthis: 1.0.4 + gopd: 1.2.0 has-property-descriptors: 1.0.2 - has-proto: 1.0.3 - has-symbols: 1.0.3 + has-proto: 1.2.0 + has-symbols: 1.1.0 hasown: 2.0.2 - internal-slot: 1.0.7 - is-array-buffer: 3.0.4 + internal-slot: 1.1.0 + is-array-buffer: 3.0.5 is-callable: 1.2.7 - is-data-view: 1.0.1 - is-negative-zero: 2.0.3 - is-regex: 1.1.4 - is-shared-array-buffer: 1.0.3 - is-string: 1.0.7 - is-typed-array: 1.1.13 - is-weakref: 1.0.2 - object-inspect: 1.13.1 + is-data-view: 1.0.2 + is-regex: 1.2.1 + is-shared-array-buffer: 1.0.4 + is-string: 1.1.1 + is-typed-array: 1.1.15 + is-weakref: 1.1.0 + math-intrinsics: 1.1.0 + object-inspect: 1.13.3 object-keys: 1.1.1 - object.assign: 4.1.5 - regexp.prototype.flags: 1.5.2 - safe-array-concat: 1.1.2 - safe-regex-test: 1.0.3 - string.prototype.trim: 1.2.9 - string.prototype.trimend: 1.0.8 + object.assign: 4.1.7 + own-keys: 1.0.1 + regexp.prototype.flags: 1.5.4 + safe-array-concat: 1.1.3 + safe-push-apply: 1.0.0 + safe-regex-test: 1.1.0 + set-proto: 1.0.0 + string.prototype.trim: 1.2.10 + string.prototype.trimend: 1.0.9 string.prototype.trimstart: 1.0.8 - typed-array-buffer: 1.0.2 - typed-array-byte-length: 1.0.1 - typed-array-byte-offset: 1.0.2 - typed-array-length: 1.0.6 - unbox-primitive: 1.0.2 - which-typed-array: 1.1.15 + typed-array-buffer: 1.0.3 + typed-array-byte-length: 1.0.3 + typed-array-byte-offset: 1.0.4 + typed-array-length: 1.0.7 + unbox-primitive: 1.1.0 + which-typed-array: 1.1.18 dev: true /es-array-method-boxes-properly@1.0.0: resolution: {integrity: sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==} dev: true - /es-define-property@1.0.0: - resolution: {integrity: sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==} + /es-define-property@1.0.1: + resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==} engines: {node: '>= 0.4'} - dependencies: - get-intrinsic: 1.2.4 dev: true /es-errors@1.3.0: @@ -14624,11 +14646,12 @@ packages: hasown: 2.0.0 dev: true - /es-set-tostringtag@2.0.3: - resolution: {integrity: sha512-3T8uNMC3OQTHkFUsFq8r/BwAXLHvU/9O9mE0fBc/MY5iq/8H7ncvO947LmYA6ldWw9Uh8Yhf25zu6n7nML5QWQ==} + /es-set-tostringtag@2.1.0: + resolution: {integrity: sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==} engines: {node: '>= 0.4'} dependencies: - get-intrinsic: 1.2.4 + es-errors: 1.3.0 + get-intrinsic: 1.2.7 has-tostringtag: 1.0.2 hasown: 2.0.2 dev: true @@ -14636,7 +14659,7 @@ packages: /es-shim-unscopables@1.0.2: resolution: {integrity: sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==} dependencies: - hasown: 2.0.2 + hasown: 2.0.0 dev: true /es-to-primitive@1.2.1: @@ -14648,6 +14671,15 @@ packages: is-symbol: 1.0.4 dev: true + /es-to-primitive@1.3.0: + resolution: {integrity: sha512-w+5mJ3GuFL+NjVtJlvydShqE1eN3h3PbI7/5LAsYJP/2qtuMXjfL2LpHSRqo4b4eSF5K/DH1JXKUAHSB2UW50g==} + engines: {node: '>= 0.4'} + dependencies: + is-callable: 1.2.7 + is-date-object: 1.0.5 + is-symbol: 1.0.4 + dev: true + /es5-ext@0.10.62: resolution: {integrity: sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA==} engines: {node: '>=0.10'} @@ -15825,6 +15857,13 @@ packages: dependencies: punycode: 1.4.1 + /fast-xml-parser@4.5.1: + resolution: {integrity: sha512-y655CeyUQ+jj7KBbYMc4FG01V8ZQqjN+gDYGJ50RtfsUB8iG9AmwmwoAgeKLJdmueKKMrH1RJ7yXHTSoczdv5w==} + hasBin: true + dependencies: + strnum: 1.0.5 + dev: true + /fastq@1.15.0: resolution: {integrity: sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==} dependencies: @@ -16276,6 +16315,18 @@ packages: functions-have-names: 1.2.3 dev: true + /function.prototype.name@1.1.8: + resolution: {integrity: sha512-e5iwyodOHhbMr/yNrc7fDYG4qlbIvI5gajyzPnb5TCwyhjApznQh1BMFou9b30SevY43gCJKXycoCBjMbsuW0Q==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.8 + call-bound: 1.0.3 + define-properties: 1.2.1 + functions-have-names: 1.2.3 + hasown: 2.0.2 + is-callable: 1.2.7 + dev: true + /functions-have-names@1.2.3: resolution: {integrity: sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==} dev: true @@ -16305,15 +16356,20 @@ packages: has-symbols: 1.0.3 hasown: 2.0.0 - /get-intrinsic@1.2.4: - resolution: {integrity: sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==} + /get-intrinsic@1.2.7: + resolution: {integrity: sha512-VW6Pxhsrk0KAOqs3WEd0klDiF/+V7gQOpAvY1jVU/LHmaD/kQO4523aiJuikX/QAKYiW6x8Jh+RJej1almdtCA==} engines: {node: '>= 0.4'} dependencies: + call-bind-apply-helpers: 1.0.1 + es-define-property: 1.0.1 es-errors: 1.3.0 + es-object-atoms: 1.0.0 function-bind: 1.1.2 - has-proto: 1.0.3 - has-symbols: 1.0.3 + get-proto: 1.0.1 + gopd: 1.2.0 + has-symbols: 1.1.0 hasown: 2.0.2 + math-intrinsics: 1.1.0 dev: true /get-nonce@1.0.1: @@ -16343,6 +16399,14 @@ packages: engines: {node: '>=8'} dev: true + /get-proto@1.0.1: + resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==} + engines: {node: '>= 0.4'} + dependencies: + dunder-proto: 1.0.1 + es-object-atoms: 1.0.0 + dev: true + /get-source@2.0.12: resolution: {integrity: sha512-X5+4+iD+HoSeEED+uwrQ07BOQr0kEDFMVqqpBuI+RaZBpBpHCuXxo70bjar6f0b0u/DQJsJ7ssurpP0V60Az+w==} dependencies: @@ -16372,13 +16436,13 @@ packages: get-intrinsic: 1.2.2 dev: true - /get-symbol-description@1.0.2: - resolution: {integrity: sha512-g0QYk1dZBxGwk+Ngc+ltRH2IBp2f7zBkBMBJZCDerh6EhlhSR6+9irMCuT/09zD6qkarHUSn529sK/yL4S27mg==} + /get-symbol-description@1.1.0: + resolution: {integrity: sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.7 + call-bound: 1.0.3 es-errors: 1.3.0 - get-intrinsic: 1.2.4 + get-intrinsic: 1.2.7 dev: true /get-tsconfig@4.7.2: @@ -16393,7 +16457,7 @@ packages: dependencies: colorette: 2.0.20 defu: 6.1.3 - https-proxy-agent: 7.0.5 + https-proxy-agent: 7.0.2 mri: 1.2.0 node-fetch-native: 1.4.1 pathe: 1.1.2 @@ -16407,11 +16471,11 @@ packages: hasBin: true dependencies: citty: 0.1.6 - consola: 3.2.3 + consola: 3.3.3 defu: 6.1.4 node-fetch-native: 1.6.4 - nypm: 0.3.9 - ohash: 1.1.3 + nypm: 0.3.12 + ohash: 1.1.4 pathe: 1.1.2 tar: 6.2.0 dev: true @@ -16547,6 +16611,14 @@ packages: define-properties: 1.2.1 dev: true + /globalthis@1.0.4: + resolution: {integrity: sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==} + engines: {node: '>= 0.4'} + dependencies: + define-properties: 1.2.1 + gopd: 1.2.0 + dev: true + /globby@11.1.0: resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==} engines: {node: '>=10'} @@ -16574,6 +16646,11 @@ packages: dependencies: get-intrinsic: 1.2.2 + /gopd@1.2.0: + resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==} + engines: {node: '>= 0.4'} + dev: true + /got@12.6.1: resolution: {integrity: sha512-mThBblvlAF1d4O5oqyvN+ZxLAYwIJK7bpMxgYqPD9okW0C3qm5FFn7k811QrcuEBwaogR3ngOFoCfs6mRv7teQ==} engines: {node: '>=14.16'} @@ -16754,22 +16831,29 @@ packages: /has-property-descriptors@1.0.2: resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==} dependencies: - es-define-property: 1.0.0 + es-define-property: 1.0.1 dev: true /has-proto@1.0.1: resolution: {integrity: sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==} engines: {node: '>= 0.4'} - /has-proto@1.0.3: - resolution: {integrity: sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==} + /has-proto@1.2.0: + resolution: {integrity: sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ==} engines: {node: '>= 0.4'} + dependencies: + dunder-proto: 1.0.1 dev: true /has-symbols@1.0.3: resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==} engines: {node: '>= 0.4'} + /has-symbols@1.1.0: + resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==} + engines: {node: '>= 0.4'} + dev: true + /has-tostringtag@1.0.0: resolution: {integrity: sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==} engines: {node: '>= 0.4'} @@ -16781,7 +16865,7 @@ packages: resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==} engines: {node: '>= 0.4'} dependencies: - has-symbols: 1.0.3 + has-symbols: 1.1.0 dev: true /has-yarn@3.0.0: @@ -16970,7 +17054,7 @@ packages: resolution: {integrity: sha512-6XMlxrAFX4UEEGxctfFnmrFaaZFNf9i5fNuV5wZ3WWQ4FVaNP1aX1LkX9j2mfEx1NpjeE/rL3nmgEn23GdFmrg==} dependencies: array.prototype.filter: 1.0.4 - call-bind: 1.0.7 + call-bind: 1.0.5 dev: true /html-entities@2.4.0: @@ -17151,8 +17235,8 @@ packages: - supports-color dev: true - /https-proxy-agent@7.0.5: - resolution: {integrity: sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==} + /https-proxy-agent@7.0.2: + resolution: {integrity: sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==} engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 @@ -17161,6 +17245,16 @@ packages: - supports-color dev: true + /https-proxy-agent@7.0.6: + resolution: {integrity: sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==} + engines: {node: '>= 14'} + dependencies: + agent-base: 7.1.3 + debug: 4.3.6 + transitivePeerDependencies: + - supports-color + dev: true + /human-id@1.0.2: resolution: {integrity: sha512-UNopramDEhHJD+VR+ehk8rOslwSfByxPIZyJRfV739NDhN5LF1fa1MqnzKm2lGTQRjNrjK19Q5fhkgIfjlVUKw==} dev: true @@ -17508,13 +17602,13 @@ packages: side-channel: 1.0.4 dev: true - /internal-slot@1.0.7: - resolution: {integrity: sha512-NGnrKwXzSms2qUUih/ILZ5JBqNTSa1+ZmP6flaIp6KmSElgE9qdndzS3cqjrDovwFdmwsGsLdeFgB6suw+1e9g==} + /internal-slot@1.1.0: + resolution: {integrity: sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==} engines: {node: '>= 0.4'} dependencies: es-errors: 1.3.0 hasown: 2.0.2 - side-channel: 1.0.4 + side-channel: 1.1.0 dev: true /interpret@1.4.0: @@ -17587,12 +17681,13 @@ packages: is-typed-array: 1.1.12 dev: true - /is-array-buffer@3.0.4: - resolution: {integrity: sha512-wcjaerHw0ydZwfhiKbXJWLDY8A7yV7KhjQOpb83hGgGfId/aQa4TOvwyzn2PuswW2gPCYEL/nEAiSVpdOj1lXw==} + /is-array-buffer@3.0.5: + resolution: {integrity: sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.7 - get-intrinsic: 1.2.4 + call-bind: 1.0.8 + call-bound: 1.0.3 + get-intrinsic: 1.2.7 dev: true /is-arrayish@0.2.1: @@ -17611,6 +17706,13 @@ packages: has-bigints: 1.0.2 dev: true + /is-bigint@1.1.0: + resolution: {integrity: sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ==} + engines: {node: '>= 0.4'} + dependencies: + has-bigints: 1.0.2 + dev: true + /is-binary-path@2.1.0: resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} engines: {node: '>=8'} @@ -17625,6 +17727,14 @@ packages: has-tostringtag: 1.0.0 dev: true + /is-boolean-object@1.2.1: + resolution: {integrity: sha512-l9qO6eFlUETHtuihLcYOaLKByJ1f+N4kthcU9YjHy3N+B3hWv0y/2Nd0mu/7lTFnRQHTrSdXF50HQ3bl5fEnng==} + engines: {node: '>= 0.4'} + dependencies: + call-bound: 1.0.3 + has-tostringtag: 1.0.2 + dev: true + /is-buffer@1.1.6: resolution: {integrity: sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==} dev: false @@ -17659,11 +17769,13 @@ packages: kind-of: 6.0.3 dev: false - /is-data-view@1.0.1: - resolution: {integrity: sha512-AHkaJrsUVW6wq6JS8y3JnM/GJF/9cf+k20+iDzlSaJrinEo5+7vRiteOSwBhHRiAyQATN1AmY4hwzxJKPmYf+w==} + /is-data-view@1.0.2: + resolution: {integrity: sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw==} engines: {node: '>= 0.4'} dependencies: - is-typed-array: 1.1.13 + call-bound: 1.0.3 + get-intrinsic: 1.2.7 + is-typed-array: 1.1.15 dev: true /is-date-object@1.0.5: @@ -17673,6 +17785,14 @@ packages: has-tostringtag: 1.0.0 dev: true + /is-date-object@1.1.0: + resolution: {integrity: sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==} + engines: {node: '>= 0.4'} + dependencies: + call-bound: 1.0.3 + has-tostringtag: 1.0.2 + dev: true + /is-decimal@2.0.1: resolution: {integrity: sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==} dev: false @@ -17710,6 +17830,13 @@ packages: call-bind: 1.0.5 dev: true + /is-finalizationregistry@1.1.1: + resolution: {integrity: sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==} + engines: {node: '>= 0.4'} + dependencies: + call-bound: 1.0.3 + dev: true + /is-fullwidth-code-point@2.0.0: resolution: {integrity: sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==} engines: {node: '>=4'} @@ -17778,6 +17905,11 @@ packages: resolution: {integrity: sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==} dev: true + /is-map@2.0.3: + resolution: {integrity: sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==} + engines: {node: '>= 0.4'} + dev: true + /is-nan@1.3.2: resolution: {integrity: sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==} engines: {node: '>= 0.4'} @@ -17791,11 +17923,6 @@ packages: engines: {node: '>= 0.4'} dev: true - /is-negative-zero@2.0.3: - resolution: {integrity: sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==} - engines: {node: '>= 0.4'} - dev: true - /is-node-process@1.2.0: resolution: {integrity: sha512-Vg4o6/fqPxIjtxgUH5QLJhwZ7gW5diGCVlXpuUfELC62CuxM1iHcRe51f2W1FDy04Ai4KJkagKjx3XaqyfRKXw==} dev: true @@ -17812,6 +17939,14 @@ packages: has-tostringtag: 1.0.0 dev: true + /is-number-object@1.1.1: + resolution: {integrity: sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==} + engines: {node: '>= 0.4'} + dependencies: + call-bound: 1.0.3 + has-tostringtag: 1.0.2 + dev: true + /is-number@3.0.0: resolution: {integrity: sha512-4cboCqIpliH+mAvFNegjZQ4kgKc3ZUhQVr3HvWbSh5q3WH2v82ct+T2Y1hdU5Gdtorx/cLifQjqCbL7bpznLTg==} engines: {node: '>=0.10.0'} @@ -17884,6 +18019,16 @@ packages: has-tostringtag: 1.0.0 dev: true + /is-regex@1.2.1: + resolution: {integrity: sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==} + engines: {node: '>= 0.4'} + dependencies: + call-bound: 1.0.3 + gopd: 1.2.0 + has-tostringtag: 1.0.2 + hasown: 2.0.2 + dev: true + /is-regexp@1.0.0: resolution: {integrity: sha512-7zjFAPO4/gwyQAAgRRmqeEeyIICSdmCqa3tsVHMdBzaXXRiqopZL4Cyghg/XulGWrtABTpbnYYzzIRffLkP4oA==} engines: {node: '>=0.10.0'} @@ -17905,17 +18050,22 @@ packages: resolution: {integrity: sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==} dev: true + /is-set@2.0.3: + resolution: {integrity: sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==} + engines: {node: '>= 0.4'} + dev: true + /is-shared-array-buffer@1.0.2: resolution: {integrity: sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==} dependencies: call-bind: 1.0.5 dev: true - /is-shared-array-buffer@1.0.3: - resolution: {integrity: sha512-nA2hv5XIhLR3uVzDDfCIknerhx8XUKnstuOERPNNIinXG7v9u+ohXF67vxm4TPTEPU6lm61ZkwP3c9PCB97rhg==} + /is-shared-array-buffer@1.0.4: + resolution: {integrity: sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.7 + call-bound: 1.0.3 dev: true /is-stream@1.1.0: @@ -17939,6 +18089,14 @@ packages: has-tostringtag: 1.0.0 dev: true + /is-string@1.1.1: + resolution: {integrity: sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==} + engines: {node: '>= 0.4'} + dependencies: + call-bound: 1.0.3 + has-tostringtag: 1.0.2 + dev: true + /is-subdir@1.2.0: resolution: {integrity: sha512-2AT6j+gXe/1ueqbW6fLZJiIw3F8iXGJtt0yDrZaBhAZEG1raiTxKWU+IPqMCzQAXOUCKdA4UDMgacKH25XG2Cw==} engines: {node: '>=4'} @@ -17957,6 +18115,15 @@ packages: has-symbols: 1.0.3 dev: true + /is-symbol@1.1.1: + resolution: {integrity: sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w==} + engines: {node: '>= 0.4'} + dependencies: + call-bound: 1.0.3 + has-symbols: 1.1.0 + safe-regex-test: 1.1.0 + dev: true + /is-typed-array@1.1.12: resolution: {integrity: sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==} engines: {node: '>= 0.4'} @@ -17964,11 +18131,11 @@ packages: which-typed-array: 1.1.13 dev: true - /is-typed-array@1.1.13: - resolution: {integrity: sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==} + /is-typed-array@1.1.15: + resolution: {integrity: sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==} engines: {node: '>= 0.4'} dependencies: - which-typed-array: 1.1.15 + which-typed-array: 1.1.18 dev: true /is-typedarray@1.0.0: @@ -17999,12 +18166,24 @@ packages: resolution: {integrity: sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==} dev: true + /is-weakmap@2.0.2: + resolution: {integrity: sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==} + engines: {node: '>= 0.4'} + dev: true + /is-weakref@1.0.2: resolution: {integrity: sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==} dependencies: call-bind: 1.0.5 dev: true + /is-weakref@1.1.0: + resolution: {integrity: sha512-SXM8Nwyys6nT5WP6pltOwKytLV7FqQ4UiibxVmW+EIosHcmCqkkjViTb5SNssDlkCiEYRP1/pdWUKVvZBmsR2Q==} + engines: {node: '>= 0.4'} + dependencies: + call-bound: 1.0.3 + dev: true + /is-weakset@2.0.2: resolution: {integrity: sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg==} dependencies: @@ -18012,6 +18191,14 @@ packages: get-intrinsic: 1.2.2 dev: true + /is-weakset@2.0.4: + resolution: {integrity: sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ==} + engines: {node: '>= 0.4'} + dependencies: + call-bound: 1.0.3 + get-intrinsic: 1.2.7 + dev: true + /is-windows@1.0.2: resolution: {integrity: sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==} engines: {node: '>=0.10.0'} @@ -18606,8 +18793,8 @@ packages: resolution: {integrity: sha512-3TV69ZbrvV6U5DfQimop50jE9Dl6J8O1ja1dvBbMba/sZ3YBEQqJ2VZRoQPVnhlzjNtU1vaXRZVrVjU4qtm8yA==} hasBin: true - /jiti@1.21.6: - resolution: {integrity: sha512-2yTgeWTWzMWkHu6Jp9NKgePDaYHbntiwvYuuJLbbN9vl7DC9DvXKOB2BC3ZZ92D3cvV/aflH0osDfwpHepQ53w==} + /jiti@1.21.7: + resolution: {integrity: sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==} hasBin: true dev: true @@ -19329,6 +19516,11 @@ packages: hasBin: true dev: true + /math-intrinsics@1.1.0: + resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==} + engines: {node: '>= 0.4'} + dev: true + /md5-hex@3.0.1: resolution: {integrity: sha512-BUiRtTtV39LIJwinWBjqVsU9xhdnz7/i889V859IBFpuqGAj6LuOvHv5XLbgZ2R7ptJoJaEcxkv88/h25T7Ciw==} engines: {node: '>=8'} @@ -20214,20 +20406,20 @@ packages: ufo: 1.3.1 dev: true - /mlly@1.7.1: - resolution: {integrity: sha512-rrVRZRELyQzrIUAVMHxP97kv+G786pHmOKzuFII8zDYahFBS7qnHh2AlYSl1GAHhaMPCz6/oHjVMcfFYgFYHgA==} + /mlly@1.7.3: + resolution: {integrity: sha512-xUsx5n/mN0uQf4V548PKQ+YShA4/IW0KI1dZhrNrPCLG+xizETbHTkOa1f8/xut9JRPp8kQuMnz0oqwkTiLo/A==} dependencies: - acorn: 8.12.1 + acorn: 8.14.0 pathe: 1.1.2 - pkg-types: 1.2.0 + pkg-types: 1.3.0 ufo: 1.5.4 dev: true - /mobx-react-lite@4.0.7(mobx@6.13.1)(react-dom@18.3.1)(react@18.3.1): - resolution: {integrity: sha512-RjwdseshK9Mg8On5tyJZHtGD+J78ZnCnRaxeQDSiciKVQDUbfZcXhmld0VMxAwvcTnPEHZySGGewm467Fcpreg==} + /mobx-react-lite@4.1.0(mobx@6.13.5)(react-dom@18.3.1)(react@18.3.1): + resolution: {integrity: sha512-QEP10dpHHBeQNv1pks3WnHRCem2Zp636lq54M2nKO2Sarr13pL4u6diQXf65yzXUn0mkk18SyIDCm9UOJYTi1w==} peerDependencies: mobx: ^6.9.0 - react: ^16.8.0 || ^17 || ^18 + react: ^16.8.0 || ^17 || ^18 || ^19 react-dom: '*' react-native: '*' peerDependenciesMeta: @@ -20236,17 +20428,17 @@ packages: react-native: optional: true dependencies: - mobx: 6.13.1 + mobx: 6.13.5 react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - use-sync-external-store: 1.2.0(react@18.3.1) + use-sync-external-store: 1.4.0(react@18.3.1) dev: true - /mobx-react@9.1.1(mobx@6.13.1)(react-dom@18.3.1)(react@18.3.1): - resolution: {integrity: sha512-gVV7AdSrAAxqXOJ2bAbGa5TkPqvITSzaPiiEkzpW4rRsMhSec7C2NBCJYILADHKp2tzOAIETGRsIY0UaCV5aEw==} + /mobx-react@9.2.0(mobx@6.13.5)(react-dom@18.3.1)(react@18.3.1): + resolution: {integrity: sha512-dkGWCx+S0/1mfiuFfHRH8D9cplmwhxOV5CkXMp38u6rQGG2Pv3FWYztS0M7ncR6TyPRQKaTG/pnitInoYE9Vrw==} peerDependencies: mobx: ^6.9.0 - react: ^16.8.0 || ^17 || ^18 + react: ^16.8.0 || ^17 || ^18 || ^19 react-dom: '*' react-native: '*' peerDependenciesMeta: @@ -20255,14 +20447,14 @@ packages: react-native: optional: true dependencies: - mobx: 6.13.1 - mobx-react-lite: 4.0.7(mobx@6.13.1)(react-dom@18.3.1)(react@18.3.1) + mobx: 6.13.5 + mobx-react-lite: 4.1.0(mobx@6.13.5)(react-dom@18.3.1)(react@18.3.1) react: 18.3.1 react-dom: 18.3.1(react@18.3.1) dev: true - /mobx@6.13.1: - resolution: {integrity: sha512-ekLRxgjWJr8hVxj9ZKuClPwM/iHckx3euIJ3Np7zLVNtqJvfbbq7l370W/98C8EabdQ1pB5Jd3BbDWxJPNnaOg==} + /mobx@6.13.5: + resolution: {integrity: sha512-/HTWzW2s8J1Gqt+WmUj5Y0mddZk+LInejADc79NJadrWla3rHzmRHki/mnEUH1AvOmbNTZ1BRbKxr8DSgfdjMA==} dev: true /moo@0.5.2: @@ -20397,8 +20589,8 @@ packages: engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true - /nanoid@3.3.7: - resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} + /nanoid@3.3.8: + resolution: {integrity: sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true dev: true @@ -20639,16 +20831,16 @@ packages: resolution: {integrity: sha512-2vPPEi+Z7WqML2jZYddDIfy5Dqb0r2fze2zTxNNknZaFpVHU3mFB3R+DWeJWGVx0ecvttSGlJTI+WG+8Z4cDWw==} dev: true - /nypm@0.3.9: - resolution: {integrity: sha512-BI2SdqqTHg2d4wJh8P9A1W+bslg33vOE9IZDY6eR2QC+Pu1iNBVZUqczrd43rJb+fMzHU7ltAYKsEFY/kHMFcw==} + /nypm@0.3.12: + resolution: {integrity: sha512-D3pzNDWIvgA+7IORhD/IuWzEk4uXv6GsgOxiid4UU3h9oq5IqV1KtPDi63n4sZJ/xcWlr88c0QM2RgN5VbOhFA==} engines: {node: ^14.16.0 || >=16.10.0} hasBin: true dependencies: citty: 0.1.6 - consola: 3.2.3 + consola: 3.3.3 execa: 8.0.1 pathe: 1.1.2 - pkg-types: 1.2.0 + pkg-types: 1.3.0 ufo: 1.5.4 dev: true @@ -20711,6 +20903,11 @@ packages: /object-inspect@1.13.1: resolution: {integrity: sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==} + /object-inspect@1.13.3: + resolution: {integrity: sha512-kDCGIbxkDSXE3euJZZXzc6to7fCrKHNI/hSRQnRuQ+BWjFNzZwiFF8fj/6o2t2G9/jTj8PSIYTfCLelLZEeRpA==} + engines: {node: '>= 0.4'} + dev: true + /object-inspect@1.4.1: resolution: {integrity: sha512-wqdhLpfCUbEsoEwl3FXwGyv8ief1k/1aUdIPCqVnupM6e8l63BEJdiF/0swtn04/8p05tG/T0FrpTlfwvljOdw==} dev: true @@ -20736,13 +20933,15 @@ packages: has-symbols: 1.0.3 object-keys: 1.1.1 - /object.assign@4.1.5: - resolution: {integrity: sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==} + /object.assign@4.1.7: + resolution: {integrity: sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 + call-bound: 1.0.3 define-properties: 1.2.1 - has-symbols: 1.0.3 + es-object-atoms: 1.0.0 + has-symbols: 1.1.0 object-keys: 1.1.1 dev: true @@ -20750,9 +20949,9 @@ packages: resolution: {integrity: sha512-jCBs/0plmPsOnrKAfFQXRG2NFjlhZgjjcBLSmTnEhU8U6vVTsVe8ANeQJCHTl3gSsI4J+0emOoCgoKlmQPMgmA==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.7 + call-bind: 1.0.5 define-properties: 1.2.1 - es-abstract: 1.23.3 + es-abstract: 1.22.3 dev: true /object.fromentries@2.0.7: @@ -20784,17 +20983,17 @@ packages: resolution: {integrity: sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.7 + call-bind: 1.0.5 define-properties: 1.2.1 - es-abstract: 1.23.3 + es-abstract: 1.22.3 dev: true /obuf@1.1.2: resolution: {integrity: sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==} dev: false - /ohash@1.1.3: - resolution: {integrity: sha512-zuHHiGTYTA1sYJ/wZN+t5HKZaH23i4yI1HMwbuXm24Nid7Dv0KcuRlKoNKS9UNfAVSBlnGLcuQrnOKWOZoEGaw==} + /ohash@1.1.4: + resolution: {integrity: sha512-FlDryZAahJmEF3VR3w1KogSEdWX3WhA5GPakFx4J81kEAiHyLMpdLLElS8n8dfNadMgAne/MywcvmogzscVt4g==} dev: true /on-finished@2.4.1: @@ -20833,10 +21032,11 @@ packages: is-docker: 2.2.1 is-wsl: 2.2.0 - /openapi-sampler@1.5.1: - resolution: {integrity: sha512-tIWIrZUKNAsbqf3bd9U1oH6JEXo8LNYuDlXw26By67EygpjT+ArFnsxxyTMjFWRfbqo5ozkvgSQDK69Gd8CddA==} + /openapi-sampler@1.6.1: + resolution: {integrity: sha512-s1cIatOqrrhSj2tmJ4abFYZQK6l5v+V4toO5q1Pa0DyN8mtyqy2I+Qrj5W9vOELEtybIMQs/TBZGVO/DtTFK8w==} dependencies: '@types/json-schema': 7.0.15 + fast-xml-parser: 4.5.1 json-pointer: 0.6.2 dev: true @@ -20905,6 +21105,15 @@ packages: resolution: {integrity: sha512-AlWY719RF02ujitly7Kk/0QlV+pXGFDHrHf9O2OKqyqgBieaPOIeuSkL8sRK6j2WK+/ZAURq2kZsY0d8JapUiw==} dev: true + /own-keys@1.0.1: + resolution: {integrity: sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==} + engines: {node: '>= 0.4'} + dependencies: + get-intrinsic: 1.2.7 + object-keys: 1.1.1 + safe-push-apply: 1.0.0 + dev: true + /p-cancelable@3.0.0: resolution: {integrity: sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw==} engines: {node: '>=12.20'} @@ -21191,8 +21400,8 @@ packages: resolution: {integrity: sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==} dev: true - /perfect-scrollbar@1.5.5: - resolution: {integrity: sha512-dzalfutyP3e/FOpdlhVryN4AJ5XDVauVWxybSkLZmakFE2sS3y3pc4JnSprw8tGmHvkaG5Edr5T7LBTZ+WWU2g==} + /perfect-scrollbar@1.5.6: + resolution: {integrity: sha512-rixgxw3SxyJbCaSpo1n35A/fwI1r2rdwMKOTCg/AcG+xOEyZcE8UHVjpZMFCVImzsFoCZeJTT+M/rdEIQYO2nw==} dev: true /performance-now@2.1.0: @@ -21270,17 +21479,15 @@ packages: resolution: {integrity: sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==} dependencies: jsonc-parser: 3.2.0 - mlly: 1.7.1 + mlly: 1.4.2 pathe: 1.1.2 dev: true - /pkg-types@1.2.0: - resolution: {integrity: sha512-+ifYuSSqOQ8CqP4MbZA5hDpb97n3E8SVWdJe+Wms9kj745lmd3b7EZJiqvmLwAlmRfjrI7Hi5z3kdBJ93lFNPA==} + /pkg-types@1.3.0: + resolution: {integrity: sha512-kS7yWjVFCkIw9hqdJBoMxDdzEngmkr5FXeWZZfQ6GoYacjVnsW6l2CcYW/0ThD0vF4LPJgVYnrg4d0uuhwYQbg==} dependencies: - confbox: 0.1.7 - mlly: 1.7.1 - pathe: 1.1.2 - mlly: 1.4.2 + confbox: 0.1.8 + mlly: 1.7.3 pathe: 1.1.2 dev: true @@ -21840,9 +22047,9 @@ packages: resolution: {integrity: sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==} engines: {node: ^10 || ^12 || >=14} dependencies: - nanoid: 3.3.7 + nanoid: 3.3.8 picocolors: 1.0.1 - source-map-js: 1.2.0 + source-map-js: 1.2.1 dev: true /posthog-node@3.1.2: @@ -22817,10 +23024,10 @@ packages: react: 18.3.1 tslib: 2.6.2 - /react-tabs@6.0.2(react@18.3.1): - resolution: {integrity: sha512-aQXTKolnM28k3KguGDBSAbJvcowOQr23A+CUJdzJtOSDOtTwzEaJA+1U4KwhNL9+Obe+jFS7geuvA7ICQPXOnQ==} + /react-tabs@6.1.0(react@18.3.1): + resolution: {integrity: sha512-6QtbTRDKM+jA/MZTTefvigNxo0zz+gnBTVFw2CFVvq+f2BuH0nF0vDLNClL045nuTAdOoK/IL1vTP0ZLX0DAyQ==} peerDependencies: - react: ^18.0.0 + react: ^18.0.0 || ^19.0.0 dependencies: clsx: 2.0.0 prop-types: 15.8.1 @@ -22997,8 +23204,8 @@ packages: strip-indent: 3.0.0 dev: true - /redoc@2.1.5(core-js@3.33.1)(enzyme@3.11.0)(mobx@6.13.1)(react-dom@18.3.1)(react@18.3.1)(styled-components@6.1.12): - resolution: {integrity: sha512-POSbVg+7WLf+/5/c6GWLxL7+9t2D+1WlZdLN0a6qaCQc+ih3XYzteRBkXEN5kjrYrRNjdspfxTZkDLN5WV3Tzg==} + /redoc@2.2.0(core-js@3.33.1)(enzyme@3.11.0)(mobx@6.13.5)(react-dom@18.3.1)(react@18.3.1)(styled-components@6.1.14): + resolution: {integrity: sha512-52rz/xJtpUBc3Y/GAkaX03czKhQXTxoU7WnkXNzRLuGwiGb/iEO4OgwcgQqtwHWrYNaZXTyqZ4MAVXpi/e1gAg==} engines: {node: '>=6.9', npm: '>=3.0.0'} peerDependencies: core-js: ^3.1.4 @@ -23008,30 +23215,30 @@ packages: styled-components: ^4.1.1 || ^5.1.1 || ^6.0.5 dependencies: '@cfaester/enzyme-adapter-react-18': 0.8.0(enzyme@3.11.0)(react-dom@18.3.1)(react@18.3.1) - '@redocly/openapi-core': 1.21.0 - classnames: 2.5.1 + '@redocly/openapi-core': 1.27.1 + classnames: 2.3.2 core-js: 3.33.1 decko: 1.2.0 - dompurify: 3.1.6 + dompurify: 3.2.3 eventemitter3: 5.0.1 json-pointer: 0.6.2 lunr: 2.3.9 mark.js: 8.11.1 marked: 4.3.0 - mobx: 6.13.1 - mobx-react: 9.1.1(mobx@6.13.1)(react-dom@18.3.1)(react@18.3.1) - openapi-sampler: 1.5.1 + mobx: 6.13.5 + mobx-react: 9.2.0(mobx@6.13.5)(react-dom@18.3.1)(react@18.3.1) + openapi-sampler: 1.6.1 path-browserify: 1.0.1 - perfect-scrollbar: 1.5.5 + perfect-scrollbar: 1.5.6 polished: 4.2.2 prismjs: 1.29.0 prop-types: 15.8.1 react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - react-tabs: 6.0.2(react@18.3.1) + react-tabs: 6.1.0(react@18.3.1) slugify: 1.4.7 stickyfill: 1.1.1 - styled-components: 6.1.12(react-dom@18.3.1)(react@18.3.1) + styled-components: 6.1.14(react-dom@18.3.1)(react@18.3.1) swagger2openapi: 7.0.8 url-template: 2.0.8 transitivePeerDependencies: @@ -23041,6 +23248,20 @@ packages: - supports-color dev: true + /reflect.getprototypeof@1.0.10: + resolution: {integrity: sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.8 + define-properties: 1.2.1 + es-abstract: 1.23.9 + es-errors: 1.3.0 + es-object-atoms: 1.0.0 + get-intrinsic: 1.2.7 + get-proto: 1.0.1 + which-builtin-type: 1.2.1 + dev: true + /reflect.getprototypeof@1.0.4: resolution: {integrity: sha512-ECkTw8TmJwW60lOTR+ZkODISW6RQ8+2CL3COqtiJKLd6MmB45hN51HprHFziKLGkAuTGQhBb91V8cy+KHlaCjw==} engines: {node: '>= 0.4'} @@ -23086,14 +23307,16 @@ packages: set-function-name: 2.0.1 dev: true - /regexp.prototype.flags@1.5.2: - resolution: {integrity: sha512-NcDiDkTLuPR+++OCKB0nWafEmhg/Da8aUPLPMQbK+bxKKCm1/S5he+AqYa4PlMCVBalb4/yxIRub6qkEx5yJbw==} + /regexp.prototype.flags@1.5.4: + resolution: {integrity: sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 define-properties: 1.2.1 es-errors: 1.3.0 - set-function-name: 2.0.1 + get-proto: 1.0.1 + gopd: 1.2.0 + set-function-name: 2.0.2 dev: true /regexpu-core@5.3.2: @@ -23409,7 +23632,6 @@ packages: /rimraf@3.0.2: resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} - deprecated: Rimraf versions prior to v4 are no longer supported hasBin: true dependencies: glob: 7.2.3 @@ -23499,13 +23721,14 @@ packages: isarray: 2.0.5 dev: true - /safe-array-concat@1.1.2: - resolution: {integrity: sha512-vj6RsCsWBCf19jIeHEfkRMw8DPiBb+DMXklQ/1SGDHOMlHdPUkZXFQ2YdplS23zESTijAcurb1aSgJA3AgMu1Q==} + /safe-array-concat@1.1.3: + resolution: {integrity: sha512-AURm5f0jYEOydBj7VQlVvDrjeFgthDdEF5H1dP+6mNpoXOMo1quQqJ4wvJDyRZ9+pO3kGWoOdmV08cSv2aJV6Q==} engines: {node: '>=0.4'} dependencies: - call-bind: 1.0.7 - get-intrinsic: 1.2.4 - has-symbols: 1.0.3 + call-bind: 1.0.8 + call-bound: 1.0.3 + get-intrinsic: 1.2.7 + has-symbols: 1.1.0 isarray: 2.0.5 dev: true @@ -23519,6 +23742,14 @@ packages: resolution: {integrity: sha512-6pNbSMW6OhAi9j+N8V+U715yBQsaWJ7eyEUaOrawX+isg5ZxhUlV1NipNtgaKHmFGiABwt+ZF04Ii+3Xjkg+8w==} dev: true + /safe-push-apply@1.0.0: + resolution: {integrity: sha512-iKE9w/Z7xCzUMIZqdBsp6pEQvwuEebH4vdpjcDWnyzaI6yl6O9FHvVpmGelvEHNsoY6wGblkxR6Zty/h00WiSA==} + engines: {node: '>= 0.4'} + dependencies: + es-errors: 1.3.0 + isarray: 2.0.5 + dev: true + /safe-regex-test@1.0.0: resolution: {integrity: sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==} dependencies: @@ -23527,13 +23758,13 @@ packages: is-regex: 1.1.4 dev: true - /safe-regex-test@1.0.3: - resolution: {integrity: sha512-CdASjNJPvRa7roO6Ra/gLYBTzYzzPyyBXxIMdGW3USQLyjWEls2RgW5UBTXaQVp+OrpeCK3bLem8smtmheoRuw==} + /safe-regex-test@1.1.0: + resolution: {integrity: sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.7 + call-bound: 1.0.3 es-errors: 1.3.0 - is-regex: 1.1.4 + is-regex: 1.2.1 dev: true /safer-buffer@2.1.2: @@ -23752,7 +23983,7 @@ packages: define-data-property: 1.1.4 es-errors: 1.3.0 function-bind: 1.1.2 - get-intrinsic: 1.2.4 + get-intrinsic: 1.2.7 gopd: 1.0.1 has-property-descriptors: 1.0.2 dev: true @@ -23766,6 +23997,25 @@ packages: has-property-descriptors: 1.0.1 dev: true + /set-function-name@2.0.2: + resolution: {integrity: sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==} + engines: {node: '>= 0.4'} + dependencies: + define-data-property: 1.1.4 + es-errors: 1.3.0 + functions-have-names: 1.2.3 + has-property-descriptors: 1.0.2 + dev: true + + /set-proto@1.0.0: + resolution: {integrity: sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==} + engines: {node: '>= 0.4'} + dependencies: + dunder-proto: 1.0.1 + es-errors: 1.3.0 + es-object-atoms: 1.0.0 + dev: true + /setimmediate@1.0.5: resolution: {integrity: sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==} @@ -23862,6 +24112,35 @@ packages: should-util: 1.0.1 dev: true + /side-channel-list@1.0.0: + resolution: {integrity: sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==} + engines: {node: '>= 0.4'} + dependencies: + es-errors: 1.3.0 + object-inspect: 1.13.3 + dev: true + + /side-channel-map@1.0.1: + resolution: {integrity: sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==} + engines: {node: '>= 0.4'} + dependencies: + call-bound: 1.0.3 + es-errors: 1.3.0 + get-intrinsic: 1.2.7 + object-inspect: 1.13.3 + dev: true + + /side-channel-weakmap@1.0.2: + resolution: {integrity: sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==} + engines: {node: '>= 0.4'} + dependencies: + call-bound: 1.0.3 + es-errors: 1.3.0 + get-intrinsic: 1.2.7 + object-inspect: 1.13.3 + side-channel-map: 1.0.1 + dev: true + /side-channel@1.0.4: resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==} dependencies: @@ -23869,6 +24148,17 @@ packages: get-intrinsic: 1.2.2 object-inspect: 1.13.1 + /side-channel@1.1.0: + resolution: {integrity: sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==} + engines: {node: '>= 0.4'} + dependencies: + es-errors: 1.3.0 + object-inspect: 1.13.3 + side-channel-list: 1.0.0 + side-channel-map: 1.0.1 + side-channel-weakmap: 1.0.2 + dev: true + /siginfo@2.0.0: resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} dev: true @@ -24048,8 +24338,8 @@ packages: resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==} engines: {node: '>=0.10.0'} - /source-map-js@1.2.0: - resolution: {integrity: sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==} + /source-map-js@1.2.1: + resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} engines: {node: '>=0.10.0'} dev: true @@ -24074,7 +24364,6 @@ packages: /source-map@0.6.1: resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} engines: {node: '>=0.10.0'} - requiresBuild: true /source-map@0.7.4: resolution: {integrity: sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==} @@ -24347,23 +24636,26 @@ packages: side-channel: 1.0.4 dev: true - /string.prototype.trim@1.2.8: - resolution: {integrity: sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ==} + /string.prototype.trim@1.2.10: + resolution: {integrity: sha512-Rs66F0P/1kedk5lyYyH9uBzuiI/kNRmwJAR9quK6VOtIpZ2G+hMZd+HQbbv25MgCA6gEffoMZYxlTod4WcdrKA==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.5 + call-bind: 1.0.8 + call-bound: 1.0.3 + define-data-property: 1.1.4 define-properties: 1.2.1 - es-abstract: 1.22.3 + es-abstract: 1.23.9 + es-object-atoms: 1.0.0 + has-property-descriptors: 1.0.2 dev: true - /string.prototype.trim@1.2.9: - resolution: {integrity: sha512-klHuCNxiMZ8MlsOihJhJEBJAiMVqU3Z2nEXWfWnIqjN0gEFS9J9+IxKozWWtQGcgoa1WUZzLjKPTr4ZHNFTFxw==} + /string.prototype.trim@1.2.8: + resolution: {integrity: sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.7 + call-bind: 1.0.5 define-properties: 1.2.1 - es-abstract: 1.23.3 - es-object-atoms: 1.0.0 + es-abstract: 1.22.3 dev: true /string.prototype.trimend@1.0.7: @@ -24374,10 +24666,12 @@ packages: es-abstract: 1.22.3 dev: true - /string.prototype.trimend@1.0.8: - resolution: {integrity: sha512-p73uL5VCHCO2BZZ6krwwQE3kCzM7NKmis8S//xEC6fQonchbum4eP6kR4DLEjQFO3Wnj3Fuo8NM0kOSjVdHjZQ==} + /string.prototype.trimend@1.0.9: + resolution: {integrity: sha512-G7Ok5C6E/j4SGfyLCloXTrngQIQU3PWtXGst3yM7Bea9FRURf1S42ZHlZZtsNque2FN2PoUhfZXYLNWwEr4dLQ==} + engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 + call-bound: 1.0.3 define-properties: 1.2.1 es-object-atoms: 1.0.0 dev: true @@ -24394,7 +24688,7 @@ packages: resolution: {integrity: sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 define-properties: 1.2.1 es-object-atoms: 1.0.0 dev: true @@ -24510,14 +24804,18 @@ packages: acorn: 8.12.1 dev: true + /strnum@1.0.5: + resolution: {integrity: sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==} + dev: true + /style-to-object@0.4.4: resolution: {integrity: sha512-HYNoHZa2GorYNyqiCaBgsxvcJIn7OHq6inEga+E6Ke3m5JkoqpQbnFssk4jwe+K7AhGa2fcha4wSOf1Kn01dMg==} dependencies: inline-style-parser: 0.1.1 dev: false - /styled-components@6.1.12(react-dom@18.3.1)(react@18.3.1): - resolution: {integrity: sha512-n/O4PzRPhbYI0k1vKKayfti3C/IGcPf+DqcrOB7O/ab9x4u/zjqraneT5N45+sIe87cxrCApXM8Bna7NYxwoTA==} + /styled-components@6.1.14(react-dom@18.3.1)(react@18.3.1): + resolution: {integrity: sha512-KtfwhU5jw7UoxdM0g6XU9VZQFV4do+KrM8idiVCH5h4v49W+3p3yMe0icYwJgZQZepa5DbH04Qv8P0/RdcLcgg==} engines: {node: '>= 16'} peerDependencies: react: '>= 16.8.0' @@ -25483,13 +25781,13 @@ packages: is-typed-array: 1.1.12 dev: true - /typed-array-buffer@1.0.2: - resolution: {integrity: sha512-gEymJYKZtKXzzBzM4jqa9w6Q1Jjm7x2d+sh19AdsD4wqnMPDYyvwpsIc2Q/835kHuo3BEQ7CjelGhfTsoBb2MQ==} + /typed-array-buffer@1.0.3: + resolution: {integrity: sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.7 + call-bound: 1.0.3 es-errors: 1.3.0 - is-typed-array: 1.1.13 + is-typed-array: 1.1.15 dev: true /typed-array-byte-length@1.0.0: @@ -25502,15 +25800,15 @@ packages: is-typed-array: 1.1.12 dev: true - /typed-array-byte-length@1.0.1: - resolution: {integrity: sha512-3iMJ9q0ao7WE9tWcaYKIptkNBuOIcZCCT0d4MRvuuH88fEoEH62IuQe0OtraD3ebQEoTRk8XCBoknUNc1Y67pw==} + /typed-array-byte-length@1.0.3: + resolution: {integrity: sha512-BaXgOuIxz8n8pIq3e7Atg/7s+DpiYrxn4vdot3w9KbnBhcRQq6o3xemQdIfynqSeXeDrF32x+WvfzmOjPiY9lg==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 for-each: 0.3.3 - gopd: 1.0.1 - has-proto: 1.0.3 - is-typed-array: 1.1.13 + gopd: 1.2.0 + has-proto: 1.2.0 + is-typed-array: 1.1.15 dev: true /typed-array-byte-offset@1.0.0: @@ -25524,16 +25822,17 @@ packages: is-typed-array: 1.1.12 dev: true - /typed-array-byte-offset@1.0.2: - resolution: {integrity: sha512-Ous0vodHa56FviZucS2E63zkgtgrACj7omjwd/8lTEMEPFFyjfixMZ1ZXenpgCFBBt4EC1J2XsyVS2gkG0eTFA==} + /typed-array-byte-offset@1.0.4: + resolution: {integrity: sha512-bTlAFB/FBYMcuX81gbL4OcpH5PmlFHqlCCpAl8AlEzMz5k53oNDvN8p1PNOWLEmI2x4orp3raOFB51tv9X+MFQ==} engines: {node: '>= 0.4'} dependencies: available-typed-arrays: 1.0.7 - call-bind: 1.0.7 + call-bind: 1.0.8 for-each: 0.3.3 - gopd: 1.0.1 - has-proto: 1.0.3 - is-typed-array: 1.1.13 + gopd: 1.2.0 + has-proto: 1.2.0 + is-typed-array: 1.1.15 + reflect.getprototypeof: 1.0.10 dev: true /typed-array-length@1.0.4: @@ -25544,16 +25843,16 @@ packages: is-typed-array: 1.1.12 dev: true - /typed-array-length@1.0.6: - resolution: {integrity: sha512-/OxDN6OtAk5KBpGb28T+HZc2M+ADtvRxXrKKbUwtsLgdoxgX13hyy7ek6bFRl5+aBs2yZzB0c4CnQfAtVypW/g==} + /typed-array-length@1.0.7: + resolution: {integrity: sha512-3KS2b+kL7fsuk/eJZ7EQdnEmQoaho/r6KUef7hxvltNA5DR8NAUM+8wJMbJyZ4G9/7i3v5zPBIMN5aybAh2/Jg==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.7 + call-bind: 1.0.8 for-each: 0.3.3 - gopd: 1.0.1 - has-proto: 1.0.3 - is-typed-array: 1.1.13 + gopd: 1.2.0 + is-typed-array: 1.1.15 possible-typed-array-names: 1.0.0 + reflect.getprototypeof: 1.0.10 dev: true /typedarray-to-buffer@3.1.5: @@ -25622,6 +25921,16 @@ packages: which-boxed-primitive: 1.0.2 dev: true + /unbox-primitive@1.1.0: + resolution: {integrity: sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==} + engines: {node: '>= 0.4'} + dependencies: + call-bound: 1.0.3 + has-bigints: 1.0.2 + has-symbols: 1.1.0 + which-boxed-primitive: 1.1.1 + dev: true + /unc-path-regex@0.1.2: resolution: {integrity: sha512-eXL4nmJT7oCpkZsHZUOJo8hcX3GbsiDOa0Qu9F646fi8dT3XuSVopVqAcEiVzSKKH7UoDti23wNX3qGFxcW5Qg==} engines: {node: '>=0.10.0'} @@ -25776,8 +26085,8 @@ packages: /unplugin@1.5.1: resolution: {integrity: sha512-0QkvG13z6RD+1L1FoibQqnvTwVBXvS4XSPwAyinVgoOCl2jAgwzdUKmEj05o4Lt8xwQI85Hb6mSyYkcAGwZPew==} dependencies: - acorn: 8.12.1 - chokidar: 3.6.0 + acorn: 8.11.2 + chokidar: 3.5.3 webpack-sources: 3.2.3 webpack-virtual-modules: 0.6.1 dev: true @@ -25837,6 +26146,10 @@ packages: dependencies: tslib: 2.6.2 + /uri-js-replace@1.0.1: + resolution: {integrity: sha512-W+C9NWNLFOoBI2QWDp4UT9pv65r2w5Cx+3sTYFvtMdDBxkKt1syCqsUdSFAChbEe1uK5TfS04wt/nGwmaeIQ0g==} + dev: true + /uri-js@4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} dependencies: @@ -26799,6 +27112,17 @@ packages: is-symbol: 1.0.4 dev: true + /which-boxed-primitive@1.1.1: + resolution: {integrity: sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==} + engines: {node: '>= 0.4'} + dependencies: + is-bigint: 1.1.0 + is-boolean-object: 1.2.1 + is-number-object: 1.1.1 + is-string: 1.1.1 + is-symbol: 1.1.1 + dev: true + /which-builtin-type@1.1.3: resolution: {integrity: sha512-YmjsSMDBYsM1CaFiayOVT06+KJeXf0o5M/CAd4o1lTadFAtacTUM49zoYxr/oroopFDfhvN6iEcBxUyc3gvKmw==} engines: {node: '>= 0.4'} @@ -26817,6 +27141,25 @@ packages: which-typed-array: 1.1.13 dev: true + /which-builtin-type@1.2.1: + resolution: {integrity: sha512-6iBczoX+kDQ7a3+YJBnh3T+KZRxM/iYNPXicqk66/Qfm1b93iu+yOImkg0zHbj5LNOcNv1TEADiZ0xa34B4q6Q==} + engines: {node: '>= 0.4'} + dependencies: + call-bound: 1.0.3 + function.prototype.name: 1.1.8 + has-tostringtag: 1.0.2 + is-async-function: 2.0.0 + is-date-object: 1.1.0 + is-finalizationregistry: 1.1.1 + is-generator-function: 1.0.10 + is-regex: 1.2.1 + is-weakref: 1.1.0 + isarray: 2.0.5 + which-boxed-primitive: 1.1.1 + which-collection: 1.0.2 + which-typed-array: 1.1.18 + dev: true + /which-collection@1.0.1: resolution: {integrity: sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A==} dependencies: @@ -26826,6 +27169,16 @@ packages: is-weakset: 2.0.2 dev: true + /which-collection@1.0.2: + resolution: {integrity: sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==} + engines: {node: '>= 0.4'} + dependencies: + is-map: 2.0.3 + is-set: 2.0.3 + is-weakmap: 2.0.2 + is-weakset: 2.0.4 + dev: true + /which-module@2.0.1: resolution: {integrity: sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==} dev: true @@ -26849,14 +27202,15 @@ packages: has-tostringtag: 1.0.0 dev: true - /which-typed-array@1.1.15: - resolution: {integrity: sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA==} + /which-typed-array@1.1.18: + resolution: {integrity: sha512-qEcY+KJYlWyLH9vNbsr6/5j59AXk5ni5aakf8ldzBvGde6Iz4sxZGkJyWSAueTG7QhOvNRYb1lDdFmL5Td0QKA==} engines: {node: '>= 0.4'} dependencies: available-typed-arrays: 1.0.7 - call-bind: 1.0.7 + call-bind: 1.0.8 + call-bound: 1.0.3 for-each: 0.3.3 - gopd: 1.0.1 + gopd: 1.2.0 has-tostringtag: 1.0.2 dev: true From 63c4c399bbef6906f4b21103b79742a7ad11226b Mon Sep 17 00:00:00 2001 From: Robert Field Date: Thu, 9 Jan 2025 17:28:41 +0000 Subject: [PATCH 23/30] feat: updated hey-api --- packages/sdks/pim/package.json | 7 +- packages/sdks/pim/src/client/core/ApiError.ts | 25 - .../pim/src/client/core/ApiRequestOptions.ts | 21 - .../sdks/pim/src/client/core/ApiResult.ts | 7 - .../pim/src/client/core/CancelablePromise.ts | 126 - packages/sdks/pim/src/client/core/OpenAPI.ts | 56 - packages/sdks/pim/src/client/core/request.ts | 400 - packages/sdks/pim/src/client/index.ts | 3 +- packages/sdks/pim/src/client/schemas.gen.ts | 3310 ------- .../client/{services.gen.ts => sdk.gen.ts} | 1102 ++- packages/sdks/pim/src/client/types.gen.ts | 8078 ++++++----------- packages/sdks/pim/src/index.ts | 5 +- pnpm-lock.yaml | 181 +- 13 files changed, 3514 insertions(+), 9807 deletions(-) delete mode 100644 packages/sdks/pim/src/client/core/ApiError.ts delete mode 100644 packages/sdks/pim/src/client/core/ApiRequestOptions.ts delete mode 100644 packages/sdks/pim/src/client/core/ApiResult.ts delete mode 100644 packages/sdks/pim/src/client/core/CancelablePromise.ts delete mode 100644 packages/sdks/pim/src/client/core/OpenAPI.ts delete mode 100644 packages/sdks/pim/src/client/core/request.ts delete mode 100644 packages/sdks/pim/src/client/schemas.gen.ts rename packages/sdks/pim/src/client/{services.gen.ts => sdk.gen.ts} (68%) diff --git a/packages/sdks/pim/package.json b/packages/sdks/pim/package.json index aff0b792..bbe9b5b7 100644 --- a/packages/sdks/pim/package.json +++ b/packages/sdks/pim/package.json @@ -4,7 +4,8 @@ "description": "", "main": "dist/index.js", "scripts": { - "build": "tsc -p tsconfig.node.json", + "build": "pnpm openapi-ts && pnpm tsc:build", + "tsc:build": "tsc -p tsconfig.node.json", "openapi-ts": "openapi-ts" }, "exports": { @@ -23,10 +24,10 @@ ], "keywords": [], "devDependencies": { - "@hey-api/openapi-ts": "^0.48.2", + "@hey-api/openapi-ts": "0.61.2", "typescript": "^5.5.3" }, "dependencies": { - "@hey-api/client-fetch": "^0.1.7" + "@hey-api/client-fetch": "0.6.0" } } diff --git a/packages/sdks/pim/src/client/core/ApiError.ts b/packages/sdks/pim/src/client/core/ApiError.ts deleted file mode 100644 index 5499aa8f..00000000 --- a/packages/sdks/pim/src/client/core/ApiError.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { ApiRequestOptions } from "./ApiRequestOptions" -import type { ApiResult } from "./ApiResult" - -export class ApiError extends Error { - public readonly url: string - public readonly status: number - public readonly statusText: string - public readonly body: unknown - public readonly request: ApiRequestOptions - - constructor( - request: ApiRequestOptions, - response: ApiResult, - message: string, - ) { - super(message) - - this.name = "ApiError" - this.url = response.url - this.status = response.status - this.statusText = response.statusText - this.body = response.body - this.request = request - } -} diff --git a/packages/sdks/pim/src/client/core/ApiRequestOptions.ts b/packages/sdks/pim/src/client/core/ApiRequestOptions.ts deleted file mode 100644 index b5384fec..00000000 --- a/packages/sdks/pim/src/client/core/ApiRequestOptions.ts +++ /dev/null @@ -1,21 +0,0 @@ -export type ApiRequestOptions = { - readonly method: - | "GET" - | "PUT" - | "POST" - | "DELETE" - | "OPTIONS" - | "HEAD" - | "PATCH" - readonly url: string - readonly path?: Record - readonly cookies?: Record - readonly headers?: Record - readonly query?: Record - readonly formData?: Record - readonly body?: any - readonly mediaType?: string - readonly responseHeader?: string - readonly responseTransformer?: (data: unknown) => Promise - readonly errors?: Record -} diff --git a/packages/sdks/pim/src/client/core/ApiResult.ts b/packages/sdks/pim/src/client/core/ApiResult.ts deleted file mode 100644 index f88b8c64..00000000 --- a/packages/sdks/pim/src/client/core/ApiResult.ts +++ /dev/null @@ -1,7 +0,0 @@ -export type ApiResult = { - readonly body: TData - readonly ok: boolean - readonly status: number - readonly statusText: string - readonly url: string -} diff --git a/packages/sdks/pim/src/client/core/CancelablePromise.ts b/packages/sdks/pim/src/client/core/CancelablePromise.ts deleted file mode 100644 index f47db79e..00000000 --- a/packages/sdks/pim/src/client/core/CancelablePromise.ts +++ /dev/null @@ -1,126 +0,0 @@ -export class CancelError extends Error { - constructor(message: string) { - super(message) - this.name = "CancelError" - } - - public get isCancelled(): boolean { - return true - } -} - -export interface OnCancel { - readonly isResolved: boolean - readonly isRejected: boolean - readonly isCancelled: boolean - - (cancelHandler: () => void): void -} - -export class CancelablePromise implements Promise { - private _isResolved: boolean - private _isRejected: boolean - private _isCancelled: boolean - readonly cancelHandlers: (() => void)[] - readonly promise: Promise - private _resolve?: (value: T | PromiseLike) => void - private _reject?: (reason?: unknown) => void - - constructor( - executor: ( - resolve: (value: T | PromiseLike) => void, - reject: (reason?: unknown) => void, - onCancel: OnCancel, - ) => void, - ) { - this._isResolved = false - this._isRejected = false - this._isCancelled = false - this.cancelHandlers = [] - this.promise = new Promise((resolve, reject) => { - this._resolve = resolve - this._reject = reject - - const onResolve = (value: T | PromiseLike): void => { - if (this._isResolved || this._isRejected || this._isCancelled) { - return - } - this._isResolved = true - if (this._resolve) this._resolve(value) - } - - const onReject = (reason?: unknown): void => { - if (this._isResolved || this._isRejected || this._isCancelled) { - return - } - this._isRejected = true - if (this._reject) this._reject(reason) - } - - const onCancel = (cancelHandler: () => void): void => { - if (this._isResolved || this._isRejected || this._isCancelled) { - return - } - this.cancelHandlers.push(cancelHandler) - } - - Object.defineProperty(onCancel, "isResolved", { - get: (): boolean => this._isResolved, - }) - - Object.defineProperty(onCancel, "isRejected", { - get: (): boolean => this._isRejected, - }) - - Object.defineProperty(onCancel, "isCancelled", { - get: (): boolean => this._isCancelled, - }) - - return executor(onResolve, onReject, onCancel as OnCancel) - }) - } - - get [Symbol.toStringTag]() { - return "Cancellable Promise" - } - - public then( - onFulfilled?: ((value: T) => TResult1 | PromiseLike) | null, - onRejected?: ((reason: unknown) => TResult2 | PromiseLike) | null, - ): Promise { - return this.promise.then(onFulfilled, onRejected) - } - - public catch( - onRejected?: ((reason: unknown) => TResult | PromiseLike) | null, - ): Promise { - return this.promise.catch(onRejected) - } - - public finally(onFinally?: (() => void) | null): Promise { - return this.promise.finally(onFinally) - } - - public cancel(): void { - if (this._isResolved || this._isRejected || this._isCancelled) { - return - } - this._isCancelled = true - if (this.cancelHandlers.length) { - try { - for (const cancelHandler of this.cancelHandlers) { - cancelHandler() - } - } catch (error) { - console.warn("Cancellation threw an error", error) - return - } - } - this.cancelHandlers.length = 0 - if (this._reject) this._reject(new CancelError("Request aborted")) - } - - public get isCancelled(): boolean { - return this._isCancelled - } -} diff --git a/packages/sdks/pim/src/client/core/OpenAPI.ts b/packages/sdks/pim/src/client/core/OpenAPI.ts deleted file mode 100644 index 67761c5d..00000000 --- a/packages/sdks/pim/src/client/core/OpenAPI.ts +++ /dev/null @@ -1,56 +0,0 @@ -import type { ApiRequestOptions } from "./ApiRequestOptions.ts" - -type Headers = Record -type Middleware = (value: T) => T | Promise -type Resolver = (options: ApiRequestOptions) => Promise - -export class Interceptors { - _fns: Middleware[] - - constructor() { - this._fns = [] - } - - eject(fn: Middleware): void { - const index = this._fns.indexOf(fn) - if (index !== -1) { - this._fns = [...this._fns.slice(0, index), ...this._fns.slice(index + 1)] - } - } - - use(fn: Middleware): void { - this._fns = [...this._fns, fn] - } -} - -export type OpenAPIConfig = { - BASE: string - CREDENTIALS: "include" | "omit" | "same-origin" - ENCODE_PATH?: ((path: string) => string) | undefined - HEADERS?: Headers | Resolver | undefined - PASSWORD?: string | Resolver | undefined - TOKEN?: string | Resolver | undefined - USERNAME?: string | Resolver | undefined - VERSION: string - WITH_CREDENTIALS: boolean - interceptors: { - request: Interceptors - response: Interceptors - } -} - -export const OpenAPI: OpenAPIConfig = { - BASE: "https://euwest.api.elasticpath.com", - CREDENTIALS: "include", - ENCODE_PATH: undefined, - HEADERS: undefined, - PASSWORD: undefined, - TOKEN: undefined, - USERNAME: undefined, - VERSION: "1.0.0", - WITH_CREDENTIALS: false, - interceptors: { - request: new Interceptors(), - response: new Interceptors(), - }, -} diff --git a/packages/sdks/pim/src/client/core/request.ts b/packages/sdks/pim/src/client/core/request.ts deleted file mode 100644 index c4f42672..00000000 --- a/packages/sdks/pim/src/client/core/request.ts +++ /dev/null @@ -1,400 +0,0 @@ -import { ApiError } from "./ApiError" -import type { ApiRequestOptions } from "./ApiRequestOptions" -import type { ApiResult } from "./ApiResult" -import { CancelablePromise } from "./CancelablePromise" -import type { OnCancel } from "./CancelablePromise" -import type { OpenAPIConfig } from "./OpenAPI" - -export const isString = (value: unknown): value is string => { - return typeof value === "string" -} - -export const isStringWithValue = (value: unknown): value is string => { - return isString(value) && value !== "" -} - -export const isBlob = (value: any): value is Blob => { - return value instanceof Blob -} - -export const isFormData = (value: unknown): value is FormData => { - return value instanceof FormData -} - -export const base64 = (str: string): string => { - try { - return btoa(str) - } catch (err) { - // @ts-ignore - return Buffer.from(str).toString("base64") - } -} - -export const getQueryString = (params: Record): string => { - const qs: string[] = [] - - const append = (key: string, value: unknown) => { - qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`) - } - - const encodePair = (key: string, value: unknown) => { - if (value === undefined || value === null) { - return - } - - if (value instanceof Date) { - append(key, value.toISOString()) - } else if (Array.isArray(value)) { - value.forEach((v) => encodePair(key, v)) - } else if (typeof value === "object") { - Object.entries(value).forEach(([k, v]) => encodePair(`${key}[${k}]`, v)) - } else { - append(key, value) - } - } - - Object.entries(params).forEach(([key, value]) => encodePair(key, value)) - - return qs.length ? `?${qs.join("&")}` : "" -} - -const getUrl = (config: OpenAPIConfig, options: ApiRequestOptions): string => { - const encoder = config.ENCODE_PATH || encodeURI - - const path = options.url - .replace("{api-version}", config.VERSION) - .replace(/{(.*?)}/g, (substring: string, group: string) => { - if (options.path?.hasOwnProperty(group)) { - return encoder(String(options.path[group])) - } - return substring - }) - - const url = config.BASE + path - return options.query ? url + getQueryString(options.query) : url -} - -export const getFormData = ( - options: ApiRequestOptions, -): FormData | undefined => { - if (options.formData) { - const formData = new FormData() - - const process = (key: string, value: unknown) => { - if (isString(value) || isBlob(value)) { - formData.append(key, value) - } else { - formData.append(key, JSON.stringify(value)) - } - } - - Object.entries(options.formData) - .filter(([, value]) => value !== undefined && value !== null) - .forEach(([key, value]) => { - if (Array.isArray(value)) { - value.forEach((v) => process(key, v)) - } else { - process(key, value) - } - }) - - return formData - } - return undefined -} - -type Resolver = (options: ApiRequestOptions) => Promise - -export const resolve = async ( - options: ApiRequestOptions, - resolver?: T | Resolver, -): Promise => { - if (typeof resolver === "function") { - return (resolver as Resolver)(options) - } - return resolver -} - -export const getHeaders = async ( - config: OpenAPIConfig, - options: ApiRequestOptions, -): Promise => { - const [token, username, password, additionalHeaders] = await Promise.all([ - // @ts-ignore - resolve(options, config.TOKEN), - // @ts-ignore - resolve(options, config.USERNAME), - // @ts-ignore - resolve(options, config.PASSWORD), - // @ts-ignore - resolve(options, config.HEADERS), - ]) - - const headers = Object.entries({ - Accept: "application/json", - ...additionalHeaders, - ...options.headers, - }) - .filter(([, value]) => value !== undefined && value !== null) - .reduce( - (headers, [key, value]) => ({ - ...headers, - [key]: String(value), - }), - {} as Record, - ) - - if (isStringWithValue(token)) { - headers["Authorization"] = `Bearer ${token}` - } - - if (isStringWithValue(username) && isStringWithValue(password)) { - const credentials = base64(`${username}:${password}`) - headers["Authorization"] = `Basic ${credentials}` - } - - if (options.body !== undefined) { - if (options.mediaType) { - headers["Content-Type"] = options.mediaType - } else if (isBlob(options.body)) { - headers["Content-Type"] = options.body.type || "application/octet-stream" - } else if (isString(options.body)) { - headers["Content-Type"] = "text/plain" - } else if (!isFormData(options.body)) { - headers["Content-Type"] = "application/json" - } - } - - return new Headers(headers) -} - -export const getRequestBody = (options: ApiRequestOptions): unknown => { - if (options.body !== undefined) { - if ( - options.mediaType?.includes("application/json") || - options.mediaType?.includes("+json") - ) { - return JSON.stringify(options.body) - } else if ( - isString(options.body) || - isBlob(options.body) || - isFormData(options.body) - ) { - return options.body - } else { - return JSON.stringify(options.body) - } - } - return undefined -} - -export const sendRequest = async ( - config: OpenAPIConfig, - options: ApiRequestOptions, - url: string, - body: any, - formData: FormData | undefined, - headers: Headers, - onCancel: OnCancel, -): Promise => { - const controller = new AbortController() - - let request: RequestInit = { - headers, - body: body ?? formData, - method: options.method, - signal: controller.signal, - } - - if (config.WITH_CREDENTIALS) { - request.credentials = config.CREDENTIALS - } - - for (const fn of config.interceptors.request._fns) { - request = await fn(request) - } - - onCancel(() => controller.abort()) - - return await fetch(url, request) -} - -export const getResponseHeader = ( - response: Response, - responseHeader?: string, -): string | undefined => { - if (responseHeader) { - const content = response.headers.get(responseHeader) - if (isString(content)) { - return content - } - } - return undefined -} - -export const getResponseBody = async (response: Response): Promise => { - if (response.status !== 204) { - try { - const contentType = response.headers.get("Content-Type") - if (contentType) { - const binaryTypes = [ - "application/octet-stream", - "application/pdf", - "application/zip", - "audio/", - "image/", - "video/", - ] - if ( - contentType.includes("application/json") || - contentType.includes("+json") - ) { - return await response.json() - } else if (binaryTypes.some((type) => contentType.includes(type))) { - return await response.blob() - } else if (contentType.includes("multipart/form-data")) { - return await response.formData() - } else if (contentType.includes("text/")) { - return await response.text() - } - } - } catch (error) { - console.error(error) - } - } - return undefined -} - -export const catchErrorCodes = ( - options: ApiRequestOptions, - result: ApiResult, -): void => { - const errors: Record = { - 400: "Bad Request", - 401: "Unauthorized", - 402: "Payment Required", - 403: "Forbidden", - 404: "Not Found", - 405: "Method Not Allowed", - 406: "Not Acceptable", - 407: "Proxy Authentication Required", - 408: "Request Timeout", - 409: "Conflict", - 410: "Gone", - 411: "Length Required", - 412: "Precondition Failed", - 413: "Payload Too Large", - 414: "URI Too Long", - 415: "Unsupported Media Type", - 416: "Range Not Satisfiable", - 417: "Expectation Failed", - 418: "Im a teapot", - 421: "Misdirected Request", - 422: "Unprocessable Content", - 423: "Locked", - 424: "Failed Dependency", - 425: "Too Early", - 426: "Upgrade Required", - 428: "Precondition Required", - 429: "Too Many Requests", - 431: "Request Header Fields Too Large", - 451: "Unavailable For Legal Reasons", - 500: "Internal Server Error", - 501: "Not Implemented", - 502: "Bad Gateway", - 503: "Service Unavailable", - 504: "Gateway Timeout", - 505: "HTTP Version Not Supported", - 506: "Variant Also Negotiates", - 507: "Insufficient Storage", - 508: "Loop Detected", - 510: "Not Extended", - 511: "Network Authentication Required", - ...options.errors, - } - - const error = errors[result.status] - if (error) { - throw new ApiError(options, result, error) - } - - if (!result.ok) { - const errorStatus = result.status ?? "unknown" - const errorStatusText = result.statusText ?? "unknown" - const errorBody = (() => { - try { - return JSON.stringify(result.body, null, 2) - } catch (e) { - return undefined - } - })() - - throw new ApiError( - options, - result, - `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`, - ) - } -} - -/** - * Request method - * @param config The OpenAPI configuration object - * @param options The request options from the service - * @returns CancelablePromise - * @throws ApiError - */ -export const request = ( - config: OpenAPIConfig, - options: ApiRequestOptions, -): CancelablePromise => { - return new CancelablePromise(async (resolve, reject, onCancel) => { - try { - const url = getUrl(config, options) - const formData = getFormData(options) - const body = getRequestBody(options) - const headers = await getHeaders(config, options) - - if (!onCancel.isCancelled) { - let response = await sendRequest( - config, - options, - url, - body, - formData, - headers, - onCancel, - ) - - for (const fn of config.interceptors.response._fns) { - response = await fn(response) - } - - const responseBody = await getResponseBody(response) - const responseHeader = getResponseHeader( - response, - options.responseHeader, - ) - - let transformedBody = responseBody - if (options.responseTransformer && response.ok) { - transformedBody = await options.responseTransformer(responseBody) - } - - const result: ApiResult = { - url, - ok: response.ok, - status: response.status, - statusText: response.statusText, - body: responseHeader ?? transformedBody, - } - - catchErrorCodes(options, result) - - resolve(result.body) - } - } catch (error) { - reject(error) - } - }) -} diff --git a/packages/sdks/pim/src/client/index.ts b/packages/sdks/pim/src/client/index.ts index a8a3135a..bbc0aa80 100644 --- a/packages/sdks/pim/src/client/index.ts +++ b/packages/sdks/pim/src/client/index.ts @@ -1,4 +1,3 @@ // This file is auto-generated by @hey-api/openapi-ts -export * from "./schemas.gen" -export * from "./services.gen" +export * from "./sdk.gen" export * from "./types.gen" diff --git a/packages/sdks/pim/src/client/schemas.gen.ts b/packages/sdks/pim/src/client/schemas.gen.ts deleted file mode 100644 index 60a1ae74..00000000 --- a/packages/sdks/pim/src/client/schemas.gen.ts +++ /dev/null @@ -1,3310 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -export const $job = { - type: "object", - properties: { - id: { - description: "A unique identifier generated when a job is created.", - type: "string", - }, - type: { - description: - "This represents the type of resource object being returned. Always `pim-job`.", - type: "string", - enum: ["pim-job"], - }, - attributes: { - type: "object", - properties: { - started_at: { - description: "The date and time a job is started.", - type: "string", - example: "2020-09-22T09:00:00", - format: "date-time", - nullable: true, - }, - completed_at: { - type: "string", - example: "2020-09-22T09:00:00", - format: "date-time", - nullable: true, - description: "The date and time a job is completed.", - }, - created_at: { - type: "string", - description: "The date and time a job is created.", - example: "2020-09-22T09:00:00", - format: "date-time", - }, - updated_at: { - type: "string", - description: "The date and time a job is updated.", - example: "2020-09-22T09:00:00", - format: "date-time", - }, - type: { - type: "string", - description: `The status of a job. - -* \`pending\` - Commerce has received the request but is currently busy processing other requests. -* \`started\` - Commerce has started processing the job. -* \`success\` - The job has successfully completed. -* \`failed\` - The job has failed. -`, - enum: [ - "child-products", - "product-import", - "product-export", - "hierarchy-duplicate", - "price-import", - ], - }, - status: { - type: "string", - enum: ["pending", "cancelled", "started", "success", "failed"], - }, - }, - }, - meta: { - type: "object", - properties: { - x_request_id: { - type: "string", - description: - "Applies to all job types. A unique request ID is generated when a job is created.", - }, - copied_from: { - type: "string", - description: - "Applies to `hierarchy-duplicate` job types. The ID of the original hierarchy that you duplicated.", - }, - hierarchy_id: { - type: "string", - description: - "Applies to `hierarchy-duplicate` job types. The duplicated hierarchy ID.", - }, - file_locations: { - type: "array", - nullable: true, - description: - "If the job type is `product_export`, a link to the file is created when running a job.", - items: { - type: "string", - }, - }, - filter: { - type: "string", - description: - "The entities included in the job. For example, if the job type is `product-export`, the PXM products included in the export.", - }, - }, - }, - }, -} as const - -export const $multi = { - type: "object", - properties: { - data: { - description: "An array of jobs.", - type: "array", - items: { - $ref: "#/components/schemas/job", - }, - }, - meta: { - type: "object", - properties: { - results: { - description: "Contains the results for the entire collection.", - type: "object", - properties: { - total: { - description: "Total number of results for the entire collection.", - type: "integer", - example: 2, - }, - }, - }, - }, - }, - }, -} as const - -export const $error = { - required: ["errors"], - properties: { - errors: { - type: "array", - items: { - required: ["status", "title"], - properties: { - status: { - type: "string", - description: "The HTTP response code of the error.", - example: "500", - }, - title: { - type: "string", - description: "A brief summary of the error.", - example: "Internal server error", - }, - detail: { - type: "string", - description: "Optional additional detail about the error.", - example: "An internal error has occurred.", - }, - request_id: { - type: "string", - description: "Internal request ID.", - example: "00000000-0000-0000-0000-000000000000", - }, - meta: { - type: "object", - description: "Additional supporting meta data for the error.", - example: { - missing_ids: ["e7d50bd5-1833-43c0-9848-f9d325b08be8"], - }, - }, - }, - }, - }, - }, -} as const - -export const $single = { - type: "object", - properties: { - data: { - $ref: "#/components/schemas/job", - }, - }, -} as const - -export const $errors = { - type: "object", - properties: { - data: { - type: "array", - description: "An array of job errors.", - items: { - type: "object", - properties: { - type: { - description: - "This represents the type of resource object being returned. Always `pim-job-error`.", - type: "string", - example: "pim-job-error", - enum: ["pim-job-error"], - }, - id: { - description: - "A unique identifier for a job error generated when a job error is created.", - type: "string", - }, - attributes: { - type: "object", - properties: { - message: { - description: "A description of an error message.", - type: "string", - example: - "data.attributes.sku: Must be unique amongst products.", - }, - }, - }, - }, - }, - }, - }, -} as const - -export const $product_custom_inputs = { - type: "object", - description: - "You use the `custom_inputs` attribute to allow your shoppers to add custom text to a product when adding product items to their carts. This is useful, for example, if you have a product like a T-shirt that can be personalized or you sell greetings cards that can be printed with your shoppers personalized messages. See [Personalizing Products](/docs/api/pxm/products/create-product#personalizing-products).", - additionalProperties: { - description: - "A name for the custom text field. You can rename this to something more representative of the input that shoppers are adding, for example, `message` or `front`.", - type: "object", - properties: { - name: { - type: "string", - description: "A name for the custom text field.", - }, - validation_rules: { - type: "array", - description: "The validation rules for the custom text.", - }, - type: { - description: "This represents the type of the resource being returned.", - type: "string", - }, - options: { - type: "object", - description: "The length of the custom input text field.", - }, - max_length: { - type: "integer", - description: - "The number of characters the custom text field can be. You can specify a maximum length up to 255 characters, as the limit is 255 characters.", - }, - required: { - type: "boolean", - description: `\`true\` or \`false\` depending on whether the custom text is required.`, - }, - }, - }, -} as const - -export const $product_build_rules = { - type: "object", - description: - "You can build a combination of child products associated with a product, based on build rules that you specify. This is useful, for example, if you have a variation option that you do not sell. This makes managing and building your child products quick and easy. See [Using Build Rules](/docs/api/pxm/products/build-child-products#using-build-rules).", - properties: { - default: { - description: - "Specifies the default behaviour, either `include` or `exclude`.", - type: "string", - enum: ["include", "exclude"], - }, - include: { - description: - "An array of option IDs to include when child products are built. Each combination consists of a nested array of option IDs from one or more variations. Combinations of option IDs in the nested arrays must come from different variations.", - type: "array", - items: { - type: "array", - items: { - type: "string", - }, - }, - }, - exclude: { - description: - "An array of option IDs to exclude when child products are built. Each combination consists of a nested array of option IDs from one or more variations. Combinations of option IDs in the nested arrays must come from different variations.", - type: "array", - items: { - type: "array", - items: { - type: "string", - }, - }, - }, - }, -} as const - -export const $product_bundle_components = { - type: "object", - description: - "With Product Experience Manager, you can create and manage bundles. A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. See [Bundles](/docs/api/pxm/products/products#bundles).", - additionalProperties: { - description: - "The name of the component, such as `games`. The `bundle_configuration` uses the component name to reference a component. A component name should be relatively short and must not contain any special characters.", - type: "object", - properties: { - name: { - type: "string", - description: - "The component name. The component name is the name that is displayed in your storefront.", - }, - options: { - type: "array", - description: - "The product options included in a component. This can be the ID of another bundle.", - items: { - type: "object", - properties: { - id: { - type: "string", - description: - "The unique ID of the product you want to add to a component.", - }, - type: { - type: "string", - description: - "This represents the type of object being returned. Always `product`.", - }, - quantity: { - type: "integer", - description: - "The number of this product option that a shopper must purchase.", - }, - sort_order: { - type: "integer", - description: - "The sort order of the options. The `create a bundle` and `update a bundle` endpoints do not sort the options. You can use the `sort_order` attribute when programming your storefront to display the options in the order that you want.", - }, - default: { - description: - "Whether the product option is a default option in a bundle. Shoppers can select a bundle that specifies a default list of product options. See [Dynamic Bundles](/docs/api/pxm/products/products#dynamic-bundles).", - type: "boolean", - }, - }, - }, - }, - min: { - type: "integer", - description: - "The minimum number of product options a shopper can select from this component.", - }, - max: { - type: "integer", - description: - "The maximum number of product options a shopper can select from this component.", - }, - sort_order: { - type: "integer", - description: - "The sort order of the components. The `create a bundle` and `update a bundle` endpoints do not sort the components. You can use the `sort_order` attribute when programming your storefront to display the components in the order that you want.", - }, - }, - }, -} as const - -export const $product_response = { - type: "object", - properties: { - id: { - description: - "A unique product ID that is generated when you create the product.", - type: "string", - }, - type: { - description: - "This represents the type of resource object being returned. Always `product`.", - type: "string", - enum: ["product"], - }, - attributes: { - type: "object", - additionalProperties: false, - properties: { - name: { - description: "A name for the product.", - type: "string", - }, - description: { - description: "A description for the product.", - type: "string", - }, - slug: { - description: - "A label for the product that is used in the URL paths. A slug can contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. By default, the product name is used as the slug.", - type: "string", - }, - sku: { - description: "The unique stock keeping unit of the product.", - type: "string", - }, - status: { - description: "The status for the product, either `draft` or `live`.", - type: "string", - enum: ["live", "draft"], - }, - commodity_type: { - description: "The commodity type, either `physical` or `digital`.", - type: "string", - enum: ["physical", "digital"], - }, - upc_ean: { - description: - "The universal product code or european article number of the product.", - type: "string", - }, - mpn: { - description: "The manufacturer part number of the product.", - type: "string", - }, - external_ref: { - description: - "The unique attribute associated with the product. This could be an external reference from a separate company system, for example. The maximum length is 2048 characters.", - type: "string", - }, - locales: { - description: - "Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want.", - type: "object", - }, - tags: { - description: - "You can use product tags to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. A product can have up to 20 tags. A product tag can be up to 255 characters. Product tags must not contain any spaces or commas.", - type: "array", - items: { - type: "string", - }, - }, - extensions: { - type: "object", - additionalProperties: { - type: "object", - additionalProperties: { - oneOf: [ - { - type: "string", - nullable: true, - }, - { - type: "integer", - }, - { - type: "boolean", - }, - ], - }, - }, - }, - custom_inputs: { - $ref: "#/components/schemas/product_custom_inputs", - }, - build_rules: { - $ref: "#/components/schemas/product_build_rules", - }, - components: { - $ref: "#/components/schemas/product_bundle_components", - }, - }, - }, - meta: { - type: "object", - properties: { - created_at: { - description: "The date and time a product is created.", - type: "string", - example: "2020-09-22T09:00:00", - format: "date-time", - }, - updated_at: { - description: "The date and time a product is updated.", - type: "string", - example: "2020-09-22T09:00:00", - format: "date-time", - }, - owner: { - description: "The resource owner, either `organization` or `store`.", - type: "string", - enum: ["organization", "store"], - }, - variations: { - description: - "A product's variations and the options defined for each variation. If you have specified `build_rules`, only the child products included in the `build_rules` are specified.", - type: "array", - items: { - type: "object", - properties: { - id: { - type: "string", - description: - "A unique ID generated when a variation is created.", - }, - name: { - type: "string", - description: "The name of a variation.", - }, - options: { - type: "array", - items: { - type: "object", - description: "The options available for this variation.", - properties: { - id: { - type: "string", - description: - "A unique ID that is generated an option is created.", - }, - name: { - type: "string", - description: "The name of an option.", - }, - description: { - type: "string", - description: "A description of an option.", - }, - }, - }, - }, - }, - }, - }, - product_types: { - description: `One of the following product types: - -- \`standard\` - A \`standard\` product is a standalone product. -- \`parent\` - A \`parent\` product is a product that has child products that have been built using the \`Build Child Products\` endpoint. -- \`child\` - When you configure product variations and variation options for \`parent\` products, the \`child\` products derived from the \`parent\` products are automatically created in Commerce. -- \`bundle\` - A \`bundle\` is a purchasable product, comprising one or more standalone products (in other words, components) to be sold together. -`, - type: "array", - items: { - type: "string", - enum: ["parent", "child", "bundle", "standard"], - }, - }, - variation_matrix: { - description: - "The child products defined for a product. The order of the variations in the `variation_matrix` is the order of the variations in the array when the variations were linked to the product. For example, the first variation in the `variation_matrix` corresponds to the first variation in the array, and so on. You can use the `sort_order`attribute to sort the order of your variation and variation options in the `variation_matrix` object. See [Sorting the Order of Variations and Options](/docs/api/pxm/products/variations#sorting-the-order-of-variations-and-options) If no variations are defined for a product, the `variation_matrix` is empty.", - type: "object", - }, - }, - }, - relationships: { - description: - "Relationships are established between different product entities. For example, a `bundle` product and a `child` product are related to a `parent` product, as both are associated with it.", - type: "object", - additionalProperties: { - type: "object", - properties: { - data: { - oneOf: [ - { - type: "array", - items: { - type: "object", - properties: { - id: { - description: "A unique identifier for a resource.", - type: "string", - }, - type: { - description: - "This represents the type of resource object being returned.", - type: "string", - }, - }, - }, - }, - { - type: "object", - nullable: true, - properties: { - id: { - description: "A unique identifier for a resource.", - type: "string", - }, - type: { - description: - "This represents the type of resource object being returned.", - type: "string", - }, - }, - }, - ], - }, - links: { - description: `Links are used to allow you to move between requests. Single entities use a \`self\` parameter with a link to that specific resource. Sometimes, there are not enough entities for a project to fill multiple pages. In this situation, we return some defaults. - - | Property | Description | - | :--- | :--- | - | \`current\` | Always the current page. | - | \`first\` | Always the first page. | - | \`last\` | \`null\` if there is only one page. | - | \`prev\` | \`null\` if the user is on the first page. | - | \`next\` | \`null\` if there is only one page. | -`, - type: "object", - additionalProperties: { - type: "string", - }, - }, - }, - }, - }, - }, -} as const - -export const $multi_product_response = { - type: "object", - properties: { - data: { - type: "array", - items: { - $ref: "#/components/schemas/product_response", - }, - }, - included: { - type: "object", - description: - "Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned.", - properties: { - component_products: { - description: - "Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned.", - type: "array", - items: { - $ref: "#/components/schemas/product_response", - }, - }, - }, - }, - meta: { - type: "object", - properties: { - results: { - description: "Contains the results for the entire collection.", - type: "object", - properties: { - total: { - description: "Total number of results for the entire collection.", - type: "integer", - example: 2, - }, - }, - }, - }, - }, - }, -} as const - -export const $product_locales = { - type: "object", - description: - "Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want.", - additionalProperties: { - description: - "A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used.", - type: "object", - required: ["name"], - properties: { - name: { - type: "string", - description: "A localized name for the product.", - }, - description: { - type: "string", - description: "A localized description for the product.", - }, - }, - }, -} as const - -export const $product_attributes = { - type: "object", - additionalProperties: false, - properties: { - external_ref: { - type: "string", - description: - "The unique attribute associated with the product. This could be an external reference from a separate company system, for example. The maximum length is 2048 characters.", - }, - name: { - type: "string", - description: "The product name to display to customers.", - }, - description: { - description: "A description for the product.", - type: "string", - }, - slug: { - type: "string", - description: - "The unique slug of the product. A slug can contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.", - }, - sku: { - type: "string", - description: "The unique stock keeping unit of the product.", - }, - status: { - type: "string", - enum: ["live", "draft"], - description: - "The status for the product, either `draft` or `live`. Default is `draft`.", - }, - commodity_type: { - description: "The commodity type, either `physical` or `digital`.", - type: "string", - enum: ["physical", "digital"], - }, - upc_ean: { - type: "string", - description: - "The universal product code or european article number of the product.", - }, - mpn: { - type: "string", - description: "The manufacturer part number of the product.", - }, - tags: { - type: "array", - description: - "You can use product tags to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. A product can have up to 20 tags. A product tag can be up to 255 characters. Product tags must not contain any spaces or commas. See [Product Tags](/docs/api/pxm/products/product-tags).", - items: { - type: "string", - }, - }, - build_rules: { - $ref: "#/components/schemas/product_build_rules", - }, - locales: { - $ref: "#/components/schemas/product_locales", - }, - custom_inputs: { - $ref: "#/components/schemas/product_custom_inputs", - }, - components: { - $ref: "#/components/schemas/product_bundle_components", - }, - }, -} as const - -export const $create_product_request = { - type: "object", - required: ["data"], - properties: { - data: { - type: "object", - required: ["type", "attributes"], - properties: { - type: { - description: - "This represents the type of resource being returned. Always `product`.", - type: "string", - enum: ["product"], - example: "product", - }, - attributes: { - $ref: "#/components/schemas/product_attributes", - }, - relationships: { - description: - "Relationships are established between different product entities.", - type: "object", - properties: { - variations: { - type: "object", - properties: { - data: { - type: "array", - items: { - type: "object", - properties: { - id: { - description: "A unique identifier for a resource.", - type: "string", - }, - type: { - description: - "This represents the type of resource object being returned.", - type: "string", - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, -} as const - -export const $single_product_response = { - type: "object", - properties: { - data: { - $ref: "#/components/schemas/product_response", - }, - included: { - type: "object", - description: - "Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned.", - properties: { - component_products: { - description: - "A list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned.", - type: "array", - items: { - $ref: "#/components/schemas/product_response", - }, - }, - }, - }, - }, -} as const - -export const $update_product_request = { - type: "object", - required: ["data"], - properties: { - data: { - type: "object", - required: ["type", "attributes", "id"], - properties: { - type: { - description: - "This represents the type of resource object being returned. Always `product`.", - type: "string", - enum: ["product"], - example: "product", - }, - id: { - type: "string", - description: - "The unique identifier of the product. Must match the product ID specified in the request path.", - example: "00000000-0000-0000-0000-000000000000", - }, - attributes: { - $ref: "#/components/schemas/product_attributes", - }, - }, - }, - }, -} as const - -export const $attributes = { - type: "object", - properties: { - name: { - description: - "The name of the node, such as `Ranges` or `Refrigerators`. Names must be unique among sibling nodes in the hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies.", - type: "string", - }, - description: { - description: "A description for a node.", - type: "string", - }, - slug: { - description: - "A slug for the node. Slugs must be unique among sibling nodes in the hierarchy. Otherwise, a slug can be non-unique within the hierarchy and across multiple hierarchies.", - type: "string", - }, - curated_products: { - description: - "You can curate your products in your nodes product lists. Product curation allows you to promote specific products within each node in a hierarchy, enabling you to create unique product collections in your storefront.", - type: "array", - items: { - description: "A list of product IDs whose products you want to curate.", - type: "string", - }, - }, - locales: { - description: - "Product Experience Manager supports localization of hierarchies and nodes. If you store supports multiple languages, you can localize hierarchy and node names and descriptions.", - type: "object", - additionalProperties: { - description: - "A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used.", - type: "object", - additionalProperties: false, - properties: { - name: { - description: "A localized hierarchy or node name.", - type: "string", - }, - description: { - description: "A localized hierarchy or node description.", - type: "string", - }, - }, - }, - }, - }, -} as const - -export const $relationships = { - type: "object", - description: - "Relationships allow you to move between requests. Includes links to the child nodes and products associated with a hierarchy or node.", - properties: { - children: { - description: "The child nodes related to the resource.", - type: "object", - properties: { - data: { - description: "An array of child nodes.", - type: "array", - required: [], - }, - links: { - description: "Links allow you to move between requests.", - type: "object", - properties: { - related: { - description: "A link to a related resource.", - type: "string", - }, - }, - }, - }, - }, - parent: { - description: "The parent node related to the resource", - type: "object", - properties: { - data: { - description: "The parent node", - type: "object", - required: ["id", "type"], - properties: { - type: { - description: - "This represents the type of resource object being returned. Always `node`.", - type: "string", - enum: ["node"], - }, - id: { - description: "The unique identifier of a node.", - type: "string", - }, - }, - }, - }, - }, - products: { - type: "object", - description: "The products related to the resource.", - properties: { - data: { - description: "An array of products.", - type: "array", - required: [], - }, - links: { - type: "object", - description: "Links allow you to move between requests.", - properties: { - related: { - description: "A link to a related resource.", - type: "string", - }, - }, - }, - }, - }, - }, -} as const - -export const $node = { - type: "object", - properties: { - id: { - description: "The unique identifier of a node.", - type: "string", - }, - type: { - description: - "This represents the type of resource object being returned. Always `node`.", - type: "string", - enum: ["node"], - }, - attributes: { - $ref: "#/components/schemas/attributes", - }, - relationships: { - $ref: "#/components/schemas/relationships", - }, - meta: { - type: "object", - properties: { - sort_order: { - description: - "The sort order value. The node with the highest value of `sort_order` is displayed first. For example, a node with a `sort_order` value of `3` appears before a node with a `sort_order` value of `2`. See [Sorting Nodes in a hierarchy](/docs/api/pxm/products/create-node#sorting-nodes-in-a-hierarchy).", - type: "integer", - }, - created_at: { - description: "The date and time a node is created.", - type: "string", - example: "2020-09-22T09:00:00", - format: "date-time", - }, - updated_at: { - description: "The date and time a node was updated.", - type: "string", - example: "2020-09-22T09:00:00", - format: "date-time", - }, - parent_name: { - description: "The name of the parent of the node if one exists.", - type: "string", - }, - owner: { - description: "The node owner, either `organization` or `store`.", - type: "string", - enum: ["store", "organization"], - }, - }, - }, - }, -} as const - -export const $multi_meta = { - type: "object", - properties: { - results: { - description: "Contains the results for the entire collection.", - type: "object", - properties: { - total: { - description: "Total number of results for the entire collection.", - type: "integer", - example: 30, - minimum: 0, - }, - }, - }, - }, -} as const - -export const $multi_links = { - type: "object", - description: "Links are used to allow you to move between requests.", - properties: { - first: { - description: "Always the first page.", - type: "string", - example: "/pcm/hierarchies?page[offset]=0&page[limit]=10", - }, - last: { - description: "This is `null` if there is only one page.", - type: "string", - example: "/pcm/hierarchies?page[offset]=20&page[limit]=10", - }, - next: { - description: "This is `null` if there is only one page.", - type: "string", - example: "/pcm/hierarchies?page[offset]=10&page[limit]=10", - }, - prev: { - description: "This is `null` if you on the first page.", - type: "string", - example: "/pcm/hierarchies?page[offset]=8&page[limit]=10", - }, - }, -} as const - -export const $multi_nodes = { - type: "object", - properties: { - data: { - description: "An array of nodes.", - type: "array", - items: { - $ref: "#/components/schemas/node", - }, - }, - meta: { - $ref: "#/components/schemas/multi_meta", - }, - links: { - $ref: "#/components/schemas/multi_links", - }, - }, -} as const - -export const $template_response = { - type: "object", - properties: { - data: { - type: "array", - items: { - type: "object", - properties: { - id: { - description: - "A unique identifier for a template generated when a template is created.", - type: "string", - }, - type: { - description: - "This represents the type of resource object being returned. Always `template`.", - type: "string", - enum: ["template"], - }, - }, - }, - }, - }, -} as const - -export const $product_templates_request = { - type: "object", - properties: { - data: { - type: "array", - items: { - type: "object", - properties: { - id: { - type: "string", - description: "The unique identifier of a template.", - }, - type: { - type: "string", - enum: ["template"], - description: - "This represents the type of resource object being returned. Always `template'.", - }, - }, - }, - }, - }, -} as const - -export const $component_products_response = { - type: "object", - properties: { - data: { - type: "array", - items: { - type: "object", - properties: { - id: { - type: "string", - description: - "The unique identifier of a product component generated when a product is created.", - }, - type: { - type: "string", - enum: ["product"], - description: - "This represents the type of resource object being returned. Always `product`.", - }, - }, - }, - }, - }, -} as const - -export const $file_response = { - type: "object", - properties: { - data: { - type: "array", - items: { - type: "object", - properties: { - id: { - type: "string", - description: "The unique identifier of the new file.", - }, - type: { - type: "string", - description: - "This represents the type of resource object being returned. Always `file`.", - enum: ["file"], - }, - }, - }, - }, - }, -} as const - -export const $product_files_request = { - type: "object", - properties: { - data: { - type: "array", - items: { - type: "object", - properties: { - id: { - description: - "A unique identifier for a file generated when a file is created.", - type: "string", - }, - type: { - description: - "This represents the type of resource being returned. Always `file`.", - type: "string", - enum: ["file"], - }, - meta: { - type: "object", - properties: { - tags: { - description: "The files associated with a product.", - type: "array", - items: { - type: "string", - }, - }, - }, - additionalProperties: false, - }, - }, - }, - }, - }, -} as const - -export const $variations_response = { - type: "object", - properties: { - data: { - type: "array", - items: { - type: "object", - properties: { - id: { - description: - "A unique identifier generated when a variation is created.", - type: "string", - }, - type: { - description: - "This represents the type of resource object being returned. Always `product-variation`.", - type: "string", - enum: ["product-variation"], - }, - meta: { - type: "object", - properties: { - created_at: { - description: "The date and time a resource is created.", - type: "string", - example: "2020-09-22T09:00:00", - format: "date-time", - }, - }, - }, - }, - }, - }, - }, -} as const - -export const $product_variations_request = { - type: "object", - properties: { - data: { - type: "array", - items: { - type: "object", - properties: { - id: { - type: "string", - description: "The ID of the product variation.", - }, - type: { - type: "string", - enum: ["product-variation"], - description: - "This represents the type of resource being returned. Always `product-variation`.", - }, - }, - }, - }, - }, -} as const - -export const $main_image_response = { - type: "object", - properties: { - data: { - type: "array", - items: { - type: "object", - properties: { - id: { - description: - "A unique identifier for the image file generated automatically when a file is created.", - type: "string", - }, - type: { - description: - "This represents the type of resource object being returned. Always `file`.", - type: "string", - }, - }, - }, - }, - }, -} as const - -export const $replace_main_image_request = { - type: "object", - properties: { - data: { - type: "array", - items: { - type: "object", - properties: { - id: { - type: "string", - description: "The ID of the new image file.", - example: "00000000-0000-0000-0000-000000000000", - }, - type: { - type: "string", - enum: ["file"], - }, - }, - }, - }, - }, -} as const - -export const $main_image_request = { - type: "object", - properties: { - data: { - type: "object", - properties: { - id: { - type: "string", - description: "The ID of the image file.", - example: "00000000-0000-0000-0000-000000000000", - }, - type: { - description: - "This represents the type of resource being returned. Always `file`.", - type: "string", - enum: ["file"], - }, - }, - }, - }, -} as const - -export const $multi_variations = { - type: "object", - properties: { - data: { - type: "array", - items: { - type: "object", - properties: { - id: { - description: "A unique identifier for a variation.", - type: "string", - }, - type: { - description: - "This represents the type of resource object being returned. Always `product-variation`.", - type: "string", - enum: ["product-variation"], - }, - attributes: { - type: "object", - additionalProperties: false, - properties: { - name: { - description: "The name of a variation.", - type: "string", - }, - sort_order: { - description: - "The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.", - type: "integer", - }, - }, - }, - meta: { - type: "object", - properties: { - options: { - type: "array", - items: { - type: "object", - description: "The options available for this variation.", - properties: { - id: { - type: "string", - description: - "A unique ID that is generated when an option is created.", - }, - name: { - type: "string", - description: - "A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.", - }, - description: { - type: "string", - description: - "A human recognizable description of the option.", - }, - created_at: { - type: "string", - description: "The date and time an option is created.", - example: "2020-09-22T09:00:00", - format: "date-time", - }, - updated_at: { - type: "string", - description: "The date and time an option is updated.", - example: "2020-09-22T09:00:00", - format: "date-time", - }, - sort_order: { - description: - "The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.", - type: "integer", - }, - }, - }, - }, - owner: { - type: "string", - description: - "The owner of the resource, either `organization` or `store`.", - enum: ["organization", "store"], - }, - created_at: { - type: "string", - description: "The date and time a variation is created.", - example: "2020-09-22T09:00:00", - format: "date-time", - }, - updated_at: { - type: "string", - description: "The date and time a variation is updated.", - example: "2020-09-22T09:00:00", - format: "date-time", - }, - }, - }, - }, - }, - }, - meta: { - type: "object", - properties: { - results: { - description: "Contains the results for the entire collection.", - type: "object", - properties: { - total: { - description: "Total number of results for the entire collection.", - type: "integer", - example: 3, - }, - }, - }, - }, - }, - }, -} as const - -export const $create_variation = { - type: "object", - required: ["data"], - properties: { - data: { - type: "object", - required: ["type", "attributes"], - properties: { - type: { - description: - "This represents the type of resource object being returned. Always `product-variation`.", - type: "string", - enum: ["product-variation"], - }, - attributes: { - type: "object", - additionalProperties: false, - properties: { - name: { - description: "The variation name.", - type: "string", - }, - sort_order: { - description: `The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the \`sort_order\` value to program your storefront to display the variation options in the order that you want. - - The variation with the highest value of \`sort_order\` is displayed first. For example, a variation with a \`sort_order\` value of 3 appears before a variation with a \`sort_order\` value of 2. - - You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set \`sort_order\` to either \`null\` or omit it entirely from the request if you wish to remove an existing \`sort_order\` attribute. - - You must rebuild your products for the sort order changes to take effect. -`, - type: "integer", - }, - }, - }, - }, - }, - }, -} as const - -export const $created_variation = { - type: "object", - required: ["data"], - properties: { - data: { - type: "object", - required: ["id", "type", "attributes", "meta"], - properties: { - id: { - description: - "A unique identifier generated when a variation is created.", - type: "string", - }, - type: { - description: - "This represents the type of resource object being returned. Always `product-variation`.", - type: "string", - enum: ["product-variation"], - }, - attributes: { - type: "object", - additionalProperties: false, - properties: { - name: { - description: "A human-recognizable identifier for a variation.", - type: "string", - }, - sort_order: { - description: - "The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.", - type: "integer", - }, - }, - }, - meta: { - type: "object", - properties: { - owner: { - description: - "The owner of the resource, either `organization` or `store`.", - type: "string", - enum: ["organization", "store"], - }, - created_at: { - type: "string", - description: "The date and time a variation is created.", - example: "2020-09-22T09:00:00", - format: "date-time", - }, - updated_at: { - type: "string", - description: "The date and time a variation is updated.", - example: "2020-09-22T09:00:00", - format: "date-time", - }, - }, - }, - }, - }, - }, -} as const - -export const $single_variation = { - type: "object", - required: ["data"], - properties: { - data: { - type: "object", - required: ["id", "type", "attributes", "meta"], - properties: { - id: { - description: "A unique identifier for a variation.", - type: "string", - }, - type: { - description: - "This represents the type of resource object being returned. Always `product-variation`.", - type: "string", - enum: ["product-variation"], - }, - attributes: { - type: "object", - additionalProperties: false, - properties: { - name: { - description: "The name for a variation.", - type: "string", - }, - sort_order: { - description: - "The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.", - type: "integer", - }, - }, - }, - meta: { - type: "object", - properties: { - options: { - description: - "A variation option represents an option for selection for a single product-variation. For example, if your variation is `color`, you might have three possible options; red, green, and blue.", - type: "array", - items: { - type: "object", - description: "The options available for this variation", - properties: { - id: { - type: "string", - description: - "A unique ID that is generated an option is created.", - }, - name: { - type: "string", - description: - "A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.", - }, - description: { - type: "string", - description: "A description for an option.", - }, - created_at: { - type: "string", - description: "The date and time an option is created.", - example: "2020-09-22T09:00:00", - format: "date-time", - }, - updated_at: { - type: "string", - description: "The date and time an option is updated.", - example: "2020-09-22T09:00:00", - format: "date-time", - }, - sort_order: { - description: - "The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.", - type: "integer", - }, - }, - }, - }, - owner: { - description: - "The owner of the resource, either `organization` or `store`.", - type: "string", - enum: ["organization", "store"], - }, - created_at: { - type: "string", - description: "The date and time a variation is created.", - }, - updated_at: { - type: "string", - description: "The date and time a variation is updated.", - }, - }, - }, - }, - }, - }, -} as const - -export const $update_variation = { - type: "object", - required: ["data"], - properties: { - data: { - type: "object", - required: ["type", "attributes", "id"], - properties: { - type: { - description: - "This represents the type of resource object being returned. Always `product-variation`.", - type: "string", - enum: ["product-variation"], - }, - attributes: { - type: "object", - additionalProperties: false, - properties: { - name: { - description: "The variation name.", - type: "string", - }, - sort_order: { - description: `The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the \`sort_order\` value to program your storefront to display the variation options in the order that you want. - - The variation with the highest value of \`sort_order\` is displayed first. For example, a variation with a \`sort_order\` value of 3 appears before a variation with a \`sort_order\` value of 2. - - You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set \`sort_order\` to either \`null\` or omit it entirely from the request if you wish to remove an existing \`sort_order\` attribute. - - You must rebuild your products for the sort order changes to take effect. -`, - type: "integer", - }, - }, - }, - id: { - type: "string", - description: - "The unique identifier of the variation. Must match the variation ID specified in the request path.", - example: "00000000-0000-0000-0000-000000000000", - }, - }, - }, - }, -} as const - -export const $multi_options = { - type: "object", - properties: { - data: { - type: "array", - items: { - type: "object", - properties: { - id: { - description: - "A unique identifier generated when an option is created.", - type: "string", - }, - type: { - description: - "This represents the type of resource object being returned. Always `product-variation-option`.", - type: "string", - enum: ["product-variation-option"], - }, - attributes: { - type: "object", - additionalProperties: false, - properties: { - name: { - description: - "A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.", - type: "string", - }, - description: { - description: "A human-recognizable description for the option.", - type: "string", - }, - sort_order: { - description: - "The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.", - type: "integer", - }, - }, - }, - meta: { - type: "object", - properties: { - owner: { - description: - "The owner of a resource, either `organization` or `store`.", - type: "string", - enum: ["organization", "store"], - }, - created_at: { - type: "string", - description: "The date and time an option is created.", - example: "2020-09-22T09:00:00", - format: "date-time", - }, - updated_at: { - type: "string", - description: "The date and time an option is updated.", - example: "2020-09-22T09:00:00", - format: "date-time", - }, - }, - }, - }, - }, - }, - meta: { - type: "object", - properties: { - results: { - description: "Contains the results for the entire collection.", - type: "object", - properties: { - total: { - description: "Total number of results for the entire collection.", - type: "integer", - example: 3, - }, - }, - }, - }, - }, - }, -} as const - -export const $create_option = { - type: "object", - required: ["data"], - properties: { - data: { - type: "object", - required: ["type", "attributes"], - properties: { - type: { - description: - "This represents the type of resource object being returned. Always `product-variation-option`.", - type: "string", - enum: ["product-variation-option"], - }, - attributes: { - type: "object", - additionalProperties: false, - properties: { - name: { - description: - "A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.", - type: "string", - }, - sort_order: { - description: `By default, variations and variation options are sorted alphabetically. You can use the \`sort_order\` attribute to sort the order of your variation and variation options in the \`variation_matrix\`. - - The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the \`sort_order\` value to program your storefront to display the variation options in the order that you want. - - The variation option with the highest value of \`sort_order\` is displayed first. For example, a variation option with a \`sort_order\` value of \`3\` appears before a variation option with a \`sort_order\` value of \`2\`. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, and so on, zero or negative numbers. - - You can set \`sort_order\` to either \`null\` or omit it entirely from the request if you wish to remove an existing \`sort_order\` attribute. - - You must rebuild your products for the sort order changes to take effect. -`, - type: "integer", - }, - description: { - description: "A description of a product variation option.", - type: "string", - }, - }, - }, - }, - }, - }, -} as const - -export const $created_option = { - type: "object", - required: ["data"], - properties: { - data: { - type: "object", - required: ["type", "attributes"], - properties: { - id: { - description: - "A unique identifier that is generated when an option is created.", - type: "string", - }, - type: { - description: - "This represents the type of resource object being returned. Always `product-variation-option`.", - type: "string", - enum: ["product-variation-option"], - }, - attributes: { - type: "object", - additionalProperties: false, - properties: { - name: { - description: - "A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.", - type: "string", - }, - description: { - description: "A human-recognizable description for the option.", - type: "string", - }, - sort_order: { - description: - "The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.", - type: "integer", - }, - }, - }, - meta: { - type: "object", - properties: { - owner: { - description: - "The owner of a resource, either `organization` or `store`.", - type: "string", - enum: ["organization", "store"], - }, - created_at: { - type: "string", - description: "The date and time an option is created.", - example: "2020-09-22T09:00:00", - format: "date-time", - }, - updated_at: { - type: "string", - description: "The date and time an option is updated.", - example: "2020-09-22T09:00:00", - format: "date-time", - }, - }, - }, - }, - }, - }, -} as const - -export const $single_option = { - type: "object", - required: ["data"], - properties: { - data: { - type: "object", - required: ["id", "type", "attributes", "meta"], - properties: { - id: { - description: - "The unique identifier generated when an option is created.", - type: "string", - }, - type: { - description: - "This represents the type of resource object being returned. Always `product-variation-option`.", - type: "string", - enum: ["product-variation-option"], - }, - attributes: { - type: "object", - description: - "A variation option represents an option for selection for a single product-variation. For example, if your variation is `color`, you might have three possible options; red, green, and blue.", - additionalProperties: false, - properties: { - name: { - description: - "A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.", - type: "string", - }, - description: { - description: "A human-recognizable description for the option.", - type: "string", - }, - sort_order: { - description: - "The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute.", - type: "integer", - }, - }, - }, - meta: { - type: "object", - properties: { - owner: { - description: - "The owner of a resource, either `organization` or `store`.", - type: "string", - enum: ["organization", "store"], - }, - created_at: { - type: "string", - description: "The date and time an option is created.", - example: "2020-09-22T09:00:00", - format: "date-time", - }, - updated_at: { - type: "string", - description: "The date and time an option is updated.", - example: "2020-09-22T09:00:00", - format: "date-time", - }, - }, - }, - }, - }, - }, -} as const - -export const $update_option = { - type: "object", - required: ["data"], - properties: { - data: { - type: "object", - required: ["type", "attributes", "id"], - properties: { - type: { - description: - "This represents the type of resource object being returned. Always `product-variation-option`.", - type: "string", - enum: ["product-variation-option"], - }, - attributes: { - type: "object", - additionalProperties: false, - properties: { - name: { - description: - "A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed.", - type: "string", - }, - description: { - description: "The description of the option.", - type: "string", - }, - sort_order: { - description: `By default, variations and variation options are sorted alphabetically. You can use the \`sort_order\` attribute to sort the order of your variation and variation options in the \`variation_matrix\`. The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the \`sort_order\` value to program your storefront to display the variation options in the order that you want. - -The variation option with the highest value of \`sort_order\` is displayed first. For example, a variation option with a \`sort_order\` value of \`3\` appears before a variation option with a \`sort_order\` value of \`2\`. - -You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, and so on, zero or negative numbers. - -You can set \`sort_order\` to either \`null\` or omit it entirely from the request if you wish to remove an existing \`sort_order\` attribute. - -You must rebuild your products for the sort order changes to take effect. -`, - type: "integer", - }, - }, - }, - id: { - type: "string", - description: - "The unique identifier of the option. Must match the option ID specified in the request path.", - example: "00000000-0000-0000-0000-000000000000", - }, - }, - }, - }, -} as const - -export const $multi_modifiers = { - type: "object", - properties: { - data: { - type: "array", - items: { - type: "object", - properties: { - id: { - description: - "A unique identifier for a modifier that is generated automatically when a modifier is created.", - type: "string", - }, - type: { - description: - "This represents the type of resource object being returned. Always `product-variation-modifier'.", - type: "string", - enum: ["product-variation-modifier"], - }, - attributes: { - type: "object", - additionalProperties: false, - properties: { - type: { - description: `You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. - -| Modifier | Data Type | Effect | -| :--- | :--- | :--- | -| \`name_equals\` | \`string\` | Overrides the name of the child product with the name specified by the modifier. | -| \`name_append\` | \`string\` | Appends the string specified in the modifier to the name of the child product. | -| \`name_prepend\` | \`string\` | Prepends the string specified in the modifier to the name of the child product. | -| \`description_equals\` | \`string\` | Overrides the description of the child product. | -| \`description_append\` | \`string\` | Appends the string specified in the modifier to the description of the child product. | -| \`description_prepend\` | \`string\` | Prepends the string specified in the modifier to the product description of the child product. | -| \`commodity_type\` | \`string\` | Sets the commodity type of the child product, such as \`physical\` or \`digital\`. | -| \`price\` | \`string\` | Allows application of price modifiers (\`price_increment\`, \`price_decrement\`, and \`price_equals\`) to the child products. | -| \`price_increment\` | \`string\` | Increases the price of the child product. | -| \`price_decrement\` | \`string\` | Decreases the price of the child product. | -| \`price_equals\` | \`string\` | Sets the price of a child product to the amount you specify. | -| \`slug_append\` | \`string\` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the \`slug-builder\` modifier, you can use \`{}\` in the \`seek\` field, for example, \`"seek": :{COLOR}"\`. | -| \`slug_prepend\` | \`string\` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the \`slug-builder\` modifier, you can use \`{}\` in the \`seek\` field, for example, \`"seek": :{COLOR}"\`. | -| \`slug_builder\` | \`string\`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the \`slug-builder\` modifier, you can use \`{}\` in the \`seek\` field, for example, \`"seek": :{COLOR}"\`. | -| \`sku_equals\` | \`string\` | Sets the SKU of the child product. | -| \`sku_append\` | \`string\` | Appends the string specified in the modifier to the SKU of the child product. | -| \`sku_prepend\` | \`string\` | Prepends the string specified in the modifier to the SKU of the child product. | -| \`sku_builder\` | \`string\` | Sets a part of the SKU of the child product. | -| \`status\` | \`string\` | Sets the status of the child product, such as \`draft\` or \`live\`. | -`, - type: "string", - enum: [ - "commodity_type", - "status", - "price", - "name_append", - "name_prepend", - "name_equals", - "sku_append", - "sku_prepend", - "sku_equals", - "sku_builder", - "slug_append", - "slug_prepend", - "slug_equals", - "slug_builder", - "description_append", - "description_prepend", - "description_equals", - "custom_inputs_equals", - "build_rules_equals", - "locales_equals", - "upc_ean_equals", - "mpn_equals", - "external_ref_equals", - ], - }, - value: { - description: - "Required for non-builder modifiers. The value of the modifier type.", - type: "string", - }, - seek: { - description: - "Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`.", - type: "string", - }, - set: { - description: - "Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`.", - type: "string", - }, - reference_name: { - description: "The name of the modifier.", - type: "string", - }, - }, - }, - meta: { - type: "object", - properties: { - owner: { - description: - "The owner of a resource, either `organization` or `store`.", - type: "string", - enum: ["store", "organization"], - }, - }, - }, - }, - }, - }, - meta: { - type: "object", - properties: { - results: { - type: "object", - description: "Contains the results for the entire collection.", - properties: { - total: { - description: "Total number of results for the entire collection.", - type: "integer", - example: 3, - }, - }, - }, - }, - }, - }, -} as const - -export const $create_modifier = { - type: "object", - description: - "Use modifiers to change the properties of child products that are inherited from a parent product. With modifiers, you only need to have one parent product with a variation attached to the product.", - required: ["data"], - properties: { - data: { - type: "object", - required: ["type", "attributes"], - properties: { - type: { - description: - "This represents the type of resource object being returned. Always `product-variation-modifier`.", - type: "string", - enum: ["product-variation-modifier"], - }, - attributes: { - type: "object", - required: ["type"], - additionalProperties: false, - properties: { - type: { - type: "string", - description: `You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. - -| Modifier | Data Type | Effect | -| :--- | :--- | :--- | -| \`name_equals\` | \`string\` | Overrides the name of the child product with the name specified by the modifier. | -| \`name_append\` | \`string\` | Appends the string specified in the modifier to the name of the child product. | -| \`name_prepend\` | \`string\` | Prepends the string specified in the modifier to the name of the child product. | -| \`description_equals\` | \`string\` | Overrides the description of the child product. | -| \`description_append\` | \`string\` | Appends the string specified in the modifier to the description of the child product. | -| \`description_prepend\` | \`string\` | Prepends the string specified in the modifier to the product description of the child product. | -| \`commodity_type\` | \`string\` | Sets the commodity type of the child product, such as \`physical\` or \`digital\`. | -| \`price\` | \`string\` | Allows application of price modifiers (\`price_increment\`, \`price_decrement\`, and \`price_equals\`) to the child products. | -| \`price_increment\` | \`string\` | Increases the price of the child product. | -| \`price_decrement\` | \`string\` | Decreases the price of the child product. | -| \`price_equals\` | \`string\` | Sets the price of a child product to the amount you specify. | -| \`slug_append\` | \`string\` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the \`slug-builder\` modifier, you can use \`{}\` in the \`seek\` field, for example, \`"seek": :{COLOR}"\`. | -| \`slug_prepend\` | \`string\` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the \`slug-builder\` modifier, you can use \`{}\` in the \`seek\` field, for example, \`"seek": :{COLOR}"\`. | -| \`slug_builder\` | \`string\`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the \`slug-builder\` modifier, you can use \`{}\` in the \`seek\` field, for example, \`"seek": :{COLOR}"\`. | -| \`sku_equals\` | \`string\` | Sets the SKU of the child product. | -| \`sku_append\` | \`string\` | Appends the string specified in the modifier to the SKU of the child product. | -| \`sku_prepend\` | \`string\` | Prepends the string specified in the modifier to the SKU of the child product. | -| \`sku_builder\` | \`string\` | Sets a part of the SKU of the child product. | -| \`status\` | \`string\` | Sets the status of the child product, such as \`draft\` or \`live\`. | -`, - enum: [ - "commodity_type", - "status", - "price", - "name_append", - "name_prepend", - "name_equals", - "sku_append", - "sku_prepend", - "sku_equals", - "sku_builder", - "slug_append", - "slug_prepend", - "slug_equals", - "slug_builder", - "description_append", - "description_prepend", - "description_equals", - "custom_inputs_equals", - "build_rules_equals", - "locales_equals", - "upc_ean_equals", - "mpn_equals", - "external_ref_equals", - ], - }, - value: { - description: - "Required for non-builder modifiers. The value of the modifier type.", - type: "string", - }, - seek: { - description: - "Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`.", - type: "string", - }, - set: { - description: - "Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`.", - type: "string", - }, - reference_name: { - description: "A name for the modifier.", - type: "string", - }, - }, - }, - }, - }, - }, -} as const - -export const $created_modifier = { - type: "object", - properties: { - data: { - type: "object", - properties: { - id: { - description: - "A unique identifier for a modifier that is generated automatically when a modifier is created.", - type: "string", - }, - type: { - description: - "This represents the type of resource object being returned. Always `product-variation-modifier'.", - type: "string", - enum: ["product-variation-modifier"], - }, - attributes: { - type: "object", - additionalProperties: false, - properties: { - type: { - description: `You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. - -| Modifier | Data Type | Effect | -| :--- | :--- | :--- | -| \`name_equals\` | \`string\` | Overrides the name of the child product with the name specified by the modifier. | -| \`name_append\` | \`string\` | Appends the string specified in the modifier to the name of the child product. | -| \`name_prepend\` | \`string\` | Prepends the string specified in the modifier to the name of the child product. | -| \`description_equals\` | \`string\` | Overrides the description of the child product. | -| \`description_append\` | \`string\` | Appends the string specified in the modifier to the description of the child product. | -| \`description_prepend\` | \`string\` | Prepends the string specified in the modifier to the product description of the child product. | -| \`commodity_type\` | \`string\` | Sets the commodity type of the child product, such as \`physical\` or \`digital\`. | -| \`price\` | \`string\` | Allows application of price modifiers (\`price_increment\`, \`price_decrement\`, and \`price_equals\`) to the child products. | -| \`price_increment\` | \`string\` | Increases the price of the child product. | -| \`price_decrement\` | \`string\` | Decreases the price of the child product. | -| \`price_equals\` | \`string\` | Sets the price of a child product to the amount you specify. | -| \`slug_append\` | \`string\` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the \`slug-builder\` modifier, you can use \`{}\` in the \`seek\` field, for example, \`"seek": :{COLOR}"\`. | -| \`slug_prepend\` | \`string\` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the \`slug-builder\` modifier, you can use \`{}\` in the \`seek\` field, for example, \`"seek": :{COLOR}"\`. | -| \`slug_builder\` | \`string\`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the \`slug-builder\` modifier, you can use \`{}\` in the \`seek\` field, for example, \`"seek": :{COLOR}"\`. | -| \`sku_equals\` | \`string\` | Sets the SKU of the child product. | -| \`sku_append\` | \`string\` | Appends the string specified in the modifier to the SKU of the child product. | -| \`sku_prepend\` | \`string\` | Prepends the string specified in the modifier to the SKU of the child product. | -| \`sku_builder\` | \`string\` | Sets a part of the SKU of the child product. | -| \`status\` | \`string\` | Sets the status of the child product, such as \`draft\` or \`live\`. | -`, - type: "string", - enum: [ - "commodity_type", - "status", - "price", - "name_append", - "name_prepend", - "name_equals", - "sku_append", - "sku_prepend", - "sku_equals", - "sku_builder", - "slug_append", - "slug_prepend", - "slug_equals", - "slug_builder", - "description_append", - "description_prepend", - "description_equals", - "custom_inputs_equals", - "build_rules_equals", - "locales_equals", - "upc_ean_equals", - "mpn_equals", - "external_ref_equals", - ], - }, - value: { - description: - "Required for non-builder modifiers. The value of the modifier type.", - type: "string", - }, - seek: { - description: - "Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`.", - type: "string", - }, - set: { - description: - "Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`.", - type: "string", - }, - reference_name: { - description: "The name of the modifier.", - type: "string", - }, - }, - }, - meta: { - type: "object", - properties: { - owner: { - description: - "The owner of the resource, either `organization` or `store`.", - type: "string", - enum: ["organization", "store"], - }, - }, - }, - }, - }, - }, -} as const - -export const $single_modifier = { - type: "object", - properties: { - data: { - type: "object", - properties: { - id: { - description: - "A unique identifier for a modifier that is generated automatically when a modifier is created.", - type: "string", - }, - type: { - description: - "This represents the type of resource object being returned. Always `product-variation-modifier'.", - type: "string", - enum: ["product-variation-modifier"], - }, - attributes: { - type: "object", - additionalProperties: false, - properties: { - type: { - description: `You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. - -| Modifier | Data Type | Effect | -| :--- | :--- | :--- | -| \`name_equals\` | \`string\` | Overrides the name of the child product with the name specified by the modifier. | -| \`name_append\` | \`string\` | Appends the string specified in the modifier to the name of the child product. | -| \`name_prepend\` | \`string\` | Prepends the string specified in the modifier to the name of the child product. | -| \`description_equals\` | \`string\` | Overrides the description of the child product. | -| \`description_append\` | \`string\` | Appends the string specified in the modifier to the description of the child product. | -| \`description_prepend\` | \`string\` | Prepends the string specified in the modifier to the product description of the child product. | -| \`commodity_type\` | \`string\` | Sets the commodity type of the child product, such as \`physical\` or \`digital\`. | -| \`price\` | \`string\` | Allows application of price modifiers (\`price_increment\`, \`price_decrement\`, and \`price_equals\`) to the child products. | -| \`price_increment\` | \`string\` | Increases the price of the child product. | -| \`price_decrement\` | \`string\` | Decreases the price of the child product. | -| \`price_equals\` | \`string\` | Sets the price of a child product to the amount you specify. | -| \`slug_append\` | \`string\` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the \`slug-builder\` modifier, you can use \`{}\` in the \`seek\` field, for example, \`"seek": :{COLOR}"\`. | -| \`slug_prepend\` | \`string\` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the \`slug-builder\` modifier, you can use \`{}\` in the \`seek\` field, for example, \`"seek": :{COLOR}"\`. | -| \`slug_builder\` | \`string\`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the \`slug-builder\` modifier, you can use \`{}\` in the \`seek\` field, for example, \`"seek": :{COLOR}"\`. | -| \`sku_equals\` | \`string\` | Sets the SKU of the child product. | -| \`sku_append\` | \`string\` | Appends the string specified in the modifier to the SKU of the child product. | -| \`sku_prepend\` | \`string\` | Prepends the string specified in the modifier to the SKU of the child product. | -| \`sku_builder\` | \`string\` | Sets a part of the SKU of the child product. | -| \`status\` | \`string\` | Sets the status of the child product, such as \`draft\` or \`live\`. | -`, - type: "string", - enum: [ - "commodity_type", - "status", - "price", - "name_append", - "name_prepend", - "name_equals", - "sku_append", - "sku_prepend", - "sku_equals", - "sku_builder", - "slug_append", - "slug_prepend", - "slug_equals", - "slug_builder", - "description_append", - "description_prepend", - "description_equals", - "custom_inputs_equals", - "build_rules_equals", - "locales_equals", - "upc_ean_equals", - "mpn_equals", - "external_ref_equals", - ], - }, - value: { - description: - "Required for non-builder modifiers. The value of the modifier type.", - type: "string", - }, - seek: { - description: - "Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`.", - type: "string", - }, - set: { - description: - "Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`.", - type: "string", - }, - reference_name: { - description: "The name of the modifier.", - type: "string", - }, - }, - }, - meta: { - type: "object", - description: - "The owner of the resource, either `organization` or `store`.", - properties: { - owner: { - type: "string", - enum: ["organization", "store"], - }, - }, - }, - }, - }, - }, -} as const - -export const $update_modifier = { - type: "object", - required: ["data"], - properties: { - data: { - type: "object", - required: ["type", "attributes", "id"], - properties: { - type: { - description: - "This represents the type of resource object being returned. Always `product-variation-modifier`.", - type: "string", - enum: ["product-variation-modifier"], - }, - attributes: { - type: "object", - required: ["type"], - additionalProperties: false, - properties: { - type: { - description: `You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. - -| Modifier | Data Type | Effect | -| :--- | :--- | :--- | -| \`name_equals\` | \`string\` | Overrides the name of the child product with the name specified by the modifier. | -| \`name_append\` | \`string\` | Appends the string specified in the modifier to the name of the child product. | -| \`name_prepend\` | \`string\` | Prepends the string specified in the modifier to the name of the child product. | -| \`description_equals\` | \`string\` | Overrides the description of the child product. | -| \`description_append\` | \`string\` | Appends the string specified in the modifier to the description of the child product. | -| \`description_prepend\` | \`string\` | Prepends the string specified in the modifier to the product description of the child product. | -| \`commodity_type\` | \`string\` | Sets the commodity type of the child product, such as \`physical\` or \`digital\`. | -| \`price\` | \`string\` | Allows application of price modifiers (\`price_increment\`, \`price_decrement\`, and \`price_equals\`) to the child products. | -| \`price_increment\` | \`string\` | Increases the price of the child product. | -| \`price_decrement\` | \`string\` | Decreases the price of the child product. | -| \`price_equals\` | \`string\` | Sets the price of a child product to the amount you specify. | -| \`slug_append\` | \`string\` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the \`slug-builder\` modifier, you can use \`{}\` in the \`seek\` field, for example, \`"seek": :{COLOR}"\`. | -| \`slug_prepend\` | \`string\` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the \`slug-builder\` modifier, you can use \`{}\` in the \`seek\` field, for example, \`"seek": :{COLOR}"\`. | -| \`slug_builder\` | \`string\`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the \`slug-builder\` modifier, you can use \`{}\` in the \`seek\` field, for example, \`"seek": :{COLOR}"\`. | -| \`sku_equals\` | \`string\` | Sets the SKU of the child product. | -| \`sku_append\` | \`string\` | Appends the string specified in the modifier to the SKU of the child product. | -| \`sku_prepend\` | \`string\` | Prepends the string specified in the modifier to the SKU of the child product. | -| \`sku_builder\` | \`string\` | Sets a part of the SKU of the child product. | -| \`status\` | \`string\` | Sets the status of the child product, such as \`draft\` or \`live\`. | -`, - type: "string", - enum: [ - "commodity_type", - "status", - "price", - "name_append", - "name_prepend", - "name_equals", - "sku_append", - "sku_prepend", - "sku_equals", - "sku_builder", - "slug_append", - "slug_prepend", - "slug_equals", - "slug_builder", - "description_append", - "description_prepend", - "description_equals", - "custom_inputs_equals", - "build_rules_equals", - "locales_equals", - "upc_ean_equals", - "mpn_equals", - "external_ref_equals", - ], - }, - value: { - description: - "Required for non-builder modifiers. The value of the modifier type.", - type: "string", - }, - seek: { - description: - "Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`.", - type: "string", - }, - set: { - description: - "Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`.", - type: "string", - }, - reference_name: { - description: "The name of the modifier.", - type: "string", - }, - }, - }, - id: { - type: "string", - description: - "The unique identifier of the modifier. Must match the modifier ID specified in the request path.", - example: "00000000-0000-0000-0000-000000000000", - }, - }, - }, - }, -} as const - -export const $attributes_hierarchy = { - type: "object", - properties: { - name: { - description: "The name of a hierarchy, such as `Major Appliances`.", - type: "string", - }, - description: { - description: "A description for a hierarchy.", - type: "string", - }, - slug: { - description: "A unique slug for a hierarchy.", - type: "string", - }, - locales: { - description: - "Product Experience Manager supports localization of hierarchies and nodes. If you store supports multiple languages, you can localize hierarchy and node names and descriptions.", - type: "object", - additionalProperties: { - description: - "A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used.", - type: "object", - additionalProperties: false, - properties: { - name: { - description: "A localized hierarchy or node name.", - type: "string", - }, - description: { - description: "A localized hierarchy or node description.", - type: "string", - }, - }, - }, - }, - }, -} as const - -export const $relationships_hierarchy = { - type: "object", - properties: { - children: { - description: "The child nodes related to the hierarchy.", - type: "object", - properties: { - data: { - description: "An array of child nodes.", - type: "array", - required: [], - }, - links: { - description: "Links allow you to move between requests.", - type: "object", - properties: { - related: { - description: "A link to a related resource.", - type: "string", - }, - }, - }, - }, - }, - }, -} as const - -export const $hierarchy = { - type: "object", - properties: { - id: { - description: "A unique identifier generated when a hierarchy is created.", - type: "string", - }, - type: { - description: - "This represents the type of resource object being returned. Always `hierarchy`.", - type: "string", - enum: ["hierarchy"], - }, - attributes: { - $ref: "#/components/schemas/attributes_hierarchy", - }, - relationships: { - $ref: "#/components/schemas/relationships_hierarchy", - }, - meta: { - type: "object", - properties: { - created_at: { - description: "The date and time a hierarchy is created.", - type: "string", - example: "2020-09-22T09:00:00", - format: "date-time", - }, - updated_at: { - description: "The date and time a hierarchy is updated.", - type: "string", - example: "2020-09-22T09:00:00", - format: "date-time", - }, - owner: { - description: - "The owner of a resource, either `organization` or `store`.", - type: "string", - enum: ["store", "organization"], - }, - }, - }, - }, -} as const - -export const $multi_hierarchy = { - type: "object", - properties: { - data: { - type: "array", - items: { - $ref: "#/components/schemas/hierarchy", - }, - }, - links: { - $ref: "#/components/schemas/multi_links", - }, - meta: { - $ref: "#/components/schemas/multi_meta", - }, - }, -} as const - -export const $req_attributes_hierarchy = { - type: "object", - additionalProperties: false, - properties: { - name: { - description: "The name of the hierarchy, such as `Major Appliances`.", - type: "string", - }, - description: { - description: "A description of the hierarchy.", - type: "string", - }, - slug: { - description: "A unique slug for the hierarchy.", - type: "string", - }, - locales: { - description: - "Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want.", - type: "object", - additionalProperties: { - description: - "A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used.", - type: "object", - additionalProperties: false, - properties: { - name: { - description: "A localized name for the hierarchy.", - type: "string", - }, - description: { - description: "A localized description for the hierarchy.", - type: "string", - }, - }, - }, - }, - }, -} as const - -export const $create_hierarchy = { - type: "object", - properties: { - data: { - type: "object", - required: ["type", "attributes"], - properties: { - type: { - description: - "This represents the type of resource object being returned. Always `hierarchy`.", - type: "string", - enum: ["hierarchy"], - }, - attributes: { - $ref: "#/components/schemas/req_attributes_hierarchy", - }, - }, - }, - }, -} as const - -export const $single_hierarchy = { - type: "object", - properties: { - data: { - $ref: "#/components/schemas/hierarchy", - }, - }, -} as const - -export const $update_hierarchy = { - type: "object", - required: ["data"], - properties: { - data: { - type: "object", - required: ["id", "type", "attributes"], - properties: { - id: { - type: "string", - description: - "The unique identifier of the hierarchy. Must match the hierarchy ID specified in the request path.", - example: "00000000-0000-0000-0000-000000000000", - }, - type: { - description: - "This represents the type of resource object being returned. Always `hierarchy`.", - type: "string", - enum: ["hierarchy"], - example: "hierarchy", - }, - attributes: { - $ref: "#/components/schemas/req_attributes_hierarchy", - }, - }, - }, - }, -} as const - -export const $attributes_nodes = { - type: "object", - additionalProperties: false, - properties: { - name: { - description: - "The name of the node, such as `Ranges` or `Refrigerators`. Names must be unique among sibling nodes in the hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies.", - type: "string", - }, - description: { - description: "A description of the node.", - type: "string", - }, - slug: { - description: - "A slug for the node. Slugs must be unique among sibling nodes in the hierarchy. Otherwise, a slug can be non-unique within the hierarchy and across multiple hierarchies.", - type: "string", - }, - curated_products: { - description: - "You can curate your products in your nodes product lists. Product curation allows you to promote specific products within each node in a hierarchy, enabling you to create unique product collections in your storefront. See [Curating Products in a node](/docs/api/pxm/products/create-node#curating-products-in-a-node).", - type: "array", - items: { - description: - "A list of product IDs for the products that you want to curate in a node.", - type: "string", - }, - }, - locales: { - description: - "Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want.", - type: "object", - additionalProperties: { - description: - "A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used.", - type: "object", - additionalProperties: false, - properties: { - name: { - description: "A localized name for the node.", - type: "string", - }, - description: { - description: "A localized description for the node.", - type: "string", - }, - }, - }, - }, - }, -} as const - -export const $create_node = { - type: "object", - properties: { - data: { - type: "object", - required: ["type", "attributes"], - properties: { - type: { - description: - "This represents the type of resource object being returned. Always `node`.", - type: "string", - enum: ["node"], - }, - attributes: { - $ref: "#/components/schemas/attributes_nodes", - }, - meta: { - type: "object", - additionalProperties: false, - properties: { - sort_order: { - description: `You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. The \`sort_order\` for each node. This value determines the order of nodes in the response for the \`Get a Node’s Children\` request. The node with the highest value of sort_order is displayed first. For example, a node with a sort_order value of 3 appears before a node with a sort_order value of 2. - -- If you don’t provide \`sort_order\` when creating nodes, all child nodes in the response for \`Get a Node’s Children\` request are ordered by the \`updated_at\` time in descending order, with the most recently updated child node first. -- If you set \`sort_order\` for only a few child nodes or not all, the child nodes with a \`sort_order\` value appear first and then other child nodes appear in the order of \`updated_at\` time. See [Sorting Nodes in a hierarchy](). -`, - type: "integer", - }, - }, - }, - }, - }, - }, -} as const - -export const $single_node = { - type: "object", - properties: { - data: { - $ref: "#/components/schemas/node", - }, - }, -} as const - -export const $update_node = { - type: "object", - properties: { - data: { - type: "object", - required: ["id", "type", "attributes"], - properties: { - id: { - type: "string", - description: - "The unique identifier of the node. Must match the node ID specified in the request path.", - example: "00000000-0000-0000-0000-000000000000", - }, - type: { - description: - "This represents the type of resource object being returned. Always `node`.", - type: "string", - enum: ["node"], - }, - attributes: { - $ref: "#/components/schemas/attributes_nodes", - }, - meta: { - type: "object", - additionalProperties: false, - properties: { - sort_order: { - description: `You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. The \`sort_order\` for each node. This value determines the order of nodes in the response for the \`Get a Node’s Children\` request. The node with the highest value of sort_order is displayed first. For example, a node with a sort_order value of 3 appears before a node with a sort_order value of 2. - -- If you don’t provide \`sort_order\` when creating nodes, all child nodes in the response for \`Get a Node’s Children\` request are ordered by the \`updated_at\` time in descending order, with the most recently updated child node first. -- If you set \`sort_order\` for only a few child nodes or not all, the child nodes with a \`sort_order\` value appear first and then other child nodes appear in the order of \`updated_at\` time. -`, - type: "integer", - }, - }, - }, - }, - }, - }, -} as const - -export const $node_children = { - type: "object", - properties: { - data: { - type: "array", - items: { - type: "object", - required: ["id", "type"], - properties: { - id: { - type: "string", - description: - "The unique identifier of the child node. Must not match the node ID specified in the request path.", - example: "00000000-0000-0000-0000-000000000000", - }, - type: { - description: - "This represents the type of resource object being returned. Always `node`.", - type: "string", - enum: ["node"], - }, - }, - }, - }, - }, -} as const - -export const $node_parent = { - type: "object", - properties: { - data: { - type: "object", - required: ["id", "type"], - properties: { - id: { - type: "string", - description: - "The unique identifier of the new parent node. Must not match the node ID specified in the request path.", - example: "00000000-0000-0000-0000-000000000000", - }, - type: { - description: - "This represents the type of resource object being returned. Always `node`.", - type: "string", - enum: ["node"], - }, - }, - }, - }, -} as const - -export const $node_products = { - type: "object", - properties: { - data: { - type: "array", - items: { - type: "object", - required: ["id", "type"], - properties: { - id: { - type: "string", - description: - "The unique identifier of the product to be attached to the node.", - example: "00000000-0000-0000-0000-000000000000", - }, - type: { - description: - "This represents the type of resource object being returned. Always `product`.", - type: "string", - enum: ["product"], - }, - }, - }, - }, - }, -} as const - -export const $duplicate_job = { - type: "object", - properties: { - data: { - type: "object", - properties: { - type: { - description: - "This represents the type of resource object being returned. Always `hierarchy`.", - type: "string", - enum: ["hierarchy"], - }, - attributes: { - type: "object", - additionalProperties: false, - properties: { - name: { - description: - "The name of the duplicate hierarchy. The maximum length is 1000 characters.", - type: "string", - }, - description: { - description: "A description of the duplicate hierarchy.", - type: "string", - }, - include_products: { - description: - "Specify `true` if you want the product associations in the existing nodes associated in your duplicated hierarchy. If not, specify `false`.", - type: "boolean", - }, - }, - }, - }, - }, - }, -} as const - -export const $tag = { - type: "object", - properties: { - id: { - description: "A unique identifier generated when a tag is created.", - type: "string", - }, - type: { - description: - "This represents the type of resource object being returned. Always `tag`.", - type: "string", - enum: ["tag"], - }, - attributes: { - type: "object", - properties: { - value: { - type: "string", - description: "The text value of the tag.", - }, - }, - }, - meta: { - type: "object", - properties: { - x_request_id: { - type: "string", - description: - "A unique request ID is generated when a tag is created.", - }, - created_at: { - type: "string", - description: "The date and time a tag is created.", - example: "2020-09-22T09:00:00", - format: "date-time", - }, - updated_at: { - type: "string", - description: "The date and time a tag is updated.", - example: "2020-09-22T09:00:00", - format: "date-time", - }, - owner: { - description: - "The owner of a resource, either `organization` or `store`.", - type: "string", - enum: ["store", "organization"], - }, - }, - }, - }, -} as const - -export const $multi_tag = { - type: "object", - properties: { - data: { - description: "An array of tags.", - type: "array", - items: { - $ref: "#/components/schemas/tag", - }, - }, - meta: { - type: "object", - properties: { - results: { - description: "Contains the results for the entire collection.", - type: "object", - properties: { - total: { - description: "Total number of results for the entire collection.", - type: "integer", - example: 2, - }, - }, - }, - }, - }, - }, -} as const - -export const $single_tag = { - type: "object", - properties: { - data: { - $ref: "#/components/schemas/tag", - }, - }, -} as const - -export const $req_attributes_custom_relationship = { - type: "object", - additionalProperties: false, - properties: { - name: { - description: - "The name of the custom relationship, such as `Kitchen electrics`.", - type: "string", - }, - description: { - description: "A description of the custom relationship.", - type: "string", - }, - slug: { - description: - "A unique slug for the custom relationship. Must match the slug specified in the request path.", - type: "string", - }, - }, -} as const - -export const $create_custom_relationship = { - type: "object", - properties: { - data: { - type: "object", - required: ["type", "attributes"], - properties: { - type: { - description: - "This represents the type of resource object being returned. Always `custom-relationship`.", - type: "string", - enum: ["custom-relationship"], - }, - attributes: { - $ref: "#/components/schemas/req_attributes_custom_relationship", - }, - }, - }, - }, -} as const - -export const $attributes_custom_relationship = { - type: "object", - additionalProperties: false, - properties: { - name: { - description: - "The name of the custom relationship, such as `Kitchen electrics`.", - type: "string", - }, - description: { - description: "A description of the custom relationship.", - type: "string", - }, - slug: { - description: "A unique slug for the custom relationship.", - type: "string", - }, - }, -} as const - -export const $custom_relationship = { - type: "object", - properties: { - id: { - description: - "A unique identifier generated when a custom relationship is created.", - type: "string", - }, - type: { - description: - "This represents the type of resource object being returned. Always `hierarchy`.", - type: "string", - enum: ["custom-relationship"], - }, - attributes: { - $ref: "#/components/schemas/attributes_custom_relationship", - }, - meta: { - type: "object", - properties: { - owner: { - description: "The owner of the resource.", - type: "string", - example: "store", - }, - timestamps: { - type: "object", - properties: { - created_at: { - description: "The date and time the resource is created.", - type: "string", - example: "2024-01-10T20:16:35.343Z", - format: "date-time", - }, - updated_at: { - description: "The date and time the resource is updated.", - type: "string", - example: "2024-01-10T20:16:35.343Z", - format: "date-time", - }, - }, - }, - }, - }, - }, -} as const - -export const $single_custom_relationship = { - type: "object", - properties: { - data: { - $ref: "#/components/schemas/custom_relationship", - }, - }, -} as const - -export const $update_custom_relationship = { - type: "object", - required: ["data"], - properties: { - data: { - type: "object", - required: ["id", "type", "attributes"], - properties: { - id: { - type: "string", - description: "The unique identifier of the custom relationship.", - example: "00000000-0000-0000-0000-000000000000", - }, - type: { - description: - "This represents the type of resource object being returned. Always `custom-relationship`.", - type: "string", - enum: ["custom-relationship"], - example: "custom-relationship", - }, - attributes: { - $ref: "#/components/schemas/req_attributes_custom_relationship", - }, - }, - }, - }, -} as const diff --git a/packages/sdks/pim/src/client/services.gen.ts b/packages/sdks/pim/src/client/sdk.gen.ts similarity index 68% rename from packages/sdks/pim/src/client/services.gen.ts rename to packages/sdks/pim/src/client/sdk.gen.ts index c1c40147..7ccd4b3e 100644 --- a/packages/sdks/pim/src/client/services.gen.ts +++ b/packages/sdks/pim/src/client/sdk.gen.ts @@ -1,275 +1,254 @@ // This file is auto-generated by @hey-api/openapi-ts import { - client, - type Options, + createClient, + createConfig, + type OptionsLegacyParser, formDataBodySerializer, } from "@hey-api/client-fetch" -import { - type GetAllJobsError, - type GetAllJobsResponse, - type GetJobData, - type GetJobError, - type GetJobResponse, - type CancelJobData, - type CancelJobError, - type CancelJobResponse, - type GetJobErrorsData, - type GetJobErrorsError, - type GetJobErrorsResponse, - type CreateProductData, - type CreateProductError, - type CreateProductResponse, - type GetAllProductsData, - type GetAllProductsError, - type GetAllProductsResponse, - type ImportProductsData, - type ImportProductsError, - type ImportProductsResponse, - type ExportProductsData, - type ExportProductsError, - type ExportProductsResponse, - type GetProductData, - type GetProductError, - type GetProductResponse, - type UpdateProductData, - type UpdateProductError, - type UpdateProductResponse, - type DeleteProductData, - type DeleteProductError, - type DeleteProductResponse, - type AttachNodesData, - type AttachNodesError, - type AttachNodesResponse, - type DetachNodesData, - type DetachNodesError, - type DetachNodesResponse, - type GetProductsNodesData, - type GetProductsNodesError, - type GetProductsNodesResponse, - type BuildChildProductsData, - type BuildChildProductsError, - type BuildChildProductsResponse, - type GetChildProductsData, - type GetChildProductsError, - type GetChildProductsResponse, - type CreateProductTemplateRelationshipData, - type CreateProductTemplateRelationshipError, - type CreateProductTemplateRelationshipResponse, - type GetProductTemplateRelationshipsData, - type GetProductTemplateRelationshipsError, - type GetProductTemplateRelationshipsResponse, - type DeleteProductTemplateRelationshipData, - type DeleteProductTemplateRelationshipError, - type DeleteProductTemplateRelationshipResponse, - type GetProductComponentProductsRelationshipsData, - type GetProductComponentProductsRelationshipsError, - type GetProductComponentProductsRelationshipsResponse, - type GetProductFileRelationshipsData, - type GetProductFileRelationshipsError, - type GetProductFileRelationshipsResponse, - type CreateProductFileRelationshipsData, - type CreateProductFileRelationshipsError, - type CreateProductFileRelationshipsResponse, - type UpdateProductFileRelationshipsData, - type UpdateProductFileRelationshipsError, - type UpdateProductFileRelationshipsResponse, - type DeleteProductFileRelationshipsData, - type DeleteProductFileRelationshipsError, - type DeleteProductFileRelationshipsResponse, - type CreateProductVariationRelationshipsData, - type CreateProductVariationRelationshipsError, - type CreateProductVariationRelationshipsResponse, - type GetProductVariationRelationshipsData, - type GetProductVariationRelationshipsError, - type GetProductVariationRelationshipsResponse, - type UpdateProductVariationRelationshipsData, - type UpdateProductVariationRelationshipsError, - type UpdateProductVariationRelationshipsResponse, - type DeleteProductVariationRelationshipsData, - type DeleteProductVariationRelationshipsError, - type DeleteProductVariationRelationshipsResponse, - type CreateProductMainImageRelationshipsData, - type CreateProductMainImageRelationshipsError, - type CreateProductMainImageRelationshipsResponse, - type GetProductMainImageRelationshipsData, - type GetProductMainImageRelationshipsError, - type GetProductMainImageRelationshipsResponse, - type UpdateProductMainImageRelationshipsData, - type UpdateProductMainImageRelationshipsError, - type UpdateProductMainImageRelationshipsResponse, - type DeleteProductMainImageRelationshipsData, - type DeleteProductMainImageRelationshipsError, - type DeleteProductMainImageRelationshipsResponse, - type CreateVariationData, - type CreateVariationError, - type CreateVariationResponse, - type GetAllVariationsData, - type GetAllVariationsError, - type GetAllVariationsResponse, - type GetVariationData, - type GetVariationError, - type GetVariationResponse, - type UpdateVariationData, - type UpdateVariationError, - type UpdateVariationResponse, - type DeleteVariationData, - type DeleteVariationError, - type DeleteVariationResponse, - type CreateVariationOptionData, - type CreateVariationOptionError, - type CreateVariationOptionResponse, - type GetAllVariationOptionsData, - type GetAllVariationOptionsError, - type GetAllVariationOptionsResponse, - type GetVariationOptionData, - type GetVariationOptionError, - type GetVariationOptionResponse, - type UpdateVariationOptionData, - type UpdateVariationOptionError, - type UpdateVariationOptionResponse, - type DeleteVariationOptionData, - type DeleteVariationOptionError, - type DeleteVariationOptionResponse, - type CreateModifierData, - type CreateModifierError, - type CreateModifierResponse, - type GetAllModifiersData, - type GetAllModifiersError, - type GetAllModifiersResponse, - type GetModifierData, - type GetModifierError, - type GetModifierResponse, - type UpdateModifierData, - type UpdateModifierError, - type UpdateModifierResponse, - type DeleteModifierData, - type DeleteModifierError, - type DeleteModifierResponse, - type CreateHierarchyData, - type CreateHierarchyError, - type CreateHierarchyResponse, - type GetHierarchyData, - type GetHierarchyError, - type GetHierarchyResponse, - type GetHierarchyChildData, - type GetHierarchyChildError, - type GetHierarchyChildResponse, - type UpdateHierarchyData, - type UpdateHierarchyError, - type UpdateHierarchyResponse, - type DeleteHierarchyData, - type DeleteHierarchyError, - type DeleteHierarchyResponse, - type CreateNodeData, - type CreateNodeError, - type CreateNodeResponse, - type GetAllNodesInHierarchyData, - type GetAllNodesInHierarchyError, - type GetAllNodesInHierarchyResponse, - type GetHierarchyNodeData, - type GetHierarchyNodeError, - type GetHierarchyNodeResponse, - type UpdateNodeData, - type UpdateNodeError, - type UpdateNodeResponse, - type DeleteNodeData, - type DeleteNodeError, - type DeleteNodeResponse, - type GetAllChildrenData, - type GetAllChildrenError, - type GetAllChildrenResponse, - type CreateNodeChildRelationshipsData, - type CreateNodeChildRelationshipsError, - type CreateNodeChildRelationshipsResponse, - type GetAllNodeChildrenData, - type GetAllNodeChildrenError, - type GetAllNodeChildrenResponse, - type UpdateNodeParentData, - type UpdateNodeParentError, - type UpdateNodeParentResponse, - type DeleteNodeParentData, - type DeleteNodeParentError, - type DeleteNodeParentResponse, - type CreateNodeProductRelationshipData, - type CreateNodeProductRelationshipError, - type CreateNodeProductRelationshipResponse, - type DeleteNodeProductRelationshipsData, - type DeleteNodeProductRelationshipsError, - type DeleteNodeProductRelationshipsResponse, - type GetNodeProductsData, - type GetNodeProductsError, - type GetNodeProductsResponse, - type DuplicateHierarchyData, - type DuplicateHierarchyError, - type DuplicateHierarchyResponse, - type GetAllProductTagsError, - type GetAllProductTagsResponse, - type GetProductTagData, - type GetProductTagError, - type GetProductTagResponse, - type CreateCustomRelationshipData, - type CreateCustomRelationshipError, - type CreateCustomRelationshipResponse, - type UpdateCustomRelationshipData, - type UpdateCustomRelationshipError, - type UpdateCustomRelationshipResponse, - GetAllJobsResponseTransformer, - GetJobResponseTransformer, - CancelJobResponseTransformer, - CreateProductResponseTransformer, - GetAllProductsResponseTransformer, - ImportProductsResponseTransformer, - ExportProductsResponseTransformer, - GetProductResponseTransformer, - UpdateProductResponseTransformer, - GetProductsNodesResponseTransformer, - GetChildProductsResponseTransformer, - CreateVariationResponseTransformer, - CreateVariationOptionResponseTransformer, - GetVariationOptionResponseTransformer, - UpdateVariationOptionResponseTransformer, - CreateHierarchyResponseTransformer, - GetHierarchyResponseTransformer, - GetHierarchyChildResponseTransformer, - UpdateHierarchyResponseTransformer, - CreateNodeResponseTransformer, - GetAllNodesInHierarchyResponseTransformer, - GetHierarchyNodeResponseTransformer, - UpdateNodeResponseTransformer, - GetAllChildrenResponseTransformer, - CreateNodeChildRelationshipsResponseTransformer, - GetAllNodeChildrenResponseTransformer, - CreateNodeProductRelationshipResponseTransformer, - DeleteNodeProductRelationshipsResponseTransformer, - GetNodeProductsResponseTransformer, - DuplicateHierarchyResponseTransformer, - GetAllProductTagsResponseTransformer, - GetProductTagResponseTransformer, - CreateCustomRelationshipResponseTransformer, - UpdateCustomRelationshipResponseTransformer, +import type { + GetAllJobsError, + GetAllJobsResponse, + GetJobData, + GetJobError, + GetJobResponse, + CancelJobData, + CancelJobError, + CancelJobResponse, + GetJobErrorsData, + GetJobErrorsError, + GetJobErrorsResponse, + CreateProductData, + CreateProductError, + CreateProductResponse, + GetAllProductsData, + GetAllProductsError, + GetAllProductsResponse, + ImportProductsData, + ImportProductsError, + ImportProductsResponse, + ExportProductsData, + ExportProductsError, + ExportProductsResponse, + GetProductData, + GetProductError, + GetProductResponse, + UpdateProductData, + UpdateProductError, + UpdateProductResponse, + DeleteProductData, + DeleteProductError, + DeleteProductResponse, + AttachNodesData, + AttachNodesError, + AttachNodesResponse, + DetachNodesData, + DetachNodesError, + DetachNodesResponse, + GetProductsNodesData, + GetProductsNodesError, + GetProductsNodesResponse, + BuildChildProductsData, + BuildChildProductsError, + BuildChildProductsResponse, + GetChildProductsData, + GetChildProductsError, + GetChildProductsResponse, + CreateProductTemplateRelationshipData, + CreateProductTemplateRelationshipError, + CreateProductTemplateRelationshipResponse, + GetProductTemplateRelationshipsData, + GetProductTemplateRelationshipsError, + GetProductTemplateRelationshipsResponse, + DeleteProductTemplateRelationshipData, + DeleteProductTemplateRelationshipError, + DeleteProductTemplateRelationshipResponse, + GetProductComponentProductsRelationshipsData, + GetProductComponentProductsRelationshipsError, + GetProductComponentProductsRelationshipsResponse, + GetProductFileRelationshipsData, + GetProductFileRelationshipsError, + GetProductFileRelationshipsResponse, + CreateProductFileRelationshipsData, + CreateProductFileRelationshipsError, + CreateProductFileRelationshipsResponse, + UpdateProductFileRelationshipsData, + UpdateProductFileRelationshipsError, + UpdateProductFileRelationshipsResponse, + DeleteProductFileRelationshipsData, + DeleteProductFileRelationshipsError, + DeleteProductFileRelationshipsResponse, + CreateProductVariationRelationshipsData, + CreateProductVariationRelationshipsError, + CreateProductVariationRelationshipsResponse, + GetProductVariationRelationshipsData, + GetProductVariationRelationshipsError, + GetProductVariationRelationshipsResponse, + UpdateProductVariationRelationshipsData, + UpdateProductVariationRelationshipsError, + UpdateProductVariationRelationshipsResponse, + DeleteProductVariationRelationshipsData, + DeleteProductVariationRelationshipsError, + DeleteProductVariationRelationshipsResponse, + CreateProductMainImageRelationshipsData, + CreateProductMainImageRelationshipsError, + CreateProductMainImageRelationshipsResponse, + GetProductMainImageRelationshipsData, + GetProductMainImageRelationshipsError, + GetProductMainImageRelationshipsResponse, + UpdateProductMainImageRelationshipsData, + UpdateProductMainImageRelationshipsError, + UpdateProductMainImageRelationshipsResponse, + DeleteProductMainImageRelationshipsData, + DeleteProductMainImageRelationshipsError, + DeleteProductMainImageRelationshipsResponse, + CreateVariationData, + CreateVariationError, + CreateVariationResponse, + GetAllVariationsData, + GetAllVariationsError, + GetAllVariationsResponse, + GetVariationData, + GetVariationError, + GetVariationResponse, + UpdateVariationData, + UpdateVariationError, + UpdateVariationResponse, + DeleteVariationData, + DeleteVariationError, + DeleteVariationResponse, + CreateVariationOptionData, + CreateVariationOptionError, + CreateVariationOptionResponse, + GetAllVariationOptionsData, + GetAllVariationOptionsError, + GetAllVariationOptionsResponse, + GetVariationOptionData, + GetVariationOptionError, + GetVariationOptionResponse, + UpdateVariationOptionData, + UpdateVariationOptionError, + UpdateVariationOptionResponse, + DeleteVariationOptionData, + DeleteVariationOptionError, + DeleteVariationOptionResponse, + CreateModifierData, + CreateModifierError, + CreateModifierResponse, + GetAllModifiersData, + GetAllModifiersError, + GetAllModifiersResponse, + GetModifierData, + GetModifierError, + GetModifierResponse, + UpdateModifierData, + UpdateModifierError, + UpdateModifierResponse, + DeleteModifierData, + DeleteModifierError, + DeleteModifierResponse, + CreateHierarchyData, + CreateHierarchyError, + CreateHierarchyResponse, + GetHierarchyData, + GetHierarchyError, + GetHierarchyResponse, + GetHierarchyChildData, + GetHierarchyChildError, + GetHierarchyChildResponse, + UpdateHierarchyData, + UpdateHierarchyError, + UpdateHierarchyResponse, + DeleteHierarchyData, + DeleteHierarchyError, + DeleteHierarchyResponse, + CreateNodeData, + CreateNodeError, + CreateNodeResponse, + GetAllNodesInHierarchyData, + GetAllNodesInHierarchyError, + GetAllNodesInHierarchyResponse, + GetHierarchyNodeData, + GetHierarchyNodeError, + GetHierarchyNodeResponse, + UpdateNodeData, + UpdateNodeError, + UpdateNodeResponse, + DeleteNodeData, + DeleteNodeError, + DeleteNodeResponse, + GetAllChildrenData, + GetAllChildrenError, + GetAllChildrenResponse, + CreateNodeChildRelationshipsData, + CreateNodeChildRelationshipsError, + CreateNodeChildRelationshipsResponse, + GetAllNodeChildrenData, + GetAllNodeChildrenError, + GetAllNodeChildrenResponse, + UpdateNodeParentData, + UpdateNodeParentError, + UpdateNodeParentResponse, + DeleteNodeParentData, + DeleteNodeParentError, + DeleteNodeParentResponse, + CreateNodeProductRelationshipData, + CreateNodeProductRelationshipError, + CreateNodeProductRelationshipResponse, + DeleteNodeProductRelationshipsData, + DeleteNodeProductRelationshipsError, + DeleteNodeProductRelationshipsResponse, + GetNodeProductsData, + GetNodeProductsError, + GetNodeProductsResponse, + DuplicateHierarchyData, + DuplicateHierarchyError, + DuplicateHierarchyResponse, + GetAllProductTagsError, + GetAllProductTagsResponse, + GetProductTagData, + GetProductTagError, + GetProductTagResponse, + CreateCustomRelationshipData, + CreateCustomRelationshipError, + CreateCustomRelationshipResponse, + UpdateCustomRelationshipData, + UpdateCustomRelationshipError, + UpdateCustomRelationshipResponse, } from "./types.gen" +export const client = createClient(createConfig()) + /** * Get All Jobs * The jobs endpoints displays the status of a number of endpoints that function as jobs, for example, product import and export, price book import, building child products, and duplicating hierarchies. */ -export const getAllJobs = (options?: Options) => { - return (options?.client ?? client).get({ +export const getAllJobs = ( + options?: OptionsLegacyParser, +) => { + return (options?.client ?? client).get< + GetAllJobsResponse, + GetAllJobsError, + ThrowOnError + >({ ...options, url: "/pcm/jobs", - responseTransformer: GetAllJobsResponseTransformer, }) } /** * Get a Job */ -export const getJob = (options: Options) => { - return (options?.client ?? client).get({ +export const getJob = ( + options: OptionsLegacyParser, +) => { + return (options?.client ?? client).get< + GetJobResponse, + GetJobError, + ThrowOnError + >({ ...options, url: "/pcm/jobs/{jobID}", - responseTransformer: GetJobResponseTransformer, }) } @@ -280,21 +259,29 @@ export const getJob = (options: Options) => { * Jobs are processed one at a time. You can continue to send job requests, but those jobs are queued. In other words, Commerce looks for any jobs that have a status of PENDING and starts the job with the earliest created date. If you decide that a specific job needs to be prioritized over another, you can cancel the less critical job using the `Cancel a job` endpoint. You can only cancel jobs whose status is PENDING. * */ -export const cancelJob = (options: Options) => { - return (options?.client ?? client).post({ +export const cancelJob = ( + options: OptionsLegacyParser, +) => { + return (options?.client ?? client).post< + CancelJobResponse, + CancelJobError, + ThrowOnError + >({ ...options, url: "/pcm/jobs/{jobID}/cancel", - responseTransformer: CancelJobResponseTransformer, }) } /** * Get Job Errors */ -export const getJobErrors = (options: Options) => { +export const getJobErrors = ( + options: OptionsLegacyParser, +) => { return (options?.client ?? client).get< GetJobErrorsResponse, - GetJobErrorsError + GetJobErrorsError, + ThrowOnError >({ ...options, url: "/pcm/jobs/{jobID}/errors", @@ -341,14 +328,16 @@ export const getJobErrors = (options: Options) => { * See [**Bundles**](/docs/api/pxm/products/products#bundles). * */ -export const createProduct = (options: Options) => { +export const createProduct = ( + options: OptionsLegacyParser, +) => { return (options?.client ?? client).post< CreateProductResponse, - CreateProductError + CreateProductError, + ThrowOnError >({ ...options, url: "/pcm/products", - responseTransformer: CreateProductResponseTransformer, }) } @@ -371,14 +360,16 @@ export const createProduct = (options: Options) => { * | `In` | `id`, `name`, `SKU`, `slug`, `upc_ean`, `mpn`, `product_types`, `tags` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `filter=in(id,some-id)` | * */ -export const getAllProducts = (options?: Options) => { +export const getAllProducts = ( + options?: OptionsLegacyParser, +) => { return (options?.client ?? client).get< GetAllProductsResponse, - GetAllProductsError + GetAllProductsError, + ThrowOnError >({ ...options, url: "/pcm/products", - responseTransformer: GetAllProductsResponseTransformer, }) } @@ -407,15 +398,21 @@ export const getAllProducts = (options?: Options) => { * See [**Characteristics of CSV Files**](/docs/api/pxm/products/product-import-bulk-update#characteristics-of-csv-import-files). * */ -export const importProducts = (options?: Options) => { +export const importProducts = ( + options?: OptionsLegacyParser, +) => { return (options?.client ?? client).post< ImportProductsResponse, - ImportProductsError + ImportProductsError, + ThrowOnError >({ ...options, ...formDataBodySerializer, + headers: { + "Content-Type": null, + ...options?.headers, + }, url: "/pcm/products/import", - responseTransformer: ImportProductsResponseTransformer, }) } @@ -439,14 +436,16 @@ export const importProducts = (options?: Options) => { * | `like` | `sku`, `slug`, `upc_ean`, `mpn`, `name`, `description` | Like. Checks if the operand contains the specified string. Wildcards are supported. | `filter=like(name,some-name)` | * */ -export const exportProducts = (options?: Options) => { +export const exportProducts = ( + options?: OptionsLegacyParser, +) => { return (options?.client ?? client).post< ExportProductsResponse, - ExportProductsError + ExportProductsError, + ThrowOnError >({ ...options, url: "/pcm/products/export", - responseTransformer: ExportProductsResponseTransformer, }) } @@ -457,11 +456,16 @@ export const exportProducts = (options?: Options) => { * You can also use `include=component_products` to retrieve top-level resources, such as files or images, and key attribute data, such as SKU or slug for component products in a product bundle. With this option, you can get more information about the products in a product bundle in your store front, improving the buying experience for your shoppers. * */ -export const getProduct = (options: Options) => { - return (options?.client ?? client).get({ +export const getProduct = ( + options: OptionsLegacyParser, +) => { + return (options?.client ?? client).get< + GetProductResponse, + GetProductError, + ThrowOnError + >({ ...options, url: "/pcm/products/{productID}", - responseTransformer: GetProductResponseTransformer, }) } @@ -469,14 +473,16 @@ export const getProduct = (options: Options) => { * Update a product or bundle * Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the product or bundle is not updated. */ -export const updateProduct = (options: Options) => { +export const updateProduct = ( + options: OptionsLegacyParser, +) => { return (options?.client ?? client).put< UpdateProductResponse, - UpdateProductError + UpdateProductError, + ThrowOnError >({ ...options, url: "/pcm/products/{productID}", - responseTransformer: UpdateProductResponseTransformer, }) } @@ -487,10 +493,13 @@ export const updateProduct = (options: Options) => { * You cannot delete a product if it is part of a bundle. You must first delete the bundle before you delete the product. * */ -export const deleteProduct = (options: Options) => { +export const deleteProduct = ( + options: OptionsLegacyParser, +) => { return (options?.client ?? client).delete< DeleteProductResponse, - DeleteProductError + DeleteProductError, + ThrowOnError >({ ...options, url: "/pcm/products/{productID}", @@ -511,10 +520,13 @@ export const deleteProduct = (options: Options) => { * * */ -export const attachNodes = (options: Options) => { +export const attachNodes = ( + options: OptionsLegacyParser, +) => { return (options?.client ?? client).post< AttachNodesResponse, - AttachNodesError + AttachNodesError, + ThrowOnError >({ ...options, url: "/pcm/products/attach_nodes", @@ -534,10 +546,13 @@ export const attachNodes = (options: Options) => { * | `In` | `id`, `name`, `SKU`, `slug`, `upc_ean`, `mpn`, `product_types` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `filter=in(id,some-id)` | * */ -export const detachNodes = (options: Options) => { +export const detachNodes = ( + options: OptionsLegacyParser, +) => { return (options?.client ?? client).post< DetachNodesResponse, - DetachNodesError + DetachNodesError, + ThrowOnError >({ ...options, url: "/pcm/products/detach_nodes", @@ -548,14 +563,16 @@ export const detachNodes = (options: Options) => { * Get a product's nodes * Returns the nodes associated with the product. Products must be in a `live` status. */ -export const getProductsNodes = (options: Options) => { +export const getProductsNodes = ( + options: OptionsLegacyParser, +) => { return (options?.client ?? client).get< GetProductsNodesResponse, - GetProductsNodesError + GetProductsNodesError, + ThrowOnError >({ ...options, url: "/pcm/products/{productID}/nodes", - responseTransformer: GetProductsNodesResponseTransformer, }) } @@ -611,12 +628,13 @@ export const getProductsNodes = (options: Options) => { * However, re-building child products after adding or removing an option does not change the existing product IDs. * */ -export const buildChildProducts = ( - options: Options, +export const buildChildProducts = ( + options: OptionsLegacyParser, ) => { return (options?.client ?? client).post< BuildChildProductsResponse, - BuildChildProductsError + BuildChildProductsError, + ThrowOnError >({ ...options, url: "/pcm/products/{productID}/build", @@ -626,14 +644,16 @@ export const buildChildProducts = ( /** * Get child products */ -export const getChildProducts = (options: Options) => { +export const getChildProducts = ( + options: OptionsLegacyParser, +) => { return (options?.client ?? client).get< GetChildProductsResponse, - GetChildProductsError + GetChildProductsError, + ThrowOnError >({ ...options, url: "/pcm/products/{productID}/children", - responseTransformer: GetChildProductsResponseTransformer, }) } @@ -641,12 +661,18 @@ export const getChildProducts = (options: Options) => { * Create a product template relationship * Retrieves all the templates that are associated with the specified product. */ -export const createProductTemplateRelationship = ( - options: Options, +export const createProductTemplateRelationship = < + ThrowOnError extends boolean = false, +>( + options: OptionsLegacyParser< + CreateProductTemplateRelationshipData, + ThrowOnError + >, ) => { return (options?.client ?? client).post< CreateProductTemplateRelationshipResponse, - CreateProductTemplateRelationshipError + CreateProductTemplateRelationshipError, + ThrowOnError >({ ...options, url: "/pcm/products/{productID}/relationships/templates", @@ -656,12 +682,18 @@ export const createProductTemplateRelationship = ( /** * Get all product template relationships */ -export const getProductTemplateRelationships = ( - options: Options, +export const getProductTemplateRelationships = < + ThrowOnError extends boolean = false, +>( + options: OptionsLegacyParser< + GetProductTemplateRelationshipsData, + ThrowOnError + >, ) => { return (options?.client ?? client).get< GetProductTemplateRelationshipsResponse, - GetProductTemplateRelationshipsError + GetProductTemplateRelationshipsError, + ThrowOnError >({ ...options, url: "/pcm/products/{productID}/relationships/templates", @@ -671,12 +703,18 @@ export const getProductTemplateRelationships = ( /** * Delete a product template relationship */ -export const deleteProductTemplateRelationship = ( - options: Options, +export const deleteProductTemplateRelationship = < + ThrowOnError extends boolean = false, +>( + options: OptionsLegacyParser< + DeleteProductTemplateRelationshipData, + ThrowOnError + >, ) => { return (options?.client ?? client).delete< DeleteProductTemplateRelationshipResponse, - DeleteProductTemplateRelationshipError + DeleteProductTemplateRelationshipError, + ThrowOnError >({ ...options, url: "/pcm/products/{productID}/relationships/templates", @@ -687,12 +725,18 @@ export const deleteProductTemplateRelationship = ( * Get Bundle Component Product Relationships * Retrieves all the products included in the specified bundle product. */ -export const getProductComponentProductsRelationships = ( - options: Options, +export const getProductComponentProductsRelationships = < + ThrowOnError extends boolean = false, +>( + options: OptionsLegacyParser< + GetProductComponentProductsRelationshipsData, + ThrowOnError + >, ) => { return (options?.client ?? client).get< GetProductComponentProductsRelationshipsResponse, - GetProductComponentProductsRelationshipsError + GetProductComponentProductsRelationshipsError, + ThrowOnError >({ ...options, url: "/pcm/products/{productID}/relationships/component_products", @@ -703,12 +747,15 @@ export const getProductComponentProductsRelationships = ( * Get all product file relationships * Retrieves all files that are associated with the specified product. */ -export const getProductFileRelationships = ( - options: Options, +export const getProductFileRelationships = < + ThrowOnError extends boolean = false, +>( + options: OptionsLegacyParser, ) => { return (options?.client ?? client).get< GetProductFileRelationshipsResponse, - GetProductFileRelationshipsError + GetProductFileRelationshipsError, + ThrowOnError >({ ...options, url: "/pcm/products/{productID}/relationships/files", @@ -718,12 +765,18 @@ export const getProductFileRelationships = ( /** * Create a product file relationship */ -export const createProductFileRelationships = ( - options: Options, +export const createProductFileRelationships = < + ThrowOnError extends boolean = false, +>( + options: OptionsLegacyParser< + CreateProductFileRelationshipsData, + ThrowOnError + >, ) => { return (options?.client ?? client).post< CreateProductFileRelationshipsResponse, - CreateProductFileRelationshipsError + CreateProductFileRelationshipsError, + ThrowOnError >({ ...options, url: "/pcm/products/{productID}/relationships/files", @@ -733,12 +786,18 @@ export const createProductFileRelationships = ( /** * Replace a product file relationship */ -export const updateProductFileRelationships = ( - options: Options, +export const updateProductFileRelationships = < + ThrowOnError extends boolean = false, +>( + options: OptionsLegacyParser< + UpdateProductFileRelationshipsData, + ThrowOnError + >, ) => { return (options?.client ?? client).put< UpdateProductFileRelationshipsResponse, - UpdateProductFileRelationshipsError + UpdateProductFileRelationshipsError, + ThrowOnError >({ ...options, url: "/pcm/products/{productID}/relationships/files", @@ -748,12 +807,18 @@ export const updateProductFileRelationships = ( /** * Delete a product file relationships */ -export const deleteProductFileRelationships = ( - options: Options, +export const deleteProductFileRelationships = < + ThrowOnError extends boolean = false, +>( + options: OptionsLegacyParser< + DeleteProductFileRelationshipsData, + ThrowOnError + >, ) => { return (options?.client ?? client).delete< DeleteProductFileRelationshipsResponse, - DeleteProductFileRelationshipsError + DeleteProductFileRelationshipsError, + ThrowOnError >({ ...options, url: "/pcm/products/{productID}/relationships/files", @@ -763,12 +828,18 @@ export const deleteProductFileRelationships = ( /** * Create a product variation relationship */ -export const createProductVariationRelationships = ( - options: Options, +export const createProductVariationRelationships = < + ThrowOnError extends boolean = false, +>( + options: OptionsLegacyParser< + CreateProductVariationRelationshipsData, + ThrowOnError + >, ) => { return (options?.client ?? client).post< CreateProductVariationRelationshipsResponse, - CreateProductVariationRelationshipsError + CreateProductVariationRelationshipsError, + ThrowOnError >({ ...options, url: "/pcm/products/{productID}/relationships/variations", @@ -778,12 +849,18 @@ export const createProductVariationRelationships = ( /** * Get all product variation relationships */ -export const getProductVariationRelationships = ( - options: Options, +export const getProductVariationRelationships = < + ThrowOnError extends boolean = false, +>( + options: OptionsLegacyParser< + GetProductVariationRelationshipsData, + ThrowOnError + >, ) => { return (options?.client ?? client).get< GetProductVariationRelationshipsResponse, - GetProductVariationRelationshipsError + GetProductVariationRelationshipsError, + ThrowOnError >({ ...options, url: "/pcm/products/{productID}/relationships/variations", @@ -793,12 +870,18 @@ export const getProductVariationRelationships = ( /** * Replace a product variation relationship */ -export const updateProductVariationRelationships = ( - options: Options, +export const updateProductVariationRelationships = < + ThrowOnError extends boolean = false, +>( + options: OptionsLegacyParser< + UpdateProductVariationRelationshipsData, + ThrowOnError + >, ) => { return (options?.client ?? client).put< UpdateProductVariationRelationshipsResponse, - UpdateProductVariationRelationshipsError + UpdateProductVariationRelationshipsError, + ThrowOnError >({ ...options, url: "/pcm/products/{productID}/relationships/variations", @@ -808,12 +891,18 @@ export const updateProductVariationRelationships = ( /** * Delete a product variation relationships */ -export const deleteProductVariationRelationships = ( - options: Options, +export const deleteProductVariationRelationships = < + ThrowOnError extends boolean = false, +>( + options: OptionsLegacyParser< + DeleteProductVariationRelationshipsData, + ThrowOnError + >, ) => { return (options?.client ?? client).delete< DeleteProductVariationRelationshipsResponse, - DeleteProductVariationRelationshipsError + DeleteProductVariationRelationshipsError, + ThrowOnError >({ ...options, url: "/pcm/products/{productID}/relationships/variations", @@ -824,12 +913,18 @@ export const deleteProductVariationRelationships = ( * Create main image relationships * Associates a main image with the specified product. */ -export const createProductMainImageRelationships = ( - options: Options, +export const createProductMainImageRelationships = < + ThrowOnError extends boolean = false, +>( + options: OptionsLegacyParser< + CreateProductMainImageRelationshipsData, + ThrowOnError + >, ) => { return (options?.client ?? client).post< CreateProductMainImageRelationshipsResponse, - CreateProductMainImageRelationshipsError + CreateProductMainImageRelationshipsError, + ThrowOnError >({ ...options, url: "/pcm/products/{productID}/relationships/main_image", @@ -839,12 +934,18 @@ export const createProductMainImageRelationships = ( /** * Get Main Image Relationships */ -export const getProductMainImageRelationships = ( - options: Options, +export const getProductMainImageRelationships = < + ThrowOnError extends boolean = false, +>( + options: OptionsLegacyParser< + GetProductMainImageRelationshipsData, + ThrowOnError + >, ) => { return (options?.client ?? client).get< GetProductMainImageRelationshipsResponse, - GetProductMainImageRelationshipsError + GetProductMainImageRelationshipsError, + ThrowOnError >({ ...options, url: "/pcm/products/{productID}/relationships/main_image", @@ -854,12 +955,18 @@ export const getProductMainImageRelationships = ( /** * Replace Main Image Relationships */ -export const updateProductMainImageRelationships = ( - options: Options, +export const updateProductMainImageRelationships = < + ThrowOnError extends boolean = false, +>( + options: OptionsLegacyParser< + UpdateProductMainImageRelationshipsData, + ThrowOnError + >, ) => { return (options?.client ?? client).put< UpdateProductMainImageRelationshipsResponse, - UpdateProductMainImageRelationshipsError + UpdateProductMainImageRelationshipsError, + ThrowOnError >({ ...options, url: "/pcm/products/{productID}/relationships/main_image", @@ -869,12 +976,18 @@ export const updateProductMainImageRelationships = ( /** * Delete Main Image Relationships */ -export const deleteProductMainImageRelationships = ( - options: Options, +export const deleteProductMainImageRelationships = < + ThrowOnError extends boolean = false, +>( + options: OptionsLegacyParser< + DeleteProductMainImageRelationshipsData, + ThrowOnError + >, ) => { return (options?.client ?? client).delete< DeleteProductMainImageRelationshipsResponse, - DeleteProductMainImageRelationshipsError + DeleteProductMainImageRelationshipsError, + ThrowOnError >({ ...options, url: "/pcm/products/{productID}/relationships/main_image", @@ -884,24 +997,29 @@ export const deleteProductMainImageRelationships = ( /** * Create a variation */ -export const createVariation = (options: Options) => { +export const createVariation = ( + options: OptionsLegacyParser, +) => { return (options?.client ?? client).post< CreateVariationResponse, - CreateVariationError + CreateVariationError, + ThrowOnError >({ ...options, url: "/pcm/variations", - responseTransformer: CreateVariationResponseTransformer, }) } /** * Get all variations */ -export const getAllVariations = (options?: Options) => { +export const getAllVariations = ( + options?: OptionsLegacyParser, +) => { return (options?.client ?? client).get< GetAllVariationsResponse, - GetAllVariationsError + GetAllVariationsError, + ThrowOnError >({ ...options, url: "/pcm/variations", @@ -911,10 +1029,13 @@ export const getAllVariations = (options?: Options) => { /** * Get a variation */ -export const getVariation = (options: Options) => { +export const getVariation = ( + options: OptionsLegacyParser, +) => { return (options?.client ?? client).get< GetVariationResponse, - GetVariationError + GetVariationError, + ThrowOnError >({ ...options, url: "/pcm/variations/{variationID}", @@ -925,10 +1046,13 @@ export const getVariation = (options: Options) => { * Update a variation * Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the variation is not updated. */ -export const updateVariation = (options: Options) => { +export const updateVariation = ( + options: OptionsLegacyParser, +) => { return (options?.client ?? client).put< UpdateVariationResponse, - UpdateVariationError + UpdateVariationError, + ThrowOnError >({ ...options, url: "/pcm/variations/{variationID}", @@ -938,10 +1062,13 @@ export const updateVariation = (options: Options) => { /** * Delete a variation and all it's associated options */ -export const deleteVariation = (options: Options) => { +export const deleteVariation = ( + options: OptionsLegacyParser, +) => { return (options?.client ?? client).delete< DeleteVariationResponse, - DeleteVariationError + DeleteVariationError, + ThrowOnError >({ ...options, url: "/pcm/variations/{variationID}", @@ -951,28 +1078,29 @@ export const deleteVariation = (options: Options) => { /** * Create a variation option */ -export const createVariationOption = ( - options: Options, +export const createVariationOption = ( + options: OptionsLegacyParser, ) => { return (options?.client ?? client).post< CreateVariationOptionResponse, - CreateVariationOptionError + CreateVariationOptionError, + ThrowOnError >({ ...options, url: "/pcm/variations/{variationID}/options", - responseTransformer: CreateVariationOptionResponseTransformer, }) } /** * Get all variation options */ -export const getAllVariationOptions = ( - options: Options, +export const getAllVariationOptions = ( + options: OptionsLegacyParser, ) => { return (options?.client ?? client).get< GetAllVariationOptionsResponse, - GetAllVariationOptionsError + GetAllVariationOptionsError, + ThrowOnError >({ ...options, url: "/pcm/variations/{variationID}/options", @@ -982,44 +1110,45 @@ export const getAllVariationOptions = ( /** * Get a variation option */ -export const getVariationOption = ( - options: Options, +export const getVariationOption = ( + options: OptionsLegacyParser, ) => { return (options?.client ?? client).get< GetVariationOptionResponse, - GetVariationOptionError + GetVariationOptionError, + ThrowOnError >({ ...options, url: "/pcm/variations/{variationID}/options/{optionID}", - responseTransformer: GetVariationOptionResponseTransformer, }) } /** * Update a variation option */ -export const updateVariationOption = ( - options: Options, +export const updateVariationOption = ( + options: OptionsLegacyParser, ) => { return (options?.client ?? client).put< UpdateVariationOptionResponse, - UpdateVariationOptionError + UpdateVariationOptionError, + ThrowOnError >({ ...options, url: "/pcm/variations/{variationID}/options/{optionID}", - responseTransformer: UpdateVariationOptionResponseTransformer, }) } /** * Delete a variation option */ -export const deleteVariationOption = ( - options: Options, +export const deleteVariationOption = ( + options: OptionsLegacyParser, ) => { return (options?.client ?? client).delete< DeleteVariationOptionResponse, - DeleteVariationOptionError + DeleteVariationOptionError, + ThrowOnError >({ ...options, url: "/pcm/variations/{variationID}/options/{optionID}", @@ -1029,10 +1158,13 @@ export const deleteVariationOption = ( /** * Create a modifier */ -export const createModifier = (options: Options) => { +export const createModifier = ( + options: OptionsLegacyParser, +) => { return (options?.client ?? client).post< CreateModifierResponse, - CreateModifierError + CreateModifierError, + ThrowOnError >({ ...options, url: "/pcm/variations/{variationID}/options/{optionID}/modifiers", @@ -1042,10 +1174,13 @@ export const createModifier = (options: Options) => { /** * Get all modifiers */ -export const getAllModifiers = (options: Options) => { +export const getAllModifiers = ( + options: OptionsLegacyParser, +) => { return (options?.client ?? client).get< GetAllModifiersResponse, - GetAllModifiersError + GetAllModifiersError, + ThrowOnError >({ ...options, url: "/pcm/variations/{variationID}/options/{optionID}/modifiers", @@ -1055,23 +1190,30 @@ export const getAllModifiers = (options: Options) => { /** * Get a modifier */ -export const getModifier = (options: Options) => { - return (options?.client ?? client).get( - { - ...options, - url: "/pcm/variations/{variationID}/options/{optionID}/modifiers/{modifierID}", - }, - ) +export const getModifier = ( + options: OptionsLegacyParser, +) => { + return (options?.client ?? client).get< + GetModifierResponse, + GetModifierError, + ThrowOnError + >({ + ...options, + url: "/pcm/variations/{variationID}/options/{optionID}/modifiers/{modifierID}", + }) } /** * Update a modifier * Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the modifier is not updated. */ -export const updateModifier = (options: Options) => { +export const updateModifier = ( + options: OptionsLegacyParser, +) => { return (options?.client ?? client).put< UpdateModifierResponse, - UpdateModifierError + UpdateModifierError, + ThrowOnError >({ ...options, url: "/pcm/variations/{variationID}/options/{optionID}/modifiers/{modifierID}", @@ -1082,10 +1224,13 @@ export const updateModifier = (options: Options) => { * Delete a modifier * You cannot delete a modifier if it is in use. Deleting a modifier in us returns a `422 Failed Validation` error. */ -export const deleteModifier = (options: Options) => { +export const deleteModifier = ( + options: OptionsLegacyParser, +) => { return (options?.client ?? client).delete< DeleteModifierResponse, - DeleteModifierError + DeleteModifierError, + ThrowOnError >({ ...options, url: "/pcm/variations/{variationID}/options/{optionID}/modifiers/{modifierID}", @@ -1096,14 +1241,16 @@ export const deleteModifier = (options: Options) => { * Create a hierarchy * Create a hierarchy */ -export const createHierarchy = (options: Options) => { +export const createHierarchy = ( + options: OptionsLegacyParser, +) => { return (options?.client ?? client).post< CreateHierarchyResponse, - CreateHierarchyError + CreateHierarchyError, + ThrowOnError >({ ...options, url: "/pcm/hierarchies", - responseTransformer: CreateHierarchyResponseTransformer, }) } @@ -1111,14 +1258,16 @@ export const createHierarchy = (options: Options) => { * Get all hierarchies * Get all hierarchies */ -export const getHierarchy = (options?: Options) => { +export const getHierarchy = ( + options?: OptionsLegacyParser, +) => { return (options?.client ?? client).get< GetHierarchyResponse, - GetHierarchyError + GetHierarchyError, + ThrowOnError >({ ...options, url: "/pcm/hierarchies", - responseTransformer: GetHierarchyResponseTransformer, }) } @@ -1126,14 +1275,16 @@ export const getHierarchy = (options?: Options) => { * Get a hierarchy * Retrieves the specified hierarchy. */ -export const getHierarchyChild = (options: Options) => { +export const getHierarchyChild = ( + options: OptionsLegacyParser, +) => { return (options?.client ?? client).get< GetHierarchyChildResponse, - GetHierarchyChildError + GetHierarchyChildError, + ThrowOnError >({ ...options, url: "/pcm/hierarchies/{hierarchyID}", - responseTransformer: GetHierarchyChildResponseTransformer, }) } @@ -1141,14 +1292,16 @@ export const getHierarchyChild = (options: Options) => { * Update a hierarchy * Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the hierarchy is not updated. */ -export const updateHierarchy = (options: Options) => { +export const updateHierarchy = ( + options: OptionsLegacyParser, +) => { return (options?.client ?? client).put< UpdateHierarchyResponse, - UpdateHierarchyError + UpdateHierarchyError, + ThrowOnError >({ ...options, url: "/pcm/hierarchies/{hierarchyID}", - responseTransformer: UpdateHierarchyResponseTransformer, }) } @@ -1156,10 +1309,13 @@ export const updateHierarchy = (options: Options) => { * Delete a hierarchy * Deletes the specified hierarchy and all its children. */ -export const deleteHierarchy = (options: Options) => { +export const deleteHierarchy = ( + options: OptionsLegacyParser, +) => { return (options?.client ?? client).delete< DeleteHierarchyResponse, - DeleteHierarchyError + DeleteHierarchyError, + ThrowOnError >({ ...options, url: "/pcm/hierarchies/{hierarchyID}", @@ -1208,11 +1364,16 @@ export const deleteHierarchy = (options: Options) => { * - Get node children in a catalog. * */ -export const createNode = (options: Options) => { - return (options?.client ?? client).post({ +export const createNode = ( + options: OptionsLegacyParser, +) => { + return (options?.client ?? client).post< + CreateNodeResponse, + CreateNodeError, + ThrowOnError + >({ ...options, url: "/pcm/hierarchies/{hierarchyID}/nodes", - responseTransformer: CreateNodeResponseTransformer, }) } @@ -1220,16 +1381,16 @@ export const createNode = (options: Options) => { * Get all nodes in a hierarchy * A fully paginated view of all nodes in a hierarchy regardless of depth. */ -export const getAllNodesInHierarchy = ( - options: Options, +export const getAllNodesInHierarchy = ( + options: OptionsLegacyParser, ) => { return (options?.client ?? client).get< GetAllNodesInHierarchyResponse, - GetAllNodesInHierarchyError + GetAllNodesInHierarchyError, + ThrowOnError >({ ...options, url: "/pcm/hierarchies/{hierarchyID}/nodes", - responseTransformer: GetAllNodesInHierarchyResponseTransformer, }) } @@ -1237,14 +1398,16 @@ export const getAllNodesInHierarchy = ( * Get a node * Retrieves a node from a hierarchy. */ -export const getHierarchyNode = (options: Options) => { +export const getHierarchyNode = ( + options: OptionsLegacyParser, +) => { return (options?.client ?? client).get< GetHierarchyNodeResponse, - GetHierarchyNodeError + GetHierarchyNodeError, + ThrowOnError >({ ...options, url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}", - responseTransformer: GetHierarchyNodeResponseTransformer, }) } @@ -1288,11 +1451,16 @@ export const getHierarchyNode = (options: Options) => { * - Get node children in a catalog. * */ -export const updateNode = (options: Options) => { - return (options?.client ?? client).put({ +export const updateNode = ( + options: OptionsLegacyParser, +) => { + return (options?.client ?? client).put< + UpdateNodeResponse, + UpdateNodeError, + ThrowOnError + >({ ...options, url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}", - responseTransformer: UpdateNodeResponseTransformer, }) } @@ -1300,10 +1468,13 @@ export const updateNode = (options: Options) => { * Deletes a node * Deletes a node by the node ID */ -export const deleteNode = (options: Options) => { +export const deleteNode = ( + options: OptionsLegacyParser, +) => { return (options?.client ?? client).delete< DeleteNodeResponse, - DeleteNodeError + DeleteNodeError, + ThrowOnError >({ ...options, url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}", @@ -1314,14 +1485,16 @@ export const deleteNode = (options: Options) => { * Get a hierarchy's children * Get a hierarchy's children */ -export const getAllChildren = (options: Options) => { +export const getAllChildren = ( + options: OptionsLegacyParser, +) => { return (options?.client ?? client).get< GetAllChildrenResponse, - GetAllChildrenError + GetAllChildrenError, + ThrowOnError >({ ...options, url: "/pcm/hierarchies/{hierarchyID}/children", - responseTransformer: GetAllChildrenResponseTransformer, }) } @@ -1350,16 +1523,18 @@ export const getAllChildren = (options: Options) => { * - If you create\update **Node A** and then you create a relationship with **Node B** but do not configure a `sort_order`, the `sort_order` you specified when you created\updated **Node A** is not overwritten. * */ -export const createNodeChildRelationships = ( - options: Options, +export const createNodeChildRelationships = < + ThrowOnError extends boolean = false, +>( + options: OptionsLegacyParser, ) => { return (options?.client ?? client).post< CreateNodeChildRelationshipsResponse, - CreateNodeChildRelationshipsError + CreateNodeChildRelationshipsError, + ThrowOnError >({ ...options, url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/children", - responseTransformer: CreateNodeChildRelationshipsResponseTransformer, }) } @@ -1367,16 +1542,16 @@ export const createNodeChildRelationships = ( * Get a node's children * Retrieves the child nodes for a specified node. */ -export const getAllNodeChildren = ( - options: Options, +export const getAllNodeChildren = ( + options: OptionsLegacyParser, ) => { return (options?.client ?? client).get< GetAllNodeChildrenResponse, - GetAllNodeChildrenError + GetAllNodeChildrenError, + ThrowOnError >({ ...options, url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/children", - responseTransformer: GetAllNodeChildrenResponseTransformer, }) } @@ -1387,10 +1562,13 @@ export const getAllNodeChildren = ( * You cannot move a node to another hierarchy. If you want to put the specified node into another hierarchy, create the node in the target hierarchy and delete it from the current hierarchy. * */ -export const updateNodeParent = (options: Options) => { +export const updateNodeParent = ( + options: OptionsLegacyParser, +) => { return (options?.client ?? client).put< UpdateNodeParentResponse, - UpdateNodeParentError + UpdateNodeParentError, + ThrowOnError >({ ...options, url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/parent", @@ -1400,10 +1578,13 @@ export const updateNodeParent = (options: Options) => { /** * Delete a node's parent */ -export const deleteNodeParent = (options: Options) => { +export const deleteNodeParent = ( + options: OptionsLegacyParser, +) => { return (options?.client ?? client).delete< DeleteNodeParentResponse, - DeleteNodeParentError + DeleteNodeParentError, + ThrowOnError >({ ...options, url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/parent", @@ -1414,32 +1595,39 @@ export const deleteNodeParent = (options: Options) => { * Create a node's product relationships * Creates relationships between the specified node and one or more products in a specified hierarchy. */ -export const createNodeProductRelationship = ( - options: Options, +export const createNodeProductRelationship = < + ThrowOnError extends boolean = false, +>( + options: OptionsLegacyParser, ) => { return (options?.client ?? client).post< CreateNodeProductRelationshipResponse, - CreateNodeProductRelationshipError + CreateNodeProductRelationshipError, + ThrowOnError >({ ...options, url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/products", - responseTransformer: CreateNodeProductRelationshipResponseTransformer, }) } /** * Deletes a node's product relationships */ -export const deleteNodeProductRelationships = ( - options: Options, +export const deleteNodeProductRelationships = < + ThrowOnError extends boolean = false, +>( + options: OptionsLegacyParser< + DeleteNodeProductRelationshipsData, + ThrowOnError + >, ) => { return (options?.client ?? client).delete< DeleteNodeProductRelationshipsResponse, - DeleteNodeProductRelationshipsError + DeleteNodeProductRelationshipsError, + ThrowOnError >({ ...options, url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/products", - responseTransformer: DeleteNodeProductRelationshipsResponseTransformer, }) } @@ -1448,14 +1636,16 @@ export const deleteNodeProductRelationships = ( * Returns the products associated with the specified hierarchy node from a published catalog. Products must be in a live status. If the products have been curated using the update a hierarchy node endpoint, then the products are returned in the order specified in the `curated_products` attribute in the body of the update a hierarchy node request. A product that is curated has the "curated_product": true attribute displayed. * */ -export const getNodeProducts = (options: Options) => { +export const getNodeProducts = ( + options: OptionsLegacyParser, +) => { return (options?.client ?? client).get< GetNodeProductsResponse, - GetNodeProductsError + GetNodeProductsError, + ThrowOnError >({ ...options, url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/products", - responseTransformer: GetNodeProductsResponseTransformer, }) } @@ -1477,16 +1667,16 @@ export const getNodeProducts = (options: Options) => { * - Get a hierarchy to retrieve the nodes and (if applicable) products associated with the duplicated hierarchy. * */ -export const duplicateHierarchy = ( - options: Options, +export const duplicateHierarchy = ( + options: OptionsLegacyParser, ) => { return (options?.client ?? client).post< DuplicateHierarchyResponse, - DuplicateHierarchyError + DuplicateHierarchyError, + ThrowOnError >({ ...options, url: "/pcm/hierarchies/{hierarchyID}/duplicate_job", - responseTransformer: DuplicateHierarchyResponseTransformer, }) } @@ -1496,14 +1686,16 @@ export const duplicateHierarchy = ( * * */ -export const getAllProductTags = (options?: Options) => { +export const getAllProductTags = ( + options?: OptionsLegacyParser, +) => { return (options?.client ?? client).get< GetAllProductTagsResponse, - GetAllProductTagsError + GetAllProductTagsError, + ThrowOnError >({ ...options, url: "/pcm/tags", - responseTransformer: GetAllProductTagsResponseTransformer, }) } @@ -1511,14 +1703,16 @@ export const getAllProductTags = (options?: Options) => { * Get a Product Tag * Retrieves a product tag for a store. A store can view the tags associated with the organization to which the store belongs. However, an organization can only view the tags associated with the organization. */ -export const getProductTag = (options: Options) => { +export const getProductTag = ( + options: OptionsLegacyParser, +) => { return (options?.client ?? client).get< GetProductTagResponse, - GetProductTagError + GetProductTagError, + ThrowOnError >({ ...options, url: "/pcm/tags/{tagID}", - responseTransformer: GetProductTagResponseTransformer, }) } @@ -1526,16 +1720,16 @@ export const getProductTag = (options: Options) => { * Create a custom relationship * Create a custom relationship */ -export const createCustomRelationship = ( - options: Options, +export const createCustomRelationship = ( + options: OptionsLegacyParser, ) => { return (options?.client ?? client).post< CreateCustomRelationshipResponse, - CreateCustomRelationshipError + CreateCustomRelationshipError, + ThrowOnError >({ ...options, url: "/pcm/custom_relationships", - responseTransformer: CreateCustomRelationshipResponseTransformer, }) } @@ -1543,15 +1737,15 @@ export const createCustomRelationship = ( * Update a custom relationship * Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the custom relationship is not updated. */ -export const updateCustomRelationship = ( - options: Options, +export const updateCustomRelationship = ( + options: OptionsLegacyParser, ) => { return (options?.client ?? client).put< UpdateCustomRelationshipResponse, - UpdateCustomRelationshipError + UpdateCustomRelationshipError, + ThrowOnError >({ ...options, url: "/pcm/custom_relationships/{customRelationshipSlug}", - responseTransformer: UpdateCustomRelationshipResponseTransformer, }) } diff --git a/packages/sdks/pim/src/client/types.gen.ts b/packages/sdks/pim/src/client/types.gen.ts index eedf9a86..2ce3514e 100644 --- a/packages/sdks/pim/src/client/types.gen.ts +++ b/packages/sdks/pim/src/client/types.gen.ts @@ -1,5873 +1,3339 @@ // This file is auto-generated by @hey-api/openapi-ts -export type Job = { - /** - * A unique identifier generated when a job is created. - */ - id?: string - /** - * This represents the type of resource object being returned. Always `pim-job`. - */ - type?: "pim-job" - attributes?: { +export type attributes = { /** - * The date and time a job is started. + * The name of the node, such as `Ranges` or `Refrigerators`. Names must be unique among sibling nodes in the hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies. */ - started_at?: Date | null + name?: string; /** - * The date and time a job is completed. + * A description for a node. */ - completed_at?: Date | null + description?: string; /** - * The date and time a job is created. + * A slug for the node. Slugs must be unique among sibling nodes in the hierarchy. Otherwise, a slug can be non-unique within the hierarchy and across multiple hierarchies. */ - created_at?: Date + slug?: string; /** - * The date and time a job is updated. + * You can curate your products in your nodes product lists. Product curation allows you to promote specific products within each node in a hierarchy, enabling you to create unique product collections in your storefront. */ - updated_at?: Date + curated_products?: Array<(string)>; /** - * The status of a job. - * - * * `pending` - Commerce has received the request but is currently busy processing other requests. - * * `started` - Commerce has started processing the job. - * * `success` - The job has successfully completed. - * * `failed` - The job has failed. - * + * Product Experience Manager supports localization of hierarchies and nodes. If you store supports multiple languages, you can localize hierarchy and node names and descriptions. */ - type?: - | "child-products" - | "product-import" - | "product-export" - | "hierarchy-duplicate" - | "price-import" - status?: "pending" | "cancelled" | "started" | "success" | "failed" - } - meta?: { - /** - * Applies to all job types. A unique request ID is generated when a job is created. - */ - x_request_id?: string - /** - * Applies to `hierarchy-duplicate` job types. The ID of the original hierarchy that you duplicated. - */ - copied_from?: string - /** - * Applies to `hierarchy-duplicate` job types. The duplicated hierarchy ID. - */ - hierarchy_id?: string - /** - * If the job type is `product_export`, a link to the file is created when running a job. - */ - file_locations?: Array | null - /** - * The entities included in the job. For example, if the job type is `product-export`, the PXM products included in the export. - */ - filter?: string - } -} - -/** - * This represents the type of resource object being returned. Always `pim-job`. - */ -export type type = "pim-job" - -export type status = "pending" | "cancelled" | "started" | "success" | "failed" + locales?: { + [key: string]: { + /** + * A localized hierarchy or node name. + */ + name?: string; + /** + * A localized hierarchy or node description. + */ + description?: string; + }; + }; +}; -export type Multi = { - /** - * An array of jobs. - */ - data?: Array - meta?: { - /** - * Contains the results for the entire collection. - */ - results?: { - /** - * Total number of results for the entire collection. - */ - total?: number - } - } -} - -export type Error = { - errors: Array<{ +export type attributes_custom_relationship = { /** - * The HTTP response code of the error. + * The name of the custom relationship, such as `Kitchen electrics`. */ - status: string + name?: string; /** - * A brief summary of the error. + * A description of the custom relationship. */ - title: string + description?: string; /** - * Optional additional detail about the error. + * A unique slug for the custom relationship. */ - detail?: string + slug?: string; +}; + +export type attributes_hierarchy = { /** - * Internal request ID. + * The name of a hierarchy, such as `Major Appliances`. */ - request_id?: string + name?: string; /** - * Additional supporting meta data for the error. + * A description for a hierarchy. */ - meta?: { - [key: string]: unknown - } - }> -} - -export type Single = { - data?: Job -} - -export type Errors = { - /** - * An array of job errors. - */ - data?: Array<{ + description?: string; /** - * This represents the type of resource object being returned. Always `pim-job-error`. + * A unique slug for a hierarchy. */ - type?: "pim-job-error" + slug?: string; /** - * A unique identifier for a job error generated when a job error is created. + * Product Experience Manager supports localization of hierarchies and nodes. If you store supports multiple languages, you can localize hierarchy and node names and descriptions. */ - id?: string - attributes?: { - /** - * A description of an error message. - */ - message?: string - } - }> -} + locales?: { + [key: string]: { + /** + * A localized hierarchy or node name. + */ + name?: string; + /** + * A localized hierarchy or node description. + */ + description?: string; + }; + }; +}; -/** - * You use the `custom_inputs` attribute to allow your shoppers to add custom text to a product when adding product items to their carts. This is useful, for example, if you have a product like a T-shirt that can be personalized or you sell greetings cards that can be printed with your shoppers personalized messages. See [Personalizing Products](/docs/api/pxm/products/create-product#personalizing-products). - */ -export type ProductCustomInputs = { - [key: string]: { - /** - * A name for the custom text field. - */ - name?: string +export type attributes_nodes = { /** - * The validation rules for the custom text. + * The name of the node, such as `Ranges` or `Refrigerators`. Names must be unique among sibling nodes in the hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies. */ - validation_rules?: unknown[] + name?: string; /** - * This represents the type of the resource being returned. + * A description of the node. */ - type?: string + description?: string; /** - * The length of the custom input text field. + * A slug for the node. Slugs must be unique among sibling nodes in the hierarchy. Otherwise, a slug can be non-unique within the hierarchy and across multiple hierarchies. */ - options?: { - [key: string]: unknown - } + slug?: string; /** - * The number of characters the custom text field can be. You can specify a maximum length up to 255 characters, as the limit is 255 characters. + * You can curate your products in your nodes product lists. Product curation allows you to promote specific products within each node in a hierarchy, enabling you to create unique product collections in your storefront. See [Curating Products in a node](/docs/api/pxm/products/create-node#curating-products-in-a-node). */ - max_length?: number + curated_products?: Array<(string)>; /** - * `true` or `false` depending on whether the custom text is required. + * Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. */ - required?: boolean - } -} + locales?: { + [key: string]: { + /** + * A localized name for the node. + */ + name?: string; + /** + * A localized description for the node. + */ + description?: string; + }; + }; +}; + +export type component_products_response = { + data?: Array<{ + /** + * The unique identifier of a product component generated when a product is created. + */ + id?: string; + /** + * This represents the type of resource object being returned. Always `product`. + */ + type?: 'product'; + }>; +}; + +export type create_custom_relationship = { + data?: { + /** + * This represents the type of resource object being returned. Always `custom-relationship`. + */ + type: 'custom-relationship'; + attributes: req_attributes_custom_relationship; + }; +}; /** - * You can build a combination of child products associated with a product, based on build rules that you specify. This is useful, for example, if you have a variation option that you do not sell. This makes managing and building your child products quick and easy. See [Using Build Rules](/docs/api/pxm/products/build-child-products#using-build-rules). + * This represents the type of resource object being returned. Always `custom-relationship`. */ -export type ProductBuildRules = { - /** - * Specifies the default behaviour, either `include` or `exclude`. - */ - default?: "include" | "exclude" - /** - * An array of option IDs to include when child products are built. Each combination consists of a nested array of option IDs from one or more variations. Combinations of option IDs in the nested arrays must come from different variations. - */ - include?: Array> - /** - * An array of option IDs to exclude when child products are built. Each combination consists of a nested array of option IDs from one or more variations. Combinations of option IDs in the nested arrays must come from different variations. - */ - exclude?: Array> -} +export type type = 'custom-relationship'; + +export type create_hierarchy = { + data?: { + /** + * This represents the type of resource object being returned. Always `hierarchy`. + */ + type: 'hierarchy'; + attributes: req_attributes_hierarchy; + }; +}; /** - * Specifies the default behaviour, either `include` or `exclude`. + * This represents the type of resource object being returned. Always `hierarchy`. */ -export type Default = "include" | "exclude" +export type type2 = 'hierarchy'; /** - * With Product Experience Manager, you can create and manage bundles. A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. See [Bundles](/docs/api/pxm/products/products#bundles). + * Use modifiers to change the properties of child products that are inherited from a parent product. With modifiers, you only need to have one parent product with a variation attached to the product. */ -export type ProductBundleComponents = { - [key: string]: { - /** - * The component name. The component name is the name that is displayed in your storefront. - */ - name?: string - /** - * The product options included in a component. This can be the ID of another bundle. - */ - options?: Array<{ - /** - * The unique ID of the product you want to add to a component. - */ - id?: string - /** - * This represents the type of object being returned. Always `product`. - */ - type?: string - /** - * The number of this product option that a shopper must purchase. - */ - quantity?: number - /** - * The sort order of the options. The `create a bundle` and `update a bundle` endpoints do not sort the options. You can use the `sort_order` attribute when programming your storefront to display the options in the order that you want. - */ - sort_order?: number - /** - * Whether the product option is a default option in a bundle. Shoppers can select a bundle that specifies a default list of product options. See [Dynamic Bundles](/docs/api/pxm/products/products#dynamic-bundles). - */ - default?: boolean - }> - /** - * The minimum number of product options a shopper can select from this component. - */ - min?: number - /** - * The maximum number of product options a shopper can select from this component. - */ - max?: number - /** - * The sort order of the components. The `create a bundle` and `update a bundle` endpoints do not sort the components. You can use the `sort_order` attribute when programming your storefront to display the components in the order that you want. - */ - sort_order?: number - } -} - -export type ProductResponse = { - /** - * A unique product ID that is generated when you create the product. - */ - id?: string - /** - * This represents the type of resource object being returned. Always `product`. - */ - type?: "product" - attributes?: { - /** - * A name for the product. - */ - name?: string - /** - * A description for the product. - */ - description?: string - /** - * A label for the product that is used in the URL paths. A slug can contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. By default, the product name is used as the slug. - */ - slug?: string - /** - * The unique stock keeping unit of the product. - */ - sku?: string - /** - * The status for the product, either `draft` or `live`. - */ - status?: "live" | "draft" - /** - * The commodity type, either `physical` or `digital`. - */ - commodity_type?: "physical" | "digital" - /** - * The universal product code or european article number of the product. - */ - upc_ean?: string - /** - * The manufacturer part number of the product. - */ - mpn?: string - /** - * The unique attribute associated with the product. This could be an external reference from a separate company system, for example. The maximum length is 2048 characters. - */ - external_ref?: string - /** - * Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. - */ - locales?: { - [key: string]: unknown - } - /** - * You can use product tags to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. A product can have up to 20 tags. A product tag can be up to 255 characters. Product tags must not contain any spaces or commas. - */ - tags?: Array - extensions?: { - [key: string]: { - [key: string]: string | null | number | boolean - } - } - custom_inputs?: ProductCustomInputs - build_rules?: ProductBuildRules - components?: ProductBundleComponents - } - meta?: { - /** - * The date and time a product is created. - */ - created_at?: Date - /** - * The date and time a product is updated. - */ - updated_at?: Date - /** - * The resource owner, either `organization` or `store`. - */ - owner?: "organization" | "store" - /** - * A product's variations and the options defined for each variation. If you have specified `build_rules`, only the child products included in the `build_rules` are specified. - */ - variations?: Array<{ - /** - * A unique ID generated when a variation is created. - */ - id?: string - /** - * The name of a variation. - */ - name?: string - options?: Array<{ - /** - * A unique ID that is generated an option is created. - */ - id?: string - /** - * The name of an option. - */ - name?: string +export type create_modifier = { + data: { /** - * A description of an option. + * This represents the type of resource object being returned. Always `product-variation-modifier`. */ - description?: string - }> - }> - /** - * One of the following product types: - * - * - `standard` - A `standard` product is a standalone product. - * - `parent` - A `parent` product is a product that has child products that have been built using the `Build Child Products` endpoint. - * - `child` - When you configure product variations and variation options for `parent` products, the `child` products derived from the `parent` products are automatically created in Commerce. - * - `bundle` - A `bundle` is a purchasable product, comprising one or more standalone products (in other words, components) to be sold together. - * - */ - product_types?: Array<"parent" | "child" | "bundle" | "standard"> - /** - * The child products defined for a product. The order of the variations in the `variation_matrix` is the order of the variations in the array when the variations were linked to the product. For example, the first variation in the `variation_matrix` corresponds to the first variation in the array, and so on. You can use the `sort_order`attribute to sort the order of your variation and variation options in the `variation_matrix` object. See [Sorting the Order of Variations and Options](/docs/api/pxm/products/variations#sorting-the-order-of-variations-and-options) If no variations are defined for a product, the `variation_matrix` is empty. - */ - variation_matrix?: { - [key: string]: unknown - } - } - /** - * Relationships are established between different product entities. For example, a `bundle` product and a `child` product are related to a `parent` product, as both are associated with it. - */ - relationships?: { - [key: string]: { - data?: - | Array<{ + type: 'product-variation-modifier'; + attributes: { /** - * A unique identifier for a resource. + * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + * + * | Modifier | Data Type | Effect | + * | :--- | :--- | :--- | + * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | + * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | + * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | + * | `description_equals` | `string` | Overrides the description of the child product. | + * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | + * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | + * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | + * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | + * | `price_increment` | `string` | Increases the price of the child product. | + * | `price_decrement` | `string` | Decreases the price of the child product. | + * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | + * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `sku_equals` | `string` | Sets the SKU of the child product. | + * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | + * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | + * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | + * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | + * */ - id?: string + type: 'commodity_type' | 'status' | 'price' | 'name_append' | 'name_prepend' | 'name_equals' | 'sku_append' | 'sku_prepend' | 'sku_equals' | 'sku_builder' | 'slug_append' | 'slug_prepend' | 'slug_equals' | 'slug_builder' | 'description_append' | 'description_prepend' | 'description_equals' | 'custom_inputs_equals' | 'build_rules_equals' | 'locales_equals' | 'upc_ean_equals' | 'mpn_equals' | 'external_ref_equals'; /** - * This represents the type of resource object being returned. + * Required for non-builder modifiers. The value of the modifier type. */ - type?: string - }> - | { + value?: string; /** - * A unique identifier for a resource. + * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. */ - id?: string + seek?: string; /** - * This represents the type of resource object being returned. + * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. */ - type?: string - } - | null - /** - * Links are used to allow you to move between requests. Single entities use a `self` parameter with a link to that specific resource. Sometimes, there are not enough entities for a project to fill multiple pages. In this situation, we return some defaults. - * - * | Property | Description | - * | :--- | :--- | - * | `current` | Always the current page. | - * | `first` | Always the first page. | - * | `last` | `null` if there is only one page. | - * | `prev` | `null` if the user is on the first page. | - * | `next` | `null` if there is only one page. | - * - */ - links?: { - [key: string]: string - } - } - } -} + set?: string; + /** + * A name for the modifier. + */ + reference_name?: string; + }; + }; +}; /** - * This represents the type of resource object being returned. Always `product`. + * This represents the type of resource object being returned. Always `product-variation-modifier`. */ -export type type2 = "product" +export type type3 = 'product-variation-modifier'; -/** - * The status for the product, either `draft` or `live`. - */ -export type status2 = "live" | "draft" +export type create_node = { + data?: { + /** + * This represents the type of resource object being returned. Always `node`. + */ + type: 'node'; + attributes: attributes_nodes; + meta?: { + /** + * You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. The `sort_order` for each node. This value determines the order of nodes in the response for the `Get a Node’s Children` request. The node with the highest value of sort_order is displayed first. For example, a node with a sort_order value of 3 appears before a node with a sort_order value of 2. + * + * - If you don’t provide `sort_order` when creating nodes, all child nodes in the response for `Get a Node’s Children` request are ordered by the `updated_at` time in descending order, with the most recently updated child node first. + * - If you set `sort_order` for only a few child nodes or not all, the child nodes with a `sort_order` value appear first and then other child nodes appear in the order of `updated_at` time. See [Sorting Nodes in a hierarchy](). + * + */ + sort_order?: number; + }; + }; +}; /** - * The commodity type, either `physical` or `digital`. + * This represents the type of resource object being returned. Always `node`. */ -export type commodity_type = "physical" | "digital" +export type type4 = 'node'; -/** - * The resource owner, either `organization` or `store`. - */ -export type owner = "organization" | "store" - -export type MultiProductResponse = { - data?: Array - /** - * Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. - */ - included?: { - /** - * Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. - */ - component_products?: Array - } - meta?: { - /** - * Contains the results for the entire collection. - */ - results?: { - /** - * Total number of results for the entire collection. - */ - total?: number - } - } -} +export type create_option = { + data: { + /** + * This represents the type of resource object being returned. Always `product-variation-option`. + */ + type: 'product-variation-option'; + attributes: { + /** + * A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + */ + name?: string; + /** + * By default, variations and variation options are sorted alphabetically. You can use the `sort_order` attribute to sort the order of your variation and variation options in the `variation_matrix`. + * + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. + * + * The variation option with the highest value of `sort_order` is displayed first. For example, a variation option with a `sort_order` value of `3` appears before a variation option with a `sort_order` value of `2`. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, and so on, zero or negative numbers. + * + * You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + * + * You must rebuild your products for the sort order changes to take effect. + * + */ + sort_order?: number; + /** + * A description of a product variation option. + */ + description?: string; + }; + }; +}; /** - * Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. + * This represents the type of resource object being returned. Always `product-variation-option`. */ -export type ProductLocales = { - [key: string]: { - /** - * A localized name for the product. - */ - name: string - /** - * A localized description for the product. - */ - description?: string - } -} - -export type ProductAttributes = { - /** - * The unique attribute associated with the product. This could be an external reference from a separate company system, for example. The maximum length is 2048 characters. - */ - external_ref?: string - /** - * The product name to display to customers. - */ - name?: string - /** - * A description for the product. - */ - description?: string - /** - * The unique slug of the product. A slug can contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. - */ - slug?: string - /** - * The unique stock keeping unit of the product. - */ - sku?: string - /** - * The status for the product, either `draft` or `live`. Default is `draft`. - */ - status?: "live" | "draft" - /** - * The commodity type, either `physical` or `digital`. - */ - commodity_type?: "physical" | "digital" - /** - * The universal product code or european article number of the product. - */ - upc_ean?: string - /** - * The manufacturer part number of the product. - */ - mpn?: string - /** - * You can use product tags to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. A product can have up to 20 tags. A product tag can be up to 255 characters. Product tags must not contain any spaces or commas. See [Product Tags](/docs/api/pxm/products/product-tags). - */ - tags?: Array - build_rules?: ProductBuildRules - locales?: ProductLocales - custom_inputs?: ProductCustomInputs - components?: ProductBundleComponents -} - -export type CreateProductRequest = { - data: { - /** - * This represents the type of resource being returned. Always `product`. - */ - type: "product" - attributes: ProductAttributes - /** - * Relationships are established between different product entities. - */ - relationships?: { - variations?: { - data?: Array<{ - /** - * A unique identifier for a resource. - */ - id?: string - /** - * This represents the type of resource object being returned. - */ - type?: string - }> - } - } - } -} - -export type SingleProductResponse = { - data?: ProductResponse - /** - * Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. - */ - included?: { - /** - * A list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. - */ - component_products?: Array - } -} +export type type5 = 'product-variation-option'; -export type UpdateProductRequest = { - data: { - /** - * This represents the type of resource object being returned. Always `product`. - */ - type: "product" - /** - * The unique identifier of the product. Must match the product ID specified in the request path. - */ - id: string - attributes: ProductAttributes - } -} - -export type Attributes = { - /** - * The name of the node, such as `Ranges` or `Refrigerators`. Names must be unique among sibling nodes in the hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies. - */ - name?: string - /** - * A description for a node. - */ - description?: string - /** - * A slug for the node. Slugs must be unique among sibling nodes in the hierarchy. Otherwise, a slug can be non-unique within the hierarchy and across multiple hierarchies. - */ - slug?: string - /** - * You can curate your products in your nodes product lists. Product curation allows you to promote specific products within each node in a hierarchy, enabling you to create unique product collections in your storefront. - */ - curated_products?: Array - /** - * Product Experience Manager supports localization of hierarchies and nodes. If you store supports multiple languages, you can localize hierarchy and node names and descriptions. - */ - locales?: { - [key: string]: { - /** - * A localized hierarchy or node name. - */ - name?: string - /** - * A localized hierarchy or node description. - */ - description?: string - } - } -} +export type create_product_request = { + data: { + /** + * This represents the type of resource being returned. Always `product`. + */ + type: 'product'; + attributes: product_attributes; + /** + * Relationships are established between different product entities. + */ + relationships?: { + variations?: { + data?: Array<{ + /** + * A unique identifier for a resource. + */ + id?: string; + /** + * This represents the type of resource object being returned. + */ + type?: string; + }>; + }; + }; + }; +}; /** - * Relationships allow you to move between requests. Includes links to the child nodes and products associated with a hierarchy or node. + * This represents the type of resource being returned. Always `product`. */ -export type Relationships = { - /** - * The child nodes related to the resource. - */ - children?: { - /** - * An array of child nodes. - */ - data?: unknown[] - /** - * Links allow you to move between requests. - */ - links?: { - /** - * A link to a related resource. - */ - related?: string - } - } - /** - * The parent node related to the resource - */ - parent?: { - /** - * The parent node - */ - data?: { - /** - * This represents the type of resource object being returned. Always `node`. - */ - type: "node" - /** - * The unique identifier of a node. - */ - id: string - } - } - /** - * The products related to the resource. - */ - products?: { - /** - * An array of products. - */ - data?: unknown[] - /** - * Links allow you to move between requests. - */ - links?: { - /** - * A link to a related resource. - */ - related?: string - } - } -} +export type type6 = 'product'; -/** - * This represents the type of resource object being returned. Always `node`. - */ -export type type3 = "node" - -export type Node = { - /** - * The unique identifier of a node. - */ - id?: string - /** - * This represents the type of resource object being returned. Always `node`. - */ - type?: "node" - attributes?: Attributes - relationships?: Relationships - meta?: { - /** - * The sort order value. The node with the highest value of `sort_order` is displayed first. For example, a node with a `sort_order` value of `3` appears before a node with a `sort_order` value of `2`. See [Sorting Nodes in a hierarchy](/docs/api/pxm/products/create-node#sorting-nodes-in-a-hierarchy). - */ - sort_order?: number - /** - * The date and time a node is created. - */ - created_at?: Date - /** - * The date and time a node was updated. - */ - updated_at?: Date - /** - * The name of the parent of the node if one exists. - */ - parent_name?: string - /** - * The node owner, either `organization` or `store`. - */ - owner?: "store" | "organization" - } -} - -export type MultiMeta = { - /** - * Contains the results for the entire collection. - */ - results?: { - /** - * Total number of results for the entire collection. - */ - total?: number - } -} +export type create_variation = { + data: { + /** + * This represents the type of resource object being returned. Always `product-variation`. + */ + type: 'product-variation'; + attributes: { + /** + * The variation name. + */ + name?: string; + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. + * + * The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. + * + * You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + * + * You must rebuild your products for the sort order changes to take effect. + * + */ + sort_order?: number; + }; + }; +}; /** - * Links are used to allow you to move between requests. + * This represents the type of resource object being returned. Always `product-variation`. */ -export type MultiLinks = { - /** - * Always the first page. - */ - first?: string - /** - * This is `null` if there is only one page. - */ - last?: string - /** - * This is `null` if there is only one page. - */ - next?: string - /** - * This is `null` if you on the first page. - */ - prev?: string -} - -export type MultiNodes = { - /** - * An array of nodes. - */ - data?: Array - meta?: MultiMeta - links?: MultiLinks -} - -export type TemplateResponse = { - data?: Array<{ - /** - * A unique identifier for a template generated when a template is created. - */ - id?: string - /** - * This represents the type of resource object being returned. Always `template`. - */ - type?: "template" - }> -} - -export type ProductTemplatesRequest = { - data?: Array<{ - /** - * The unique identifier of a template. - */ - id?: string - /** - * This represents the type of resource object being returned. Always `template'. - */ - type?: "template" - }> -} +export type type7 = 'product-variation'; -export type ComponentProductsResponse = { - data?: Array<{ - /** - * The unique identifier of a product component generated when a product is created. - */ - id?: string - /** - * This represents the type of resource object being returned. Always `product`. - */ - type?: "product" - }> -} +export type created_modifier = { + data?: { + /** + * A unique identifier for a modifier that is generated automatically when a modifier is created. + */ + id?: string; + /** + * This represents the type of resource object being returned. Always `product-variation-modifier'. + */ + type?: 'product-variation-modifier'; + attributes?: { + /** + * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + * + * | Modifier | Data Type | Effect | + * | :--- | :--- | :--- | + * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | + * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | + * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | + * | `description_equals` | `string` | Overrides the description of the child product. | + * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | + * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | + * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | + * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | + * | `price_increment` | `string` | Increases the price of the child product. | + * | `price_decrement` | `string` | Decreases the price of the child product. | + * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | + * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `sku_equals` | `string` | Sets the SKU of the child product. | + * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | + * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | + * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | + * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | + * + */ + type?: 'commodity_type' | 'status' | 'price' | 'name_append' | 'name_prepend' | 'name_equals' | 'sku_append' | 'sku_prepend' | 'sku_equals' | 'sku_builder' | 'slug_append' | 'slug_prepend' | 'slug_equals' | 'slug_builder' | 'description_append' | 'description_prepend' | 'description_equals' | 'custom_inputs_equals' | 'build_rules_equals' | 'locales_equals' | 'upc_ean_equals' | 'mpn_equals' | 'external_ref_equals'; + /** + * Required for non-builder modifiers. The value of the modifier type. + */ + value?: string; + /** + * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. + */ + seek?: string; + /** + * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. + */ + set?: string; + /** + * The name of the modifier. + */ + reference_name?: string; + }; + meta?: { + /** + * The owner of the resource, either `organization` or `store`. + */ + owner?: 'organization' | 'store'; + }; + }; +}; -export type FileResponse = { - data?: Array<{ - /** - * The unique identifier of the new file. - */ - id?: string - /** - * This represents the type of resource object being returned. Always `file`. - */ - type?: "file" - }> -} +/** + * The owner of the resource, either `organization` or `store`. + */ +export type owner = 'organization' | 'store'; -export type ProductFilesRequest = { - data?: Array<{ - /** - * A unique identifier for a file generated when a file is created. - */ - id?: string - /** - * This represents the type of resource being returned. Always `file`. - */ - type?: "file" - meta?: { - /** - * The files associated with a product. - */ - tags?: Array - } - }> -} - -export type VariationsResponse = { - data?: Array<{ - /** - * A unique identifier generated when a variation is created. - */ - id?: string - /** - * This represents the type of resource object being returned. Always `product-variation`. - */ - type?: "product-variation" - meta?: { - /** - * The date and time a resource is created. - */ - created_at?: Date - } - }> -} - -export type ProductVariationsRequest = { - data?: Array<{ - /** - * The ID of the product variation. - */ - id?: string - /** - * This represents the type of resource being returned. Always `product-variation`. - */ - type?: "product-variation" - }> -} - -export type MainImageResponse = { - data?: Array<{ - /** - * A unique identifier for the image file generated automatically when a file is created. - */ - id?: string - /** - * This represents the type of resource object being returned. Always `file`. - */ - type?: string - }> -} - -export type ReplaceMainImageRequest = { - data?: Array<{ - /** - * The ID of the new image file. - */ - id?: string - type?: "file" - }> -} - -export type MainImageRequest = { - data?: { - /** - * The ID of the image file. - */ - id?: string - /** - * This represents the type of resource being returned. Always `file`. - */ - type?: "file" - } -} - -/** - * This represents the type of resource being returned. Always `file`. - */ -export type type4 = "file" - -export type MultiVariations = { - data?: Array<{ - /** - * A unique identifier for a variation. - */ - id?: string - /** - * This represents the type of resource object being returned. Always `product-variation`. - */ - type?: "product-variation" - attributes?: { - /** - * The name of a variation. - */ - name?: string - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - */ - sort_order?: number - } - meta?: { - options?: Array<{ - /** - * A unique ID that is generated when an option is created. - */ - id?: string - /** - * A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. - */ - name?: string - /** - * A human recognizable description of the option. - */ - description?: string - /** - * The date and time an option is created. - */ - created_at?: Date - /** - * The date and time an option is updated. - */ - updated_at?: Date - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - */ - sort_order?: number - }> - /** - * The owner of the resource, either `organization` or `store`. - */ - owner?: "organization" | "store" - /** - * The date and time a variation is created. - */ - created_at?: Date - /** - * The date and time a variation is updated. - */ - updated_at?: Date - } - }> - meta?: { - /** - * Contains the results for the entire collection. - */ - results?: { - /** - * Total number of results for the entire collection. - */ - total?: number - } - } -} - -export type CreateVariation = { - data: { - /** - * This represents the type of resource object being returned. Always `product-variation`. - */ - type: "product-variation" - attributes: { - /** - * The variation name. - */ - name?: string - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. - * - * The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. - * - * You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - * - * You must rebuild your products for the sort order changes to take effect. - * - */ - sort_order?: number - } - } -} - -/** - * This represents the type of resource object being returned. Always `product-variation`. - */ -export type type5 = "product-variation" - -export type CreatedVariation = { - data: { - /** - * A unique identifier generated when a variation is created. - */ - id: string - /** - * This represents the type of resource object being returned. Always `product-variation`. - */ - type: "product-variation" - attributes: { - /** - * A human-recognizable identifier for a variation. - */ - name?: string - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - */ - sort_order?: number - } - meta: { - /** - * The owner of the resource, either `organization` or `store`. - */ - owner?: "organization" | "store" - /** - * The date and time a variation is created. - */ - created_at?: Date - /** - * The date and time a variation is updated. - */ - updated_at?: Date - } - } -} - -export type SingleVariation = { - data: { - /** - * A unique identifier for a variation. - */ - id: string - /** - * This represents the type of resource object being returned. Always `product-variation`. - */ - type: "product-variation" - attributes: { - /** - * The name for a variation. - */ - name?: string - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - */ - sort_order?: number - } - meta: { - /** - * A variation option represents an option for selection for a single product-variation. For example, if your variation is `color`, you might have three possible options; red, green, and blue. - */ - options?: Array<{ - /** - * A unique ID that is generated an option is created. - */ - id?: string - /** - * A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. - */ - name?: string - /** - * A description for an option. - */ - description?: string - /** - * The date and time an option is created. - */ - created_at?: Date - /** - * The date and time an option is updated. - */ - updated_at?: Date - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - */ - sort_order?: number - }> - /** - * The owner of the resource, either `organization` or `store`. - */ - owner?: "organization" | "store" - /** - * The date and time a variation is created. - */ - created_at?: string - /** - * The date and time a variation is updated. - */ - updated_at?: string - } - } -} - -export type UpdateVariation = { - data: { - /** - * This represents the type of resource object being returned. Always `product-variation`. - */ - type: "product-variation" - attributes: { - /** - * The variation name. - */ - name?: string - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. - * - * The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. - * - * You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - * - * You must rebuild your products for the sort order changes to take effect. - * - */ - sort_order?: number - } - /** - * The unique identifier of the variation. Must match the variation ID specified in the request path. - */ - id: string - } -} - -export type MultiOptions = { - data?: Array<{ - /** - * A unique identifier generated when an option is created. - */ - id?: string - /** - * This represents the type of resource object being returned. Always `product-variation-option`. - */ - type?: "product-variation-option" - attributes?: { - /** - * A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. - */ - name?: string - /** - * A human-recognizable description for the option. - */ - description?: string - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - */ - sort_order?: number - } - meta?: { - /** - * The owner of a resource, either `organization` or `store`. - */ - owner?: "organization" | "store" - /** - * The date and time an option is created. - */ - created_at?: Date - /** - * The date and time an option is updated. - */ - updated_at?: Date - } - }> - meta?: { - /** - * Contains the results for the entire collection. - */ - results?: { - /** - * Total number of results for the entire collection. - */ - total?: number - } - } -} - -export type CreateOption = { - data: { - /** - * This represents the type of resource object being returned. Always `product-variation-option`. - */ - type: "product-variation-option" - attributes: { - /** - * A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. - */ - name?: string - /** - * By default, variations and variation options are sorted alphabetically. You can use the `sort_order` attribute to sort the order of your variation and variation options in the `variation_matrix`. - * - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. - * - * The variation option with the highest value of `sort_order` is displayed first. For example, a variation option with a `sort_order` value of `3` appears before a variation option with a `sort_order` value of `2`. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, and so on, zero or negative numbers. - * - * You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - * - * You must rebuild your products for the sort order changes to take effect. - * - */ - sort_order?: number - /** - * A description of a product variation option. - */ - description?: string - } - } -} - -/** - * This represents the type of resource object being returned. Always `product-variation-option`. - */ -export type type6 = "product-variation-option" - -export type CreatedOption = { - data: { - /** - * A unique identifier that is generated when an option is created. - */ - id?: string - /** - * This represents the type of resource object being returned. Always `product-variation-option`. - */ - type: "product-variation-option" - attributes: { - /** - * A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. - */ - name?: string - /** - * A human-recognizable description for the option. - */ - description?: string - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - */ - sort_order?: number - } - meta?: { - /** - * The owner of a resource, either `organization` or `store`. - */ - owner?: "organization" | "store" - /** - * The date and time an option is created. - */ - created_at?: Date - /** - * The date and time an option is updated. - */ - updated_at?: Date - } - } -} - -export type SingleOption = { - data: { - /** - * The unique identifier generated when an option is created. - */ - id: string - /** - * This represents the type of resource object being returned. Always `product-variation-option`. - */ - type: "product-variation-option" - /** - * A variation option represents an option for selection for a single product-variation. For example, if your variation is `color`, you might have three possible options; red, green, and blue. - */ - attributes: { - /** - * A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. - */ - name?: string - /** - * A human-recognizable description for the option. - */ - description?: string - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - */ - sort_order?: number - } - meta: { - /** - * The owner of a resource, either `organization` or `store`. - */ - owner?: "organization" | "store" - /** - * The date and time an option is created. - */ - created_at?: Date - /** - * The date and time an option is updated. - */ - updated_at?: Date - } - } -} - -export type UpdateOption = { - data: { - /** - * This represents the type of resource object being returned. Always `product-variation-option`. - */ - type: "product-variation-option" - attributes: { - /** - * A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. - */ - name?: string - /** - * The description of the option. - */ - description?: string - /** - * By default, variations and variation options are sorted alphabetically. You can use the `sort_order` attribute to sort the order of your variation and variation options in the `variation_matrix`. The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. - * - * The variation option with the highest value of `sort_order` is displayed first. For example, a variation option with a `sort_order` value of `3` appears before a variation option with a `sort_order` value of `2`. - * - * You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, and so on, zero or negative numbers. - * - * You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - * - * You must rebuild your products for the sort order changes to take effect. - * - */ - sort_order?: number - } - /** - * The unique identifier of the option. Must match the option ID specified in the request path. - */ - id: string - } -} - -export type MultiModifiers = { - data?: Array<{ - /** - * A unique identifier for a modifier that is generated automatically when a modifier is created. - */ - id?: string - /** - * This represents the type of resource object being returned. Always `product-variation-modifier'. - */ - type?: "product-variation-modifier" - attributes?: { - /** - * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. - * - * | Modifier | Data Type | Effect | - * | :--- | :--- | :--- | - * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | - * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | - * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | - * | `description_equals` | `string` | Overrides the description of the child product. | - * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | - * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | - * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | - * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | - * | `price_increment` | `string` | Increases the price of the child product. | - * | `price_decrement` | `string` | Decreases the price of the child product. | - * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | - * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `sku_equals` | `string` | Sets the SKU of the child product. | - * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | - * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | - * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | - * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | - * - */ - type?: - | "commodity_type" - | "status" - | "price" - | "name_append" - | "name_prepend" - | "name_equals" - | "sku_append" - | "sku_prepend" - | "sku_equals" - | "sku_builder" - | "slug_append" - | "slug_prepend" - | "slug_equals" - | "slug_builder" - | "description_append" - | "description_prepend" - | "description_equals" - | "custom_inputs_equals" - | "build_rules_equals" - | "locales_equals" - | "upc_ean_equals" - | "mpn_equals" - | "external_ref_equals" - /** - * Required for non-builder modifiers. The value of the modifier type. - */ - value?: string - /** - * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. - */ - seek?: string - /** - * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. - */ - set?: string - /** - * The name of the modifier. - */ - reference_name?: string - } - meta?: { - /** - * The owner of a resource, either `organization` or `store`. - */ - owner?: "store" | "organization" - } - }> - meta?: { - /** - * Contains the results for the entire collection. - */ - results?: { - /** - * Total number of results for the entire collection. - */ - total?: number - } - } -} - -/** - * Use modifiers to change the properties of child products that are inherited from a parent product. With modifiers, you only need to have one parent product with a variation attached to the product. - */ -export type CreateModifier = { - data: { - /** - * This represents the type of resource object being returned. Always `product-variation-modifier`. - */ - type: "product-variation-modifier" - attributes: { - /** - * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. - * - * | Modifier | Data Type | Effect | - * | :--- | :--- | :--- | - * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | - * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | - * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | - * | `description_equals` | `string` | Overrides the description of the child product. | - * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | - * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | - * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | - * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | - * | `price_increment` | `string` | Increases the price of the child product. | - * | `price_decrement` | `string` | Decreases the price of the child product. | - * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | - * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `sku_equals` | `string` | Sets the SKU of the child product. | - * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | - * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | - * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | - * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | - * - */ - type: - | "commodity_type" - | "status" - | "price" - | "name_append" - | "name_prepend" - | "name_equals" - | "sku_append" - | "sku_prepend" - | "sku_equals" - | "sku_builder" - | "slug_append" - | "slug_prepend" - | "slug_equals" - | "slug_builder" - | "description_append" - | "description_prepend" - | "description_equals" - | "custom_inputs_equals" - | "build_rules_equals" - | "locales_equals" - | "upc_ean_equals" - | "mpn_equals" - | "external_ref_equals" - /** - * Required for non-builder modifiers. The value of the modifier type. - */ - value?: string - /** - * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. - */ - seek?: string - /** - * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. - */ - set?: string - /** - * A name for the modifier. - */ - reference_name?: string - } - } -} - -/** - * This represents the type of resource object being returned. Always `product-variation-modifier`. - */ -export type type7 = "product-variation-modifier" - -export type CreatedModifier = { - data?: { - /** - * A unique identifier for a modifier that is generated automatically when a modifier is created. - */ - id?: string - /** - * This represents the type of resource object being returned. Always `product-variation-modifier'. - */ - type?: "product-variation-modifier" - attributes?: { - /** - * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. - * - * | Modifier | Data Type | Effect | - * | :--- | :--- | :--- | - * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | - * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | - * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | - * | `description_equals` | `string` | Overrides the description of the child product. | - * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | - * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | - * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | - * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | - * | `price_increment` | `string` | Increases the price of the child product. | - * | `price_decrement` | `string` | Decreases the price of the child product. | - * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | - * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `sku_equals` | `string` | Sets the SKU of the child product. | - * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | - * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | - * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | - * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | - * - */ - type?: - | "commodity_type" - | "status" - | "price" - | "name_append" - | "name_prepend" - | "name_equals" - | "sku_append" - | "sku_prepend" - | "sku_equals" - | "sku_builder" - | "slug_append" - | "slug_prepend" - | "slug_equals" - | "slug_builder" - | "description_append" - | "description_prepend" - | "description_equals" - | "custom_inputs_equals" - | "build_rules_equals" - | "locales_equals" - | "upc_ean_equals" - | "mpn_equals" - | "external_ref_equals" - /** - * Required for non-builder modifiers. The value of the modifier type. - */ - value?: string - /** - * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. - */ - seek?: string - /** - * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. - */ - set?: string - /** - * The name of the modifier. - */ - reference_name?: string - } - meta?: { - /** - * The owner of the resource, either `organization` or `store`. - */ - owner?: "organization" | "store" - } - } -} - -export type SingleModifier = { - data?: { - /** - * A unique identifier for a modifier that is generated automatically when a modifier is created. - */ - id?: string - /** - * This represents the type of resource object being returned. Always `product-variation-modifier'. - */ - type?: "product-variation-modifier" - attributes?: { - /** - * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. - * - * | Modifier | Data Type | Effect | - * | :--- | :--- | :--- | - * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | - * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | - * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | - * | `description_equals` | `string` | Overrides the description of the child product. | - * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | - * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | - * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | - * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | - * | `price_increment` | `string` | Increases the price of the child product. | - * | `price_decrement` | `string` | Decreases the price of the child product. | - * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | - * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `sku_equals` | `string` | Sets the SKU of the child product. | - * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | - * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | - * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | - * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | - * - */ - type?: - | "commodity_type" - | "status" - | "price" - | "name_append" - | "name_prepend" - | "name_equals" - | "sku_append" - | "sku_prepend" - | "sku_equals" - | "sku_builder" - | "slug_append" - | "slug_prepend" - | "slug_equals" - | "slug_builder" - | "description_append" - | "description_prepend" - | "description_equals" - | "custom_inputs_equals" - | "build_rules_equals" - | "locales_equals" - | "upc_ean_equals" - | "mpn_equals" - | "external_ref_equals" - /** - * Required for non-builder modifiers. The value of the modifier type. - */ - value?: string - /** - * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. - */ - seek?: string - /** - * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. - */ - set?: string - /** - * The name of the modifier. - */ - reference_name?: string - } - /** - * The owner of the resource, either `organization` or `store`. - */ - meta?: { - owner?: "organization" | "store" - } - } -} - -export type UpdateModifier = { - data: { - /** - * This represents the type of resource object being returned. Always `product-variation-modifier`. - */ - type: "product-variation-modifier" - attributes: { - /** - * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. - * - * | Modifier | Data Type | Effect | - * | :--- | :--- | :--- | - * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | - * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | - * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | - * | `description_equals` | `string` | Overrides the description of the child product. | - * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | - * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | - * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | - * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | - * | `price_increment` | `string` | Increases the price of the child product. | - * | `price_decrement` | `string` | Decreases the price of the child product. | - * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | - * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `sku_equals` | `string` | Sets the SKU of the child product. | - * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | - * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | - * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | - * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | - * - */ - type: - | "commodity_type" - | "status" - | "price" - | "name_append" - | "name_prepend" - | "name_equals" - | "sku_append" - | "sku_prepend" - | "sku_equals" - | "sku_builder" - | "slug_append" - | "slug_prepend" - | "slug_equals" - | "slug_builder" - | "description_append" - | "description_prepend" - | "description_equals" - | "custom_inputs_equals" - | "build_rules_equals" - | "locales_equals" - | "upc_ean_equals" - | "mpn_equals" - | "external_ref_equals" - /** - * Required for non-builder modifiers. The value of the modifier type. - */ - value?: string - /** - * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. - */ - seek?: string - /** - * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. - */ - set?: string - /** - * The name of the modifier. - */ - reference_name?: string - } - /** - * The unique identifier of the modifier. Must match the modifier ID specified in the request path. - */ - id: string - } -} - -export type AttributesHierarchy = { - /** - * The name of a hierarchy, such as `Major Appliances`. - */ - name?: string - /** - * A description for a hierarchy. - */ - description?: string - /** - * A unique slug for a hierarchy. - */ - slug?: string - /** - * Product Experience Manager supports localization of hierarchies and nodes. If you store supports multiple languages, you can localize hierarchy and node names and descriptions. - */ - locales?: { - [key: string]: { - /** - * A localized hierarchy or node name. - */ - name?: string - /** - * A localized hierarchy or node description. - */ - description?: string - } - } -} - -export type RelationshipsHierarchy = { - /** - * The child nodes related to the hierarchy. - */ - children?: { - /** - * An array of child nodes. - */ - data?: unknown[] - /** - * Links allow you to move between requests. - */ - links?: { - /** - * A link to a related resource. - */ - related?: string - } - } -} - -export type Hierarchy = { - /** - * A unique identifier generated when a hierarchy is created. - */ - id?: string - /** - * This represents the type of resource object being returned. Always `hierarchy`. - */ - type?: "hierarchy" - attributes?: AttributesHierarchy - relationships?: RelationshipsHierarchy - meta?: { - /** - * The date and time a hierarchy is created. - */ - created_at?: Date - /** - * The date and time a hierarchy is updated. - */ - updated_at?: Date - /** - * The owner of a resource, either `organization` or `store`. - */ - owner?: "store" | "organization" - } -} - -/** - * This represents the type of resource object being returned. Always `hierarchy`. - */ -export type type8 = "hierarchy" - -export type MultiHierarchy = { - data?: Array - links?: MultiLinks - meta?: MultiMeta -} - -export type ReqAttributesHierarchy = { - /** - * The name of the hierarchy, such as `Major Appliances`. - */ - name?: string - /** - * A description of the hierarchy. - */ - description?: string - /** - * A unique slug for the hierarchy. - */ - slug?: string - /** - * Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. - */ - locales?: { - [key: string]: { - /** - * A localized name for the hierarchy. - */ - name?: string - /** - * A localized description for the hierarchy. - */ - description?: string - } - } -} - -export type CreateHierarchy = { - data?: { - /** - * This represents the type of resource object being returned. Always `hierarchy`. - */ - type: "hierarchy" - attributes: ReqAttributesHierarchy - } -} - -export type SingleHierarchy = { - data?: Hierarchy -} - -export type UpdateHierarchy = { - data: { - /** - * The unique identifier of the hierarchy. Must match the hierarchy ID specified in the request path. - */ - id: string - /** - * This represents the type of resource object being returned. Always `hierarchy`. - */ - type: "hierarchy" - attributes: ReqAttributesHierarchy - } -} - -export type AttributesNodes = { - /** - * The name of the node, such as `Ranges` or `Refrigerators`. Names must be unique among sibling nodes in the hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies. - */ - name?: string - /** - * A description of the node. - */ - description?: string - /** - * A slug for the node. Slugs must be unique among sibling nodes in the hierarchy. Otherwise, a slug can be non-unique within the hierarchy and across multiple hierarchies. - */ - slug?: string - /** - * You can curate your products in your nodes product lists. Product curation allows you to promote specific products within each node in a hierarchy, enabling you to create unique product collections in your storefront. See [Curating Products in a node](/docs/api/pxm/products/create-node#curating-products-in-a-node). - */ - curated_products?: Array - /** - * Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. - */ - locales?: { - [key: string]: { - /** - * A localized name for the node. - */ - name?: string - /** - * A localized description for the node. - */ - description?: string - } - } -} - -export type CreateNode = { - data?: { - /** - * This represents the type of resource object being returned. Always `node`. - */ - type: "node" - attributes: AttributesNodes - meta?: { - /** - * You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. The `sort_order` for each node. This value determines the order of nodes in the response for the `Get a Node’s Children` request. The node with the highest value of sort_order is displayed first. For example, a node with a sort_order value of 3 appears before a node with a sort_order value of 2. - * - * - If you don’t provide `sort_order` when creating nodes, all child nodes in the response for `Get a Node’s Children` request are ordered by the `updated_at` time in descending order, with the most recently updated child node first. - * - If you set `sort_order` for only a few child nodes or not all, the child nodes with a `sort_order` value appear first and then other child nodes appear in the order of `updated_at` time. See [Sorting Nodes in a hierarchy](). - * - */ - sort_order?: number - } - } -} - -export type SingleNode = { - data?: Node -} - -export type UpdateNode = { - data?: { - /** - * The unique identifier of the node. Must match the node ID specified in the request path. - */ - id: string - /** - * This represents the type of resource object being returned. Always `node`. - */ - type: "node" - attributes: AttributesNodes - meta?: { - /** - * You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. The `sort_order` for each node. This value determines the order of nodes in the response for the `Get a Node’s Children` request. The node with the highest value of sort_order is displayed first. For example, a node with a sort_order value of 3 appears before a node with a sort_order value of 2. - * - * - If you don’t provide `sort_order` when creating nodes, all child nodes in the response for `Get a Node’s Children` request are ordered by the `updated_at` time in descending order, with the most recently updated child node first. - * - If you set `sort_order` for only a few child nodes or not all, the child nodes with a `sort_order` value appear first and then other child nodes appear in the order of `updated_at` time. - * - */ - sort_order?: number - } - } -} - -export type NodeChildren = { - data?: Array<{ - /** - * The unique identifier of the child node. Must not match the node ID specified in the request path. - */ - id: string - /** - * This represents the type of resource object being returned. Always `node`. - */ - type: "node" - }> -} - -export type NodeParent = { - data?: { - /** - * The unique identifier of the new parent node. Must not match the node ID specified in the request path. - */ - id: string - /** - * This represents the type of resource object being returned. Always `node`. - */ - type: "node" - } -} - -export type NodeProducts = { - data?: Array<{ - /** - * The unique identifier of the product to be attached to the node. - */ - id: string - /** - * This represents the type of resource object being returned. Always `product`. - */ - type: "product" - }> -} - -export type DuplicateJob = { - data?: { - /** - * This represents the type of resource object being returned. Always `hierarchy`. - */ - type?: "hierarchy" - attributes?: { - /** - * The name of the duplicate hierarchy. The maximum length is 1000 characters. - */ - name?: string - /** - * A description of the duplicate hierarchy. - */ - description?: string - /** - * Specify `true` if you want the product associations in the existing nodes associated in your duplicated hierarchy. If not, specify `false`. - */ - include_products?: boolean - } - } -} - -export type Tag = { - /** - * A unique identifier generated when a tag is created. - */ - id?: string - /** - * This represents the type of resource object being returned. Always `tag`. - */ - type?: "tag" - attributes?: { - /** - * The text value of the tag. - */ - value?: string - } - meta?: { - /** - * A unique request ID is generated when a tag is created. - */ - x_request_id?: string - /** - * The date and time a tag is created. - */ - created_at?: Date - /** - * The date and time a tag is updated. - */ - updated_at?: Date - /** - * The owner of a resource, either `organization` or `store`. - */ - owner?: "store" | "organization" - } -} - -/** - * This represents the type of resource object being returned. Always `tag`. - */ -export type type9 = "tag" - -export type MultiTag = { - /** - * An array of tags. - */ - data?: Array - meta?: { - /** - * Contains the results for the entire collection. - */ - results?: { - /** - * Total number of results for the entire collection. - */ - total?: number - } - } -} - -export type SingleTag = { - data?: Tag -} - -export type ReqAttributesCustomRelationship = { - /** - * The name of the custom relationship, such as `Kitchen electrics`. - */ - name?: string - /** - * A description of the custom relationship. - */ - description?: string - /** - * A unique slug for the custom relationship. Must match the slug specified in the request path. - */ - slug?: string -} - -export type CreateCustomRelationship = { - data?: { - /** - * This represents the type of resource object being returned. Always `custom-relationship`. - */ - type: "custom-relationship" - attributes: ReqAttributesCustomRelationship - } -} - -/** - * This represents the type of resource object being returned. Always `custom-relationship`. - */ -export type type10 = "custom-relationship" - -export type AttributesCustomRelationship = { - /** - * The name of the custom relationship, such as `Kitchen electrics`. - */ - name?: string - /** - * A description of the custom relationship. - */ - description?: string - /** - * A unique slug for the custom relationship. - */ - slug?: string -} - -export type CustomRelationship = { - /** - * A unique identifier generated when a custom relationship is created. - */ - id?: string - /** - * This represents the type of resource object being returned. Always `hierarchy`. - */ - type?: "custom-relationship" - attributes?: AttributesCustomRelationship - meta?: { - /** - * The owner of the resource. - */ - owner?: string - timestamps?: { - /** - * The date and time the resource is created. - */ - created_at?: Date - /** - * The date and time the resource is updated. - */ - updated_at?: Date - } - } -} - -export type SingleCustomRelationship = { - data?: CustomRelationship -} - -export type UpdateCustomRelationship = { - data: { - /** - * The unique identifier of the custom relationship. - */ - id: string - /** - * This represents the type of resource object being returned. Always `custom-relationship`. - */ - type: "custom-relationship" - attributes: ReqAttributesCustomRelationship - } -} - -/** - * A unique identifier for the job. - */ -export type ParameterJobId = string - -/** - * The number of records to offset the results by. - */ -export type ParameterPageOffset = number - -/** - * The number of records per page. The maximum limit is 100. - */ -export type ParameterPageLimit = number - -/** - * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering). - * - * For more information about the attributes and operators that are supported, see [Get all products](/docs/api/pxm/products/get-all-products). - * - */ -export type ParameterFilterproduct = string - -/** - * Using the include parameter, you can retrieve top-level resources. - * - * - Files or main image. For example, `include=files,main_image`. - * - Component product data. For example, `include=component_products`. - * - Key attribute data, such as SKU or slug. - * - */ -export type ParameterInclude = string - -/** - * Set to `true` if you want to use a template slug instead of a template ID when exporting products that have custom data. - */ -export type ParameterUseTemplateSlugs = boolean - -/** - * - * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering), but you must go to a specific endpoint to understand the attributes and operators an endpoint supports. - * - * For more information about the attributes and operators that this endpoint supports, see [Export Products](/docs/api/pxm/products/export-products). - * - */ -export type ParameterFilterexport = string - -/** - * A unique identifier for the product. - */ -export type ParameterProductId = string - -/** - * A unique identifier for the variation. - */ -export type ParameterVariationId = string - -/** - * A unique identifier for the option. - */ -export type ParameterOptionId = string - -/** - * A unique identifier for the modifier. - */ -export type ParameterModifierId = string - -/** - * A unique identifier for the hierarchy. - */ -export type ParameterHierarchyId = string - -/** - * A unique identifier for the node. - */ -export type ParameterNodeId = string - -/** - * A unique identifier for the tag. - */ -export type ParameterTagId = string - -/** - * A custom relationship slug. - */ -export type ParameterCustomRelationshipSlug = string - -export type GetAllJobsResponse = Multi - -export type GetAllJobsError = Error - -export type GetJobData = { - path: { - /** - * A unique identifier for the job. - */ - jobID: string - } -} - -export type GetJobResponse = Single - -export type GetJobError = Error - -export type CancelJobData = { - body?: { - [key: string]: unknown - } - path: { - /** - * A unique identifier for the job. - */ - jobID: string - } -} - -export type CancelJobResponse = Single - -export type CancelJobError = Error - -export type GetJobErrorsData = { - path: { - /** - * A unique identifier for the job. - */ - jobID: string - } -} - -export type GetJobErrorsResponse = Errors - -export type GetJobErrorsError = Error - -export type CreateProductData = { - body: CreateProductRequest -} - -export type CreateProductResponse = SingleProductResponse - -export type CreateProductError = Error - -export type GetAllProductsData = { - query?: { - /** - * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering). - * - * For more information about the attributes and operators that are supported, see [Get all products](/docs/api/pxm/products/get-all-products). - * - */ - filter?: string - /** - * Using the include parameter, you can retrieve top-level resources. - * - * - Files or main image. For example, `include=files,main_image`. - * - Component product data. For example, `include=component_products`. - * - Key attribute data, such as SKU or slug. - * - */ - include?: string - /** - * The number of records per page. The maximum limit is 100. - */ - "page[limit]"?: number - /** - * The number of records to offset the results by. - */ - "page[offset]"?: number - } -} - -export type GetAllProductsResponse = MultiProductResponse - -export type GetAllProductsError = Error - -export type ImportProductsData = { - body?: { - /** - * The file you want to upload. Ensure that the file format is Comma Separated Values (CSV). - */ - file?: Blob | File - } -} - -export type ImportProductsResponse = Single - -export type ImportProductsError = Error - -export type ExportProductsData = { - body?: { - [key: string]: unknown - } - query?: { - /** - * - * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering), but you must go to a specific endpoint to understand the attributes and operators an endpoint supports. - * - * For more information about the attributes and operators that this endpoint supports, see [Export Products](/docs/api/pxm/products/export-products). - * - */ - filter?: string - /** - * Set to `true` if you want to use a template slug instead of a template ID when exporting products that have custom data. - */ - useTemplateSlugs?: boolean - } -} - -export type ExportProductsResponse = Single - -export type ExportProductsError = Error - -export type GetProductData = { - path: { - /** - * A unique identifier for the product. - */ - productID: string - } - query?: { - /** - * Using the include parameter, you can retrieve top-level resources. - * - * - Files or main image. For example, `include=files,main_image`. - * - Component product data. For example, `include=component_products`. - * - Key attribute data, such as SKU or slug. - * - */ - include?: string - } -} - -export type GetProductResponse = SingleProductResponse - -export type GetProductError = Error - -export type UpdateProductData = { - body?: UpdateProductRequest - path: { - /** - * A unique identifier for the product. - */ - productID: string - } -} - -export type UpdateProductResponse = SingleProductResponse - -export type UpdateProductError = Error - -export type DeleteProductData = { - path: { - /** - * A unique identifier for the product. - */ - productID: string - } -} - -export type DeleteProductResponse = void - -export type DeleteProductError = Error - -export type AttachNodesData = { - body: { - data: { - /** - * Filters applied to search for appropriate products to attach to a node. See [Attach multiple nodes](/docs/api/pxm/products/attach-nodes). - * - */ - filter: string - /** - * A list of node unique identifiers that you want to assign to the products. - */ - node_ids: Array - } - } -} - -export type AttachNodesResponse = { - meta?: { - /** - * Number of nodes assigned to the products. - */ - nodes_attached?: number - /** - * A list of node unique identifiers that could not be identified. - */ - nodes_not_found?: Array - } -} - -export type AttachNodesError = Error - -export type DetachNodesData = { - body: { - data: { - /** - * You can apply filters to search for the appropriate products to detach. See [Detach multiple nodes](/docs/api/pxm/products/detach-nodes). - * - */ - filter: string - /** - * A list of node unique identifiers that you want to assign to the products. - */ - node_ids: Array - } - } -} - -export type DetachNodesResponse = { - meta?: { - /** - * Number of nodes dissociated from the products. - */ - nodes_detached?: number - /** - * A list of node unique identifiers that could not be identified. - */ - nodes_not_found?: Array - } -} - -export type DetachNodesError = Error - -export type GetProductsNodesData = { - path: { - /** - * A unique identifier for the product. - */ - productID: string - } - query?: { - /** - * The number of records per page. The maximum limit is 100. - */ - "page[limit]"?: number - /** - * The number of records to offset the results by. - */ - "page[offset]"?: number - } -} - -export type GetProductsNodesResponse = MultiNodes - -export type GetProductsNodesError = Error - -export type BuildChildProductsData = { - body?: { - [key: string]: unknown - } - path: { - /** - * A unique identifier for the product. - */ - productID: string - } -} - -export type BuildChildProductsResponse = unknown - -export type BuildChildProductsError = Error - -export type GetChildProductsData = { - path: { - /** - * A unique identifier for the product. - */ - productID: string - } -} - -export type GetChildProductsResponse = MultiProductResponse - -export type GetChildProductsError = Error - -export type CreateProductTemplateRelationshipData = { - body?: ProductTemplatesRequest - path: { - /** - * A unique identifier for the product. - */ - productID: string - } -} - -export type CreateProductTemplateRelationshipResponse = TemplateResponse - -export type CreateProductTemplateRelationshipError = Error - -export type GetProductTemplateRelationshipsData = { - path: { - /** - * A unique identifier for the product. - */ - productID: string - } -} - -export type GetProductTemplateRelationshipsResponse = TemplateResponse - -export type GetProductTemplateRelationshipsError = Error - -export type DeleteProductTemplateRelationshipData = { - body?: ProductTemplatesRequest - path: { - /** - * A unique identifier for the product. - */ - productID: string - } -} - -export type DeleteProductTemplateRelationshipResponse = void - -export type DeleteProductTemplateRelationshipError = Error - -export type GetProductComponentProductsRelationshipsData = { - path: { - /** - * A unique identifier for the product. - */ - productID: string - } -} - -export type GetProductComponentProductsRelationshipsResponse = - ComponentProductsResponse - -export type GetProductComponentProductsRelationshipsError = Error - -export type GetProductFileRelationshipsData = { - path: { - /** - * A unique identifier for the product. - */ - productID: string - } -} - -export type GetProductFileRelationshipsResponse = FileResponse - -export type GetProductFileRelationshipsError = Error - -export type CreateProductFileRelationshipsData = { - body?: ProductFilesRequest - path: { - /** - * A unique identifier for the product. - */ - productID: string - } -} - -export type CreateProductFileRelationshipsResponse = void - -export type CreateProductFileRelationshipsError = Error - -export type UpdateProductFileRelationshipsData = { - body?: ProductFilesRequest - path: { - /** - * A unique identifier for the product. - */ - productID: string - } -} - -export type UpdateProductFileRelationshipsResponse = void - -export type UpdateProductFileRelationshipsError = Error - -export type DeleteProductFileRelationshipsData = { - body?: ProductFilesRequest - path: { - /** - * A unique identifier for the product. - */ - productID: string - } -} - -export type DeleteProductFileRelationshipsResponse = void - -export type DeleteProductFileRelationshipsError = Error - -export type CreateProductVariationRelationshipsData = { - body?: ProductVariationsRequest - path: { - /** - * A unique identifier for the product. - */ - productID: string - } -} - -export type CreateProductVariationRelationshipsResponse = void - -export type CreateProductVariationRelationshipsError = Error - -export type GetProductVariationRelationshipsData = { - path: { - /** - * A unique identifier for the product. - */ - productID: string - } -} - -export type GetProductVariationRelationshipsResponse = VariationsResponse - -export type GetProductVariationRelationshipsError = Error - -export type UpdateProductVariationRelationshipsData = { - body?: ProductVariationsRequest - path: { - /** - * A unique identifier for the product. - */ - productID: string - } -} - -export type UpdateProductVariationRelationshipsResponse = void - -export type UpdateProductVariationRelationshipsError = Error - -export type DeleteProductVariationRelationshipsData = { - body?: ProductVariationsRequest - path: { - /** - * A unique identifier for the product. - */ - productID: string - } -} - -export type DeleteProductVariationRelationshipsResponse = void - -export type DeleteProductVariationRelationshipsError = Error - -export type CreateProductMainImageRelationshipsData = { - body?: MainImageRequest - path: { - /** - * A unique identifier for the product. - */ - productID: string - } -} - -export type CreateProductMainImageRelationshipsResponse = void - -export type CreateProductMainImageRelationshipsError = Error - -export type GetProductMainImageRelationshipsData = { - path: { - /** - * A unique identifier for the product. - */ - productID: string - } -} - -export type GetProductMainImageRelationshipsResponse = MainImageResponse - -export type GetProductMainImageRelationshipsError = Error - -export type UpdateProductMainImageRelationshipsData = { - body?: ReplaceMainImageRequest - path: { - /** - * A unique identifier for the product. - */ - productID: string - } -} - -export type UpdateProductMainImageRelationshipsResponse = void - -export type UpdateProductMainImageRelationshipsError = Error - -export type DeleteProductMainImageRelationshipsData = { - path: { - /** - * A unique identifier for the product. - */ - productID: string - } -} - -export type DeleteProductMainImageRelationshipsResponse = void - -export type DeleteProductMainImageRelationshipsError = Error - -export type CreateVariationData = { - body: CreateVariation -} - -export type CreateVariationResponse = CreatedVariation - -export type CreateVariationError = Error - -export type GetAllVariationsData = { - query?: { - /** - * The number of records per page. The maximum limit is 100. - */ - "page[limit]"?: number - /** - * The number of records to offset the results by. - */ - "page[offset]"?: number - } -} - -export type GetAllVariationsResponse = MultiVariations - -export type GetAllVariationsError = Error - -export type GetVariationData = { - path: { - /** - * A unique identifier for the variation. - */ - variationID: string - } -} - -export type GetVariationResponse = SingleVariation - -export type GetVariationError = Error - -export type UpdateVariationData = { - body?: UpdateVariation - path: { - /** - * A unique identifier for the variation. - */ - variationID: string - } -} - -export type UpdateVariationResponse = SingleVariation - -export type UpdateVariationError = Error - -export type DeleteVariationData = { - path: { - /** - * A unique identifier for the variation. - */ - variationID: string - } -} - -export type DeleteVariationResponse = void - -export type DeleteVariationError = Error - -export type CreateVariationOptionData = { - body?: CreateOption - path: { - /** - * A unique identifier for the variation. - */ - variationID: string - } -} - -export type CreateVariationOptionResponse = CreatedOption - -export type CreateVariationOptionError = Error - -export type GetAllVariationOptionsData = { - path: { - /** - * A unique identifier for the variation. - */ - variationID: string - } - query?: { - /** - * The number of records per page. The maximum limit is 100. - */ - "page[limit]"?: number - /** - * The number of records to offset the results by. - */ - "page[offset]"?: number - } -} - -export type GetAllVariationOptionsResponse = MultiOptions - -export type GetAllVariationOptionsError = Error - -export type GetVariationOptionData = { - path: { - /** - * A unique identifier for the option. - */ - optionID: string - /** - * A unique identifier for the variation. - */ - variationID: string - } -} - -export type GetVariationOptionResponse = SingleOption - -export type GetVariationOptionError = Error - -export type UpdateVariationOptionData = { - body?: UpdateOption - path: { - /** - * A unique identifier for the option. - */ - optionID: string - /** - * A unique identifier for the variation. - */ - variationID: string - } -} - -export type UpdateVariationOptionResponse = SingleOption - -export type UpdateVariationOptionError = Error - -export type DeleteVariationOptionData = { - path: { - /** - * A unique identifier for the option. - */ - optionID: string - /** - * A unique identifier for the variation. - */ - variationID: string - } -} - -export type DeleteVariationOptionResponse = void - -export type DeleteVariationOptionError = Error - -export type CreateModifierData = { - body?: CreateModifier - path: { - /** - * A unique identifier for the option. - */ - optionID: string - /** - * A unique identifier for the variation. - */ - variationID: string - } -} - -export type CreateModifierResponse = CreatedModifier - -export type CreateModifierError = Error - -export type GetAllModifiersData = { - path: { - /** - * A unique identifier for the option. - */ - optionID: string - /** - * A unique identifier for the variation. - */ - variationID: string - } - query?: { - /** - * The number of records per page. The maximum limit is 100. - */ - "page[limit]"?: number - /** - * The number of records to offset the results by. - */ - "page[offset]"?: number - } -} - -export type GetAllModifiersResponse = MultiModifiers - -export type GetAllModifiersError = Error - -export type GetModifierData = { - path: { - /** - * A unique identifier for the modifier. - */ - modifierID: string - /** - * A unique identifier for the option. - */ - optionID: string - /** - * A unique identifier for the variation. - */ - variationID: string - } -} - -export type GetModifierResponse = SingleModifier - -export type GetModifierError = Error - -export type UpdateModifierData = { - body?: UpdateModifier - path: { - /** - * A unique identifier for the modifier. - */ - modifierID: string - /** - * A unique identifier for the option. - */ - optionID: string - /** - * A unique identifier for the variation. - */ - variationID: string - } -} - -export type UpdateModifierResponse = SingleModifier - -export type UpdateModifierError = Error - -export type DeleteModifierData = { - path: { - /** - * A unique identifier for the modifier. - */ - modifierID: string - /** - * A unique identifier for the option. - */ - optionID: string - /** - * A unique identifier for the variation. - */ - variationID: string - } -} - -export type DeleteModifierResponse = void - -export type DeleteModifierError = Error - -export type CreateHierarchyData = { - body: CreateHierarchy -} - -export type CreateHierarchyResponse = SingleHierarchy - -export type CreateHierarchyError = Error - -export type GetHierarchyData = { - query?: { - /** - * The number of records per page. The maximum limit is 100. - */ - "page[limit]"?: number - /** - * The number of records to offset the results by. - */ - "page[offset]"?: number - } -} - -export type GetHierarchyResponse = MultiHierarchy - -export type GetHierarchyError = Error - -export type GetHierarchyChildData = { - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string - } -} - -export type GetHierarchyChildResponse = SingleHierarchy - -export type GetHierarchyChildError = Error - -export type UpdateHierarchyData = { - body: UpdateHierarchy - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string - } -} - -export type UpdateHierarchyResponse = SingleHierarchy - -export type UpdateHierarchyError = Error - -export type DeleteHierarchyData = { - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string - } -} - -export type DeleteHierarchyResponse = void - -export type DeleteHierarchyError = Error - -export type CreateNodeData = { - body?: CreateNode - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string - } -} - -export type CreateNodeResponse = SingleNode - -export type CreateNodeError = Error - -export type GetAllNodesInHierarchyData = { - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string - } - query?: { - /** - * The number of records per page. The maximum limit is 100. - */ - "page[limit]"?: number - /** - * The number of records to offset the results by. - */ - "page[offset]"?: number - } -} - -export type GetAllNodesInHierarchyResponse = MultiNodes - -export type GetAllNodesInHierarchyError = Error - -export type GetHierarchyNodeData = { - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string - /** - * A unique identifier for the node. - */ - nodeID: string - } -} - -export type GetHierarchyNodeResponse = SingleNode - -export type GetHierarchyNodeError = Error - -export type UpdateNodeData = { - body?: UpdateNode - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string - /** - * A unique identifier for the node. - */ - nodeID: string - } -} - -export type UpdateNodeResponse = SingleNode - -export type UpdateNodeError = Error - -export type DeleteNodeData = { - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string - /** - * A unique identifier for the node. - */ - nodeID: string - } -} - -export type DeleteNodeResponse = void - -export type DeleteNodeError = Error - -export type GetAllChildrenData = { - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string - } - query?: { - /** - * The number of records per page. The maximum limit is 100. - */ - "page[limit]"?: number - /** - * The number of records to offset the results by. - */ - "page[offset]"?: number - } -} - -export type GetAllChildrenResponse = MultiNodes - -export type GetAllChildrenError = Error - -export type CreateNodeChildRelationshipsData = { - body?: NodeChildren - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string - /** - * A unique identifier for the node. - */ - nodeID: string - } -} - -export type CreateNodeChildRelationshipsResponse = SingleNode - -export type CreateNodeChildRelationshipsError = Error - -export type GetAllNodeChildrenData = { - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string - /** - * A unique identifier for the node. - */ - nodeID: string - } - query?: { - /** - * The number of records per page. The maximum limit is 100. - */ - "page[limit]"?: number - /** - * The number of records to offset the results by. - */ - "page[offset]"?: number - } -} - -export type GetAllNodeChildrenResponse = MultiNodes - -export type GetAllNodeChildrenError = Error - -export type UpdateNodeParentData = { - body?: NodeParent - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string - /** - * A unique identifier for the node. - */ - nodeID: string - } -} - -export type UpdateNodeParentResponse = void - -export type UpdateNodeParentError = Error - -export type DeleteNodeParentData = { - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string - /** - * A unique identifier for the node. - */ - nodeID: string - } -} - -export type DeleteNodeParentResponse = void - -export type DeleteNodeParentError = Error - -export type CreateNodeProductRelationshipData = { - body?: NodeProducts - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string - /** - * A unique identifier for the node. - */ - nodeID: string - } -} - -export type CreateNodeProductRelationshipResponse = SingleNode - -export type CreateNodeProductRelationshipError = Error - -export type DeleteNodeProductRelationshipsData = { - body?: NodeProducts - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string - /** - * A unique identifier for the node. - */ - nodeID: string - } -} - -export type DeleteNodeProductRelationshipsResponse = SingleNode - -export type DeleteNodeProductRelationshipsError = Error - -export type GetNodeProductsData = { - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string - /** - * A unique identifier for the node. - */ - nodeID: string - } - query?: { - /** - * The number of records per page. The maximum limit is 100. - */ - "page[limit]"?: number - /** - * The number of records to offset the results by. - */ - "page[offset]"?: number - } -} - -export type GetNodeProductsResponse = MultiProductResponse - -export type GetNodeProductsError = Error - -export type DuplicateHierarchyData = { - body: DuplicateJob - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string - } -} - -export type DuplicateHierarchyResponse = Single - -export type DuplicateHierarchyError = Error - -export type GetAllProductTagsResponse = MultiTag - -export type GetAllProductTagsError = Error - -export type GetProductTagData = { - path: { - /** - * A unique identifier for the tag. - */ - tagID: string - } -} - -export type GetProductTagResponse = SingleTag - -export type GetProductTagError = Error - -export type CreateCustomRelationshipData = { - body: CreateCustomRelationship -} - -export type CreateCustomRelationshipResponse = SingleCustomRelationship - -export type CreateCustomRelationshipError = Error - -export type UpdateCustomRelationshipData = { - body: UpdateCustomRelationship - path: { - /** - * A custom relationship slug. - */ - customRelationshipSlug: string - } -} - -export type UpdateCustomRelationshipResponse = SingleCustomRelationship - -export type UpdateCustomRelationshipError = Error - -export type $OpenApiTs = { - "/pcm/jobs": { - get: { - res: { - /** - * Returns all the jobs. - */ - "200": Multi - /** - * Bad request. The request failed validation. - */ - "400": Error - /** - * Bad Request. Not Found. - */ - "404": Error - /** - * Bad request. The request failed validation. - */ - "422": Error - /** - * Internal server error. There was a system failure in the platform. - */ - "500": Error - } - } - } - "/pcm/jobs/{jobID}": { - get: { - req: GetJobData - res: { - /** - * Returns a job with the following attributes. - */ - "200": Single - /** - * Bad request. The request failed validation. - */ - "400": Error - /** - * Bad Request. Not Found. - */ - "404": Error - /** - * Bad request. The request failed validation. - */ - "422": Error - /** - * Internal server error. There was a system failure in the platform. - */ - "500": Error - } - } - } - "/pcm/jobs/{jobID}/cancel": { - post: { - req: CancelJobData - res: { - /** - * Successfully cancelled job - */ - "200": Single - /** - * Bad request. The request failed validation. - */ - "400": Error - /** - * Bad Request. Not Found. - */ - "404": Error - /** - * Bad request. The request failed validation. - */ - "422": Error - /** - * Internal server error. There was a system failure in the platform. - */ - "500": Error - } - } - } - "/pcm/jobs/{jobID}/errors": { - get: { - req: GetJobErrorsData - res: { - /** - * Successful - */ - "200": Errors - /** - * Bad request. The request failed validation. - */ - "400": Error - /** - * Bad Request. Not Found. - */ - "404": Error - /** - * Bad request. The request failed validation. - */ - "422": Error - /** - * Internal server error. There was a system failure in the platform. - */ - "500": Error - } - } - } - "/pcm/products": { - post: { - req: CreateProductData - res: { - /** - * Creates a product with the following attributes. - */ - "201": SingleProductResponse - /** - * Bad request. The request failed validation. - */ - "422": Error - /** - * Internal server error. There was a system failure in the platform. - */ - "500": Error - } - } - get: { - req: GetAllProductsData - res: { - /** - * Returns a list of all products. - */ - "200": MultiProductResponse - /** - * Bad request. The request failed validation. - */ - "400": Error - /** - * Internal server error. There was a system failure in the platform. - */ - "500": Error - } - } - } - "/pcm/products/import": { - post: { - req: ImportProductsData - res: { - /** - * Import started - */ - "201": Single - /** - * Bad request. The request failed validation. - */ - "400": Error - /** - * Bad request. The request failed validation. - */ - "422": Error - /** - * Internal server error. There was a system failure in the platform. - */ - "500": Error - } - } - } - "/pcm/products/export": { - post: { - req: ExportProductsData - res: { - /** - * Export started - */ - "201": Single - /** - * Bad request. The request failed validation. - */ - "400": Error - /** - * Bad request. The request failed validation. - */ - "422": Error - /** - * Internal server error. There was a system failure in the platform. - */ - "500": Error - } - } - } - "/pcm/products/{productID}": { - get: { - req: GetProductData - res: { - /** - * Returns a product by its identifier. - */ - "200": SingleProductResponse - /** - * Bad request. The request failed validation. - */ - "400": Error - /** - * Bad Request. Not Found. - */ - "404": Error - /** - * Internal server error. There was a system failure in the platform. - */ - "500": Error - } - } - put: { - req: UpdateProductData - res: { - /** - * Updates a product with the following attributes. - */ - "200": SingleProductResponse - /** - * Forbidden - */ - "403": Error - /** - * Bad Request. Not Found. - */ - "404": Error - /** - * Write conflict detected - */ - "409": Error - /** - * Bad request. The request failed validation. - */ - "422": Error - /** - * Internal server error. There was a system failure in the platform. - */ - "500": Error - } - } - delete: { - req: DeleteProductData - res: { - /** - * Deletes the specified product. - */ - "204": void - /** - * Forbidden - */ - "403": Error - /** - * Bad request. The request failed validation. - */ - "422": Error +export type created_option = { + data: { /** - * Internal server error. There was a system failure in the platform. + * A unique identifier that is generated when an option is created. */ - "500": Error - } - } - } - "/pcm/products/attach_nodes": { - post: { - req: AttachNodesData - res: { + id?: string; /** - * This request assigns the products that you have selected to multiple hierarchies and their children nodes and returns the following. + * This represents the type of resource object being returned. Always `product-variation-option`. */ - "200": { - meta?: { + type: 'product-variation-option'; + attributes: { /** - * Number of nodes assigned to the products. + * A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. */ - nodes_attached?: number + name?: string; /** - * A list of node unique identifiers that could not be identified. + * A human-recognizable description for the option. */ - nodes_not_found?: Array - } - } - /** - * Bad request. The request failed validation. - */ - "400": Error - /** - * Bad request. The request failed validation. - */ - "422": Error - /** - * Internal server error. There was a system failure in the platform. - */ - "500": Error - } - } - } - "/pcm/products/detach_nodes": { - post: { - req: DetachNodesData - res: { - /** - * The request dissociates the products that you have selected from multiple hierarchies and their children and returns the following. - */ - "200": { - meta?: { + description?: string; /** - * Number of nodes dissociated from the products. + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. */ - nodes_detached?: number + sort_order?: number; + }; + meta?: { /** - * A list of node unique identifiers that could not be identified. + * The owner of a resource, either `organization` or `store`. */ - nodes_not_found?: Array - } - } - /** - * Bad request. The request failed validation. - */ - "400": Error - /** - * Bad request. The request failed validation. - */ - "422": Error - /** - * Internal server error. There was a system failure in the platform. - */ - "500": Error - } - } - } - "/pcm/products/{productID}/nodes": { - get: { - req: GetProductsNodesData - res: { - /** - * Successfully returns the product's nodes. - */ - "200": MultiNodes - /** - * Bad request. The request failed validation. - */ - "400": Error - /** - * Bad Request. Not Found. - */ - "404": Error - /** - * Internal server error. There was a system failure in the platform. - */ - "500": Error - } - } - } - "/pcm/products/{productID}/build": { - post: { - req: BuildChildProductsData - res: { - /** - * Successfully started building child products - */ - "201": unknown - /** - * Forbidden - */ - "403": Error - /** - * Bad Request. Not Found. - */ - "404": Error - /** - * Bad request. The request failed validation. - */ - "422": Error - /** - * Internal server error. There was a system failure in the platform. - */ - "500": Error - } - } - } - "/pcm/products/{productID}/children": { - get: { - req: GetChildProductsData - res: { - /** - * Returns a list of child products for the specified parent product ID. - */ - "200": MultiProductResponse - /** - * Bad request. The request failed validation. - */ - "400": Error - /** - * Internal server error. There was a system failure in the platform. - */ - "500": Error - } - } - } - "/pcm/products/{productID}/relationships/templates": { - post: { - req: CreateProductTemplateRelationshipData - res: { - /** - * Returns a created product template relationship. - */ - "201": TemplateResponse - /** - * Bad request. The request failed validation. - */ - "400": Error - /** - * Forbidden - */ - "403": Error - /** - * Bad Request. Not Found. - */ - "404": Error - /** - * Write conflict detected - */ - "409": Error - /** - * Bad request. The request failed validation. - */ - "422": Error - /** - * Internal server error. There was a system failure in the platform. - */ - "500": Error - } - } - get: { - req: GetProductTemplateRelationshipsData - res: { - /** - * Returns all product template relationships - */ - "200": TemplateResponse - /** - * Bad request. The request failed validation. - */ - "400": Error - /** - * Forbidden - */ - "403": Error - /** - * Bad Request. Not Found. - */ - "404": Error - /** - * Write conflict detected - */ - "409": Error - /** - * Bad request. The request failed validation. - */ - "422": Error - /** - * Internal server error. There was a system failure in the platform. - */ - "500": Error - } - } - delete: { - req: DeleteProductTemplateRelationshipData - res: { - /** - * No Content - */ - "204": void - /** - * Bad request. The request failed validation. - */ - "400": Error - /** - * Forbidden - */ - "403": Error - /** - * Bad Request. Not Found. - */ - "404": Error - /** - * Write conflict detected - */ - "409": Error - /** - * Bad request. The request failed validation. - */ - "422": Error - /** - * Internal server error. There was a system failure in the platform. - */ - "500": Error - } - } - } - "/pcm/products/{productID}/relationships/component_products": { - get: { - req: GetProductComponentProductsRelationshipsData - res: { - /** - * Returns all Component Products relationships - */ - "200": ComponentProductsResponse - /** - * Bad request. The request failed validation. - */ - "400": Error - /** - * Forbidden - */ - "403": Error - /** - * Bad Request. Not Found. - */ - "404": Error - /** - * Write conflict detected - */ - "409": Error - /** - * Bad request. The request failed validation. - */ - "422": Error - /** - * Internal server error. There was a system failure in the platform. - */ - "500": Error - } - } - } - "/pcm/products/{productID}/relationships/files": { - get: { - req: GetProductFileRelationshipsData - res: { - /** - * Returns all product file relationships. - */ - "200": FileResponse - /** - * Bad request. The request failed validation. - */ - "400": Error - /** - * Forbidden - */ - "403": Error - /** - * Bad Request. Not Found. - */ - "404": Error - /** - * Write conflict detected - */ - "409": Error - /** - * Bad request. The request failed validation. - */ - "422": Error + owner?: 'organization' | 'store'; + /** + * The date and time an option is created. + */ + created_at?: string; + /** + * The date and time an option is updated. + */ + updated_at?: string; + }; + }; +}; + +export type created_variation = { + data: { /** - * Internal server error. There was a system failure in the platform. + * A unique identifier generated when a variation is created. */ - "500": Error - } - } - post: { - req: CreateProductFileRelationshipsData - res: { + id: string; /** - * No Content + * This represents the type of resource object being returned. Always `product-variation`. */ - "204": void + type: 'product-variation'; + attributes: { + /** + * A human-recognizable identifier for a variation. + */ + name?: string; + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + */ + sort_order?: number; + }; + meta: { + /** + * The owner of the resource, either `organization` or `store`. + */ + owner?: 'organization' | 'store'; + /** + * The date and time a variation is created. + */ + created_at?: string; + /** + * The date and time a variation is updated. + */ + updated_at?: string; + }; + }; +}; + +export type custom_relationship = { + /** + * A unique identifier generated when a custom relationship is created. + */ + id?: string; + /** + * This represents the type of resource object being returned. Always `hierarchy`. + */ + type?: 'custom-relationship'; + attributes?: attributes_custom_relationship; + meta?: { /** - * Bad request. The request failed validation. + * The owner of the resource. */ - "400": Error + owner?: string; + timestamps?: { + /** + * The date and time the resource is created. + */ + created_at?: string; + /** + * The date and time the resource is updated. + */ + updated_at?: string; + }; + }; +}; + +export type duplicate_job = { + data?: { /** - * Forbidden + * This represents the type of resource object being returned. Always `hierarchy`. */ - "403": Error + type?: 'hierarchy'; + attributes?: { + /** + * The name of the duplicate hierarchy. The maximum length is 1000 characters. + */ + name?: string; + /** + * A description of the duplicate hierarchy. + */ + description?: string; + /** + * Specify `true` if you want the product associations in the existing nodes associated in your duplicated hierarchy. If not, specify `false`. + */ + include_products?: boolean; + }; + }; +}; + +export type error = { + errors: Array<{ /** - * Bad Request. Not Found. + * The HTTP response code of the error. */ - "404": Error + status: string; /** - * Write conflict detected + * A brief summary of the error. */ - "409": Error + title: string; /** - * Bad request. The request failed validation. + * Optional additional detail about the error. */ - "422": Error + detail?: string; /** - * Internal server error. There was a system failure in the platform. + * Internal request ID. */ - "500": Error - } - } - put: { - req: UpdateProductFileRelationshipsData - res: { + request_id?: string; /** - * No Content + * Additional supporting meta data for the error. */ - "204": void + meta?: { + [key: string]: unknown; + }; + }>; +}; + +export type errors = { + /** + * An array of job errors. + */ + data?: Array<{ /** - * Bad request. The request failed validation. + * This represents the type of resource object being returned. Always `pim-job-error`. */ - "400": Error + type?: 'pim-job-error'; /** - * Forbidden + * A unique identifier for a job error generated when a job error is created. */ - "403": Error + id?: string; + attributes?: { + /** + * A description of an error message. + */ + message?: string; + }; + }>; +}; + +export type file_response = { + data?: Array<{ /** - * Bad Request. Not Found. + * The unique identifier of the new file. */ - "404": Error + id?: string; /** - * Write conflict detected + * This represents the type of resource object being returned. Always `file`. */ - "409": Error + type?: 'file'; + }>; +}; + +export type hierarchy = { + /** + * A unique identifier generated when a hierarchy is created. + */ + id?: string; + /** + * This represents the type of resource object being returned. Always `hierarchy`. + */ + type?: 'hierarchy'; + attributes?: attributes_hierarchy; + relationships?: relationships_hierarchy; + meta?: { /** - * Bad request. The request failed validation. + * The date and time a hierarchy is created. */ - "422": Error + created_at?: string; /** - * Internal server error. There was a system failure in the platform. + * The date and time a hierarchy is updated. */ - "500": Error - } - } - delete: { - req: DeleteProductFileRelationshipsData - res: { + updated_at?: string; /** - * No Content + * The owner of a resource, either `organization` or `store`. */ - "204": void + owner?: 'store' | 'organization'; + }; +}; + +export type job = { + /** + * A unique identifier generated when a job is created. + */ + id?: string; + /** + * This represents the type of resource object being returned. Always `pim-job`. + */ + type?: 'pim-job'; + attributes?: { /** - * Bad request. The request failed validation. + * The date and time a job is started. */ - "400": Error + started_at?: (string) | null; /** - * Forbidden + * The date and time a job is completed. */ - "403": Error + completed_at?: (string) | null; /** - * Bad Request. Not Found. + * The date and time a job is created. */ - "404": Error + created_at?: string; /** - * Write conflict detected + * The date and time a job is updated. */ - "409": Error + updated_at?: string; /** - * Bad request. The request failed validation. + * The status of a job. + * + * * `pending` - Commerce has received the request but is currently busy processing other requests. + * * `started` - Commerce has started processing the job. + * * `success` - The job has successfully completed. + * * `failed` - The job has failed. + * */ - "422": Error + type?: 'child-products' | 'product-import' | 'product-export' | 'hierarchy-duplicate' | 'price-import'; + status?: 'pending' | 'cancelled' | 'started' | 'success' | 'failed'; + }; + meta?: { /** - * Internal server error. There was a system failure in the platform. + * Applies to all job types. A unique request ID is generated when a job is created. */ - "500": Error - } - } - } - "/pcm/products/{productID}/relationships/variations": { - post: { - req: CreateProductVariationRelationshipsData - res: { + x_request_id?: string; /** - * No Content + * Applies to `hierarchy-duplicate` job types. The ID of the original hierarchy that you duplicated. */ - "204": void + copied_from?: string; /** - * Bad request. The request failed validation. + * Applies to `hierarchy-duplicate` job types. The duplicated hierarchy ID. */ - "400": Error + hierarchy_id?: string; /** - * Forbidden + * If the job type is `product_export`, a link to the file is created when running a job. */ - "403": Error + file_locations?: Array<(string)> | null; /** - * Bad Request. Not Found. + * The entities included in the job. For example, if the job type is `product-export`, the PXM products included in the export. */ - "404": Error + filter?: string; + }; +}; + +/** + * This represents the type of resource object being returned. Always `pim-job`. + */ +export type type8 = 'pim-job'; + +export type status = 'pending' | 'cancelled' | 'started' | 'success' | 'failed'; + +export type main_image_request = { + data?: { /** - * Write conflict detected + * The ID of the image file. */ - "409": Error + id?: string; /** - * Bad request. The request failed validation. + * This represents the type of resource being returned. Always `file`. */ - "422": Error + type?: 'file'; + }; +}; + +/** + * This represents the type of resource being returned. Always `file`. + */ +export type type9 = 'file'; + +export type main_image_response = { + data?: Array<{ /** - * Internal server error. There was a system failure in the platform. + * A unique identifier for the image file generated automatically when a file is created. */ - "500": Error - } - } - get: { - req: GetProductVariationRelationshipsData - res: { + id?: string; /** - * Returns all product variation relationships + * This represents the type of resource object being returned. Always `file`. */ - "200": VariationsResponse + type?: string; + }>; +}; + +export type multi = { + /** + * An array of jobs. + */ + data?: Array; + meta?: { /** - * Bad request. The request failed validation. + * Contains the results for the entire collection. */ - "400": Error + results?: { + /** + * Total number of results for the entire collection. + */ + total?: number; + }; + }; +}; + +export type multi_hierarchy = { + data?: Array; + links?: multi_links; + meta?: multi_meta; +}; + +/** + * Links are used to allow you to move between requests. + */ +export type multi_links = { + /** + * Always the first page. + */ + first?: string; + /** + * This is `null` if there is only one page. + */ + last?: string; + /** + * This is `null` if there is only one page. + */ + next?: string; + /** + * This is `null` if you on the first page. + */ + prev?: string; +}; + +export type multi_meta = { + /** + * Contains the results for the entire collection. + */ + results?: { /** - * Forbidden + * Total number of results for the entire collection. */ - "403": Error + total?: number; + }; +}; + +export type multi_modifiers = { + data?: Array<{ /** - * Bad Request. Not Found. + * A unique identifier for a modifier that is generated automatically when a modifier is created. */ - "404": Error + id?: string; /** - * Write conflict detected + * This represents the type of resource object being returned. Always `product-variation-modifier'. */ - "409": Error + type?: 'product-variation-modifier'; + attributes?: { + /** + * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + * + * | Modifier | Data Type | Effect | + * | :--- | :--- | :--- | + * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | + * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | + * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | + * | `description_equals` | `string` | Overrides the description of the child product. | + * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | + * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | + * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | + * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | + * | `price_increment` | `string` | Increases the price of the child product. | + * | `price_decrement` | `string` | Decreases the price of the child product. | + * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | + * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `sku_equals` | `string` | Sets the SKU of the child product. | + * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | + * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | + * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | + * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | + * + */ + type?: 'commodity_type' | 'status' | 'price' | 'name_append' | 'name_prepend' | 'name_equals' | 'sku_append' | 'sku_prepend' | 'sku_equals' | 'sku_builder' | 'slug_append' | 'slug_prepend' | 'slug_equals' | 'slug_builder' | 'description_append' | 'description_prepend' | 'description_equals' | 'custom_inputs_equals' | 'build_rules_equals' | 'locales_equals' | 'upc_ean_equals' | 'mpn_equals' | 'external_ref_equals'; + /** + * Required for non-builder modifiers. The value of the modifier type. + */ + value?: string; + /** + * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. + */ + seek?: string; + /** + * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. + */ + set?: string; + /** + * The name of the modifier. + */ + reference_name?: string; + }; + meta?: { + /** + * The owner of a resource, either `organization` or `store`. + */ + owner?: 'store' | 'organization'; + }; + }>; + meta?: { /** - * Bad request. The request failed validation. + * Contains the results for the entire collection. */ - "422": Error + results?: { + /** + * Total number of results for the entire collection. + */ + total?: number; + }; + }; +}; + +export type multi_nodes = { + /** + * An array of nodes. + */ + data?: Array; + meta?: multi_meta; + links?: multi_links; +}; + +export type multi_options = { + data?: Array<{ /** - * Internal server error. There was a system failure in the platform. + * A unique identifier generated when an option is created. */ - "500": Error - } - } - put: { - req: UpdateProductVariationRelationshipsData - res: { + id?: string; /** - * No Content + * This represents the type of resource object being returned. Always `product-variation-option`. */ - "204": void + type?: 'product-variation-option'; + attributes?: { + /** + * A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + */ + name?: string; + /** + * A human-recognizable description for the option. + */ + description?: string; + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + */ + sort_order?: number; + }; + meta?: { + /** + * The owner of a resource, either `organization` or `store`. + */ + owner?: 'organization' | 'store'; + /** + * The date and time an option is created. + */ + created_at?: string; + /** + * The date and time an option is updated. + */ + updated_at?: string; + }; + }>; + meta?: { /** - * Bad request. The request failed validation. + * Contains the results for the entire collection. */ - "400": Error + results?: { + /** + * Total number of results for the entire collection. + */ + total?: number; + }; + }; +}; + +export type multi_product_response = { + data?: Array; + /** + * Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. + */ + included?: { /** - * Forbidden + * Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. */ - "403": Error + component_products?: Array; + }; + meta?: { /** - * Bad Request. Not Found. + * Contains the results for the entire collection. */ - "404": Error + results?: { + /** + * Total number of results for the entire collection. + */ + total?: number; + }; + }; +}; + +export type multi_tag = { + /** + * An array of tags. + */ + data?: Array; + meta?: { /** - * Write conflict detected + * Contains the results for the entire collection. */ - "409": Error + results?: { + /** + * Total number of results for the entire collection. + */ + total?: number; + }; + }; +}; + +export type multi_variations = { + data?: Array<{ /** - * Bad request. The request failed validation. + * A unique identifier for a variation. */ - "422": Error + id?: string; /** - * Internal server error. There was a system failure in the platform. + * This represents the type of resource object being returned. Always `product-variation`. */ - "500": Error - } - } - delete: { - req: DeleteProductVariationRelationshipsData - res: { + type?: 'product-variation'; + attributes?: { + /** + * The name of a variation. + */ + name?: string; + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + */ + sort_order?: number; + }; + meta?: { + options?: Array<{ + /** + * A unique ID that is generated when an option is created. + */ + id?: string; + /** + * A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + */ + name?: string; + /** + * A human recognizable description of the option. + */ + description?: string; + /** + * The date and time an option is created. + */ + created_at?: string; + /** + * The date and time an option is updated. + */ + updated_at?: string; + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + */ + sort_order?: number; + }>; + /** + * The owner of the resource, either `organization` or `store`. + */ + owner?: 'organization' | 'store'; + /** + * The date and time a variation is created. + */ + created_at?: string; + /** + * The date and time a variation is updated. + */ + updated_at?: string; + }; + }>; + meta?: { /** - * No Content + * Contains the results for the entire collection. */ - "204": void + results?: { + /** + * Total number of results for the entire collection. + */ + total?: number; + }; + }; +}; + +export type node = { + /** + * The unique identifier of a node. + */ + id?: string; + /** + * This represents the type of resource object being returned. Always `node`. + */ + type?: 'node'; + attributes?: attributes; + relationships?: relationships; + meta?: { /** - * Bad request. The request failed validation. + * The sort order value. The node with the highest value of `sort_order` is displayed first. For example, a node with a `sort_order` value of `3` appears before a node with a `sort_order` value of `2`. See [Sorting Nodes in a hierarchy](/docs/api/pxm/products/create-node#sorting-nodes-in-a-hierarchy). */ - "400": Error + sort_order?: number; /** - * Forbidden + * The date and time a node is created. */ - "403": Error + created_at?: string; /** - * Bad Request. Not Found. + * The date and time a node was updated. */ - "404": Error + updated_at?: string; /** - * Write conflict detected + * The name of the parent of the node if one exists. */ - "409": Error + parent_name?: string; /** - * Bad request. The request failed validation. + * The node owner, either `organization` or `store`. */ - "422": Error + owner?: 'store' | 'organization'; + }; +}; + +export type node_children = { + data?: Array<{ /** - * Internal server error. There was a system failure in the platform. + * The unique identifier of the child node. Must not match the node ID specified in the request path. */ - "500": Error - } - } - } - "/pcm/products/{productID}/relationships/main_image": { - post: { - req: CreateProductMainImageRelationshipsData - res: { + id: string; /** - * No Content + * This represents the type of resource object being returned. Always `node`. */ - "204": void + type: 'node'; + }>; +}; + +export type node_parent = { + data?: { /** - * Bad request. The request failed validation. + * The unique identifier of the new parent node. Must not match the node ID specified in the request path. */ - "400": Error + id: string; /** - * Forbidden + * This represents the type of resource object being returned. Always `node`. */ - "403": Error + type: 'node'; + }; +}; + +export type node_products = { + data?: Array<{ /** - * Bad Request. Not Found. + * The unique identifier of the product to be attached to the node. */ - "404": Error + id: string; /** - * Write conflict detected + * This represents the type of resource object being returned. Always `product`. */ - "409": Error + type: 'product'; + }>; +}; + +/** + * A custom relationship slug. + */ +export type Parametercustom_relationship_slug = string; + +/** + * + * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering), but you must go to a specific endpoint to understand the attributes and operators an endpoint supports. + * + * For more information about the attributes and operators that this endpoint supports, see [Export Products](/docs/api/pxm/products/export-products). + * + */ +export type Parameterfilterexport = string; + +/** + * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering). + * + * For more information about the attributes and operators that are supported, see [Get all products](/docs/api/pxm/products/get-all-products). + * + */ +export type Parameterfilterproduct = string; + +/** + * A unique identifier for the hierarchy. + */ +export type Parameterhierarchy_id = string; + +/** + * Using the include parameter, you can retrieve top-level resources. + * + * - Files or main image. For example, `include=files,main_image`. + * - Component product data. For example, `include=component_products`. + * - Key attribute data, such as SKU or slug. + * + */ +export type Parameterinclude = string; + +/** + * A unique identifier for the job. + */ +export type Parameterjob_id = string; + +/** + * A unique identifier for the modifier. + */ +export type Parametermodifier_id = string; + +/** + * A unique identifier for the node. + */ +export type Parameternode_id = string; + +/** + * A unique identifier for the option. + */ +export type Parameteroption_id = string; + +/** + * The number of records per page. The maximum limit is 100. + */ +export type Parameterpage_limit = number; + +/** + * The number of records to offset the results by. + */ +export type Parameterpage_offset = number; + +/** + * A unique identifier for the product. + */ +export type Parameterproduct_id = string; + +/** + * A unique identifier for the tag. + */ +export type Parametertag_id = string; + +/** + * Set to `true` if you want to use a template slug instead of a template ID when exporting products that have custom data. + */ +export type ParameteruseTemplateSlugs = boolean; + +/** + * A unique identifier for the variation. + */ +export type Parametervariation_id = string; + +export type product_attributes = { + /** + * The unique attribute associated with the product. This could be an external reference from a separate company system, for example. The maximum length is 2048 characters. + */ + external_ref?: string; + /** + * The product name to display to customers. + */ + name?: string; + /** + * A description for the product. + */ + description?: string; + /** + * The unique slug of the product. A slug can contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + */ + slug?: string; + /** + * The unique stock keeping unit of the product. + */ + sku?: string; + /** + * The status for the product, either `draft` or `live`. Default is `draft`. + */ + status?: 'live' | 'draft'; + /** + * The commodity type, either `physical` or `digital`. + */ + commodity_type?: 'physical' | 'digital'; + /** + * The universal product code or european article number of the product. + */ + upc_ean?: string; + /** + * The manufacturer part number of the product. + */ + mpn?: string; + /** + * You can use product tags to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. A product can have up to 20 tags. A product tag can be up to 255 characters. Product tags must not contain any spaces or commas. See [Product Tags](/docs/api/pxm/products/product-tags). + */ + tags?: Array<(string)>; + build_rules?: product_build_rules; + locales?: product_locales; + custom_inputs?: product_custom_inputs; + components?: product_bundle_components; +}; + +/** + * The status for the product, either `draft` or `live`. Default is `draft`. + */ +export type status2 = 'live' | 'draft'; + +/** + * The commodity type, either `physical` or `digital`. + */ +export type commodity_type = 'physical' | 'digital'; + +/** + * You can build a combination of child products associated with a product, based on build rules that you specify. This is useful, for example, if you have a variation option that you do not sell. This makes managing and building your child products quick and easy. See [Using Build Rules](/docs/api/pxm/products/build-child-products#using-build-rules). + */ +export type product_build_rules = { + /** + * Specifies the default behaviour, either `include` or `exclude`. + */ + default?: 'include' | 'exclude'; + /** + * An array of option IDs to include when child products are built. Each combination consists of a nested array of option IDs from one or more variations. Combinations of option IDs in the nested arrays must come from different variations. + */ + include?: Array>; + /** + * An array of option IDs to exclude when child products are built. Each combination consists of a nested array of option IDs from one or more variations. Combinations of option IDs in the nested arrays must come from different variations. + */ + exclude?: Array>; +}; + +/** + * Specifies the default behaviour, either `include` or `exclude`. + */ +export type default = 'include' | 'exclude'; + +/** + * With Product Experience Manager, you can create and manage bundles. A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. See [Bundles](/docs/api/pxm/products/products#bundles). + */ +export type product_bundle_components = { + [key: string]: { /** - * Bad request. The request failed validation. + * The component name. The component name is the name that is displayed in your storefront. */ - "422": Error + name?: string; /** - * Internal server error. There was a system failure in the platform. + * The product options included in a component. This can be the ID of another bundle. */ - "500": Error - } - } - get: { - req: GetProductMainImageRelationshipsData - res: { + options?: Array<{ + /** + * The unique ID of the product you want to add to a component. + */ + id?: string; + /** + * This represents the type of object being returned. Always `product`. + */ + type?: string; + /** + * The number of this product option that a shopper must purchase. + */ + quantity?: number; + /** + * The sort order of the options. The `create a bundle` and `update a bundle` endpoints do not sort the options. You can use the `sort_order` attribute when programming your storefront to display the options in the order that you want. + */ + sort_order?: number; + /** + * Whether the product option is a default option in a bundle. Shoppers can select a bundle that specifies a default list of product options. See [Dynamic Bundles](/docs/api/pxm/products/products#dynamic-bundles). + */ + default?: boolean; + }>; /** - * Returns all product variation relationships + * The minimum number of product options a shopper can select from this component. */ - "200": MainImageResponse + min?: number; /** - * Bad request. The request failed validation. + * The maximum number of product options a shopper can select from this component. */ - "400": Error + max?: number; /** - * Forbidden + * The sort order of the components. The `create a bundle` and `update a bundle` endpoints do not sort the components. You can use the `sort_order` attribute when programming your storefront to display the components in the order that you want. */ - "403": Error + sort_order?: number; + }; +}; + +/** + * You use the `custom_inputs` attribute to allow your shoppers to add custom text to a product when adding product items to their carts. This is useful, for example, if you have a product like a T-shirt that can be personalized or you sell greetings cards that can be printed with your shoppers personalized messages. See [Personalizing Products](/docs/api/pxm/products/create-product#personalizing-products). + */ +export type product_custom_inputs = { + [key: string]: { /** - * Bad Request. Not Found. + * A name for the custom text field. */ - "404": Error + name?: string; /** - * Write conflict detected + * The validation rules for the custom text. */ - "409": Error + validation_rules?: unknown[]; /** - * Bad request. The request failed validation. + * This represents the type of the resource being returned. */ - "422": Error + type?: string; /** - * Internal server error. There was a system failure in the platform. + * The length of the custom input text field. */ - "500": Error - } - } - put: { - req: UpdateProductMainImageRelationshipsData - res: { + options?: { + [key: string]: unknown; + }; /** - * No Content + * The number of characters the custom text field can be. You can specify a maximum length up to 255 characters, as the limit is 255 characters. */ - "204": void + max_length?: number; /** - * Bad request. The request failed validation. + * `true` or `false` depending on whether the custom text is required. */ - "400": Error + required?: boolean; + }; +}; + +export type product_files_request = { + data?: Array<{ /** - * Forbidden + * A unique identifier for a file generated when a file is created. */ - "403": Error + id?: string; /** - * Bad Request. Not Found. + * This represents the type of resource being returned. Always `file`. */ - "404": Error + type?: 'file'; + meta?: { + /** + * The files associated with a product. + */ + tags?: Array<(string)>; + }; + }>; +}; + +/** + * Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. + */ +export type product_locales = { + [key: string]: { /** - * Write conflict detected + * A localized name for the product. */ - "409": Error + name: string; /** - * Bad request. The request failed validation. + * A localized description for the product. */ - "422": Error + description?: string; + }; +}; + +export type product_response = { + /** + * A unique product ID that is generated when you create the product. + */ + id?: string; + /** + * This represents the type of resource object being returned. Always `product`. + */ + type?: 'product'; + attributes?: { /** - * Internal server error. There was a system failure in the platform. + * A name for the product. */ - "500": Error - } - } - delete: { - req: DeleteProductMainImageRelationshipsData - res: { + name?: string; /** - * No Content + * A description for the product. */ - "204": void + description?: string; /** - * Bad request. The request failed validation. + * A label for the product that is used in the URL paths. A slug can contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. By default, the product name is used as the slug. */ - "400": Error + slug?: string; /** - * Forbidden + * The unique stock keeping unit of the product. */ - "403": Error + sku?: string; /** - * Bad Request. Not Found. + * The status for the product, either `draft` or `live`. */ - "404": Error + status?: 'live' | 'draft'; /** - * Write conflict detected + * The commodity type, either `physical` or `digital`. */ - "409": Error + commodity_type?: 'physical' | 'digital'; /** - * Bad request. The request failed validation. + * The universal product code or european article number of the product. */ - "422": Error + upc_ean?: string; /** - * Internal server error. There was a system failure in the platform. + * The manufacturer part number of the product. */ - "500": Error - } - } - } - "/pcm/variations": { - post: { - req: CreateVariationData - res: { + mpn?: string; /** - * Returns a created variation with the following attributes. + * The unique attribute associated with the product. This could be an external reference from a separate company system, for example. The maximum length is 2048 characters. */ - "201": CreatedVariation + external_ref?: string; /** - * Bad request. The request failed validation. + * Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. */ - "422": Error + locales?: { + [key: string]: unknown; + }; /** - * Internal server error. There was a system failure in the platform. + * You can use product tags to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. A product can have up to 20 tags. A product tag can be up to 255 characters. Product tags must not contain any spaces or commas. */ - "500": Error - } - } - get: { - req: GetAllVariationsData - res: { + tags?: Array<(string)>; + extensions?: { + [key: string]: { + [key: string]: ((string) | null | number | boolean); + }; + }; + custom_inputs?: product_custom_inputs; + build_rules?: product_build_rules; + components?: product_bundle_components; + }; + meta?: { /** - * Returns all variations. + * The date and time a product is created. */ - "200": MultiVariations + created_at?: string; /** - * Bad request. The request failed validation. + * The date and time a product is updated. */ - "400": Error + updated_at?: string; /** - * Internal server error. There was a system failure in the platform. + * The resource owner, either `organization` or `store`. */ - "500": Error - } - } - } - "/pcm/variations/{variationID}": { - get: { - req: GetVariationData - res: { + owner?: 'organization' | 'store'; /** - * Returns the specified variation. + * A product's variations and the options defined for each variation. If you have specified `build_rules`, only the child products included in the `build_rules` are specified. */ - "200": SingleVariation + variations?: Array<{ + /** + * A unique ID generated when a variation is created. + */ + id?: string; + /** + * The name of a variation. + */ + name?: string; + options?: Array<{ + /** + * A unique ID that is generated an option is created. + */ + id?: string; + /** + * The name of an option. + */ + name?: string; + /** + * A description of an option. + */ + description?: string; + }>; + }>; + /** + * One of the following product types: + * + * - `standard` - A `standard` product is a standalone product. + * - `parent` - A `parent` product is a product that has child products that have been built using the `Build Child Products` endpoint. + * - `child` - When you configure product variations and variation options for `parent` products, the `child` products derived from the `parent` products are automatically created in Commerce. + * - `bundle` - A `bundle` is a purchasable product, comprising one or more standalone products (in other words, components) to be sold together. + * + */ + product_types?: Array<('parent' | 'child' | 'bundle' | 'standard')>; + /** + * The child products defined for a product. The order of the variations in the `variation_matrix` is the order of the variations in the array when the variations were linked to the product. For example, the first variation in the `variation_matrix` corresponds to the first variation in the array, and so on. You can use the `sort_order`attribute to sort the order of your variation and variation options in the `variation_matrix` object. See [Sorting the Order of Variations and Options](/docs/api/pxm/products/variations#sorting-the-order-of-variations-and-options) If no variations are defined for a product, the `variation_matrix` is empty. + */ + variation_matrix?: { + [key: string]: unknown; + }; + }; + /** + * Relationships are established between different product entities. For example, a `bundle` product and a `child` product are related to a `parent` product, as both are associated with it. + */ + relationships?: { + [key: string]: { + data?: (Array<{ + /** + * A unique identifier for a resource. + */ + id?: string; + /** + * This represents the type of resource object being returned. + */ + type?: string; +}> | { + /** + * A unique identifier for a resource. + */ + id?: string; + /** + * This represents the type of resource object being returned. + */ + type?: string; +} | null); + /** + * Links are used to allow you to move between requests. Single entities use a `self` parameter with a link to that specific resource. Sometimes, there are not enough entities for a project to fill multiple pages. In this situation, we return some defaults. + * + * | Property | Description | + * | :--- | :--- | + * | `current` | Always the current page. | + * | `first` | Always the first page. | + * | `last` | `null` if there is only one page. | + * | `prev` | `null` if the user is on the first page. | + * | `next` | `null` if there is only one page. | + * + */ + links?: { + [key: string]: (string); + }; + }; + }; +}; + +export type product_templates_request = { + data?: Array<{ /** - * Bad request. The request failed validation. + * The unique identifier of a template. */ - "400": Error + id?: string; /** - * Bad Request. Not Found. + * This represents the type of resource object being returned. Always `template'. */ - "404": Error + type?: 'template'; + }>; +}; + +export type product_variations_request = { + data?: Array<{ /** - * Internal server error. There was a system failure in the platform. + * The ID of the product variation. */ - "500": Error - } - } - put: { - req: UpdateVariationData - res: { + id?: string; /** - * Returns an updated variation with the following attributes. + * This represents the type of resource being returned. Always `product-variation`. */ - "200": SingleVariation + type?: 'product-variation'; + }>; +}; + +/** + * Relationships allow you to move between requests. Includes links to the child nodes and products associated with a hierarchy or node. + */ +export type relationships = { + /** + * The child nodes related to the resource. + */ + children?: { /** - * Forbidden + * An array of child nodes. */ - "403": Error + data?: unknown[]; /** - * Bad Request. Not Found. + * Links allow you to move between requests. */ - "404": Error + links?: { + /** + * A link to a related resource. + */ + related?: string; + }; + }; + /** + * The parent node related to the resource + */ + parent?: { /** - * Write conflict detected + * The parent node */ - "409": Error + data?: { + /** + * This represents the type of resource object being returned. Always `node`. + */ + type: 'node'; + /** + * The unique identifier of a node. + */ + id: string; + }; + }; + /** + * The products related to the resource. + */ + products?: { /** - * Bad request. The request failed validation. + * An array of products. */ - "422": Error + data?: unknown[]; /** - * Internal server error. There was a system failure in the platform. + * Links allow you to move between requests. */ - "500": Error - } - } - delete: { - req: DeleteVariationData - res: { + links?: { + /** + * A link to a related resource. + */ + related?: string; + }; + }; +}; + +export type relationships_hierarchy = { + /** + * The child nodes related to the hierarchy. + */ + children?: { /** - * No Content + * An array of child nodes. */ - "204": void + data?: unknown[]; /** - * Forbidden + * Links allow you to move between requests. */ - "403": Error + links?: { + /** + * A link to a related resource. + */ + related?: string; + }; + }; +}; + +export type replace_main_image_request = { + data?: Array<{ /** - * Bad request. The request failed validation. + * The ID of the new image file. */ - "422": Error + id?: string; + type?: 'file'; + }>; +}; + +export type req_attributes_custom_relationship = { + /** + * The name of the custom relationship, such as `Kitchen electrics`. + */ + name?: string; + /** + * A description of the custom relationship. + */ + description?: string; + /** + * A unique slug for the custom relationship. Must match the slug specified in the request path. + */ + slug?: string; +}; + +export type req_attributes_hierarchy = { + /** + * The name of the hierarchy, such as `Major Appliances`. + */ + name?: string; + /** + * A description of the hierarchy. + */ + description?: string; + /** + * A unique slug for the hierarchy. + */ + slug?: string; + /** + * Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. + */ + locales?: { + [key: string]: { + /** + * A localized name for the hierarchy. + */ + name?: string; + /** + * A localized description for the hierarchy. + */ + description?: string; + }; + }; +}; + +export type single = { + data?: job; +}; + +export type single_custom_relationship = { + data?: custom_relationship; +}; + +export type single_hierarchy = { + data?: hierarchy; +}; + +export type single_modifier = { + data?: { /** - * Internal server error. There was a system failure in the platform. + * A unique identifier for a modifier that is generated automatically when a modifier is created. */ - "500": Error - } - } - } - "/pcm/variations/{variationID}/options": { - post: { - req: CreateVariationOptionData - res: { + id?: string; /** - * Successfully returns the created variation option + * This represents the type of resource object being returned. Always `product-variation-modifier'. */ - "201": CreatedOption + type?: 'product-variation-modifier'; + attributes?: { + /** + * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + * + * | Modifier | Data Type | Effect | + * | :--- | :--- | :--- | + * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | + * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | + * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | + * | `description_equals` | `string` | Overrides the description of the child product. | + * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | + * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | + * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | + * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | + * | `price_increment` | `string` | Increases the price of the child product. | + * | `price_decrement` | `string` | Decreases the price of the child product. | + * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | + * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `sku_equals` | `string` | Sets the SKU of the child product. | + * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | + * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | + * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | + * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | + * + */ + type?: 'commodity_type' | 'status' | 'price' | 'name_append' | 'name_prepend' | 'name_equals' | 'sku_append' | 'sku_prepend' | 'sku_equals' | 'sku_builder' | 'slug_append' | 'slug_prepend' | 'slug_equals' | 'slug_builder' | 'description_append' | 'description_prepend' | 'description_equals' | 'custom_inputs_equals' | 'build_rules_equals' | 'locales_equals' | 'upc_ean_equals' | 'mpn_equals' | 'external_ref_equals'; + /** + * Required for non-builder modifiers. The value of the modifier type. + */ + value?: string; + /** + * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. + */ + seek?: string; + /** + * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. + */ + set?: string; + /** + * The name of the modifier. + */ + reference_name?: string; + }; /** - * Bad request. The request failed validation. + * The owner of the resource, either `organization` or `store`. */ - "422": Error + meta?: { + owner?: 'organization' | 'store'; + }; + }; +}; + +export type single_node = { + data?: node; +}; + +export type single_option = { + data: { /** - * Internal server error. There was a system failure in the platform. + * The unique identifier generated when an option is created. */ - "500": Error - } - } - get: { - req: GetAllVariationOptionsData - res: { + id: string; /** - * Successfully returns all variation options + * This represents the type of resource object being returned. Always `product-variation-option`. */ - "200": MultiOptions + type: 'product-variation-option'; /** - * Bad request. The request failed validation. + * A variation option represents an option for selection for a single product-variation. For example, if your variation is `color`, you might have three possible options; red, green, and blue. */ - "400": Error + attributes: { + /** + * A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + */ + name?: string; + /** + * A human-recognizable description for the option. + */ + description?: string; + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + */ + sort_order?: number; + }; + meta: { + /** + * The owner of a resource, either `organization` or `store`. + */ + owner?: 'organization' | 'store'; + /** + * The date and time an option is created. + */ + created_at?: string; + /** + * The date and time an option is updated. + */ + updated_at?: string; + }; + }; +}; + +export type single_product_response = { + data?: product_response; + /** + * Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. + */ + included?: { /** - * Internal server error. There was a system failure in the platform. + * A list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. */ - "500": Error - } - } - } - "/pcm/variations/{variationID}/options/{optionID}": { - get: { - req: GetVariationOptionData - res: { + component_products?: Array; + }; +}; + +export type single_tag = { + data?: tag; +}; + +export type single_variation = { + data: { /** - * Successfully returns the variation option + * A unique identifier for a variation. */ - "200": SingleOption + id: string; /** - * Bad request. The request failed validation. + * This represents the type of resource object being returned. Always `product-variation`. */ - "400": Error + type: 'product-variation'; + attributes: { + /** + * The name for a variation. + */ + name?: string; + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + */ + sort_order?: number; + }; + meta: { + /** + * A variation option represents an option for selection for a single product-variation. For example, if your variation is `color`, you might have three possible options; red, green, and blue. + */ + options?: Array<{ + /** + * A unique ID that is generated an option is created. + */ + id?: string; + /** + * A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + */ + name?: string; + /** + * A description for an option. + */ + description?: string; + /** + * The date and time an option is created. + */ + created_at?: string; + /** + * The date and time an option is updated. + */ + updated_at?: string; + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + */ + sort_order?: number; + }>; + /** + * The owner of the resource, either `organization` or `store`. + */ + owner?: 'organization' | 'store'; + /** + * The date and time a variation is created. + */ + created_at?: string; + /** + * The date and time a variation is updated. + */ + updated_at?: string; + }; + }; +}; + +export type tag = { + /** + * A unique identifier generated when a tag is created. + */ + id?: string; + /** + * This represents the type of resource object being returned. Always `tag`. + */ + type?: 'tag'; + attributes?: { /** - * Bad Request. Not Found. + * The text value of the tag. */ - "404": Error + value?: string; + }; + meta?: { /** - * Internal server error. There was a system failure in the platform. + * A unique request ID is generated when a tag is created. */ - "500": Error - } - } - put: { - req: UpdateVariationOptionData - res: { + x_request_id?: string; /** - * Successfully returns the updated variation option + * The date and time a tag is created. */ - "200": SingleOption + created_at?: string; /** - * Forbidden + * The date and time a tag is updated. */ - "403": Error + updated_at?: string; /** - * Bad Request. Not Found. + * The owner of a resource, either `organization` or `store`. */ - "404": Error + owner?: 'store' | 'organization'; + }; +}; + +/** + * This represents the type of resource object being returned. Always `tag`. + */ +export type type10 = 'tag'; + +export type template_response = { + data?: Array<{ /** - * Write conflict detected + * A unique identifier for a template generated when a template is created. */ - "409": Error + id?: string; /** - * Bad request. The request failed validation. + * This represents the type of resource object being returned. Always `template`. */ - "422": Error + type?: 'template'; + }>; +}; + +export type update_custom_relationship = { + data: { /** - * Internal server error. There was a system failure in the platform. + * The unique identifier of the custom relationship. */ - "500": Error - } - } - delete: { - req: DeleteVariationOptionData - res: { + id: string; /** - * No Content + * This represents the type of resource object being returned. Always `custom-relationship`. */ - "204": void + type: 'custom-relationship'; + attributes: req_attributes_custom_relationship; + }; +}; + +export type update_hierarchy = { + data: { /** - * Forbidden + * The unique identifier of the hierarchy. Must match the hierarchy ID specified in the request path. */ - "403": Error + id: string; /** - * Bad request. The request failed validation. + * This represents the type of resource object being returned. Always `hierarchy`. */ - "422": Error + type: 'hierarchy'; + attributes: req_attributes_hierarchy; + }; +}; + +export type update_modifier = { + data: { /** - * Internal server error. There was a system failure in the platform. + * This represents the type of resource object being returned. Always `product-variation-modifier`. */ - "500": Error - } - } - } - "/pcm/variations/{variationID}/options/{optionID}/modifiers": { - post: { - req: CreateModifierData - res: { + type: 'product-variation-modifier'; + attributes: { + /** + * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + * + * | Modifier | Data Type | Effect | + * | :--- | :--- | :--- | + * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | + * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | + * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | + * | `description_equals` | `string` | Overrides the description of the child product. | + * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | + * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | + * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | + * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | + * | `price_increment` | `string` | Increases the price of the child product. | + * | `price_decrement` | `string` | Decreases the price of the child product. | + * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | + * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `sku_equals` | `string` | Sets the SKU of the child product. | + * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | + * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | + * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | + * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | + * + */ + type: 'commodity_type' | 'status' | 'price' | 'name_append' | 'name_prepend' | 'name_equals' | 'sku_append' | 'sku_prepend' | 'sku_equals' | 'sku_builder' | 'slug_append' | 'slug_prepend' | 'slug_equals' | 'slug_builder' | 'description_append' | 'description_prepend' | 'description_equals' | 'custom_inputs_equals' | 'build_rules_equals' | 'locales_equals' | 'upc_ean_equals' | 'mpn_equals' | 'external_ref_equals'; + /** + * Required for non-builder modifiers. The value of the modifier type. + */ + value?: string; + /** + * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. + */ + seek?: string; + /** + * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. + */ + set?: string; + /** + * The name of the modifier. + */ + reference_name?: string; + }; /** - * Successfully returns the created modifier + * The unique identifier of the modifier. Must match the modifier ID specified in the request path. */ - "201": CreatedModifier + id: string; + }; +}; + +export type update_node = { + data?: { /** - * Bad request. The request failed validation. + * The unique identifier of the node. Must match the node ID specified in the request path. */ - "422": Error + id: string; /** - * Internal server error. There was a system failure in the platform. + * This represents the type of resource object being returned. Always `node`. */ - "500": Error - } - } - get: { - req: GetAllModifiersData - res: { + type: 'node'; + attributes: attributes_nodes; + meta?: { + /** + * You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. The `sort_order` for each node. This value determines the order of nodes in the response for the `Get a Node’s Children` request. The node with the highest value of sort_order is displayed first. For example, a node with a sort_order value of 3 appears before a node with a sort_order value of 2. + * + * - If you don’t provide `sort_order` when creating nodes, all child nodes in the response for `Get a Node’s Children` request are ordered by the `updated_at` time in descending order, with the most recently updated child node first. + * - If you set `sort_order` for only a few child nodes or not all, the child nodes with a `sort_order` value appear first and then other child nodes appear in the order of `updated_at` time. + * + */ + sort_order?: number; + }; + }; +}; + +export type update_option = { + data: { /** - * Successfully returns all variation modifiers + * This represents the type of resource object being returned. Always `product-variation-option`. */ - "200": MultiModifiers + type: 'product-variation-option'; + attributes: { + /** + * A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + */ + name?: string; + /** + * The description of the option. + */ + description?: string; + /** + * By default, variations and variation options are sorted alphabetically. You can use the `sort_order` attribute to sort the order of your variation and variation options in the `variation_matrix`. The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. + * + * The variation option with the highest value of `sort_order` is displayed first. For example, a variation option with a `sort_order` value of `3` appears before a variation option with a `sort_order` value of `2`. + * + * You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, and so on, zero or negative numbers. + * + * You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + * + * You must rebuild your products for the sort order changes to take effect. + * + */ + sort_order?: number; + }; /** - * Bad request. The request failed validation. + * The unique identifier of the option. Must match the option ID specified in the request path. */ - "400": Error + id: string; + }; +}; + +export type update_product_request = { + data: { /** - * Internal server error. There was a system failure in the platform. + * This represents the type of resource object being returned. Always `product`. */ - "500": Error - } - } - } - "/pcm/variations/{variationID}/options/{optionID}/modifiers/{modifierID}": { - get: { - req: GetModifierData - res: { + type: 'product'; /** - * Returns the specified modifier. + * The unique identifier of the product. Must match the product ID specified in the request path. */ - "200": SingleModifier + id: string; + attributes: product_attributes; + }; +}; + +export type update_variation = { + data: { /** - * Bad request. The request failed validation. + * This represents the type of resource object being returned. Always `product-variation`. */ - "400": Error + type: 'product-variation'; + attributes: { + /** + * The variation name. + */ + name?: string; + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. + * + * The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. + * + * You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + * + * You must rebuild your products for the sort order changes to take effect. + * + */ + sort_order?: number; + }; /** - * Bad Request. Not Found. + * The unique identifier of the variation. Must match the variation ID specified in the request path. */ - "404": Error + id: string; + }; +}; + +export type variations_response = { + data?: Array<{ /** - * Internal server error. There was a system failure in the platform. + * A unique identifier generated when a variation is created. */ - "500": Error - } - } - put: { - req: UpdateModifierData - res: { + id?: string; /** - * Successfully returns the updated modifier + * This represents the type of resource object being returned. Always `product-variation`. */ - "200": SingleModifier + type?: 'product-variation'; + meta?: { + /** + * The date and time a resource is created. + */ + created_at?: string; + }; + }>; +}; + +export type GetAllJobsResponse = (multi); + +export type GetAllJobsError = (error); + +export type GetJobData = { + path: { /** - * Forbidden + * A unique identifier for the job. */ - "403": Error + jobID: string; + }; +}; + +export type GetJobResponse = (single); + +export type GetJobError = (error); + +export type CancelJobData = { + body?: { + [key: string]: unknown; + }; + path: { /** - * Bad Request. Not Found. + * A unique identifier for the job. */ - "404": Error + jobID: string; + }; +}; + +export type CancelJobResponse = (single); + +export type CancelJobError = (error); + +export type GetJobErrorsData = { + path: { /** - * Write conflict detected + * A unique identifier for the job. */ - "409": Error + jobID: string; + }; +}; + +export type GetJobErrorsResponse = (errors); + +export type GetJobErrorsError = (error); + +export type CreateProductData = { + body: create_product_request; +}; + +export type CreateProductResponse = (single_product_response); + +export type CreateProductError = (error); + +export type GetAllProductsData = { + query?: { /** - * Bad request. The request failed validation. + * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering). + * + * For more information about the attributes and operators that are supported, see [Get all products](/docs/api/pxm/products/get-all-products). + * */ - "422": Error + filter?: string; /** - * Internal server error. There was a system failure in the platform. + * Using the include parameter, you can retrieve top-level resources. + * + * - Files or main image. For example, `include=files,main_image`. + * - Component product data. For example, `include=component_products`. + * - Key attribute data, such as SKU or slug. + * */ - "500": Error - } - } - delete: { - req: DeleteModifierData - res: { + include?: string; /** - * No Content + * The number of records per page. The maximum limit is 100. */ - "204": void + 'page[limit]'?: number; /** - * Forbidden + * The number of records to offset the results by. */ - "403": Error + 'page[offset]'?: number; + }; +}; + +export type GetAllProductsResponse = (multi_product_response); + +export type GetAllProductsError = (error); + +export type ImportProductsData = { + body?: { /** - * Bad request. The request failed validation. + * The file you want to upload. Ensure that the file format is Comma Separated Values (CSV). */ - "422": Error + file?: (Blob | File); + }; +}; + +export type ImportProductsResponse = (single); + +export type ImportProductsError = (error); + +export type ExportProductsData = { + body?: { + [key: string]: unknown; + }; + query?: { /** - * Internal server error. There was a system failure in the platform. + * + * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering), but you must go to a specific endpoint to understand the attributes and operators an endpoint supports. + * + * For more information about the attributes and operators that this endpoint supports, see [Export Products](/docs/api/pxm/products/export-products). + * */ - "500": Error - } - } - } - "/pcm/hierarchies": { - post: { - req: CreateHierarchyData - res: { + filter?: string; /** - * Returns a created hierarchy with the following attributes. + * Set to `true` if you want to use a template slug instead of a template ID when exporting products that have custom data. */ - "201": SingleHierarchy + useTemplateSlugs?: boolean; + }; +}; + +export type ExportProductsResponse = (single); + +export type ExportProductsError = (error); + +export type GetProductData = { + path: { /** - * Bad request. The request failed validation. + * A unique identifier for the product. */ - "422": Error + productID: string; + }; + query?: { /** - * Internal server error. There was a system failure in the platform. + * Using the include parameter, you can retrieve top-level resources. + * + * - Files or main image. For example, `include=files,main_image`. + * - Component product data. For example, `include=component_products`. + * - Key attribute data, such as SKU or slug. + * */ - "500": Error - } - } - get: { - req: GetHierarchyData - res: { + include?: string; + }; +}; + +export type GetProductResponse = (single_product_response); + +export type GetProductError = (error); + +export type UpdateProductData = { + body?: update_product_request; + path: { /** - * Returns a list of all hierarchies. + * A unique identifier for the product. */ - "200": MultiHierarchy + productID: string; + }; +}; + +export type UpdateProductResponse = (single_product_response); + +export type UpdateProductError = (error); + +export type DeleteProductData = { + path: { /** - * Bad request. The request failed validation. + * A unique identifier for the product. */ - "400": Error + productID: string; + }; +}; + +export type DeleteProductResponse = (void); + +export type DeleteProductError = (error); + +export type AttachNodesData = { + body: { + data: { + /** + * Filters applied to search for appropriate products to attach to a node. See [Attach multiple nodes](/docs/api/pxm/products/attach-nodes). + * + */ + filter: string; + /** + * A list of node unique identifiers that you want to assign to the products. + */ + node_ids: Array<(string)>; + }; + }; +}; + +export type AttachNodesResponse = ({ + meta?: { /** - * Internal server error. There was a system failure in the platform. + * Number of nodes assigned to the products. */ - "500": Error - } - } - } - "/pcm/hierarchies/{hierarchyID}": { - get: { - req: GetHierarchyChildData - res: { + nodes_attached?: number; /** - * Returns a hierarchy with the following attributes. + * A list of node unique identifiers that could not be identified. */ - "200": SingleHierarchy + nodes_not_found?: Array<(string)>; + }; +}); + +export type AttachNodesError = (error); + +export type DetachNodesData = { + body: { + data: { + /** + * You can apply filters to search for the appropriate products to detach. See [Detach multiple nodes](/docs/api/pxm/products/detach-nodes). + * + */ + filter: string; + /** + * A list of node unique identifiers that you want to assign to the products. + */ + node_ids: Array<(string)>; + }; + }; +}; + +export type DetachNodesResponse = ({ + meta?: { /** - * Bad request. The request failed validation. + * Number of nodes dissociated from the products. */ - "400": Error + nodes_detached?: number; /** - * Bad Request. Not Found. + * A list of node unique identifiers that could not be identified. */ - "404": Error + nodes_not_found?: Array<(string)>; + }; +}); + +export type DetachNodesError = (error); + +export type GetProductsNodesData = { + path: { /** - * Internal server error. There was a system failure in the platform. + * A unique identifier for the product. */ - "500": Error - } - } - put: { - req: UpdateHierarchyData - res: { + productID: string; + }; + query?: { /** - * Successfully returns the updated hierarchy + * The number of records per page. The maximum limit is 100. */ - "200": SingleHierarchy + 'page[limit]'?: number; /** - * Forbidden + * The number of records to offset the results by. */ - "403": Error + 'page[offset]'?: number; + }; +}; + +export type GetProductsNodesResponse = (multi_nodes); + +export type GetProductsNodesError = (error); + +export type BuildChildProductsData = { + body?: { + [key: string]: unknown; + }; + path: { /** - * Bad Request. Not Found. + * A unique identifier for the product. */ - "404": Error + productID: string; + }; +}; + +export type BuildChildProductsResponse = (unknown); + +export type BuildChildProductsError = (error); + +export type GetChildProductsData = { + path: { /** - * Bad request. The request failed validation. + * A unique identifier for the product. */ - "422": Error + productID: string; + }; +}; + +export type GetChildProductsResponse = (multi_product_response); + +export type GetChildProductsError = (error); + +export type CreateProductTemplateRelationshipData = { + body?: product_templates_request; + path: { /** - * Internal server error. There was a system failure in the platform. + * A unique identifier for the product. */ - "500": Error - } - } - delete: { - req: DeleteHierarchyData - res: { + productID: string; + }; +}; + +export type CreateProductTemplateRelationshipResponse = (template_response); + +export type CreateProductTemplateRelationshipError = (error); + +export type GetProductTemplateRelationshipsData = { + path: { /** - * No Content + * A unique identifier for the product. */ - "204": void + productID: string; + }; +}; + +export type GetProductTemplateRelationshipsResponse = (template_response); + +export type GetProductTemplateRelationshipsError = (error); + +export type DeleteProductTemplateRelationshipData = { + body?: product_templates_request; + path: { /** - * Forbidden + * A unique identifier for the product. */ - "403": Error + productID: string; + }; +}; + +export type DeleteProductTemplateRelationshipResponse = (void); + +export type DeleteProductTemplateRelationshipError = (error); + +export type GetProductComponentProductsRelationshipsData = { + path: { /** - * Internal server error. There was a system failure in the platform. + * A unique identifier for the product. */ - "500": Error - } - } - } - "/pcm/hierarchies/{hierarchyID}/nodes": { - post: { - req: CreateNodeData - res: { + productID: string; + }; +}; + +export type GetProductComponentProductsRelationshipsResponse = (component_products_response); + +export type GetProductComponentProductsRelationshipsError = (error); + +export type GetProductFileRelationshipsData = { + path: { /** - * Successfully returns the created node + * A unique identifier for the product. */ - "201": SingleNode + productID: string; + }; +}; + +export type GetProductFileRelationshipsResponse = (file_response); + +export type GetProductFileRelationshipsError = (error); + +export type CreateProductFileRelationshipsData = { + body?: product_files_request; + path: { /** - * Forbidden + * A unique identifier for the product. */ - "403": Error + productID: string; + }; +}; + +export type CreateProductFileRelationshipsResponse = (void); + +export type CreateProductFileRelationshipsError = (error); + +export type UpdateProductFileRelationshipsData = { + body?: product_files_request; + path: { /** - * Bad Request. Not Found. + * A unique identifier for the product. */ - "404": Error + productID: string; + }; +}; + +export type UpdateProductFileRelationshipsResponse = (void); + +export type UpdateProductFileRelationshipsError = (error); + +export type DeleteProductFileRelationshipsData = { + body?: product_files_request; + path: { /** - * Bad request. The request failed validation. + * A unique identifier for the product. */ - "422": Error + productID: string; + }; +}; + +export type DeleteProductFileRelationshipsResponse = (void); + +export type DeleteProductFileRelationshipsError = (error); + +export type CreateProductVariationRelationshipsData = { + body?: product_variations_request; + path: { /** - * Internal server error. There was a system failure in the platform. + * A unique identifier for the product. */ - "500": Error - } - } - get: { - req: GetAllNodesInHierarchyData - res: { + productID: string; + }; +}; + +export type CreateProductVariationRelationshipsResponse = (void); + +export type CreateProductVariationRelationshipsError = (error); + +export type GetProductVariationRelationshipsData = { + path: { /** - * Successfully returns the node's children + * A unique identifier for the product. */ - "200": MultiNodes + productID: string; + }; +}; + +export type GetProductVariationRelationshipsResponse = (variations_response); + +export type GetProductVariationRelationshipsError = (error); + +export type UpdateProductVariationRelationshipsData = { + body?: product_variations_request; + path: { /** - * Bad request. The request failed validation. + * A unique identifier for the product. */ - "400": Error + productID: string; + }; +}; + +export type UpdateProductVariationRelationshipsResponse = (void); + +export type UpdateProductVariationRelationshipsError = (error); + +export type DeleteProductVariationRelationshipsData = { + body?: product_variations_request; + path: { /** - * Bad Request. Not Found. + * A unique identifier for the product. */ - "404": Error + productID: string; + }; +}; + +export type DeleteProductVariationRelationshipsResponse = (void); + +export type DeleteProductVariationRelationshipsError = (error); + +export type CreateProductMainImageRelationshipsData = { + body?: main_image_request; + path: { /** - * Internal server error. There was a system failure in the platform. + * A unique identifier for the product. */ - "500": Error - } - } - } - "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}": { - get: { - req: GetHierarchyNodeData - res: { + productID: string; + }; +}; + +export type CreateProductMainImageRelationshipsResponse = (void); + +export type CreateProductMainImageRelationshipsError = (error); + +export type GetProductMainImageRelationshipsData = { + path: { /** - * Returns a node with the following attributes. + * A unique identifier for the product. */ - "200": SingleNode + productID: string; + }; +}; + +export type GetProductMainImageRelationshipsResponse = (main_image_response); + +export type GetProductMainImageRelationshipsError = (error); + +export type UpdateProductMainImageRelationshipsData = { + body?: replace_main_image_request; + path: { /** - * Bad request. The request failed validation. + * A unique identifier for the product. */ - "400": Error + productID: string; + }; +}; + +export type UpdateProductMainImageRelationshipsResponse = (void); + +export type UpdateProductMainImageRelationshipsError = (error); + +export type DeleteProductMainImageRelationshipsData = { + path: { /** - * Bad Request. Not Found. + * A unique identifier for the product. */ - "404": Error + productID: string; + }; +}; + +export type DeleteProductMainImageRelationshipsResponse = (void); + +export type DeleteProductMainImageRelationshipsError = (error); + +export type CreateVariationData = { + body: create_variation; +}; + +export type CreateVariationResponse = (created_variation); + +export type CreateVariationError = (error); + +export type GetAllVariationsData = { + query?: { /** - * Internal server error. There was a system failure in the platform. + * The number of records per page. The maximum limit is 100. */ - "500": Error - } - } - put: { - req: UpdateNodeData - res: { + 'page[limit]'?: number; /** - * Successfully returns the updated node + * The number of records to offset the results by. */ - "200": SingleNode + 'page[offset]'?: number; + }; +}; + +export type GetAllVariationsResponse = (multi_variations); + +export type GetAllVariationsError = (error); + +export type GetVariationData = { + path: { /** - * Forbidden + * A unique identifier for the variation. */ - "403": Error + variationID: string; + }; +}; + +export type GetVariationResponse = (single_variation); + +export type GetVariationError = (error); + +export type UpdateVariationData = { + body?: update_variation; + path: { /** - * Bad Request. Not Found. + * A unique identifier for the variation. */ - "404": Error + variationID: string; + }; +}; + +export type UpdateVariationResponse = (single_variation); + +export type UpdateVariationError = (error); + +export type DeleteVariationData = { + path: { /** - * Bad request. The request failed validation. + * A unique identifier for the variation. */ - "422": Error + variationID: string; + }; +}; + +export type DeleteVariationResponse = (void); + +export type DeleteVariationError = (error); + +export type CreateVariationOptionData = { + body?: create_option; + path: { /** - * Internal server error. There was a system failure in the platform. + * A unique identifier for the variation. */ - "500": Error - } - } - delete: { - req: DeleteNodeData - res: { + variationID: string; + }; +}; + +export type CreateVariationOptionResponse = (created_option); + +export type CreateVariationOptionError = (error); + +export type GetAllVariationOptionsData = { + path: { /** - * No Content + * A unique identifier for the variation. */ - "204": void + variationID: string; + }; + query?: { /** - * Forbidden + * The number of records per page. The maximum limit is 100. */ - "403": Error + 'page[limit]'?: number; /** - * Bad request. The request failed validation. + * The number of records to offset the results by. */ - "422": Error + 'page[offset]'?: number; + }; +}; + +export type GetAllVariationOptionsResponse = (multi_options); + +export type GetAllVariationOptionsError = (error); + +export type GetVariationOptionData = { + path: { /** - * Internal server error. There was a system failure in the platform. + * A unique identifier for the option. */ - "500": Error - } - } - } - "/pcm/hierarchies/{hierarchyID}/children": { - get: { - req: GetAllChildrenData - res: { + optionID: string; /** - * Returns the hierarchy's children. + * A unique identifier for the variation. */ - "200": MultiNodes + variationID: string; + }; +}; + +export type GetVariationOptionResponse = (single_option); + +export type GetVariationOptionError = (error); + +export type UpdateVariationOptionData = { + body?: update_option; + path: { /** - * Bad request. The request failed validation. + * A unique identifier for the option. */ - "400": Error + optionID: string; /** - * Bad Request. Not Found. + * A unique identifier for the variation. */ - "404": Error + variationID: string; + }; +}; + +export type UpdateVariationOptionResponse = (single_option); + +export type UpdateVariationOptionError = (error); + +export type DeleteVariationOptionData = { + path: { /** - * Internal server error. There was a system failure in the platform. + * A unique identifier for the option. */ - "500": Error - } - } - } - "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/children": { - post: { - req: CreateNodeChildRelationshipsData - res: { + optionID: string; /** - * Successfully returns the node's children + * A unique identifier for the variation. */ - "200": SingleNode + variationID: string; + }; +}; + +export type DeleteVariationOptionResponse = (void); + +export type DeleteVariationOptionError = (error); + +export type CreateModifierData = { + body?: create_modifier; + path: { /** - * Forbidden + * A unique identifier for the option. */ - "403": Error + optionID: string; /** - * Bad Request. Not Found. + * A unique identifier for the variation. */ - "404": Error + variationID: string; + }; +}; + +export type CreateModifierResponse = (created_modifier); + +export type CreateModifierError = (error); + +export type GetAllModifiersData = { + path: { /** - * Bad request. The request failed validation. + * A unique identifier for the option. */ - "422": Error + optionID: string; /** - * Internal server error. There was a system failure in the platform. + * A unique identifier for the variation. */ - "500": Error - } - } - } - "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/children": { - get: { - req: GetAllNodeChildrenData - res: { + variationID: string; + }; + query?: { /** - * Successfully returns the node's children + * The number of records per page. The maximum limit is 100. */ - "200": MultiNodes + 'page[limit]'?: number; /** - * Bad request. The request failed validation. + * The number of records to offset the results by. */ - "400": Error + 'page[offset]'?: number; + }; +}; + +export type GetAllModifiersResponse = (multi_modifiers); + +export type GetAllModifiersError = (error); + +export type GetModifierData = { + path: { /** - * Bad Request. Not Found. + * A unique identifier for the modifier. */ - "404": Error + modifierID: string; /** - * Internal server error. There was a system failure in the platform. + * A unique identifier for the option. */ - "500": Error - } - } - } - "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/parent": { - put: { - req: UpdateNodeParentData - res: { + optionID: string; /** - * No Content + * A unique identifier for the variation. */ - "204": void + variationID: string; + }; +}; + +export type GetModifierResponse = (single_modifier); + +export type GetModifierError = (error); + +export type UpdateModifierData = { + body?: update_modifier; + path: { /** - * Forbidden + * A unique identifier for the modifier. */ - "403": Error + modifierID: string; /** - * Bad Request. Not Found. + * A unique identifier for the option. */ - "404": Error + optionID: string; /** - * Bad request. The request failed validation. + * A unique identifier for the variation. */ - "422": Error + variationID: string; + }; +}; + +export type UpdateModifierResponse = (single_modifier); + +export type UpdateModifierError = (error); + +export type DeleteModifierData = { + path: { /** - * Internal server error. There was a system failure in the platform. + * A unique identifier for the modifier. */ - "500": Error - } - } - delete: { - req: DeleteNodeParentData - res: { + modifierID: string; /** - * No Content + * A unique identifier for the option. */ - "204": void + optionID: string; /** - * Forbidden + * A unique identifier for the variation. */ - "403": Error + variationID: string; + }; +}; + +export type DeleteModifierResponse = (void); + +export type DeleteModifierError = (error); + +export type CreateHierarchyData = { + body: create_hierarchy; +}; + +export type CreateHierarchyResponse = (single_hierarchy); + +export type CreateHierarchyError = (error); + +export type GetHierarchyData = { + query?: { /** - * Bad Request. Not Found. + * The number of records per page. The maximum limit is 100. */ - "404": Error + 'page[limit]'?: number; /** - * Bad request. The request failed validation. + * The number of records to offset the results by. */ - "422": Error + 'page[offset]'?: number; + }; +}; + +export type GetHierarchyResponse = (multi_hierarchy); + +export type GetHierarchyError = (error); + +export type GetHierarchyChildData = { + path: { /** - * Internal server error. There was a system failure in the platform. + * A unique identifier for the hierarchy. */ - "500": Error - } - } - } - "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/products": { - post: { - req: CreateNodeProductRelationshipData - res: { + hierarchyID: string; + }; +}; + +export type GetHierarchyChildResponse = (single_hierarchy); + +export type GetHierarchyChildError = (error); + +export type UpdateHierarchyData = { + body: update_hierarchy; + path: { /** - * Successfully returns the updated node + * A unique identifier for the hierarchy. */ - "201": SingleNode + hierarchyID: string; + }; +}; + +export type UpdateHierarchyResponse = (single_hierarchy); + +export type UpdateHierarchyError = (error); + +export type DeleteHierarchyData = { + path: { /** - * Forbidden + * A unique identifier for the hierarchy. */ - "403": Error + hierarchyID: string; + }; +}; + +export type DeleteHierarchyResponse = (void); + +export type DeleteHierarchyError = (error); + +export type CreateNodeData = { + body?: create_node; + path: { /** - * Bad Request. Not Found. + * A unique identifier for the hierarchy. */ - "404": Error + hierarchyID: string; + }; +}; + +export type CreateNodeResponse = (single_node); + +export type CreateNodeError = (error); + +export type GetAllNodesInHierarchyData = { + path: { /** - * Bad request. The request failed validation. + * A unique identifier for the hierarchy. */ - "422": Error + hierarchyID: string; + }; + query?: { /** - * Internal server error. There was a system failure in the platform. + * The number of records per page. The maximum limit is 100. */ - "500": Error - } - } - delete: { - req: DeleteNodeProductRelationshipsData - res: { + 'page[limit]'?: number; /** - * Successfully returns the updated node + * The number of records to offset the results by. */ - "200": SingleNode + 'page[offset]'?: number; + }; +}; + +export type GetAllNodesInHierarchyResponse = (multi_nodes); + +export type GetAllNodesInHierarchyError = (error); + +export type GetHierarchyNodeData = { + path: { /** - * Bad Request. Not Found. + * A unique identifier for the hierarchy. */ - "404": Error + hierarchyID: string; /** - * Bad request. The request failed validation. + * A unique identifier for the node. */ - "422": Error + nodeID: string; + }; +}; + +export type GetHierarchyNodeResponse = (single_node); + +export type GetHierarchyNodeError = (error); + +export type UpdateNodeData = { + body?: update_node; + path: { /** - * Internal server error. There was a system failure in the platform. + * A unique identifier for the hierarchy. */ - "500": Error - } - } - } - "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/products": { - get: { - req: GetNodeProductsData - res: { + hierarchyID: string; /** - * Successfully returns the node's products + * A unique identifier for the node. */ - "200": MultiProductResponse + nodeID: string; + }; +}; + +export type UpdateNodeResponse = (single_node); + +export type UpdateNodeError = (error); + +export type DeleteNodeData = { + path: { /** - * Bad request. The request failed validation. + * A unique identifier for the hierarchy. */ - "400": Error + hierarchyID: string; /** - * Bad Request. Not Found. + * A unique identifier for the node. */ - "404": Error + nodeID: string; + }; +}; + +export type DeleteNodeResponse = (void); + +export type DeleteNodeError = (error); + +export type GetAllChildrenData = { + path: { /** - * Internal server error. There was a system failure in the platform. + * A unique identifier for the hierarchy. */ - "500": Error - } - } - } - "/pcm/hierarchies/{hierarchyID}/duplicate_job": { - post: { - req: DuplicateHierarchyData - res: { + hierarchyID: string; + }; + query?: { /** - * Successfully returns the duplicate hierarchy job ID + * The number of records per page. The maximum limit is 100. */ - "201": Single + 'page[limit]'?: number; /** - * Bad Request. Not Found. + * The number of records to offset the results by. */ - "404": Error + 'page[offset]'?: number; + }; +}; + +export type GetAllChildrenResponse = (multi_nodes); + +export type GetAllChildrenError = (error); + +export type CreateNodeChildRelationshipsData = { + body?: node_children; + path: { /** - * Bad request. The request failed validation. + * A unique identifier for the hierarchy. */ - "422": Error + hierarchyID: string; /** - * Internal server error. There was a system failure in the platform. + * A unique identifier for the node. */ - "500": Error - } - } - } - "/pcm/tags": { - get: { - res: { + nodeID: string; + }; +}; + +export type CreateNodeChildRelationshipsResponse = (single_node); + +export type CreateNodeChildRelationshipsError = (error); + +export type GetAllNodeChildrenData = { + path: { /** - * Returns all the product tags. + * A unique identifier for the hierarchy. */ - "200": MultiTag + hierarchyID: string; /** - * Bad request. The request failed validation. + * A unique identifier for the node. */ - "400": Error + nodeID: string; + }; + query?: { /** - * Bad Request. Not Found. + * The number of records per page. The maximum limit is 100. */ - "404": Error + 'page[limit]'?: number; /** - * Bad request. The request failed validation. + * The number of records to offset the results by. */ - "422": Error + 'page[offset]'?: number; + }; +}; + +export type GetAllNodeChildrenResponse = (multi_nodes); + +export type GetAllNodeChildrenError = (error); + +export type UpdateNodeParentData = { + body?: node_parent; + path: { /** - * Internal server error. There was a system failure in the platform. + * A unique identifier for the hierarchy. */ - "500": Error - } - } - } - "/pcm/tags/{tagID}": { - get: { - req: GetProductTagData - res: { + hierarchyID: string; /** - * Returns a product tag with the following attributes. + * A unique identifier for the node. */ - "200": SingleTag + nodeID: string; + }; +}; + +export type UpdateNodeParentResponse = (void); + +export type UpdateNodeParentError = (error); + +export type DeleteNodeParentData = { + path: { /** - * Bad request. The request failed validation. + * A unique identifier for the hierarchy. */ - "400": Error + hierarchyID: string; /** - * Bad Request. Not Found. + * A unique identifier for the node. */ - "404": Error + nodeID: string; + }; +}; + +export type DeleteNodeParentResponse = (void); + +export type DeleteNodeParentError = (error); + +export type CreateNodeProductRelationshipData = { + body?: node_products; + path: { /** - * Bad request. The request failed validation. + * A unique identifier for the hierarchy. */ - "422": Error + hierarchyID: string; /** - * Internal server error. There was a system failure in the platform. + * A unique identifier for the node. */ - "500": Error - } - } - } - "/pcm/custom_relationships": { - post: { - req: CreateCustomRelationshipData - res: { + nodeID: string; + }; +}; + +export type CreateNodeProductRelationshipResponse = (single_node); + +export type CreateNodeProductRelationshipError = (error); + +export type DeleteNodeProductRelationshipsData = { + body?: node_products; + path: { /** - * Returns a created custom relationship with the following attributes. + * A unique identifier for the hierarchy. */ - "201": SingleCustomRelationship + hierarchyID: string; /** - * Bad request. The request failed validation. + * A unique identifier for the node. */ - "422": Error + nodeID: string; + }; +}; + +export type DeleteNodeProductRelationshipsResponse = (single_node); + +export type DeleteNodeProductRelationshipsError = (error); + +export type GetNodeProductsData = { + path: { /** - * Internal server error. There was a system failure in the platform. + * A unique identifier for the hierarchy. */ - "500": Error - } - } - } - "/pcm/custom_relationships/{customRelationshipSlug}": { - put: { - req: UpdateCustomRelationshipData - res: { + hierarchyID: string; /** - * Successfully returns the updated custom relationship + * A unique identifier for the node. */ - "200": SingleCustomRelationship + nodeID: string; + }; + query?: { /** - * Forbidden + * The number of records per page. The maximum limit is 100. */ - "403": Error + 'page[limit]'?: number; /** - * Bad Request. Not Found. + * The number of records to offset the results by. */ - "404": Error + 'page[offset]'?: number; + }; +}; + +export type GetNodeProductsResponse = (multi_product_response); + +export type GetNodeProductsError = (error); + +export type DuplicateHierarchyData = { + body: duplicate_job; + path: { /** - * Bad request. The request failed validation. + * A unique identifier for the hierarchy. */ - "422": Error + hierarchyID: string; + }; +}; + +export type DuplicateHierarchyResponse = (single); + +export type DuplicateHierarchyError = (error); + +export type GetAllProductTagsResponse = (multi_tag); + +export type GetAllProductTagsError = (error); + +export type GetProductTagData = { + path: { /** - * Internal server error. There was a system failure in the platform. + * A unique identifier for the tag. */ - "500": Error - } - } - } -} + tagID: string; + }; +}; -export type GetAllJobsResponseTransformer = ( - data: any, -) => Promise +export type GetProductTagResponse = (single_tag); -export type MultiModelResponseTransformer = (data: any) => Multi +export type GetProductTagError = (error); + +export type CreateCustomRelationshipData = { + body: create_custom_relationship; +}; + +export type CreateCustomRelationshipResponse = (single_custom_relationship); + +export type CreateCustomRelationshipError = (error); + +export type UpdateCustomRelationshipData = { + body: update_custom_relationship; + path: { + /** + * A custom relationship slug. + */ + customRelationshipSlug: string; + }; +}; -export type JobModelResponseTransformer = (data: any) => Job +export type UpdateCustomRelationshipResponse = (single_custom_relationship); -export const JobModelResponseTransformer: JobModelResponseTransformer = ( - data, -) => { - if (data?.attributes?.started_at) { - data.attributes.started_at = new Date(data.attributes.started_at) - } - if (data?.attributes?.completed_at) { - data.attributes.completed_at = new Date(data.attributes.completed_at) - } - if (data?.attributes?.created_at) { - data.attributes.created_at = new Date(data.attributes.created_at) - } - if (data?.attributes?.updated_at) { - data.attributes.updated_at = new Date(data.attributes.updated_at) - } - return data -} - -export const MultiModelResponseTransformer: MultiModelResponseTransformer = ( - data, -) => { - if (Array.isArray(data?.data)) { - data.data.forEach(JobModelResponseTransformer) - } - return data -} - -export const GetAllJobsResponseTransformer: GetAllJobsResponseTransformer = - async (data) => { - MultiModelResponseTransformer(data) - return data - } - -export type GetJobResponseTransformer = (data: any) => Promise - -export type SingleModelResponseTransformer = (data: any) => Single - -export const SingleModelResponseTransformer: SingleModelResponseTransformer = ( - data, -) => { - if (data?.data) { - JobModelResponseTransformer(data.data) - } - return data -} - -export const GetJobResponseTransformer: GetJobResponseTransformer = async ( - data, -) => { - SingleModelResponseTransformer(data) - return data -} - -export type CancelJobResponseTransformer = ( - data: any, -) => Promise - -export const CancelJobResponseTransformer: CancelJobResponseTransformer = - async (data) => { - SingleModelResponseTransformer(data) - return data - } - -export type CreateProductResponseTransformer = ( - data: any, -) => Promise - -export type SingleProductResponseModelResponseTransformer = ( - data: any, -) => SingleProductResponse - -export type ProductResponseModelResponseTransformer = ( - data: any, -) => ProductResponse - -export const ProductResponseModelResponseTransformer: ProductResponseModelResponseTransformer = - (data) => { - if (data?.meta?.created_at) { - data.meta.created_at = new Date(data.meta.created_at) - } - if (data?.meta?.updated_at) { - data.meta.updated_at = new Date(data.meta.updated_at) - } - return data - } - -export const SingleProductResponseModelResponseTransformer: SingleProductResponseModelResponseTransformer = - (data) => { - if (data?.data) { - ProductResponseModelResponseTransformer(data.data) - } - if (Array.isArray(data?.included?.component_products)) { - data.included.component_products.forEach( - ProductResponseModelResponseTransformer, - ) - } - return data - } - -export const CreateProductResponseTransformer: CreateProductResponseTransformer = - async (data) => { - SingleProductResponseModelResponseTransformer(data) - return data - } - -export type GetAllProductsResponseTransformer = ( - data: any, -) => Promise - -export type MultiProductResponseModelResponseTransformer = ( - data: any, -) => MultiProductResponse - -export const MultiProductResponseModelResponseTransformer: MultiProductResponseModelResponseTransformer = - (data) => { - if (Array.isArray(data?.data)) { - data.data.forEach(ProductResponseModelResponseTransformer) - } - if (Array.isArray(data?.included?.component_products)) { - data.included.component_products.forEach( - ProductResponseModelResponseTransformer, - ) - } - return data - } - -export const GetAllProductsResponseTransformer: GetAllProductsResponseTransformer = - async (data) => { - MultiProductResponseModelResponseTransformer(data) - return data - } - -export type ImportProductsResponseTransformer = ( - data: any, -) => Promise - -export const ImportProductsResponseTransformer: ImportProductsResponseTransformer = - async (data) => { - SingleModelResponseTransformer(data) - return data - } - -export type ExportProductsResponseTransformer = ( - data: any, -) => Promise - -export const ExportProductsResponseTransformer: ExportProductsResponseTransformer = - async (data) => { - SingleModelResponseTransformer(data) - return data - } - -export type GetProductResponseTransformer = ( - data: any, -) => Promise - -export const GetProductResponseTransformer: GetProductResponseTransformer = - async (data) => { - SingleProductResponseModelResponseTransformer(data) - return data - } - -export type UpdateProductResponseTransformer = ( - data: any, -) => Promise - -export const UpdateProductResponseTransformer: UpdateProductResponseTransformer = - async (data) => { - SingleProductResponseModelResponseTransformer(data) - return data - } - -export type GetProductsNodesResponseTransformer = ( - data: any, -) => Promise - -export type MultiNodesModelResponseTransformer = (data: any) => MultiNodes - -export type NodeModelResponseTransformer = (data: any) => Node - -export const NodeModelResponseTransformer: NodeModelResponseTransformer = ( - data, -) => { - if (data?.meta?.created_at) { - data.meta.created_at = new Date(data.meta.created_at) - } - if (data?.meta?.updated_at) { - data.meta.updated_at = new Date(data.meta.updated_at) - } - return data -} - -export const MultiNodesModelResponseTransformer: MultiNodesModelResponseTransformer = - (data) => { - if (Array.isArray(data?.data)) { - data.data.forEach(NodeModelResponseTransformer) - } - return data - } - -export const GetProductsNodesResponseTransformer: GetProductsNodesResponseTransformer = - async (data) => { - MultiNodesModelResponseTransformer(data) - return data - } - -export type GetChildProductsResponseTransformer = ( - data: any, -) => Promise - -export const GetChildProductsResponseTransformer: GetChildProductsResponseTransformer = - async (data) => { - MultiProductResponseModelResponseTransformer(data) - return data - } - -export type CreateVariationResponseTransformer = ( - data: any, -) => Promise - -export type CreatedVariationModelResponseTransformer = ( - data: any, -) => CreatedVariation - -export const CreatedVariationModelResponseTransformer: CreatedVariationModelResponseTransformer = - (data) => { - if (data?.data?.meta?.created_at) { - data.data.meta.created_at = new Date(data.data.meta.created_at) - } - if (data?.data?.meta?.updated_at) { - data.data.meta.updated_at = new Date(data.data.meta.updated_at) - } - return data - } - -export const CreateVariationResponseTransformer: CreateVariationResponseTransformer = - async (data) => { - CreatedVariationModelResponseTransformer(data) - return data - } - -export type CreateVariationOptionResponseTransformer = ( - data: any, -) => Promise - -export type CreatedOptionModelResponseTransformer = (data: any) => CreatedOption - -export const CreatedOptionModelResponseTransformer: CreatedOptionModelResponseTransformer = - (data) => { - if (data?.data?.meta?.created_at) { - data.data.meta.created_at = new Date(data.data.meta.created_at) - } - if (data?.data?.meta?.updated_at) { - data.data.meta.updated_at = new Date(data.data.meta.updated_at) - } - return data - } - -export const CreateVariationOptionResponseTransformer: CreateVariationOptionResponseTransformer = - async (data) => { - CreatedOptionModelResponseTransformer(data) - return data - } - -export type GetVariationOptionResponseTransformer = ( - data: any, -) => Promise - -export type SingleOptionModelResponseTransformer = (data: any) => SingleOption - -export const SingleOptionModelResponseTransformer: SingleOptionModelResponseTransformer = - (data) => { - if (data?.data?.meta?.created_at) { - data.data.meta.created_at = new Date(data.data.meta.created_at) - } - if (data?.data?.meta?.updated_at) { - data.data.meta.updated_at = new Date(data.data.meta.updated_at) - } - return data - } - -export const GetVariationOptionResponseTransformer: GetVariationOptionResponseTransformer = - async (data) => { - SingleOptionModelResponseTransformer(data) - return data - } - -export type UpdateVariationOptionResponseTransformer = ( - data: any, -) => Promise - -export const UpdateVariationOptionResponseTransformer: UpdateVariationOptionResponseTransformer = - async (data) => { - SingleOptionModelResponseTransformer(data) - return data - } - -export type CreateHierarchyResponseTransformer = ( - data: any, -) => Promise - -export type SingleHierarchyModelResponseTransformer = ( - data: any, -) => SingleHierarchy - -export type HierarchyModelResponseTransformer = (data: any) => Hierarchy - -export const HierarchyModelResponseTransformer: HierarchyModelResponseTransformer = - (data) => { - if (data?.meta?.created_at) { - data.meta.created_at = new Date(data.meta.created_at) - } - if (data?.meta?.updated_at) { - data.meta.updated_at = new Date(data.meta.updated_at) - } - return data - } - -export const SingleHierarchyModelResponseTransformer: SingleHierarchyModelResponseTransformer = - (data) => { - if (data?.data) { - HierarchyModelResponseTransformer(data.data) - } - return data - } - -export const CreateHierarchyResponseTransformer: CreateHierarchyResponseTransformer = - async (data) => { - SingleHierarchyModelResponseTransformer(data) - return data - } - -export type GetHierarchyResponseTransformer = ( - data: any, -) => Promise - -export type MultiHierarchyModelResponseTransformer = ( - data: any, -) => MultiHierarchy - -export const MultiHierarchyModelResponseTransformer: MultiHierarchyModelResponseTransformer = - (data) => { - if (Array.isArray(data?.data)) { - data.data.forEach(HierarchyModelResponseTransformer) - } - return data - } - -export const GetHierarchyResponseTransformer: GetHierarchyResponseTransformer = - async (data) => { - MultiHierarchyModelResponseTransformer(data) - return data - } - -export type GetHierarchyChildResponseTransformer = ( - data: any, -) => Promise - -export const GetHierarchyChildResponseTransformer: GetHierarchyChildResponseTransformer = - async (data) => { - SingleHierarchyModelResponseTransformer(data) - return data - } - -export type UpdateHierarchyResponseTransformer = ( - data: any, -) => Promise - -export const UpdateHierarchyResponseTransformer: UpdateHierarchyResponseTransformer = - async (data) => { - SingleHierarchyModelResponseTransformer(data) - return data - } - -export type CreateNodeResponseTransformer = ( - data: any, -) => Promise - -export type SingleNodeModelResponseTransformer = (data: any) => SingleNode - -export const SingleNodeModelResponseTransformer: SingleNodeModelResponseTransformer = - (data) => { - if (data?.data) { - NodeModelResponseTransformer(data.data) - } - return data - } - -export const CreateNodeResponseTransformer: CreateNodeResponseTransformer = - async (data) => { - SingleNodeModelResponseTransformer(data) - return data - } - -export type GetAllNodesInHierarchyResponseTransformer = ( - data: any, -) => Promise - -export const GetAllNodesInHierarchyResponseTransformer: GetAllNodesInHierarchyResponseTransformer = - async (data) => { - MultiNodesModelResponseTransformer(data) - return data - } - -export type GetHierarchyNodeResponseTransformer = ( - data: any, -) => Promise - -export const GetHierarchyNodeResponseTransformer: GetHierarchyNodeResponseTransformer = - async (data) => { - SingleNodeModelResponseTransformer(data) - return data - } - -export type UpdateNodeResponseTransformer = ( - data: any, -) => Promise - -export const UpdateNodeResponseTransformer: UpdateNodeResponseTransformer = - async (data) => { - SingleNodeModelResponseTransformer(data) - return data - } - -export type GetAllChildrenResponseTransformer = ( - data: any, -) => Promise - -export const GetAllChildrenResponseTransformer: GetAllChildrenResponseTransformer = - async (data) => { - MultiNodesModelResponseTransformer(data) - return data - } - -export type CreateNodeChildRelationshipsResponseTransformer = ( - data: any, -) => Promise - -export const CreateNodeChildRelationshipsResponseTransformer: CreateNodeChildRelationshipsResponseTransformer = - async (data) => { - SingleNodeModelResponseTransformer(data) - return data - } - -export type GetAllNodeChildrenResponseTransformer = ( - data: any, -) => Promise - -export const GetAllNodeChildrenResponseTransformer: GetAllNodeChildrenResponseTransformer = - async (data) => { - MultiNodesModelResponseTransformer(data) - return data - } - -export type CreateNodeProductRelationshipResponseTransformer = ( - data: any, -) => Promise - -export const CreateNodeProductRelationshipResponseTransformer: CreateNodeProductRelationshipResponseTransformer = - async (data) => { - SingleNodeModelResponseTransformer(data) - return data - } - -export type DeleteNodeProductRelationshipsResponseTransformer = ( - data: any, -) => Promise - -export const DeleteNodeProductRelationshipsResponseTransformer: DeleteNodeProductRelationshipsResponseTransformer = - async (data) => { - SingleNodeModelResponseTransformer(data) - return data - } - -export type GetNodeProductsResponseTransformer = ( - data: any, -) => Promise - -export const GetNodeProductsResponseTransformer: GetNodeProductsResponseTransformer = - async (data) => { - MultiProductResponseModelResponseTransformer(data) - return data - } - -export type DuplicateHierarchyResponseTransformer = ( - data: any, -) => Promise - -export const DuplicateHierarchyResponseTransformer: DuplicateHierarchyResponseTransformer = - async (data) => { - SingleModelResponseTransformer(data) - return data - } - -export type GetAllProductTagsResponseTransformer = ( - data: any, -) => Promise - -export type MultiTagModelResponseTransformer = (data: any) => MultiTag - -export type TagModelResponseTransformer = (data: any) => Tag - -export const TagModelResponseTransformer: TagModelResponseTransformer = ( - data, -) => { - if (data?.meta?.created_at) { - data.meta.created_at = new Date(data.meta.created_at) - } - if (data?.meta?.updated_at) { - data.meta.updated_at = new Date(data.meta.updated_at) - } - return data -} - -export const MultiTagModelResponseTransformer: MultiTagModelResponseTransformer = - (data) => { - if (Array.isArray(data?.data)) { - data.data.forEach(TagModelResponseTransformer) - } - return data - } - -export const GetAllProductTagsResponseTransformer: GetAllProductTagsResponseTransformer = - async (data) => { - MultiTagModelResponseTransformer(data) - return data - } - -export type GetProductTagResponseTransformer = ( - data: any, -) => Promise - -export type SingleTagModelResponseTransformer = (data: any) => SingleTag - -export const SingleTagModelResponseTransformer: SingleTagModelResponseTransformer = - (data) => { - if (data?.data) { - TagModelResponseTransformer(data.data) - } - return data - } - -export const GetProductTagResponseTransformer: GetProductTagResponseTransformer = - async (data) => { - SingleTagModelResponseTransformer(data) - return data - } - -export type CreateCustomRelationshipResponseTransformer = ( - data: any, -) => Promise - -export type SingleCustomRelationshipModelResponseTransformer = ( - data: any, -) => SingleCustomRelationship - -export type CustomRelationshipModelResponseTransformer = ( - data: any, -) => CustomRelationship - -export const CustomRelationshipModelResponseTransformer: CustomRelationshipModelResponseTransformer = - (data) => { - if (data?.meta?.timestamps?.created_at) { - data.meta.timestamps.created_at = new Date( - data.meta.timestamps.created_at, - ) - } - if (data?.meta?.timestamps?.updated_at) { - data.meta.timestamps.updated_at = new Date( - data.meta.timestamps.updated_at, - ) - } - return data - } - -export const SingleCustomRelationshipModelResponseTransformer: SingleCustomRelationshipModelResponseTransformer = - (data) => { - if (data?.data) { - CustomRelationshipModelResponseTransformer(data.data) - } - return data - } - -export const CreateCustomRelationshipResponseTransformer: CreateCustomRelationshipResponseTransformer = - async (data) => { - SingleCustomRelationshipModelResponseTransformer(data) - return data - } - -export type UpdateCustomRelationshipResponseTransformer = ( - data: any, -) => Promise - -export const UpdateCustomRelationshipResponseTransformer: UpdateCustomRelationshipResponseTransformer = - async (data) => { - SingleCustomRelationshipModelResponseTransformer(data) - return data - } +export type UpdateCustomRelationshipError = (error); \ No newline at end of file diff --git a/packages/sdks/pim/src/index.ts b/packages/sdks/pim/src/index.ts index b583818f..d40d9fe8 100644 --- a/packages/sdks/pim/src/index.ts +++ b/packages/sdks/pim/src/index.ts @@ -1,3 +1,4 @@ export * from "./client" -import { createClient, client } from "@hey-api/client-fetch" -export { createClient, client } +import { Client, createClient } from "@hey-api/client-fetch" +export { createClient, Client } +export { client } from "./client/sdk.gen" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d55c77f1..51e5cd88 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1485,12 +1485,12 @@ importers: packages/sdks/pim: dependencies: '@hey-api/client-fetch': - specifier: ^0.1.7 - version: 0.1.14 + specifier: 0.6.0 + version: 0.6.0 devDependencies: '@hey-api/openapi-ts': - specifier: ^0.48.2 - version: 0.48.3(typescript@5.5.4) + specifier: 0.61.2 + version: 0.61.2(typescript@5.5.4) typescript: specifier: ^5.5.3 version: 5.5.4 @@ -1498,12 +1498,12 @@ importers: packages/sdks/shopper: dependencies: '@hey-api/client-fetch': - specifier: ^0.2.4 - version: 0.2.4 + specifier: 0.6.0 + version: 0.6.0 devDependencies: '@hey-api/openapi-ts': - specifier: ^0.52.10 - version: 0.52.11(typescript@5.5.4) + specifier: 0.61.1 + version: 0.61.1(typescript@5.5.4) '@redocly/cli': specifier: ^1.21.0 version: 1.27.1(enzyme@3.11.0) @@ -1819,24 +1819,6 @@ packages: - chokidar dev: false - /@apidevtools/json-schema-ref-parser@11.6.4: - resolution: {integrity: sha512-9K6xOqeevacvweLGik6LnZCb1fBtCOSIWQs8d096XGeqoLKC33UVMGz9+77Gw44KvbH4pKcQPWo4ZpxkXYj05w==} - engines: {node: '>= 16'} - dependencies: - '@jsdevtools/ono': 7.1.3 - '@types/json-schema': 7.0.15 - js-yaml: 4.1.0 - dev: true - - /@apidevtools/json-schema-ref-parser@11.7.0: - resolution: {integrity: sha512-pRrmXMCwnmrkS3MLgAIW5dXRzeTv6GLjkjb4HmxNnvAKXN1Nfzp4KmGADBQvlVUcqi+a5D+hfGDLLnd5NnYxog==} - engines: {node: '>= 16'} - dependencies: - '@jsdevtools/ono': 7.1.3 - '@types/json-schema': 7.0.15 - js-yaml: 4.1.0 - dev: true - /@ardatan/relay-compiler@12.0.0(graphql@16.8.1): resolution: {integrity: sha512-9anThAaj1dQr6IGmzBMcfzOQKTa5artjuPmw8NYK/fiGEMjADbSguBY2FMDykt+QhilR3wc9VA/3yVju7JHg7Q==} hasBin: true @@ -6857,41 +6839,49 @@ packages: react: 18.3.1 dev: false - /@hey-api/client-fetch@0.1.14: - resolution: {integrity: sha512-6RoO2prOVrQfx2wClJ7DkeIVWQokiRLIdqiuxvFTfWEQVfOc+hQhAw6/IijYrSM9cA7A7DzmHpzTLc/gbQ7/2Q==} - dev: false - /@hey-api/client-fetch@0.2.4: resolution: {integrity: sha512-SGTVAVw3PlKDLw+IyhNhb/jCH3P1P2xJzLxA8Kyz1g95HrkYOJdRpl9F5I7LLwo9aCIB7nwR2NrSeX7QaQD7vQ==} dev: false - /@hey-api/openapi-ts@0.48.3(typescript@5.5.4): - resolution: {integrity: sha512-R53Nr4Gicz77icS+RiH0fwHa9A0uFPtzsjC8SBaGwtOel5ZyxeBbayWE6HhE789hp3dok9pegwWncwwOrr4WFA==} + /@hey-api/client-fetch@0.6.0: + resolution: {integrity: sha512-FlhFsVeH8RxJe/nq8xUzxNbiOpe+GadxlD2pfvDyOyLdCTU4o/LRv46ZVWstaW7DgF4nxhI328chy3+AulwVXw==} + dev: false + + /@hey-api/json-schema-ref-parser@1.0.1: + resolution: {integrity: sha512-dBt0A7op9kf4BcK++x6HBYDmvCvnJUZEGe5QytghPFHnMXPyKwDKomwL/v5e9ERk6E0e1GzL/e/y6pWUso9zrQ==} + engines: {node: '>= 16'} + dependencies: + '@jsdevtools/ono': 7.1.3 + '@types/json-schema': 7.0.15 + js-yaml: 4.1.0 + dev: true + + /@hey-api/openapi-ts@0.61.1(typescript@5.5.4): + resolution: {integrity: sha512-CJqwyzy2/E6BS/3wrk7M9qIaZKyu52vUiHrmAQCw72/bMzzgy69TbK1IM8AHNJ6+gR9+X/uggjTn8WfouslDUw==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: typescript: ^5.x dependencies: - '@apidevtools/json-schema-ref-parser': 11.6.4 - c12: 1.11.1 - camelcase: 8.0.0 - commander: 12.1.0 + '@hey-api/json-schema-ref-parser': 1.0.1 + c12: 2.0.1 + commander: 13.0.0 handlebars: 4.7.8 typescript: 5.5.4 transitivePeerDependencies: - magicast dev: true - /@hey-api/openapi-ts@0.52.11(typescript@5.5.4): - resolution: {integrity: sha512-S3NrCQDxy7AtW5sx8OVoBaqpaYNqYsD0y6YNwhUXPUahbrW7Wxm/N4RIEsRtXVbcjUqdAjo1FmFmeyEKYziJkw==} + /@hey-api/openapi-ts@0.61.2(typescript@5.5.4): + resolution: {integrity: sha512-E0b8PibVqmZd/E/MB0h8Q2VXObZc+nhHHx3quLwNM08QgEtkC29vMcayzmuG+rR4nGvZGvREP1a4rZc0v6Xjgg==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: typescript: ^5.x dependencies: - '@apidevtools/json-schema-ref-parser': 11.7.0 - c12: 1.11.1 - commander: 12.1.0 + '@hey-api/json-schema-ref-parser': 1.0.1 + c12: 2.0.1 + commander: 13.0.0 handlebars: 4.7.8 typescript: 5.5.4 transitivePeerDependencies: @@ -11472,12 +11462,12 @@ packages: dependencies: acorn: 8.11.2 - /acorn-import-attributes@1.9.5(acorn@8.12.1): + /acorn-import-attributes@1.9.5(acorn@8.14.0): resolution: {integrity: sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ==} peerDependencies: acorn: ^8 dependencies: - acorn: 8.12.1 + acorn: 8.14.0 dev: true /acorn-jsx@5.3.2(acorn@7.4.1): @@ -11495,6 +11485,14 @@ packages: dependencies: acorn: 8.12.1 + /acorn-jsx@5.3.2(acorn@8.14.0): + resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} + peerDependencies: + acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 + dependencies: + acorn: 8.14.0 + dev: false + /acorn-walk@7.2.0: resolution: {integrity: sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==} engines: {node: '>=0.4.0'} @@ -11530,7 +11528,6 @@ packages: resolution: {integrity: sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==} engines: {node: '>=0.4.0'} hasBin: true - dev: true /address@1.2.2: resolution: {integrity: sha512-4B/qKCfeE/ODUaAUpSwfzazo5x29WD4r3vXiWsB7I2mSDAihwEqKO+g8GELZUQSSAo5e1XTYh3ZVfLyxBc12nA==} @@ -11834,7 +11831,7 @@ packages: es-abstract: 1.23.9 es-array-method-boxes-properly: 1.0.0 es-object-atoms: 1.0.0 - is-string: 1.0.7 + is-string: 1.1.1 dev: true /array.prototype.findlastindex@1.2.3: @@ -12560,20 +12557,20 @@ packages: resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==} engines: {node: '>= 0.8'} - /c12@1.11.1: - resolution: {integrity: sha512-KDU0TvSvVdaYcQKQ6iPHATGz/7p/KiVjPg4vQrB6Jg/wX9R0yl5RZxWm9IoZqaIHD2+6PZd81+KMGwRr/lRIUg==} + /c12@2.0.1: + resolution: {integrity: sha512-Z4JgsKXHG37C6PYUtIxCfLJZvo6FyhHJoClwwb9ftUkLpPSkuYqn6Tr+vnaN8hymm0kIbcg6Ey3kv/Q71k5w/A==} peerDependencies: - magicast: ^0.3.4 + magicast: ^0.3.5 peerDependenciesMeta: magicast: optional: true dependencies: - chokidar: 3.6.0 + chokidar: 4.0.3 confbox: 0.1.8 defu: 6.1.4 dotenv: 16.4.7 giget: 1.2.3 - jiti: 1.21.7 + jiti: 2.4.2 mlly: 1.7.3 ohash: 1.1.4 pathe: 1.1.2 @@ -12690,11 +12687,6 @@ packages: engines: {node: '>=14.16'} dev: false - /camelcase@8.0.0: - resolution: {integrity: sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA==} - engines: {node: '>=16'} - dev: true - /camelize@1.0.1: resolution: {integrity: sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ==} dev: true @@ -12891,6 +12883,12 @@ packages: readdirp: 3.6.0 optionalDependencies: fsevents: 2.3.3 + + /chokidar@4.0.3: + resolution: {integrity: sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==} + engines: {node: '>= 14.16.0'} + dependencies: + readdirp: 4.0.2 dev: true /chownr@1.1.4: @@ -13178,8 +13176,8 @@ packages: engines: {node: '>=16'} dev: true - /commander@12.1.0: - resolution: {integrity: sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==} + /commander@13.0.0: + resolution: {integrity: sha512-oPYleIY8wmTVzkvQq10AEok6YcTC4sRUBl8F9gVuwchGVUCTbl/vhLTaQqutuuySYOsu8YTgV+OxKc/8Yvx+mQ==} engines: {node: '>=18'} dev: true @@ -14004,7 +14002,7 @@ packages: dependencies: es-define-property: 1.0.1 es-errors: 1.3.0 - gopd: 1.0.1 + gopd: 1.2.0 dev: true /define-lazy-prop@2.0.0: @@ -14026,10 +14024,6 @@ packages: is-descriptor: 1.0.2 dev: false - /defu@6.1.3: - resolution: {integrity: sha512-Vy2wmG3NTkmHNg/kzpuvHhkqeIx3ODWqasgCRbKtbXEN0G+HpEEv9BtJLp7ZG1CZloFaC41Ah3ZFbq7aqCqMeQ==} - dev: true - /defu@6.1.4: resolution: {integrity: sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==} dev: true @@ -14438,25 +14432,25 @@ packages: array.prototype.flat: 1.3.2 cheerio: 1.0.0-rc.12 enzyme-shallow-equal: 1.0.7 - function.prototype.name: 1.1.6 + function.prototype.name: 1.1.8 has: 1.0.4 html-element-map: 1.3.1 - is-boolean-object: 1.1.2 + is-boolean-object: 1.2.1 is-callable: 1.2.7 - is-number-object: 1.0.7 - is-regex: 1.1.4 - is-string: 1.0.7 + is-number-object: 1.1.1 + is-regex: 1.2.1 + is-string: 1.1.1 is-subset: 0.1.1 lodash.escape: 4.0.1 lodash.isequal: 4.5.0 - object-inspect: 1.13.1 + object-inspect: 1.13.3 object-is: 1.1.5 - object.assign: 4.1.4 + object.assign: 4.1.7 object.entries: 1.1.7 object.values: 1.1.7 raf: 3.4.1 rst-selector-parser: 2.2.3 - string.prototype.trim: 1.2.8 + string.prototype.trim: 1.2.10 dev: true /equals@1.0.5: @@ -14676,8 +14670,8 @@ packages: engines: {node: '>= 0.4'} dependencies: is-callable: 1.2.7 - is-date-object: 1.0.5 - is-symbol: 1.0.4 + is-date-object: 1.1.0 + is-symbol: 1.1.1 dev: true /es5-ext@0.10.62: @@ -16157,7 +16151,7 @@ packages: '@babel/code-frame': 7.24.7 '@types/json-schema': 7.0.15 chalk: 4.1.2 - chokidar: 3.5.3 + chokidar: 3.6.0 cosmiconfig: 6.0.0 deepmerge: 4.3.1 eslint: 8.57.0 @@ -16456,7 +16450,7 @@ packages: hasBin: true dependencies: colorette: 2.0.20 - defu: 6.1.3 + defu: 6.1.4 https-proxy-agent: 7.0.2 mri: 1.2.0 node-fetch-native: 1.4.1 @@ -17054,7 +17048,7 @@ packages: resolution: {integrity: sha512-6XMlxrAFX4UEEGxctfFnmrFaaZFNf9i5fNuV5wZ3WWQ4FVaNP1aX1LkX9j2mfEx1NpjeE/rL3nmgEn23GdFmrg==} dependencies: array.prototype.filter: 1.0.4 - call-bind: 1.0.5 + call-bind: 1.0.8 dev: true /html-entities@2.4.0: @@ -18793,8 +18787,8 @@ packages: resolution: {integrity: sha512-3TV69ZbrvV6U5DfQimop50jE9Dl6J8O1ja1dvBbMba/sZ3YBEQqJ2VZRoQPVnhlzjNtU1vaXRZVrVjU4qtm8yA==} hasBin: true - /jiti@1.21.7: - resolution: {integrity: sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==} + /jiti@2.4.2: + resolution: {integrity: sha512-rg9zJN+G4n2nfJl5MW3BMygZX56zKPNVEYYqq7adpmMh4Jn2QNEwhvQlFy6jPVdcod7txZtKHWnyZiA3a0zP7A==} hasBin: true dev: true @@ -19066,7 +19060,7 @@ packages: engines: {node: '>=14.0.0'} dependencies: app-root-dir: 1.0.2 - dotenv: 16.3.1 + dotenv: 16.4.7 dotenv-expand: 10.0.0 dev: true @@ -20007,8 +20001,8 @@ packages: /micromark-extension-mdxjs@3.0.0: resolution: {integrity: sha512-A873fJfhnJ2siZyUrJ31l34Uqwy4xIFmvPY1oj+Ean5PHcPBYzEsvqvWGaWcfEIr11O5Dlw3p2y0tZWpKHDejQ==} dependencies: - acorn: 8.12.1 - acorn-jsx: 5.3.2(acorn@8.12.1) + acorn: 8.14.0 + acorn-jsx: 5.3.2(acorn@8.14.0) micromark-extension-mdx-expression: 3.0.0 micromark-extension-mdx-jsx: 3.0.0 micromark-extension-mdx-md: 2.0.0 @@ -20402,7 +20396,7 @@ packages: dependencies: acorn: 8.12.1 pathe: 1.1.2 - pkg-types: 1.0.3 + pkg-types: 1.3.0 ufo: 1.3.1 dev: true @@ -21475,14 +21469,6 @@ packages: find-up: 6.3.0 dev: false - /pkg-types@1.0.3: - resolution: {integrity: sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==} - dependencies: - jsonc-parser: 3.2.0 - mlly: 1.4.2 - pathe: 1.1.2 - dev: true - /pkg-types@1.3.0: resolution: {integrity: sha512-kS7yWjVFCkIw9hqdJBoMxDdzEngmkr5FXeWZZfQ6GoYacjVnsW6l2CcYW/0ThD0vF4LPJgVYnrg4d0uuhwYQbg==} dependencies: @@ -23157,6 +23143,11 @@ packages: dependencies: picomatch: 2.3.1 + /readdirp@4.0.2: + resolution: {integrity: sha512-yDMz9g+VaZkqBYS/ozoBJwaBhTbZo3UNYQHNRw1D3UFQB8oHB4uS/tAODO+ZLjGWmUbKnIlOWO+aaIiAxrUWHA==} + engines: {node: '>= 14.16.0'} + dev: true + /reading-time@1.5.0: resolution: {integrity: sha512-onYyVhBNr4CmAxFsKS7bz+uTLRakypIe4R+5A824vBSkQy/hB3fZepoVEf8OVAxzLvK+H/jm9TzpI3ETSm64Kg==} dev: false @@ -23984,7 +23975,7 @@ packages: es-errors: 1.3.0 function-bind: 1.1.2 get-intrinsic: 1.2.7 - gopd: 1.0.1 + gopd: 1.2.0 has-property-descriptors: 1.0.2 dev: true @@ -25172,7 +25163,7 @@ packages: hasBin: true dependencies: '@jridgewell/source-map': 0.3.6 - acorn: 8.12.1 + acorn: 8.14.0 commander: 2.20.3 source-map-support: 0.5.21 dev: true @@ -26085,8 +26076,8 @@ packages: /unplugin@1.5.1: resolution: {integrity: sha512-0QkvG13z6RD+1L1FoibQqnvTwVBXvS4XSPwAyinVgoOCl2jAgwzdUKmEj05o4Lt8xwQI85Hb6mSyYkcAGwZPew==} dependencies: - acorn: 8.11.2 - chokidar: 3.5.3 + acorn: 8.14.0 + chokidar: 3.6.0 webpack-sources: 3.2.3 webpack-virtual-modules: 0.6.1 dev: true @@ -27027,8 +27018,8 @@ packages: '@webassemblyjs/ast': 1.12.1 '@webassemblyjs/wasm-edit': 1.12.1 '@webassemblyjs/wasm-parser': 1.12.1 - acorn: 8.12.1 - acorn-import-attributes: 1.9.5(acorn@8.12.1) + acorn: 8.14.0 + acorn-import-attributes: 1.9.5(acorn@8.14.0) browserslist: 4.23.3 chrome-trace-event: 1.0.4 enhanced-resolve: 5.17.1 From d9ce10e89aa7af64f1a2424dd8002354d7018d94 Mon Sep 17 00:00:00 2001 From: Robert Field Date: Thu, 9 Jan 2025 17:29:49 +0000 Subject: [PATCH 24/30] feat: updated hey-api for shopper --- packages/sdks/shopper/openapi-ts.config.ts | 21 +- packages/sdks/shopper/package.json | 8 +- .../src/client/@tanstack/react-query.gen.ts | 2620 +++---- packages/sdks/shopper/src/client/index.ts | 3 +- .../sdks/shopper/src/client/schemas.gen.ts | 6057 ----------------- .../client/{services.gen.ts => sdk.gen.ts} | 1746 +++-- .../shopper/src/client/transformers.gen.ts | 626 ++ packages/sdks/shopper/src/client/types.gen.ts | 3323 +++++---- packages/sdks/shopper/src/index.ts | 2 +- packages/sdks/specs/config/redocly.yaml | 2 + 10 files changed, 4664 insertions(+), 9744 deletions(-) delete mode 100644 packages/sdks/shopper/src/client/schemas.gen.ts rename packages/sdks/shopper/src/client/{services.gen.ts => sdk.gen.ts} (87%) create mode 100644 packages/sdks/shopper/src/client/transformers.gen.ts diff --git a/packages/sdks/shopper/openapi-ts.config.ts b/packages/sdks/shopper/openapi-ts.config.ts index 2a9d0fad..55267048 100644 --- a/packages/sdks/shopper/openapi-ts.config.ts +++ b/packages/sdks/shopper/openapi-ts.config.ts @@ -1,13 +1,20 @@ -import { defineConfig } from "@hey-api/openapi-ts" +import { defineConfig, defaultPlugins } from "@hey-api/openapi-ts" export default defineConfig({ client: "@hey-api/client-fetch", input: "../specs/shopper.yaml", + experimentalParser: true, output: { path: "src/client", format: "prettier" }, - types: { - name: "PascalCase", - enums: false, - dates: "types+transform", - }, - plugins: ["@tanstack/react-query"], + plugins: [ + ...defaultPlugins, + { + exportInlineEnums: true, + name: "@hey-api/typescript", + }, + { + dates: true, + name: "@hey-api/transformers", + }, + "@tanstack/react-query", + ], }) diff --git a/packages/sdks/shopper/package.json b/packages/sdks/shopper/package.json index 4a88e218..bff8004c 100644 --- a/packages/sdks/shopper/package.json +++ b/packages/sdks/shopper/package.json @@ -11,7 +11,7 @@ "oas:redocly": "redocly --config ./redocly.json", "oas:redocly:lint": "redocly lint --config ../specs/config/redocly.yaml", "oas:redocly:join:shopper": "redocly join --config ../specs/config/redocly.yaml --output ../specs/shopper.yaml ../specs/bundled/catalog_view_3.1.yaml ../specs/bundled/cart_checkout.yaml", - "oas:redocly:bundle": "redocly bundle --config ../specs/config/redocly.yaml --output ../specs/bundled", + "oas:redocly:bundle": "redocly bundle --config ../specs/config/redocly.yaml", "oas:openapi-format:convert": "pnpm dlx openapi-format ../specs/bundled/catalog_view.yaml -o ../specs/bundled/catalog_view_3.1.yaml --convertTo \"3.1\"" }, "exports": { @@ -30,15 +30,15 @@ ], "keywords": [], "devDependencies": { - "@tanstack/react-query": "^5.52.1", - "@hey-api/openapi-ts": "^0.52.10", + "@hey-api/openapi-ts": "0.61.1", "@redocly/cli": "^1.21.0", "@redocly/openapi-core": "^1.21.0", + "@tanstack/react-query": "^5.52.1", "lodash": "^4.17.21", "typescript": "^5.5.3" }, "dependencies": { - "@hey-api/client-fetch": "^0.2.4" + "@hey-api/client-fetch": "0.6.0" }, "peerDependencies": { "@tanstack/react-query": "^5.52.1" diff --git a/packages/sdks/shopper/src/client/@tanstack/react-query.gen.ts b/packages/sdks/shopper/src/client/@tanstack/react-query.gen.ts index 3ada802e..11865962 100644 --- a/packages/sdks/shopper/src/client/@tanstack/react-query.gen.ts +++ b/packages/sdks/shopper/src/client/@tanstack/react-query.gen.ts @@ -3,190 +3,146 @@ import type { Options } from "@hey-api/client-fetch" import { queryOptions, - infiniteQueryOptions, - type InfiniteData, type UseMutationOptions, type DefaultError, } from "@tanstack/react-query" import type { GetByContextReleaseData, GetByContextAllHierarchiesData, - GetByContextAllHierarchiesError, - GetByContextAllHierarchiesResponse, GetByContextHierarchyData, GetByContextHierarchyNodesData, - GetByContextHierarchyNodesError, - GetByContextHierarchyNodesResponse, GetByContextHierarchyChildNodesData, - GetByContextHierarchyChildNodesError, - GetByContextHierarchyChildNodesResponse, GetByContextAllNodesData, - GetByContextAllNodesError, - GetByContextAllNodesResponse, GetByContextNodeData, GetByContextChildNodesData, - GetByContextChildNodesError, - GetByContextChildNodesResponse, GetByContextAllProductsData, - GetByContextAllProductsError, - GetByContextAllProductsResponse, GetByContextProductData, GetByContextComponentProductIdsData, - GetByContextComponentProductIdsError, - GetByContextComponentProductIdsResponse, GetByContextChildProductsData, - GetByContextChildProductsError, - GetByContextChildProductsResponse, GetByContextProductsForHierarchyData, - GetByContextProductsForHierarchyError, - GetByContextProductsForHierarchyResponse, GetByContextProductsForNodeData, - GetByContextProductsForNodeError, - GetByContextProductsForNodeResponse, ConfigureByContextProductData, ConfigureByContextProductError, ConfigureByContextProductResponse, + GetCatalogsData, CreateCatalogData, CreateCatalogError, CreateCatalogResponse, + DeleteCatalogByIdData, + DeleteCatalogByIdError, + DeleteCatalogByIdResponse, GetCatalogByIdData, UpdateCatalogData, UpdateCatalogError, UpdateCatalogResponse, - DeleteCatalogByIdData, - DeleteCatalogByIdError, - DeleteCatalogByIdResponse, - PublishReleaseData, - PublishReleaseError, - PublishReleaseResponse, - GetReleasesData, DeleteReleasesData, DeleteReleasesError, DeleteReleasesResponse, - GetReleaseByIdData, + GetReleasesData, + PublishReleaseData, + PublishReleaseError, + PublishReleaseResponse, DeleteReleaseByIdData, DeleteReleaseByIdError, DeleteReleaseByIdResponse, + GetReleaseByIdData, + GetRulesData, CreateRuleData, CreateRuleError, CreateRuleResponse, - GetRulesData, - GetRulesError, - GetRulesResponse, + DeleteRuleByIdData, + DeleteRuleByIdError, + DeleteRuleByIdResponse, GetRuleByIdData, UpdateRuleData, UpdateRuleError, UpdateRuleResponse, - DeleteRuleByIdData, - DeleteRuleByIdError, - DeleteRuleByIdResponse, GetAllHierarchiesData, - GetAllHierarchiesError, - GetAllHierarchiesResponse, GetHierarchyData, GetHierarchyNodesData, - GetHierarchyNodesError, - GetHierarchyNodesResponse, GetHierarchyChildNodesData, - GetHierarchyChildNodesError, - GetHierarchyChildNodesResponse, GetAllNodesData, - GetAllNodesError, - GetAllNodesResponse, GetNodeData, GetChildNodesData, - GetChildNodesError, - GetChildNodesResponse, GetAllProductsData, - GetAllProductsError, - GetAllProductsResponse, GetProductData, GetComponentProductIdsData, - GetComponentProductIdsError, - GetComponentProductIdsResponse, GetChildProductsData, - GetChildProductsError, - GetChildProductsResponse, GetProductsForHierarchyData, - GetProductsForHierarchyError, - GetProductsForHierarchyResponse, GetProductsForNodeData, - GetProductsForNodeError, - GetProductsForNodeResponse, GetCartsData, - CreateAcartData, - CreateAcartError, - CreateAcartResponse, + CreateACartData, + CreateACartError, + CreateACartResponse, + DeleteACartData, + DeleteACartError, + DeleteACartResponse, GetCartData, - UpdateAcartData, - UpdateAcartError, - UpdateAcartResponse, - DeleteAcartData, - DeleteAcartError, - DeleteAcartResponse, + UpdateACartData, + UpdateACartError, + UpdateACartResponse, + DeleteAllCartItemsData, + DeleteAllCartItemsError, + DeleteAllCartItemsResponse, GetCartItemsData, - BulkUpdateItemsInCartData, - BulkUpdateItemsInCartError, - BulkUpdateItemsInCartResponse, ManageCartsData, ManageCartsError, ManageCartsResponse, - DeleteAllCartItemsData, - DeleteAllCartItemsError, - DeleteAllCartItemsResponse, - UpdateAcartItemData, - UpdateAcartItemError, - UpdateAcartItemResponse, - DeleteAcartItemData, - DeleteAcartItemError, - DeleteAcartItemResponse, - CreateAccountCartAssociationData, - CreateAccountCartAssociationError, - CreateAccountCartAssociationResponse, + BulkUpdateItemsInCartData, + BulkUpdateItemsInCartError, + DeleteACartItemData, + DeleteACartItemError, + DeleteACartItemResponse, + UpdateACartItemData, + UpdateACartItemError, + UpdateACartItemResponse, DeleteAccountCartAssociationData, DeleteAccountCartAssociationError, DeleteAccountCartAssociationResponse, - CreateCustomerCartAssociationData, - CreateCustomerCartAssociationError, - CreateCustomerCartAssociationResponse, + CreateAccountCartAssociationData, + CreateAccountCartAssociationError, + CreateAccountCartAssociationResponse, DeleteCustomerCartAssociationData, DeleteCustomerCartAssociationError, DeleteCustomerCartAssociationResponse, - DeleteApromotionViaPromotionCodeData, - DeleteApromotionViaPromotionCodeError, - DeleteApromotionViaPromotionCodeResponse, + CreateCustomerCartAssociationData, + CreateCustomerCartAssociationError, + CreateCustomerCartAssociationResponse, + DeleteAPromotionViaPromotionCodeData, + DeleteAPromotionViaPromotionCodeError, + DeleteAPromotionViaPromotionCodeResponse, AddTaxItemToCartData, AddTaxItemToCartError, AddTaxItemToCartResponse, - BulkAddTaxItemsToCartData, - BulkAddTaxItemsToCartError, - BulkAddTaxItemsToCartResponse, BulkDeleteTaxItemsFromCartData, BulkDeleteTaxItemsFromCartError, BulkDeleteTaxItemsFromCartResponse, - UpdateAtaxItemData, - UpdateAtaxItemError, - UpdateAtaxItemResponse, - DeleteAtaxItemData, - DeleteAtaxItemError, - DeleteAtaxItemResponse, - BulkAddCustomDiscountsToCartData, - BulkAddCustomDiscountsToCartError, - BulkAddCustomDiscountsToCartResponse, + BulkAddTaxItemsToCartData, + BulkAddTaxItemsToCartError, + BulkAddTaxItemsToCartResponse, + DeleteATaxItemData, + DeleteATaxItemError, + DeleteATaxItemResponse, + UpdateATaxItemData, + UpdateATaxItemError, + UpdateATaxItemResponse, BulkDeleteCustomDiscountsFromCartData, BulkDeleteCustomDiscountsFromCartError, BulkDeleteCustomDiscountsFromCartResponse, - UpdateCustomDiscountForCartData, - UpdateCustomDiscountForCartError, - UpdateCustomDiscountForCartResponse, + BulkAddCustomDiscountsToCartData, + BulkAddCustomDiscountsToCartError, + BulkAddCustomDiscountsToCartResponse, DeleteCustomDiscountFromCartData, DeleteCustomDiscountFromCartError, DeleteCustomDiscountFromCartResponse, + UpdateCustomDiscountForCartData, + UpdateCustomDiscountForCartError, + UpdateCustomDiscountForCartResponse, AddCustomDiscountToCartItemData, - UpdateCustomDiscountForCartItemData, DeleteCustomDiscountFromCartItemData, DeleteCustomDiscountFromCartItemError, DeleteCustomDiscountFromCartItemResponse, + UpdateCustomDiscountForCartItemData, CreateCartPaymentIntentData, CreateCartPaymentIntentError, CreateCartPaymentIntentResponse, @@ -208,20 +164,19 @@ import type { ConfirmSetupData, ConfirmSetupError, ConfirmSetupResponse, - CaptureAtransactionData, - CaptureAtransactionError, - CaptureAtransactionResponse, - RefundAtransactionData, - RefundAtransactionError, - RefundAtransactionResponse, + CaptureATransactionData, + CaptureATransactionError, + CaptureATransactionResponse, + RefundATransactionData, + RefundATransactionError, + RefundATransactionResponse, GetOrderTransactionsData, - GetAtransactionData, - CancelAtransactionData, - CancelAtransactionError, - CancelAtransactionResponse, + GetATransactionData, + CancelATransactionData, + CancelATransactionError, + CancelATransactionResponse, } from "../types.gen" import { - client, getByContextRelease, getByContextAllHierarchies, getByContextHierarchy, @@ -237,21 +192,21 @@ import { getByContextProductsForHierarchy, getByContextProductsForNode, configureByContextProduct, - createCatalog, getCatalogs, + createCatalog, + deleteCatalogById, getCatalogById, updateCatalog, - deleteCatalogById, - publishRelease, - getReleases, deleteReleases, - getReleaseById, + getReleases, + publishRelease, deleteReleaseById, - createRule, + getReleaseById, getRules, + createRule, + deleteRuleById, getRuleById, updateRule, - deleteRuleById, getAllHierarchies, getHierarchy, getHierarchyNodes, @@ -266,33 +221,33 @@ import { getProductsForHierarchy, getProductsForNode, getCarts, - createAcart, + createACart, + deleteACart, getCart, - updateAcart, - deleteAcart, + updateACart, + deleteAllCartItems, getCartItems, - bulkUpdateItemsInCart, manageCarts, - deleteAllCartItems, - updateAcartItem, - deleteAcartItem, - createAccountCartAssociation, + bulkUpdateItemsInCart, + deleteACartItem, + updateACartItem, deleteAccountCartAssociation, - createCustomerCartAssociation, + createAccountCartAssociation, deleteCustomerCartAssociation, - deleteApromotionViaPromotionCode, + createCustomerCartAssociation, + deleteAPromotionViaPromotionCode, addTaxItemToCart, - bulkAddTaxItemsToCart, bulkDeleteTaxItemsFromCart, - updateAtaxItem, - deleteAtaxItem, - bulkAddCustomDiscountsToCart, + bulkAddTaxItemsToCart, + deleteATaxItem, + updateATaxItem, bulkDeleteCustomDiscountsFromCart, - updateCustomDiscountForCart, + bulkAddCustomDiscountsToCart, deleteCustomDiscountFromCart, + updateCustomDiscountForCart, addCustomDiscountToCartItem, - updateCustomDiscountForCartItem, deleteCustomDiscountFromCartItem, + updateCustomDiscountForCartItem, createCartPaymentIntent, checkoutApi, getCustomerOrders, @@ -302,12 +257,13 @@ import { anonymizeOrders, authorizeSetup, confirmSetup, - captureAtransaction, - refundAtransaction, + captureATransaction, + refundATransaction, getOrderTransactions, - getAtransaction, - cancelAtransaction, -} from "../services.gen" + getATransaction, + cancelATransaction, + client, +} from "../sdk.gen" type QueryKey = [ Pick & { @@ -323,7 +279,7 @@ const createQueryKey = ( ): QueryKey[0] => { const params: QueryKey[0] = { _id: id, - baseUrl: client.getConfig().baseUrl, + baseUrl: (options?.client ?? client).getConfig().baseUrl, } as QueryKey[0] if (infinite) { params._infinite = infinite @@ -343,831 +299,333 @@ const createQueryKey = ( return params } +export const getByContextReleaseQueryKey = ( + options?: Options, +) => [createQueryKey("getByContextRelease", options)] + export const getByContextReleaseOptions = ( options?: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getByContextRelease({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getByContextRelease", options)], + queryKey: getByContextReleaseQueryKey(options), }) } +export const getByContextAllHierarchiesQueryKey = ( + options?: Options, +) => [createQueryKey("getByContextAllHierarchies", options)] + export const getByContextAllHierarchiesOptions = ( options?: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getByContextAllHierarchies({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getByContextAllHierarchies", options)], + queryKey: getByContextAllHierarchiesQueryKey(options), }) } -export const getByContextAllHierarchiesInfiniteOptions = ( - options?: Options, -) => { - return infiniteQueryOptions< - GetByContextAllHierarchiesResponse, - GetByContextAllHierarchiesError, - InfiniteData, - QueryKey>, - | number - | Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > - >( - // @ts-ignore - { - queryFn: async ({ pageParam, queryKey }) => { - // @ts-ignore - const page: Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > = - typeof pageParam === "object" - ? pageParam - : { - query: { - "page[limit]": pageParam, - }, - } - const { data } = await getByContextAllHierarchies({ - ...options, - ...queryKey[0], - body: { - ...(queryKey[0].body as any), - ...(page.body as any), - }, - headers: { - ...queryKey[0].headers, - ...page.headers, - }, - path: { - ...queryKey[0].path, - ...page.path, - }, - query: { - ...queryKey[0].query, - ...page.query, - }, - throwOnError: true, - }) - return data - }, - queryKey: [createQueryKey("getByContextAllHierarchies", options, true)], - }, - ) -} +export const getByContextHierarchyQueryKey = ( + options: Options, +) => [createQueryKey("getByContextHierarchy", options)] export const getByContextHierarchyOptions = ( options: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getByContextHierarchy({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getByContextHierarchy", options)], + queryKey: getByContextHierarchyQueryKey(options), }) } +export const getByContextHierarchyNodesQueryKey = ( + options: Options, +) => [createQueryKey("getByContextHierarchyNodes", options)] + export const getByContextHierarchyNodesOptions = ( options: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getByContextHierarchyNodes({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getByContextHierarchyNodes", options)], + queryKey: getByContextHierarchyNodesQueryKey(options), }) } -export const getByContextHierarchyNodesInfiniteOptions = ( - options: Options, -) => { - return infiniteQueryOptions< - GetByContextHierarchyNodesResponse, - GetByContextHierarchyNodesError, - InfiniteData, - QueryKey>, - | number - | Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > - >( - // @ts-ignore - { - queryFn: async ({ pageParam, queryKey }) => { - // @ts-ignore - const page: Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > = - typeof pageParam === "object" - ? pageParam - : { - query: { - "page[limit]": pageParam, - }, - } - const { data } = await getByContextHierarchyNodes({ - ...options, - ...queryKey[0], - body: { - ...(queryKey[0].body as any), - ...(page.body as any), - }, - headers: { - ...queryKey[0].headers, - ...page.headers, - }, - path: { - ...queryKey[0].path, - ...page.path, - }, - query: { - ...queryKey[0].query, - ...page.query, - }, - throwOnError: true, - }) - return data - }, - queryKey: [createQueryKey("getByContextHierarchyNodes", options, true)], - }, - ) -} +export const getByContextHierarchyChildNodesQueryKey = ( + options: Options, +) => [createQueryKey("getByContextHierarchyChildNodes", options)] export const getByContextHierarchyChildNodesOptions = ( options: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getByContextHierarchyChildNodes({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getByContextHierarchyChildNodes", options)], + queryKey: getByContextHierarchyChildNodesQueryKey(options), }) } -export const getByContextHierarchyChildNodesInfiniteOptions = ( - options: Options, -) => { - return infiniteQueryOptions< - GetByContextHierarchyChildNodesResponse, - GetByContextHierarchyChildNodesError, - InfiniteData, - QueryKey>, - | number - | Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > - >( - // @ts-ignore - { - queryFn: async ({ pageParam, queryKey }) => { - // @ts-ignore - const page: Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > = - typeof pageParam === "object" - ? pageParam - : { - query: { - "page[limit]": pageParam, - }, - } - const { data } = await getByContextHierarchyChildNodes({ - ...options, - ...queryKey[0], - body: { - ...(queryKey[0].body as any), - ...(page.body as any), - }, - headers: { - ...queryKey[0].headers, - ...page.headers, - }, - path: { - ...queryKey[0].path, - ...page.path, - }, - query: { - ...queryKey[0].query, - ...page.query, - }, - throwOnError: true, - }) - return data - }, - queryKey: [ - createQueryKey("getByContextHierarchyChildNodes", options, true), - ], - }, - ) -} +export const getByContextAllNodesQueryKey = ( + options?: Options, +) => [createQueryKey("getByContextAllNodes", options)] export const getByContextAllNodesOptions = ( options?: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getByContextAllNodes({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getByContextAllNodes", options)], + queryKey: getByContextAllNodesQueryKey(options), }) } -export const getByContextAllNodesInfiniteOptions = ( - options?: Options, -) => { - return infiniteQueryOptions< - GetByContextAllNodesResponse, - GetByContextAllNodesError, - InfiniteData, - QueryKey>, - | number - | Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > - >( - // @ts-ignore - { - queryFn: async ({ pageParam, queryKey }) => { - // @ts-ignore - const page: Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > = - typeof pageParam === "object" - ? pageParam - : { - query: { - "page[limit]": pageParam, - }, - } - const { data } = await getByContextAllNodes({ - ...options, - ...queryKey[0], - body: { - ...(queryKey[0].body as any), - ...(page.body as any), - }, - headers: { - ...queryKey[0].headers, - ...page.headers, - }, - path: { - ...queryKey[0].path, - ...page.path, - }, - query: { - ...queryKey[0].query, - ...page.query, - }, - throwOnError: true, - }) - return data - }, - queryKey: [createQueryKey("getByContextAllNodes", options, true)], - }, - ) -} +export const getByContextNodeQueryKey = ( + options: Options, +) => [createQueryKey("getByContextNode", options)] export const getByContextNodeOptions = ( options: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getByContextNode({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getByContextNode", options)], + queryKey: getByContextNodeQueryKey(options), }) } +export const getByContextChildNodesQueryKey = ( + options: Options, +) => [createQueryKey("getByContextChildNodes", options)] + export const getByContextChildNodesOptions = ( options: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getByContextChildNodes({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getByContextChildNodes", options)], + queryKey: getByContextChildNodesQueryKey(options), }) } -export const getByContextChildNodesInfiniteOptions = ( - options: Options, -) => { - return infiniteQueryOptions< - GetByContextChildNodesResponse, - GetByContextChildNodesError, - InfiniteData, - QueryKey>, - | number - | Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > - >( - // @ts-ignore - { - queryFn: async ({ pageParam, queryKey }) => { - // @ts-ignore - const page: Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > = - typeof pageParam === "object" - ? pageParam - : { - query: { - "page[limit]": pageParam, - }, - } - const { data } = await getByContextChildNodes({ - ...options, - ...queryKey[0], - body: { - ...(queryKey[0].body as any), - ...(page.body as any), - }, - headers: { - ...queryKey[0].headers, - ...page.headers, - }, - path: { - ...queryKey[0].path, - ...page.path, - }, - query: { - ...queryKey[0].query, - ...page.query, - }, - throwOnError: true, - }) - return data - }, - queryKey: [createQueryKey("getByContextChildNodes", options, true)], - }, - ) -} +export const getByContextAllProductsQueryKey = ( + options?: Options, +) => [createQueryKey("getByContextAllProducts", options)] export const getByContextAllProductsOptions = ( options?: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getByContextAllProducts({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getByContextAllProducts", options)], + queryKey: getByContextAllProductsQueryKey(options), }) } -export const getByContextAllProductsInfiniteOptions = ( - options?: Options, -) => { - return infiniteQueryOptions< - GetByContextAllProductsResponse, - GetByContextAllProductsError, - InfiniteData, - QueryKey>, - | number - | Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > - >( - // @ts-ignore - { - queryFn: async ({ pageParam, queryKey }) => { - // @ts-ignore - const page: Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > = - typeof pageParam === "object" - ? pageParam - : { - query: { - "page[limit]": pageParam, - }, - } - const { data } = await getByContextAllProducts({ - ...options, - ...queryKey[0], - body: { - ...(queryKey[0].body as any), - ...(page.body as any), - }, - headers: { - ...queryKey[0].headers, - ...page.headers, - }, - path: { - ...queryKey[0].path, - ...page.path, - }, - query: { - ...queryKey[0].query, - ...page.query, - }, - throwOnError: true, - }) - return data - }, - queryKey: [createQueryKey("getByContextAllProducts", options, true)], - }, - ) -} +export const getByContextProductQueryKey = ( + options: Options, +) => [createQueryKey("getByContextProduct", options)] export const getByContextProductOptions = ( options: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getByContextProduct({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getByContextProduct", options)], + queryKey: getByContextProductQueryKey(options), }) } +export const getByContextComponentProductIdsQueryKey = ( + options: Options, +) => [createQueryKey("getByContextComponentProductIds", options)] + export const getByContextComponentProductIdsOptions = ( options: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getByContextComponentProductIds({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getByContextComponentProductIds", options)], + queryKey: getByContextComponentProductIdsQueryKey(options), }) } -export const getByContextComponentProductIdsInfiniteOptions = ( - options: Options, -) => { - return infiniteQueryOptions< - GetByContextComponentProductIdsResponse, - GetByContextComponentProductIdsError, - InfiniteData, - QueryKey>, - | number - | Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > - >( - // @ts-ignore - { - queryFn: async ({ pageParam, queryKey }) => { - // @ts-ignore - const page: Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > = - typeof pageParam === "object" - ? pageParam - : { - query: { - "page[limit]": pageParam, - }, - } - const { data } = await getByContextComponentProductIds({ - ...options, - ...queryKey[0], - body: { - ...(queryKey[0].body as any), - ...(page.body as any), - }, - headers: { - ...queryKey[0].headers, - ...page.headers, - }, - path: { - ...queryKey[0].path, - ...page.path, - }, - query: { - ...queryKey[0].query, - ...page.query, - }, - throwOnError: true, - }) - return data - }, - queryKey: [ - createQueryKey("getByContextComponentProductIds", options, true), - ], - }, - ) -} +export const getByContextChildProductsQueryKey = ( + options: Options, +) => [createQueryKey("getByContextChildProducts", options)] export const getByContextChildProductsOptions = ( options: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getByContextChildProducts({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getByContextChildProducts", options)], + queryKey: getByContextChildProductsQueryKey(options), }) } -export const getByContextChildProductsInfiniteOptions = ( - options: Options, -) => { - return infiniteQueryOptions< - GetByContextChildProductsResponse, - GetByContextChildProductsError, - InfiniteData, - QueryKey>, - | number - | Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > - >( - // @ts-ignore - { - queryFn: async ({ pageParam, queryKey }) => { - // @ts-ignore - const page: Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > = - typeof pageParam === "object" - ? pageParam - : { - query: { - "page[limit]": pageParam, - }, - } - const { data } = await getByContextChildProducts({ - ...options, - ...queryKey[0], - body: { - ...(queryKey[0].body as any), - ...(page.body as any), - }, - headers: { - ...queryKey[0].headers, - ...page.headers, - }, - path: { - ...queryKey[0].path, - ...page.path, - }, - query: { - ...queryKey[0].query, - ...page.query, - }, - throwOnError: true, - }) - return data - }, - queryKey: [createQueryKey("getByContextChildProducts", options, true)], - }, - ) -} +export const getByContextProductsForHierarchyQueryKey = ( + options: Options, +) => [createQueryKey("getByContextProductsForHierarchy", options)] export const getByContextProductsForHierarchyOptions = ( options: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getByContextProductsForHierarchy({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getByContextProductsForHierarchy", options)], + queryKey: getByContextProductsForHierarchyQueryKey(options), }) } -export const getByContextProductsForHierarchyInfiniteOptions = ( - options: Options, -) => { - return infiniteQueryOptions< - GetByContextProductsForHierarchyResponse, - GetByContextProductsForHierarchyError, - InfiniteData, - QueryKey>, - | number - | Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > - >( - // @ts-ignore - { - queryFn: async ({ pageParam, queryKey }) => { - // @ts-ignore - const page: Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > = - typeof pageParam === "object" - ? pageParam - : { - query: { - "page[limit]": pageParam, - }, - } - const { data } = await getByContextProductsForHierarchy({ - ...options, - ...queryKey[0], - body: { - ...(queryKey[0].body as any), - ...(page.body as any), - }, - headers: { - ...queryKey[0].headers, - ...page.headers, - }, - path: { - ...queryKey[0].path, - ...page.path, - }, - query: { - ...queryKey[0].query, - ...page.query, - }, - throwOnError: true, - }) - return data - }, - queryKey: [ - createQueryKey("getByContextProductsForHierarchy", options, true), - ], - }, - ) -} +export const getByContextProductsForNodeQueryKey = ( + options: Options, +) => [createQueryKey("getByContextProductsForNode", options)] export const getByContextProductsForNodeOptions = ( options: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getByContextProductsForNode({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getByContextProductsForNode", options)], + queryKey: getByContextProductsForNodeQueryKey(options), }) } -export const getByContextProductsForNodeInfiniteOptions = ( - options: Options, -) => { - return infiniteQueryOptions< - GetByContextProductsForNodeResponse, - GetByContextProductsForNodeError, - InfiniteData, - QueryKey>, - | number - | Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > - >( - // @ts-ignore - { - queryFn: async ({ pageParam, queryKey }) => { - // @ts-ignore - const page: Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > = - typeof pageParam === "object" - ? pageParam - : { - query: { - "page[limit]": pageParam, - }, - } - const { data } = await getByContextProductsForNode({ - ...options, - ...queryKey[0], - body: { - ...(queryKey[0].body as any), - ...(page.body as any), - }, - headers: { - ...queryKey[0].headers, - ...page.headers, - }, - path: { - ...queryKey[0].path, - ...page.path, - }, - query: { - ...queryKey[0].query, - ...page.query, - }, - throwOnError: true, - }) - return data - }, - queryKey: [createQueryKey("getByContextProductsForNode", options, true)], - }, - ) -} +export const configureByContextProductQueryKey = ( + options: Options, +) => [createQueryKey("configureByContextProduct", options)] export const configureByContextProductOptions = ( options: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await configureByContextProduct({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("configureByContextProduct", options)], + queryKey: configureByContextProductQueryKey(options), }) } -export const configureByContextProductMutation = () => { +export const configureByContextProductMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< ConfigureByContextProductResponse, ConfigureByContextProductError, Options > = { - mutationFn: async (options) => { + mutationFn: async (localOptions) => { const { data } = await configureByContextProduct({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -1176,29 +634,56 @@ export const configureByContextProductMutation = () => { return mutationOptions } +export const getCatalogsQueryKey = (options?: Options) => [ + createQueryKey("getCatalogs", options), +] + +export const getCatalogsOptions = (options?: Options) => { + return queryOptions({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await getCatalogs({ + ...options, + ...queryKey[0], + signal, + throwOnError: true, + }) + return data + }, + queryKey: getCatalogsQueryKey(options), + }) +} + +export const createCatalogQueryKey = (options: Options) => [ + createQueryKey("createCatalog", options), +] + export const createCatalogOptions = (options: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await createCatalog({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("createCatalog", options)], + queryKey: createCatalogQueryKey(options), }) } -export const createCatalogMutation = () => { +export const createCatalogMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< CreateCatalogResponse, CreateCatalogError, Options > = { - mutationFn: async (options) => { + mutationFn: async (localOptions) => { const { data } = await createCatalog({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -1207,43 +692,57 @@ export const createCatalogMutation = () => { return mutationOptions } -export const getCatalogsOptions = (options?: Options) => { - return queryOptions({ - queryFn: async ({ queryKey }) => { - const { data } = await getCatalogs({ +export const deleteCatalogByIdMutation = ( + options?: Partial>, +) => { + const mutationOptions: UseMutationOptions< + DeleteCatalogByIdResponse, + DeleteCatalogByIdError, + Options + > = { + mutationFn: async (localOptions) => { + const { data } = await deleteCatalogById({ ...options, - ...queryKey[0], + ...localOptions, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getCatalogs", options)], - }) + } + return mutationOptions } +export const getCatalogByIdQueryKey = ( + options: Options, +) => [createQueryKey("getCatalogById", options)] + export const getCatalogByIdOptions = (options: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getCatalogById({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getCatalogById", options)], + queryKey: getCatalogByIdQueryKey(options), }) } -export const updateCatalogMutation = () => { +export const updateCatalogMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< UpdateCatalogResponse, UpdateCatalogError, Options > = { - mutationFn: async (options) => { + mutationFn: async (localOptions) => { const { data } = await updateCatalog({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -1252,15 +751,18 @@ export const updateCatalogMutation = () => { return mutationOptions } -export const deleteCatalogByIdMutation = () => { +export const deleteReleasesMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< - DeleteCatalogByIdResponse, - DeleteCatalogByIdError, - Options + DeleteReleasesResponse, + DeleteReleasesError, + Options > = { - mutationFn: async (options) => { - const { data } = await deleteCatalogById({ + mutationFn: async (localOptions) => { + const { data } = await deleteReleases({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -1269,29 +771,56 @@ export const deleteCatalogByIdMutation = () => { return mutationOptions } +export const getReleasesQueryKey = (options: Options) => [ + createQueryKey("getReleases", options), +] + +export const getReleasesOptions = (options: Options) => { + return queryOptions({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await getReleases({ + ...options, + ...queryKey[0], + signal, + throwOnError: true, + }) + return data + }, + queryKey: getReleasesQueryKey(options), + }) +} + +export const publishReleaseQueryKey = ( + options: Options, +) => [createQueryKey("publishRelease", options)] + export const publishReleaseOptions = (options: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await publishRelease({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("publishRelease", options)], + queryKey: publishReleaseQueryKey(options), }) } -export const publishReleaseMutation = () => { +export const publishReleaseMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< PublishReleaseResponse, PublishReleaseError, Options > = { - mutationFn: async (options) => { + mutationFn: async (localOptions) => { const { data } = await publishRelease({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -1300,29 +829,18 @@ export const publishReleaseMutation = () => { return mutationOptions } -export const getReleasesOptions = (options: Options) => { - return queryOptions({ - queryFn: async ({ queryKey }) => { - const { data } = await getReleases({ - ...options, - ...queryKey[0], - throwOnError: true, - }) - return data - }, - queryKey: [createQueryKey("getReleases", options)], - }) -} - -export const deleteReleasesMutation = () => { +export const deleteReleaseByIdMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< - DeleteReleasesResponse, - DeleteReleasesError, - Options + DeleteReleaseByIdResponse, + DeleteReleaseByIdError, + Options > = { - mutationFn: async (options) => { - const { data } = await deleteReleases({ + mutationFn: async (localOptions) => { + const { data } = await deleteReleaseById({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -1331,60 +849,75 @@ export const deleteReleasesMutation = () => { return mutationOptions } +export const getReleaseByIdQueryKey = ( + options: Options, +) => [createQueryKey("getReleaseById", options)] + export const getReleaseByIdOptions = (options: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getReleaseById({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getReleaseById", options)], + queryKey: getReleaseByIdQueryKey(options), }) } -export const deleteReleaseByIdMutation = () => { - const mutationOptions: UseMutationOptions< - DeleteReleaseByIdResponse, - DeleteReleaseByIdError, - Options - > = { - mutationFn: async (options) => { - const { data } = await deleteReleaseById({ +export const getRulesQueryKey = (options?: Options) => [ + createQueryKey("getRules", options), +] + +export const getRulesOptions = (options?: Options) => { + return queryOptions({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await getRules({ ...options, + ...queryKey[0], + signal, throwOnError: true, }) return data }, - } - return mutationOptions + queryKey: getRulesQueryKey(options), + }) } +export const createRuleQueryKey = (options: Options) => [ + createQueryKey("createRule", options), +] + export const createRuleOptions = (options: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await createRule({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("createRule", options)], + queryKey: createRuleQueryKey(options), }) } -export const createRuleMutation = () => { +export const createRuleMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< CreateRuleResponse, CreateRuleError, Options > = { - mutationFn: async (options) => { + mutationFn: async (localOptions) => { const { data } = await createRule({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -1393,115 +926,57 @@ export const createRuleMutation = () => { return mutationOptions } -export const getRulesOptions = (options?: Options) => { - return queryOptions({ - queryFn: async ({ queryKey }) => { - const { data } = await getRules({ +export const deleteRuleByIdMutation = ( + options?: Partial>, +) => { + const mutationOptions: UseMutationOptions< + DeleteRuleByIdResponse, + DeleteRuleByIdError, + Options + > = { + mutationFn: async (localOptions) => { + const { data } = await deleteRuleById({ ...options, - ...queryKey[0], + ...localOptions, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getRules", options)], - }) + } + return mutationOptions } -export const getRulesInfiniteOptions = (options?: Options) => { - return infiniteQueryOptions< - GetRulesResponse, - GetRulesError, - InfiniteData, - QueryKey>, - | number - | Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > - >( - // @ts-ignore - { - queryFn: async ({ pageParam, queryKey }) => { - // @ts-ignore - const page: Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > = - typeof pageParam === "object" - ? pageParam - : { - query: { - "page[limit]": pageParam, - }, - } - const { data } = await getRules({ - ...options, - ...queryKey[0], - body: { - ...(queryKey[0].body as any), - ...(page.body as any), - }, - headers: { - ...queryKey[0].headers, - ...page.headers, - }, - path: { - ...queryKey[0].path, - ...page.path, - }, - query: { - ...queryKey[0].query, - ...page.query, - }, - throwOnError: true, - }) - return data - }, - queryKey: [createQueryKey("getRules", options, true)], - }, - ) -} +export const getRuleByIdQueryKey = (options: Options) => [ + createQueryKey("getRuleById", options), +] export const getRuleByIdOptions = (options: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getRuleById({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getRuleById", options)], + queryKey: getRuleByIdQueryKey(options), }) } -export const updateRuleMutation = () => { - const mutationOptions: UseMutationOptions< - UpdateRuleResponse, - UpdateRuleError, - Options - > = { - mutationFn: async (options) => { - const { data } = await updateRule({ - ...options, - throwOnError: true, - }) - return data - }, - } - return mutationOptions -} - -export const deleteRuleByIdMutation = () => { +export const updateRuleMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< - DeleteRuleByIdResponse, - DeleteRuleByIdError, - Options + UpdateRuleResponse, + UpdateRuleError, + Options > = { - mutationFn: async (options) => { - const { data } = await deleteRuleById({ + mutationFn: async (localOptions) => { + const { data } = await updateRule({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -1510,809 +985,337 @@ export const deleteRuleByIdMutation = () => { return mutationOptions } +export const getAllHierarchiesQueryKey = ( + options: Options, +) => [createQueryKey("getAllHierarchies", options)] + export const getAllHierarchiesOptions = ( options: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getAllHierarchies({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getAllHierarchies", options)], + queryKey: getAllHierarchiesQueryKey(options), }) } -export const getAllHierarchiesInfiniteOptions = ( - options: Options, -) => { - return infiniteQueryOptions< - GetAllHierarchiesResponse, - GetAllHierarchiesError, - InfiniteData, - QueryKey>, - | number - | Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > - >( - // @ts-ignore - { - queryFn: async ({ pageParam, queryKey }) => { - // @ts-ignore - const page: Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > = - typeof pageParam === "object" - ? pageParam - : { - query: { - "page[limit]": pageParam, - }, - } - const { data } = await getAllHierarchies({ - ...options, - ...queryKey[0], - body: { - ...(queryKey[0].body as any), - ...(page.body as any), - }, - headers: { - ...queryKey[0].headers, - ...page.headers, - }, - path: { - ...queryKey[0].path, - ...page.path, - }, - query: { - ...queryKey[0].query, - ...page.query, - }, - throwOnError: true, - }) - return data - }, - queryKey: [createQueryKey("getAllHierarchies", options, true)], - }, - ) -} +export const getHierarchyQueryKey = (options: Options) => [ + createQueryKey("getHierarchy", options), +] export const getHierarchyOptions = (options: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getHierarchy({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getHierarchy", options)], + queryKey: getHierarchyQueryKey(options), }) } +export const getHierarchyNodesQueryKey = ( + options: Options, +) => [createQueryKey("getHierarchyNodes", options)] + export const getHierarchyNodesOptions = ( options: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getHierarchyNodes({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getHierarchyNodes", options)], + queryKey: getHierarchyNodesQueryKey(options), }) } -export const getHierarchyNodesInfiniteOptions = ( - options: Options, -) => { - return infiniteQueryOptions< - GetHierarchyNodesResponse, - GetHierarchyNodesError, - InfiniteData, - QueryKey>, - | number - | Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > - >( - // @ts-ignore - { - queryFn: async ({ pageParam, queryKey }) => { - // @ts-ignore - const page: Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > = - typeof pageParam === "object" - ? pageParam - : { - query: { - "page[limit]": pageParam, - }, - } - const { data } = await getHierarchyNodes({ - ...options, - ...queryKey[0], - body: { - ...(queryKey[0].body as any), - ...(page.body as any), - }, - headers: { - ...queryKey[0].headers, - ...page.headers, - }, - path: { - ...queryKey[0].path, - ...page.path, - }, - query: { - ...queryKey[0].query, - ...page.query, - }, - throwOnError: true, - }) - return data - }, - queryKey: [createQueryKey("getHierarchyNodes", options, true)], - }, - ) -} +export const getHierarchyChildNodesQueryKey = ( + options: Options, +) => [createQueryKey("getHierarchyChildNodes", options)] export const getHierarchyChildNodesOptions = ( options: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getHierarchyChildNodes({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getHierarchyChildNodes", options)], + queryKey: getHierarchyChildNodesQueryKey(options), }) } -export const getHierarchyChildNodesInfiniteOptions = ( - options: Options, -) => { - return infiniteQueryOptions< - GetHierarchyChildNodesResponse, - GetHierarchyChildNodesError, - InfiniteData, - QueryKey>, - | number - | Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > - >( - // @ts-ignore - { - queryFn: async ({ pageParam, queryKey }) => { - // @ts-ignore - const page: Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > = - typeof pageParam === "object" - ? pageParam - : { - query: { - "page[limit]": pageParam, - }, - } - const { data } = await getHierarchyChildNodes({ - ...options, - ...queryKey[0], - body: { - ...(queryKey[0].body as any), - ...(page.body as any), - }, - headers: { - ...queryKey[0].headers, - ...page.headers, - }, - path: { - ...queryKey[0].path, - ...page.path, - }, - query: { - ...queryKey[0].query, - ...page.query, - }, - throwOnError: true, - }) - return data - }, - queryKey: [createQueryKey("getHierarchyChildNodes", options, true)], - }, - ) -} +export const getAllNodesQueryKey = (options: Options) => [ + createQueryKey("getAllNodes", options), +] export const getAllNodesOptions = (options: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getAllNodes({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getAllNodes", options)], + queryKey: getAllNodesQueryKey(options), }) } -export const getAllNodesInfiniteOptions = ( - options: Options, -) => { - return infiniteQueryOptions< - GetAllNodesResponse, - GetAllNodesError, - InfiniteData, - QueryKey>, - | number - | Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > - >( - // @ts-ignore - { - queryFn: async ({ pageParam, queryKey }) => { - // @ts-ignore - const page: Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > = - typeof pageParam === "object" - ? pageParam - : { - query: { - "page[limit]": pageParam, - }, - } - const { data } = await getAllNodes({ - ...options, - ...queryKey[0], - body: { - ...(queryKey[0].body as any), - ...(page.body as any), - }, - headers: { - ...queryKey[0].headers, - ...page.headers, - }, - path: { - ...queryKey[0].path, - ...page.path, - }, - query: { - ...queryKey[0].query, - ...page.query, - }, - throwOnError: true, - }) - return data - }, - queryKey: [createQueryKey("getAllNodes", options, true)], - }, - ) -} +export const getNodeQueryKey = (options: Options) => [ + createQueryKey("getNode", options), +] export const getNodeOptions = (options: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getNode({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getNode", options)], + queryKey: getNodeQueryKey(options), }) } +export const getChildNodesQueryKey = (options: Options) => [ + createQueryKey("getChildNodes", options), +] + export const getChildNodesOptions = (options: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getChildNodes({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getChildNodes", options)], + queryKey: getChildNodesQueryKey(options), }) } -export const getChildNodesInfiniteOptions = ( - options: Options, -) => { - return infiniteQueryOptions< - GetChildNodesResponse, - GetChildNodesError, - InfiniteData, - QueryKey>, - | number - | Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > - >( - // @ts-ignore - { - queryFn: async ({ pageParam, queryKey }) => { - // @ts-ignore - const page: Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > = - typeof pageParam === "object" - ? pageParam - : { - query: { - "page[limit]": pageParam, - }, - } - const { data } = await getChildNodes({ - ...options, - ...queryKey[0], - body: { - ...(queryKey[0].body as any), - ...(page.body as any), - }, - headers: { - ...queryKey[0].headers, - ...page.headers, - }, - path: { - ...queryKey[0].path, - ...page.path, - }, - query: { - ...queryKey[0].query, - ...page.query, - }, - throwOnError: true, - }) - return data - }, - queryKey: [createQueryKey("getChildNodes", options, true)], - }, - ) -} +export const getAllProductsQueryKey = ( + options: Options, +) => [createQueryKey("getAllProducts", options)] export const getAllProductsOptions = (options: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getAllProducts({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getAllProducts", options)], + queryKey: getAllProductsQueryKey(options), }) } -export const getAllProductsInfiniteOptions = ( - options: Options, -) => { - return infiniteQueryOptions< - GetAllProductsResponse, - GetAllProductsError, - InfiniteData, - QueryKey>, - | number - | Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > - >( - // @ts-ignore - { - queryFn: async ({ pageParam, queryKey }) => { - // @ts-ignore - const page: Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > = - typeof pageParam === "object" - ? pageParam - : { - query: { - "page[limit]": pageParam, - }, - } - const { data } = await getAllProducts({ - ...options, - ...queryKey[0], - body: { - ...(queryKey[0].body as any), - ...(page.body as any), - }, - headers: { - ...queryKey[0].headers, - ...page.headers, - }, - path: { - ...queryKey[0].path, - ...page.path, - }, - query: { - ...queryKey[0].query, - ...page.query, - }, - throwOnError: true, - }) - return data - }, - queryKey: [createQueryKey("getAllProducts", options, true)], - }, - ) -} +export const getProductQueryKey = (options: Options) => [ + createQueryKey("getProduct", options), +] export const getProductOptions = (options: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getProduct({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getProduct", options)], + queryKey: getProductQueryKey(options), }) } +export const getComponentProductIdsQueryKey = ( + options: Options, +) => [createQueryKey("getComponentProductIds", options)] + export const getComponentProductIdsOptions = ( options: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getComponentProductIds({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getComponentProductIds", options)], + queryKey: getComponentProductIdsQueryKey(options), }) } -export const getComponentProductIdsInfiniteOptions = ( - options: Options, -) => { - return infiniteQueryOptions< - GetComponentProductIdsResponse, - GetComponentProductIdsError, - InfiniteData, - QueryKey>, - | number - | Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > - >( - // @ts-ignore - { - queryFn: async ({ pageParam, queryKey }) => { - // @ts-ignore - const page: Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > = - typeof pageParam === "object" - ? pageParam - : { - query: { - "page[limit]": pageParam, - }, - } - const { data } = await getComponentProductIds({ - ...options, - ...queryKey[0], - body: { - ...(queryKey[0].body as any), - ...(page.body as any), - }, - headers: { - ...queryKey[0].headers, - ...page.headers, - }, - path: { - ...queryKey[0].path, - ...page.path, - }, - query: { - ...queryKey[0].query, - ...page.query, - }, - throwOnError: true, - }) - return data - }, - queryKey: [createQueryKey("getComponentProductIds", options, true)], - }, - ) -} +export const getChildProductsQueryKey = ( + options: Options, +) => [createQueryKey("getChildProducts", options)] export const getChildProductsOptions = ( options: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getChildProducts({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getChildProducts", options)], + queryKey: getChildProductsQueryKey(options), }) } -export const getChildProductsInfiniteOptions = ( - options: Options, -) => { - return infiniteQueryOptions< - GetChildProductsResponse, - GetChildProductsError, - InfiniteData, - QueryKey>, - | number - | Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > - >( - // @ts-ignore - { - queryFn: async ({ pageParam, queryKey }) => { - // @ts-ignore - const page: Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > = - typeof pageParam === "object" - ? pageParam - : { - query: { - "page[limit]": pageParam, - }, - } - const { data } = await getChildProducts({ - ...options, - ...queryKey[0], - body: { - ...(queryKey[0].body as any), - ...(page.body as any), - }, - headers: { - ...queryKey[0].headers, - ...page.headers, - }, - path: { - ...queryKey[0].path, - ...page.path, - }, - query: { - ...queryKey[0].query, - ...page.query, - }, - throwOnError: true, - }) - return data - }, - queryKey: [createQueryKey("getChildProducts", options, true)], - }, - ) -} +export const getProductsForHierarchyQueryKey = ( + options: Options, +) => [createQueryKey("getProductsForHierarchy", options)] export const getProductsForHierarchyOptions = ( options: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getProductsForHierarchy({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getProductsForHierarchy", options)], + queryKey: getProductsForHierarchyQueryKey(options), }) } -export const getProductsForHierarchyInfiniteOptions = ( - options: Options, -) => { - return infiniteQueryOptions< - GetProductsForHierarchyResponse, - GetProductsForHierarchyError, - InfiniteData, - QueryKey>, - | number - | Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > - >( - // @ts-ignore - { - queryFn: async ({ pageParam, queryKey }) => { - // @ts-ignore - const page: Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > = - typeof pageParam === "object" - ? pageParam - : { - query: { - "page[limit]": pageParam, - }, - } - const { data } = await getProductsForHierarchy({ - ...options, - ...queryKey[0], - body: { - ...(queryKey[0].body as any), - ...(page.body as any), - }, - headers: { - ...queryKey[0].headers, - ...page.headers, - }, - path: { - ...queryKey[0].path, - ...page.path, - }, - query: { - ...queryKey[0].query, - ...page.query, - }, - throwOnError: true, - }) - return data - }, - queryKey: [createQueryKey("getProductsForHierarchy", options, true)], - }, - ) -} +export const getProductsForNodeQueryKey = ( + options: Options, +) => [createQueryKey("getProductsForNode", options)] export const getProductsForNodeOptions = ( options: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getProductsForNode({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getProductsForNode", options)], + queryKey: getProductsForNodeQueryKey(options), }) } -export const getProductsForNodeInfiniteOptions = ( - options: Options, -) => { - return infiniteQueryOptions< - GetProductsForNodeResponse, - GetProductsForNodeError, - InfiniteData, - QueryKey>, - | number - | Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > - >( - // @ts-ignore - { - queryFn: async ({ pageParam, queryKey }) => { - // @ts-ignore - const page: Pick< - QueryKey>[0], - "body" | "headers" | "path" | "query" - > = - typeof pageParam === "object" - ? pageParam - : { - query: { - "page[limit]": pageParam, - }, - } - const { data } = await getProductsForNode({ - ...options, - ...queryKey[0], - body: { - ...(queryKey[0].body as any), - ...(page.body as any), - }, - headers: { - ...queryKey[0].headers, - ...page.headers, - }, - path: { - ...queryKey[0].path, - ...page.path, - }, - query: { - ...queryKey[0].query, - ...page.query, - }, - throwOnError: true, - }) - return data - }, - queryKey: [createQueryKey("getProductsForNode", options, true)], - }, - ) -} +export const getCartsQueryKey = (options?: Options) => [ + createQueryKey("getCarts", options), +] export const getCartsOptions = (options?: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getCarts({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getCarts", options)], + queryKey: getCartsQueryKey(options), }) } -export const createAcartOptions = (options?: Options) => { +export const createACartQueryKey = (options?: Options) => [ + createQueryKey("createACart", options), +] + +export const createACartOptions = (options?: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { - const { data } = await createAcart({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await createACart({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("createAcart", options)], + queryKey: createACartQueryKey(options), }) } -export const createAcartMutation = () => { +export const createACartMutation = ( + options?: Partial>, +) => { + const mutationOptions: UseMutationOptions< + CreateACartResponse, + CreateACartError, + Options + > = { + mutationFn: async (localOptions) => { + const { data } = await createACart({ + ...options, + ...localOptions, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const deleteACartMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< - CreateAcartResponse, - CreateAcartError, - Options + DeleteACartResponse, + DeleteACartError, + Options > = { - mutationFn: async (options) => { - const { data } = await createAcart({ + mutationFn: async (localOptions) => { + const { data } = await deleteACart({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -2321,29 +1324,37 @@ export const createAcartMutation = () => { return mutationOptions } +export const getCartQueryKey = (options: Options) => [ + createQueryKey("getCart", options), +] + export const getCartOptions = (options: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getCart({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getCart", options)], + queryKey: getCartQueryKey(options), }) } -export const updateAcartMutation = () => { +export const updateACartMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< - UpdateAcartResponse, - UpdateAcartError, - Options + UpdateACartResponse, + UpdateACartError, + Options > = { - mutationFn: async (options) => { - const { data } = await updateAcart({ + mutationFn: async (localOptions) => { + const { data } = await updateACart({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -2352,15 +1363,18 @@ export const updateAcartMutation = () => { return mutationOptions } -export const deleteAcartMutation = () => { +export const deleteAllCartItemsMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< - DeleteAcartResponse, - DeleteAcartError, - Options + DeleteAllCartItemsResponse, + DeleteAllCartItemsError, + Options > = { - mutationFn: async (options) => { - const { data } = await deleteAcart({ + mutationFn: async (localOptions) => { + const { data } = await deleteAllCartItems({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -2369,60 +1383,56 @@ export const deleteAcartMutation = () => { return mutationOptions } +export const getCartItemsQueryKey = (options: Options) => [ + createQueryKey("getCartItems", options), +] + export const getCartItemsOptions = (options: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getCartItems({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getCartItems", options)], + queryKey: getCartItemsQueryKey(options), }) } -export const bulkUpdateItemsInCartMutation = () => { - const mutationOptions: UseMutationOptions< - BulkUpdateItemsInCartResponse, - BulkUpdateItemsInCartError, - Options - > = { - mutationFn: async (options) => { - const { data } = await bulkUpdateItemsInCart({ - ...options, - throwOnError: true, - }) - return data - }, - } - return mutationOptions -} +export const manageCartsQueryKey = (options: Options) => [ + createQueryKey("manageCarts", options), +] export const manageCartsOptions = (options: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await manageCarts({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("manageCarts", options)], + queryKey: manageCartsQueryKey(options), }) } -export const manageCartsMutation = () => { +export const manageCartsMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< ManageCartsResponse, ManageCartsError, Options > = { - mutationFn: async (options) => { + mutationFn: async (localOptions) => { const { data } = await manageCarts({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -2431,15 +1441,38 @@ export const manageCartsMutation = () => { return mutationOptions } -export const deleteAllCartItemsMutation = () => { +export const bulkUpdateItemsInCartMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< - DeleteAllCartItemsResponse, - DeleteAllCartItemsError, - Options + unknown, + BulkUpdateItemsInCartError, + Options > = { - mutationFn: async (options) => { - const { data } = await deleteAllCartItems({ + mutationFn: async (localOptions) => { + const { data } = await bulkUpdateItemsInCart({ + ...options, + ...localOptions, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const deleteACartItemMutation = ( + options?: Partial>, +) => { + const mutationOptions: UseMutationOptions< + DeleteACartItemResponse, + DeleteACartItemError, + Options + > = { + mutationFn: async (localOptions) => { + const { data } = await deleteACartItem({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -2448,15 +1481,18 @@ export const deleteAllCartItemsMutation = () => { return mutationOptions } -export const updateAcartItemMutation = () => { +export const updateACartItemMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< - UpdateAcartItemResponse, - UpdateAcartItemError, - Options + UpdateACartItemResponse, + UpdateACartItemError, + Options > = { - mutationFn: async (options) => { - const { data } = await updateAcartItem({ + mutationFn: async (localOptions) => { + const { data } = await updateACartItem({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -2465,15 +1501,18 @@ export const updateAcartItemMutation = () => { return mutationOptions } -export const deleteAcartItemMutation = () => { +export const deleteAccountCartAssociationMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< - DeleteAcartItemResponse, - DeleteAcartItemError, - Options + DeleteAccountCartAssociationResponse, + DeleteAccountCartAssociationError, + Options > = { - mutationFn: async (options) => { - const { data } = await deleteAcartItem({ + mutationFn: async (localOptions) => { + const { data } = await deleteAccountCartAssociation({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -2482,31 +1521,39 @@ export const deleteAcartItemMutation = () => { return mutationOptions } +export const createAccountCartAssociationQueryKey = ( + options: Options, +) => [createQueryKey("createAccountCartAssociation", options)] + export const createAccountCartAssociationOptions = ( options: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await createAccountCartAssociation({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("createAccountCartAssociation", options)], + queryKey: createAccountCartAssociationQueryKey(options), }) } -export const createAccountCartAssociationMutation = () => { +export const createAccountCartAssociationMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< CreateAccountCartAssociationResponse, CreateAccountCartAssociationError, Options > = { - mutationFn: async (options) => { + mutationFn: async (localOptions) => { const { data } = await createAccountCartAssociation({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -2515,15 +1562,18 @@ export const createAccountCartAssociationMutation = () => { return mutationOptions } -export const deleteAccountCartAssociationMutation = () => { +export const deleteCustomerCartAssociationMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< - DeleteAccountCartAssociationResponse, - DeleteAccountCartAssociationError, - Options + DeleteCustomerCartAssociationResponse, + DeleteCustomerCartAssociationError, + Options > = { - mutationFn: async (options) => { - const { data } = await deleteAccountCartAssociation({ + mutationFn: async (localOptions) => { + const { data } = await deleteCustomerCartAssociation({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -2532,31 +1582,39 @@ export const deleteAccountCartAssociationMutation = () => { return mutationOptions } +export const createCustomerCartAssociationQueryKey = ( + options: Options, +) => [createQueryKey("createCustomerCartAssociation", options)] + export const createCustomerCartAssociationOptions = ( options: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await createCustomerCartAssociation({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("createCustomerCartAssociation", options)], + queryKey: createCustomerCartAssociationQueryKey(options), }) } -export const createCustomerCartAssociationMutation = () => { +export const createCustomerCartAssociationMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< CreateCustomerCartAssociationResponse, CreateCustomerCartAssociationError, Options > = { - mutationFn: async (options) => { + mutationFn: async (localOptions) => { const { data } = await createCustomerCartAssociation({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -2565,15 +1623,18 @@ export const createCustomerCartAssociationMutation = () => { return mutationOptions } -export const deleteCustomerCartAssociationMutation = () => { +export const deleteAPromotionViaPromotionCodeMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< - DeleteCustomerCartAssociationResponse, - DeleteCustomerCartAssociationError, - Options + DeleteAPromotionViaPromotionCodeResponse, + DeleteAPromotionViaPromotionCodeError, + Options > = { - mutationFn: async (options) => { - const { data } = await deleteCustomerCartAssociation({ + mutationFn: async (localOptions) => { + const { data } = await deleteAPromotionViaPromotionCode({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -2582,48 +1643,59 @@ export const deleteCustomerCartAssociationMutation = () => { return mutationOptions } -export const deleteApromotionViaPromotionCodeMutation = () => { - const mutationOptions: UseMutationOptions< - DeleteApromotionViaPromotionCodeResponse, - DeleteApromotionViaPromotionCodeError, - Options - > = { - mutationFn: async (options) => { - const { data } = await deleteApromotionViaPromotionCode({ - ...options, - throwOnError: true, - }) - return data - }, - } - return mutationOptions -} +export const addTaxItemToCartQueryKey = ( + options: Options, +) => [createQueryKey("addTaxItemToCart", options)] export const addTaxItemToCartOptions = ( options: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await addTaxItemToCart({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("addTaxItemToCart", options)], + queryKey: addTaxItemToCartQueryKey(options), }) } -export const addTaxItemToCartMutation = () => { +export const addTaxItemToCartMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< AddTaxItemToCartResponse, AddTaxItemToCartError, Options > = { - mutationFn: async (options) => { + mutationFn: async (localOptions) => { const { data } = await addTaxItemToCart({ ...options, + ...localOptions, + throwOnError: true, + }) + return data + }, + } + return mutationOptions +} + +export const bulkDeleteTaxItemsFromCartMutation = ( + options?: Partial>, +) => { + const mutationOptions: UseMutationOptions< + BulkDeleteTaxItemsFromCartResponse, + BulkDeleteTaxItemsFromCartError, + Options + > = { + mutationFn: async (localOptions) => { + const { data } = await bulkDeleteTaxItemsFromCart({ + ...options, + ...localOptions, throwOnError: true, }) return data @@ -2632,31 +1704,39 @@ export const addTaxItemToCartMutation = () => { return mutationOptions } +export const bulkAddTaxItemsToCartQueryKey = ( + options: Options, +) => [createQueryKey("bulkAddTaxItemsToCart", options)] + export const bulkAddTaxItemsToCartOptions = ( options: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await bulkAddTaxItemsToCart({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("bulkAddTaxItemsToCart", options)], + queryKey: bulkAddTaxItemsToCartQueryKey(options), }) } -export const bulkAddTaxItemsToCartMutation = () => { +export const bulkAddTaxItemsToCartMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< BulkAddTaxItemsToCartResponse, BulkAddTaxItemsToCartError, Options > = { - mutationFn: async (options) => { + mutationFn: async (localOptions) => { const { data } = await bulkAddTaxItemsToCart({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -2665,15 +1745,18 @@ export const bulkAddTaxItemsToCartMutation = () => { return mutationOptions } -export const bulkDeleteTaxItemsFromCartMutation = () => { +export const deleteATaxItemMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< - BulkDeleteTaxItemsFromCartResponse, - BulkDeleteTaxItemsFromCartError, - Options + DeleteATaxItemResponse, + DeleteATaxItemError, + Options > = { - mutationFn: async (options) => { - const { data } = await bulkDeleteTaxItemsFromCart({ + mutationFn: async (localOptions) => { + const { data } = await deleteATaxItem({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -2682,15 +1765,18 @@ export const bulkDeleteTaxItemsFromCartMutation = () => { return mutationOptions } -export const updateAtaxItemMutation = () => { +export const updateATaxItemMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< - UpdateAtaxItemResponse, - UpdateAtaxItemError, - Options + UpdateATaxItemResponse, + UpdateATaxItemError, + Options > = { - mutationFn: async (options) => { - const { data } = await updateAtaxItem({ + mutationFn: async (localOptions) => { + const { data } = await updateATaxItem({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -2699,15 +1785,18 @@ export const updateAtaxItemMutation = () => { return mutationOptions } -export const deleteAtaxItemMutation = () => { +export const bulkDeleteCustomDiscountsFromCartMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< - DeleteAtaxItemResponse, - DeleteAtaxItemError, - Options + BulkDeleteCustomDiscountsFromCartResponse, + BulkDeleteCustomDiscountsFromCartError, + Options > = { - mutationFn: async (options) => { - const { data } = await deleteAtaxItem({ + mutationFn: async (localOptions) => { + const { data } = await bulkDeleteCustomDiscountsFromCart({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -2716,31 +1805,39 @@ export const deleteAtaxItemMutation = () => { return mutationOptions } +export const bulkAddCustomDiscountsToCartQueryKey = ( + options: Options, +) => [createQueryKey("bulkAddCustomDiscountsToCart", options)] + export const bulkAddCustomDiscountsToCartOptions = ( options: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await bulkAddCustomDiscountsToCart({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("bulkAddCustomDiscountsToCart", options)], + queryKey: bulkAddCustomDiscountsToCartQueryKey(options), }) } -export const bulkAddCustomDiscountsToCartMutation = () => { +export const bulkAddCustomDiscountsToCartMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< BulkAddCustomDiscountsToCartResponse, BulkAddCustomDiscountsToCartError, Options > = { - mutationFn: async (options) => { + mutationFn: async (localOptions) => { const { data } = await bulkAddCustomDiscountsToCart({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -2749,15 +1846,18 @@ export const bulkAddCustomDiscountsToCartMutation = () => { return mutationOptions } -export const bulkDeleteCustomDiscountsFromCartMutation = () => { +export const deleteCustomDiscountFromCartMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< - BulkDeleteCustomDiscountsFromCartResponse, - BulkDeleteCustomDiscountsFromCartError, - Options + DeleteCustomDiscountFromCartResponse, + DeleteCustomDiscountFromCartError, + Options > = { - mutationFn: async (options) => { - const { data } = await bulkDeleteCustomDiscountsFromCart({ + mutationFn: async (localOptions) => { + const { data } = await deleteCustomDiscountFromCart({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -2766,15 +1866,18 @@ export const bulkDeleteCustomDiscountsFromCartMutation = () => { return mutationOptions } -export const updateCustomDiscountForCartMutation = () => { +export const updateCustomDiscountForCartMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< UpdateCustomDiscountForCartResponse, UpdateCustomDiscountForCartError, Options > = { - mutationFn: async (options) => { + mutationFn: async (localOptions) => { const { data } = await updateCustomDiscountForCart({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -2783,48 +1886,39 @@ export const updateCustomDiscountForCartMutation = () => { return mutationOptions } -export const deleteCustomDiscountFromCartMutation = () => { - const mutationOptions: UseMutationOptions< - DeleteCustomDiscountFromCartResponse, - DeleteCustomDiscountFromCartError, - Options - > = { - mutationFn: async (options) => { - const { data } = await deleteCustomDiscountFromCart({ - ...options, - throwOnError: true, - }) - return data - }, - } - return mutationOptions -} +export const addCustomDiscountToCartItemQueryKey = ( + options: Options, +) => [createQueryKey("addCustomDiscountToCartItem", options)] export const addCustomDiscountToCartItemOptions = ( options: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await addCustomDiscountToCartItem({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("addCustomDiscountToCartItem", options)], + queryKey: addCustomDiscountToCartItemQueryKey(options), }) } -export const addCustomDiscountToCartItemMutation = () => { +export const addCustomDiscountToCartItemMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< - void, + unknown, DefaultError, Options > = { - mutationFn: async (options) => { + mutationFn: async (localOptions) => { const { data } = await addCustomDiscountToCartItem({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -2833,15 +1927,18 @@ export const addCustomDiscountToCartItemMutation = () => { return mutationOptions } -export const updateCustomDiscountForCartItemMutation = () => { +export const deleteCustomDiscountFromCartItemMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< - void, - DefaultError, - Options + DeleteCustomDiscountFromCartItemResponse, + DeleteCustomDiscountFromCartItemError, + Options > = { - mutationFn: async (options) => { - const { data } = await updateCustomDiscountForCartItem({ + mutationFn: async (localOptions) => { + const { data } = await deleteCustomDiscountFromCartItem({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -2850,15 +1947,18 @@ export const updateCustomDiscountForCartItemMutation = () => { return mutationOptions } -export const deleteCustomDiscountFromCartItemMutation = () => { +export const updateCustomDiscountForCartItemMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< - DeleteCustomDiscountFromCartItemResponse, - DeleteCustomDiscountFromCartItemError, - Options + unknown, + DefaultError, + Options > = { - mutationFn: async (options) => { - const { data } = await deleteCustomDiscountFromCartItem({ + mutationFn: async (localOptions) => { + const { data } = await updateCustomDiscountForCartItem({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -2867,31 +1967,39 @@ export const deleteCustomDiscountFromCartItemMutation = () => { return mutationOptions } +export const createCartPaymentIntentQueryKey = ( + options: Options, +) => [createQueryKey("createCartPaymentIntent", options)] + export const createCartPaymentIntentOptions = ( options: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await createCartPaymentIntent({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("createCartPaymentIntent", options)], + queryKey: createCartPaymentIntentQueryKey(options), }) } -export const createCartPaymentIntentMutation = () => { +export const createCartPaymentIntentMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< CreateCartPaymentIntentResponse, CreateCartPaymentIntentError, Options > = { - mutationFn: async (options) => { + mutationFn: async (localOptions) => { const { data } = await createCartPaymentIntent({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -2900,29 +2008,37 @@ export const createCartPaymentIntentMutation = () => { return mutationOptions } +export const checkoutApiQueryKey = (options: Options) => [ + createQueryKey("checkoutApi", options), +] + export const checkoutApiOptions = (options: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await checkoutApi({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("checkoutApi", options)], + queryKey: checkoutApiQueryKey(options), }) } -export const checkoutApiMutation = () => { +export const checkoutApiMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< CheckoutApiResponse, CheckoutApiError, Options > = { - mutationFn: async (options) => { + mutationFn: async (localOptions) => { const { data } = await checkoutApi({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -2931,45 +2047,58 @@ export const checkoutApiMutation = () => { return mutationOptions } +export const getCustomerOrdersQueryKey = ( + options?: Options, +) => [createQueryKey("getCustomerOrders", options)] + export const getCustomerOrdersOptions = ( options?: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getCustomerOrders({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getCustomerOrders", options)], + queryKey: getCustomerOrdersQueryKey(options), }) } +export const getAnOrderQueryKey = (options: Options) => [ + createQueryKey("getAnOrder", options), +] + export const getAnOrderOptions = (options: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getAnOrder({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getAnOrder", options)], + queryKey: getAnOrderQueryKey(options), }) } -export const updateAnOrderMutation = () => { +export const updateAnOrderMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< UpdateAnOrderResponse, UpdateAnOrderError, Options > = { - mutationFn: async (options) => { + mutationFn: async (localOptions) => { const { data } = await updateAnOrder({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -2978,45 +2107,58 @@ export const updateAnOrderMutation = () => { return mutationOptions } +export const getOrderItemsQueryKey = (options: Options) => [ + createQueryKey("getOrderItems", options), +] + export const getOrderItemsOptions = (options: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getOrderItems({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getOrderItems", options)], + queryKey: getOrderItemsQueryKey(options), }) } +export const anonymizeOrdersQueryKey = ( + options?: Options, +) => [createQueryKey("anonymizeOrders", options)] + export const anonymizeOrdersOptions = ( options?: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await anonymizeOrders({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("anonymizeOrders", options)], + queryKey: anonymizeOrdersQueryKey(options), }) } -export const anonymizeOrdersMutation = () => { +export const anonymizeOrdersMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< AnonymizeOrdersResponse, AnonymizeOrdersError, Options > = { - mutationFn: async (options) => { + mutationFn: async (localOptions) => { const { data } = await anonymizeOrders({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -3025,29 +2167,37 @@ export const anonymizeOrdersMutation = () => { return mutationOptions } +export const authorizeSetupQueryKey = ( + options: Options, +) => [createQueryKey("authorizeSetup", options)] + export const authorizeSetupOptions = (options: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await authorizeSetup({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("authorizeSetup", options)], + queryKey: authorizeSetupQueryKey(options), }) } -export const authorizeSetupMutation = () => { +export const authorizeSetupMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< AuthorizeSetupResponse, AuthorizeSetupError, Options > = { - mutationFn: async (options) => { + mutationFn: async (localOptions) => { const { data } = await authorizeSetup({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -3056,29 +2206,37 @@ export const authorizeSetupMutation = () => { return mutationOptions } +export const confirmSetupQueryKey = (options: Options) => [ + createQueryKey("confirmSetup", options), +] + export const confirmSetupOptions = (options: Options) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await confirmSetup({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("confirmSetup", options)], + queryKey: confirmSetupQueryKey(options), }) } -export const confirmSetupMutation = () => { +export const confirmSetupMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< ConfirmSetupResponse, ConfirmSetupError, Options > = { - mutationFn: async (options) => { + mutationFn: async (localOptions) => { const { data } = await confirmSetup({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -3087,31 +2245,39 @@ export const confirmSetupMutation = () => { return mutationOptions } -export const captureAtransactionOptions = ( - options: Options, +export const captureATransactionQueryKey = ( + options: Options, +) => [createQueryKey("captureATransaction", options)] + +export const captureATransactionOptions = ( + options: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { - const { data } = await captureAtransaction({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await captureATransaction({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("captureAtransaction", options)], + queryKey: captureATransactionQueryKey(options), }) } -export const captureAtransactionMutation = () => { +export const captureATransactionMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< - CaptureAtransactionResponse, - CaptureAtransactionError, - Options + CaptureATransactionResponse, + CaptureATransactionError, + Options > = { - mutationFn: async (options) => { - const { data } = await captureAtransaction({ + mutationFn: async (localOptions) => { + const { data } = await captureATransaction({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -3120,31 +2286,39 @@ export const captureAtransactionMutation = () => { return mutationOptions } -export const refundAtransactionOptions = ( - options: Options, +export const refundATransactionQueryKey = ( + options: Options, +) => [createQueryKey("refundATransaction", options)] + +export const refundATransactionOptions = ( + options: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { - const { data } = await refundAtransaction({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await refundATransaction({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("refundAtransaction", options)], + queryKey: refundATransactionQueryKey(options), }) } -export const refundAtransactionMutation = () => { +export const refundATransactionMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< - RefundAtransactionResponse, - RefundAtransactionError, - Options + RefundATransactionResponse, + RefundATransactionError, + Options > = { - mutationFn: async (options) => { - const { data } = await refundAtransaction({ + mutationFn: async (localOptions) => { + const { data } = await refundATransaction({ ...options, + ...localOptions, throwOnError: true, }) return data @@ -3153,63 +2327,81 @@ export const refundAtransactionMutation = () => { return mutationOptions } +export const getOrderTransactionsQueryKey = ( + options: Options, +) => [createQueryKey("getOrderTransactions", options)] + export const getOrderTransactionsOptions = ( options: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { + queryFn: async ({ queryKey, signal }) => { const { data } = await getOrderTransactions({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getOrderTransactions", options)], + queryKey: getOrderTransactionsQueryKey(options), }) } -export const getAtransactionOptions = ( - options: Options, +export const getATransactionQueryKey = ( + options: Options, +) => [createQueryKey("getATransaction", options)] + +export const getATransactionOptions = ( + options: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { - const { data } = await getAtransaction({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await getATransaction({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("getAtransaction", options)], + queryKey: getATransactionQueryKey(options), }) } -export const cancelAtransactionOptions = ( - options: Options, +export const cancelATransactionQueryKey = ( + options: Options, +) => [createQueryKey("cancelATransaction", options)] + +export const cancelATransactionOptions = ( + options: Options, ) => { return queryOptions({ - queryFn: async ({ queryKey }) => { - const { data } = await cancelAtransaction({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await cancelATransaction({ ...options, ...queryKey[0], + signal, throwOnError: true, }) return data }, - queryKey: [createQueryKey("cancelAtransaction", options)], + queryKey: cancelATransactionQueryKey(options), }) } -export const cancelAtransactionMutation = () => { +export const cancelATransactionMutation = ( + options?: Partial>, +) => { const mutationOptions: UseMutationOptions< - CancelAtransactionResponse, - CancelAtransactionError, - Options + CancelATransactionResponse, + CancelATransactionError, + Options > = { - mutationFn: async (options) => { - const { data } = await cancelAtransaction({ + mutationFn: async (localOptions) => { + const { data } = await cancelATransaction({ ...options, + ...localOptions, throwOnError: true, }) return data diff --git a/packages/sdks/shopper/src/client/index.ts b/packages/sdks/shopper/src/client/index.ts index a8a3135a..44d2c904 100644 --- a/packages/sdks/shopper/src/client/index.ts +++ b/packages/sdks/shopper/src/client/index.ts @@ -1,4 +1,3 @@ // This file is auto-generated by @hey-api/openapi-ts -export * from "./schemas.gen" -export * from "./services.gen" export * from "./types.gen" +export * from "./sdk.gen" diff --git a/packages/sdks/shopper/src/client/schemas.gen.ts b/packages/sdks/shopper/src/client/schemas.gen.ts deleted file mode 100644 index 8c4b982d..00000000 --- a/packages/sdks/shopper/src/client/schemas.gen.ts +++ /dev/null @@ -1,6057 +0,0 @@ -// This file is auto-generated by @hey-api/openapi-ts - -export const $amount = { - description: - "The three-letter ISO code for the currency associated with this price.", - type: "object", - properties: { - amount: { - description: - "The price in the lowest denomination for the specified currency. This is a product's list price.", - type: "integer", - format: "int64", - examples: [100], - "x-go-name": "Amount", - "x-omitempty": false, - }, - includes_tax: { - description: "Whether this price includes tax.", - type: "boolean", - examples: [false], - default: false, - "x-go-name": "IncludesTax", - }, - }, - title: "Amount", - "x-go-name": "PriceAmount", -} as const - -export const $prioritized_pricebooks = { - description: - "If you want multiple price books for different scenarios, such as seasonal sales, business versus retail pricing, and reward programs, when creating a catalog, you can specify up to five price books. You must configure a priority for your price books. Product prices are displayed in the catalog according to the priority of the price books.", - type: "array", - items: { - type: "object", - properties: { - id: { - description: "A unique identifier of a price book.", - type: "string", - format: "uuid", - }, - priority: { - description: - "Priority is a number and the price book with the highest number has the highest priority.", - type: "integer", - }, - }, - required: ["priority", "id"], - "x-go-name": "PrioritizedPricebook", - }, - maxItems: 5, -} as const - -export const $catalog = { - description: "Creates a catalog with the following attributes.", - type: "object", - properties: { - id: { - description: "A unique identifier of a catalog.", - type: "string", - examples: ["8dbb35b2-ef04-477e-974d-e5f3abe6faae"], - }, - attributes: { - type: "object", - properties: { - name: { - description: "The name of a catalog.", - type: "string", - examples: ["catalog-123"], - }, - description: { - description: - "A brief description of the catalog, such as the purpose of the catalog.", - type: "string", - examples: ["Catalog for Store 123"], - default: "", - }, - hierarchy_ids: { - description: - "The unique identifiers of the hierarchies associated with a catalog.", - type: "array", - items: { - type: "string", - }, - }, - pricebook_id: { - description: - "The unique identifier of a price book associated with a catalog. If no price book is selected, the catalog is displayed without prices.", - type: "string", - }, - pricebook_ids: { - $ref: "#/components/schemas/prioritized-pricebooks", - }, - locales: { - description: - "Product Experience Manager supports localization of products and hierarchies. If you store supports multiple languages, you can localize product names and descriptions.", - type: "object", - additionalProperties: { - description: - "A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used.", - type: "object", - additionalProperties: { - description: - "A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used.", - type: "string", - }, - }, - }, - created_at: { - description: "The date and time a catalog is created.", - type: "string", - format: "date-time", - examples: ["2020-09-22T09:00:00"], - }, - updated_at: { - description: "The date and time a catalog was updated.", - type: "string", - format: "date-time", - examples: ["2020-09-22T09:00:00"], - }, - owner: { - description: - "The owner of this resource, can be either `organization` or `store`.", - type: ["string", "null"], - default: "store", - enum: ["store", "organization"], - "x-go-name": "Owner", - }, - }, - required: ["name", "hierarchy_ids", "created_at", "updated_at"], - }, - relationships: { - description: - "Relationships are established between different catalog entities. For example, a catalog rule and a price book are related to a catalog, as both are associated with it.", - type: "object", - properties: { - rules: { - description: "The catalog rules related to a catalog.", - type: "object", - properties: { - links: { - $ref: "#/components/schemas/related-link", - }, - }, - }, - releases: { - description: - "When a catalog is published, a catalog release is created. This is a URL to all catalog published releases available for this catalog.", - type: "object", - properties: { - links: { - $ref: "#/components/schemas/related-link", - }, - meta: { - type: "object", - properties: { - count: { - description: "The number releases available for a catalog.", - type: "integer", - }, - }, - }, - }, - }, - }, - title: "CatalogRelationships", - }, - type: { - type: "string", - examples: ["catalog"], - const: "catalog", - }, - }, - required: ["id", "type", "attributes"], - title: "Catalog", -} as const - -export const $catalog_create_data = { - description: "Creates a catalog with the following attributes.", - type: "object", - properties: { - data: { - type: "object", - properties: { - attributes: { - type: "object", - properties: { - name: { - description: "The name of the catalog.", - type: "string", - examples: ["catalog-123"], - minLength: 1, - }, - description: { - description: "A brief description of the catalog.", - type: ["string", "null"], - examples: ["Catalog for Store 123"], - }, - hierarchy_ids: { - description: - "The unique identifiers of the hierarchies to associate with a catalog.", - type: "array", - items: { - type: "string", - }, - }, - pricebook_id: { - description: `The unique identifier of the price book to associate with this catalog. You can specify either a \`pricebook_id\` or \`pricebook_ids\` but not both. If you specify both a \`pricebook_id\` and \`pricebook_ids\`, a \`422 Unprocessable Entity\` error is displayed. -`, - type: "string", - }, - pricebook_ids: { - $ref: "#/components/schemas/prioritized-pricebooks", - }, - locales: { - description: - "Product Experience Manager supports localization of products and hierarchies. If you store supports multiple languages, you can localize product names and descriptions.", - type: "object", - additionalProperties: { - description: - "A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used.", - type: "object", - additionalProperties: { - description: - "A [three-letter language code](https://www.iso.org/iso-639-language-code) that represents the name of language you have used.", - type: "string", - }, - }, - }, - }, - required: ["name", "hierarchy_ids"], - }, - type: { - description: - "Represents the type of object being returned. Always `Catalog`.", - type: "string", - examples: ["catalog"], - const: "catalog", - }, - }, - required: ["type", "attributes"], - }, - }, - required: ["data"], - title: "CatalogCreateData", -} as const - -export const $catalog_data = { - description: "Container for a single catalog.", - type: "object", - properties: { - data: { - $ref: "#/components/schemas/catalog", - }, - links: { - $ref: "#/components/schemas/links", - }, - }, - required: ["data"], - title: "CatalogData", -} as const - -export const $catalog_list_data = { - description: "Container for a list of catalogs.", - type: "object", - properties: { - data: { - type: "array", - items: { - $ref: "#/components/schemas/catalog", - }, - }, - links: { - $ref: "#/components/schemas/links", - }, - }, - required: ["data"], - title: "CatalogListData", -} as const - -export const $catalog_update_data = { - description: - "A catalog combines price books, product lists, and hierarchies.", - type: "object", - properties: { - data: { - type: "object", - properties: { - attributes: { - type: "object", - properties: { - name: { - description: "The name of the catalog.", - type: ["string", "null"], - examples: ["catalog-123"], - minLength: 1, - }, - description: { - description: "A brief description of the catalog.", - type: ["string", "null"], - examples: ["Catalog for Store 123"], - }, - hierarchy_ids: { - description: - "The unique identifiers of the hierarchies to associate with a catalog.", - type: ["array", "null"], - items: { - type: "string", - }, - }, - pricebook_id: { - description: - "The unique identifier of a price book to associate with a catalog. You can specify a `pricebook_id` or a `pricebook_ids` but not both. If you specify both, a `422 unprocessable entity` error is displayed.", - type: ["string", "null"], - }, - pricebook_ids: { - $ref: "#/components/schemas/prioritized-pricebooks", - }, - locales: { - description: - "Product Experience Manager supports localization of products and hierarchies. If you store supports multiple languages, you can localize product names and descriptions.", - type: "object", - additionalProperties: { - description: - "A [three-letter language code](https://www.loc.gov/standards/iso639-2/) that represents the name of language you have used.", - type: "object", - additionalProperties: { - description: - "A [three-letter language code](https://www.loc.gov/standards/iso639-2/) that represents the name of language you have used.", - type: "string", - }, - }, - }, - }, - }, - id: { - description: "The unique identifier of the catalog to be updated.", - type: "string", - examples: ["8dbb35b2-ef04-477e-974d-e5f3abe6faae"], - "x-go-name": "ID", - }, - type: { - description: - "This represents the type of object being returned. Always `catalog`.", - type: "string", - examples: ["catalog"], - const: "catalog", - }, - }, - required: ["type", "id", "attributes"], - }, - }, - required: ["data"], - title: "CatalogUpdateData", -} as const - -export const $component_product = { - description: "The unique identifier of the component, for example, `games`.", - type: "object", - properties: { - name: { - description: - "The component name is the name that is displayed in your storefront.", - type: "string", - "x-go-name": "Name", - }, - min: { - description: - "The minimum number of product options a shopper can select from this component.", - type: ["integer", "null"], - "x-go-name": "Min", - }, - max: { - description: - "The maximum number of product options a shopper can select from this component.", - type: ["integer", "null"], - "x-go-name": "Max", - }, - sort_order: { - description: - "The sort order of the components. The `create a bundle` and `update a bundle` endpoints do not sort the components. You can use the `sort_order` attribute when programming your storefront to display the components in the order that you want.", - type: ["integer", "null"], - "x-go-name": "Sort Order", - }, - options: { - description: - "The product options included in a component. This can be the ID of another bundle.", - type: "array", - items: { - $ref: "#/components/schemas/component-product-option", - }, - "x-go-name": "Options", - }, - }, - title: "Component Product", -} as const - -export const $component_product_option = { - description: - "The product options included in a component. This can be the ID of another bundle.", - type: "object", - properties: { - id: { - description: - "A unique identifier of the product you want to add to a component.", - type: "string", - format: "uuid", - "x-go-name": "ID", - }, - type: { - description: - "This represents the type of object being returned. Always `product`.", - type: "string", - examples: ["product"], - default: "product", - const: "product", - "x-go-name": "Type", - }, - quantity: { - description: - "The number of this product option that a shopper must purchase.", - type: "integer", - examples: [2], - "x-go-name": "Quantity", - }, - sort_order: { - description: - "The sort order of the options. The `create a bundle` and `update a bundle` endpoints do not sort the options. You can use the `sort_order` attribute when programming your storefront to display the options in the order that you want.", - type: ["integer", "null"], - examples: [15], - "x-go-name": "Sort Order", - }, - default: { - description: - "The boolean indicates whether the current option is a default option for the component.", - type: ["boolean", "null"], - examples: [true], - default: false, - "x-go-name": "Default", - }, - }, - title: "Component Product Option", -} as const - -export const $components = { - additionalProperties: { - $ref: "#/components/schemas/component-product", - }, - description: - "A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity.", - title: "Components", - type: "object", -} as const - -export const $custom_input_validation_rule_options = { - description: "The length of the custom input text field.", - type: "object", - properties: { - max_length: { - description: - "The number of characters the custom text field can be. You can specify a maximum length up to 255 characters, as the limit is 255 characters.", - type: "integer", - examples: [255], - "x-go-name": "MaxLength", - }, - }, - "x-go-name": "CustomInputValidationRuleOptions", -} as const - -export const $custom_input_validation_rule = { - description: "The validation rules for the custom text.", - type: "object", - properties: { - type: { - description: - "This represents the type of object being returned. Must be `string`.", - type: "string", - examples: ["string"], - default: "string", - const: "string", - "x-go-name": "Type", - }, - options: { - $ref: "#/components/schemas/custom-input-validation-rule-options", - }, - }, - title: "Custom Input Validation Rule", - "x-go-name": "CustomInputValidationRule", -} as const - -export const $custom_input = { - description: - "The name of the custom input. You can rename the input to something more representative of the input that shoppers are adding, for example, `message` or `front`.", - type: "object", - properties: { - name: { - description: - "The name for the custom text field that is displayed in your storefront.", - type: "string", - examples: ["Message"], - "x-go-name": "Name", - }, - validation_rules: { - description: "The validation rules for the custom text.", - type: "array", - items: { - $ref: "#/components/schemas/custom-input-validation-rule", - }, - "x-go-name": "ValidationRules", - }, - required: { - description: - "This is `true` or `false` depending on whether the custom text is required.", - type: ["boolean", "null"], - examples: [false], - default: false, - "x-go-name": "Required", - }, - }, - title: "Custom Input", -} as const - -export const $custom_inputs = { - description: `You can allow your shoppers to add custom text to a product when adding product items to their carts. This is useful, for example, if you have a product like a T-shirt that can be personalized or you sell greetings cards that can be printed with your shoppers personalized messages. You can do this using the \`custom_inputs\` attribute. - - - You can rename input to something more representative of the input that shoppers are adding, for example, \`message\` or \`front\`. - - \`name\` is the name that is displayed in your storefront. - - You can add validation rules. For example, the input field must be a string and/or up to 255 characters in length. The limit is 255 characters. -`, - type: "object", - additionalProperties: { - $ref: "#/components/schemas/custom-input", - }, - title: "Custom Inputs", -} as const - -export const $currencies = { - description: - "A collection of one or more currencies objects that consists of the [**three-letter ISO code**](https://www.iso.org/iso-3166-country-codes.html) of the currencies associated with this price and the amount. This is the product's price.", - type: "object", - additionalProperties: { - $ref: "#/components/schemas/amount", - }, - title: "Currencies", -} as const - -export const $shopper_attributes = { - description: - "The optional price extension with values in string format, viewable by shoppers.", - type: "object", - additionalProperties: { - type: "string", - }, - title: "ShopperAttributes", -} as const - -export const $diff_list_data = { - description: "A list of differences between two releases.", - type: "object", - properties: { - data: { - type: "array", - items: { - $ref: "#/components/schemas/product-diff", - }, - }, - links: { - $ref: "#/components/schemas/links", - }, - }, - title: "DiffListData", -} as const - -export const $display_price = { - description: "A price formatted for display.", - type: "object", - properties: { - with_tax: { - $ref: "#/components/schemas/formatted-price", - }, - without_tax: { - $ref: "#/components/schemas/formatted-price", - }, - }, - "x-omitempty": true, -} as const - -export const $error = { - description: "APIError is a json-api style part of an error response.", - type: "object", - properties: { - detail: { - type: "string", - examples: ["not processable"], - "x-go-name": "Detail", - }, - status: { - type: "string", - examples: ["422"], - "x-go-name": "Status", - }, - title: { - type: "string", - examples: ["There was a problem processing your request."], - "x-go-name": "Title", - }, - }, - title: "APIError", - "x-go-name": "APIError", -} as const - -export const $error_response = { - description: "ErrorResponse is a json-api style Error response.", - type: "object", - properties: { - errors: { - type: "array", - items: { - $ref: "#/components/schemas/error", - }, - "x-go-name": "Errors", - }, - }, - title: "ErrorResponse", - "x-go-name": "ErrorResponse", -} as const - -export const $extension = { - description: "The name of the product template.", - type: "object", - additionalProperties: { - description: "The product attributes available for this template.", - type: "object", - }, - title: "Extension", -} as const - -export const $extensions = { - description: - "With extension templates, you can attach a specific set of custom fields to your products in Product Experience Manager. For example, a **Book** template might contain the attributes, such as **ISBN**, **Author**, **Number of pages**, **Year Published**, or **Condition (New/Used)**.", - type: "object", - additionalProperties: { - $ref: "#/components/schemas/extension", - }, - title: "Extensions", -} as const - -export const $file_reference = { - description: - "In Product Experience Manager, products can have associated rich media assets, such as product images or a file containing additional product details.", - type: "object", - properties: { - type: { - description: - "This represents the type of object being returned. Always `file`.", - type: "string", - examples: ["file"], - const: "file", - }, - id: { - description: "A unique identifier for a file.", - type: "string", - format: "uuid", - }, - created_at: { - description: "The date and time a file is created.", - type: "string", - format: "date-time", - examples: ["1970-01-01T00:00:00.000"], - "x-go-name": "CreatedAt", - }, - }, - "x-go-name": "FileRelationship", -} as const - -export const $files_relationship = { - description: - "In Product Experience Manager, products can have associated rich media assets, such as product images or a file containing additional product details.", - type: "object", - properties: { - data: { - type: "array", - items: { - $ref: "#/components/schemas/file-reference", - }, - }, - }, - "x-omitempty": true, -} as const - -export const $component_products_relationship = { - description: - "A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. You can link to the products that make up your bundle components.", - type: "object", - properties: { - data: { - $ref: "#/components/schemas/product-references", - }, - links: { - $ref: "#/components/schemas/self-link", - }, - }, - "x-omitempty": true, -} as const - -export const $formatted_price = { - description: "A price formatted for display.", - type: "object", - properties: { - amount: { - description: - "The price in the lowest denomination for the specified currency. This is a product's list price.", - type: "integer", - examples: ["47500"], - "x-omitempty": false, - }, - currency: { - description: - "The three-letter ISO code of the currencies associated with this price and the amount.", - type: "string", - examples: ["USD"], - }, - formatted: { - description: "The format of the price for display.", - type: "string", - examples: ["$475.00"], - }, - }, - title: "FormattedPrice", - "x-omitempty": true, -} as const - -export const $hierarchy = { - description: - "A category hierarchy in a catalog. Hierarchies can have parent nodes and child nodes, as well as a list of attached products.", - type: "object", - properties: { - attributes: { - $ref: "#/components/schemas/hierarchy-attributes", - }, - id: { - description: "A unique identifier of a hierarchy.", - type: "string", - examples: ["e871df93-c769-49a9-9394-a6fd555b8e8a"], - "x-go-name": "ID", - }, - relationships: { - $ref: "#/components/schemas/hierarchy-relationships", - }, - type: { - description: - "This represents the type of object being returned. Always `hierarchy`.", - type: "string", - examples: ["hierarchy"], - "x-go-name": "Type", - }, - meta: { - $ref: "#/components/schemas/hierarchy-meta", - }, - }, - title: "Hierarchy", - "x-go-name": "Hierarchy", -} as const - -export const $hierarchy_meta = { - description: "A hierarchy's metadata.", - type: "object", - properties: { - language: { - description: - "Product Experience Manager supports localization of hierarchies. If your store supports multiple languages, you can localize hierarchy names and descriptions. This is [**three-letter language code**](https://www.iso.org/iso-639-language-code) that represents the name of the language you have used.", - type: "string", - examples: ["en-GB"], - }, - }, - title: "HierarchyMeta", - "x-go-name": "HierarchyMeta", - "x-omitempty": true, -} as const - -export const $hierarchy_attributes = { - description: "Resource attributes of a catalog hierarchy.", - type: "object", - properties: { - created_at: { - description: "The date and time a hierarchy is created.", - type: "string", - format: "date-time", - examples: ["1970-01-01T00:00:00.000"], - "x-go-name": "CreatedAt", - }, - published_at: { - description: "The date and time a hierarchy is published in a catalog.", - type: ["string", "null"], - format: "date-time", - examples: ["1970-01-01T00:00:00.000"], - }, - description: { - description: "A description of a hierarchy.", - type: "string", - examples: ["Formal dresswear"], - "x-go-name": "Description", - }, - name: { - description: "The name of a hierarchy.", - type: "string", - examples: ["Formal dresswear"], - "x-go-name": "Name", - }, - slug: { - description: "A unique slug for a hierarchy.", - type: "string", - examples: ["formal"], - "x-go-name": "Slug", - }, - updated_at: { - description: "The date and time a hierarchy was updated.", - type: "string", - format: "date-time", - examples: ["1970-01-01T00:00:00.000"], - "x-go-name": "UpdatedAt", - }, - }, - title: "HierarchyAttributes", - "x-go-name": "HierarchyAttributes", -} as const - -export const $hierarchy_data = { - description: "Container for hierarchies.", - type: "object", - properties: { - data: { - $ref: "#/components/schemas/hierarchy", - }, - links: { - $ref: "#/components/schemas/links", - }, - }, - title: "HierarchyData", -} as const - -export const $hierarchy_list_data = { - description: "Container for a list of hierarchies.", - type: "object", - properties: { - meta: { - $ref: "#/components/schemas/page-meta", - }, - data: { - type: "array", - items: { - $ref: "#/components/schemas/hierarchy", - }, - }, - links: { - $ref: "#/components/schemas/links", - }, - }, - title: "HierarchyListData", -} as const - -export const $hierarchy_relationships = { - description: "Relationships to child nodes, and products.", - type: "object", - properties: { - products: { - description: "A URL to all the products associated with a hierarchy.", - type: "object", - properties: { - links: { - $ref: "#/components/schemas/related-link", - }, - }, - }, - children: { - description: - "A URL to all the child products associated with a hierarchy.", - type: "object", - properties: { - links: { - $ref: "#/components/schemas/related-link", - }, - }, - required: ["links"], - }, - nodes: { - description: "A URL to all the nodes associated with a hierarchy.", - type: "object", - properties: { - links: { - $ref: "#/components/schemas/related-link", - }, - }, - required: ["links"], - }, - }, - title: "HierarchyRelationships", - "x-go-name": "HierarchyRelationships", -} as const - -export const $links = { - description: "Links allow you to move between requests.", - type: "object", - properties: { - self: { - description: - "Single entities use a `self` parameter with a link the specific resource.", - type: ["string", "null"], - format: "uri", - }, - first: { - description: "Always the first page.", - type: ["string", "null"], - format: "uri", - }, - last: { - description: "This is `null` if there is only one page.", - type: ["string", "null"], - format: "uri", - }, - prev: { - description: "This is `null` if there is only one page.", - type: ["string", "null"], - format: "uri", - }, - next: { - description: "This is `null` if there is only one page.", - type: ["string", "null"], - format: "uri", - }, - }, -} as const - -export const $main_image_relationship = { - description: - "In Product Experience Manager, products can also have associated product images.", - type: "object", - properties: { - data: { - description: "The images associated with a product.", - type: "object", - properties: { - type: { - description: - "This represents the type of object being returned. Always `main_image`.", - type: "string", - examples: ["main_image"], - const: "main_image", - }, - id: { - description: "A unique identifier for an image.", - type: "string", - format: "uuid", - }, - }, - "x-nullable": "true", - }, - }, - "x-omitempty": true, -} as const - -export const $node = { - description: - "A category node in a catalog. Nodes can have child nodes, as well as a list of attached products.", - type: "object", - properties: { - attributes: { - $ref: "#/components/schemas/node-attributes", - }, - id: { - description: "The unique identifier of a node.", - type: "string", - examples: ["e871df93-c769-49a9-9394-a6fd555b8e8a"], - "x-go-name": "ID", - }, - relationships: { - $ref: "#/components/schemas/node-relationships", - }, - type: { - description: - "This represents the type of object being returned. Always `node`.", - type: "string", - examples: ["node"], - "x-go-name": "Type", - }, - meta: { - $ref: "#/components/schemas/node-meta", - }, - }, - title: "Node", - "x-go-name": "Node", -} as const - -export const $node_attributes = { - description: "Resource attributes of a catalog node.", - type: "object", - properties: { - created_at: { - description: "The date and time a node was created.", - type: "string", - format: "date-time", - examples: ["1970-01-01T00:00:00.000"], - "x-go-name": "CreatedAt", - }, - published_at: { - description: "The date and time a node was published in a catalog.", - type: ["string", "null"], - format: "date-time", - examples: ["1970-01-01T00:00:00.000"], - }, - description: { - description: "A description of a node.", - type: "string", - examples: ["Formal dresswear"], - "x-go-name": "Description", - }, - label: { - type: "string", - examples: ["category"], - "x-go-name": "Label", - }, - name: { - description: - "The name of a node. Names must be unique among sibling nodes in a hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies.", - type: "string", - examples: ["Formal dresswear"], - "x-go-name": "Name", - }, - slug: { - description: - "A slug for the node. Slugs must be unique among sibling nodes in the hierarchy. Otherwise, a slug can be non-unique within the hierarchy and across multiple hierarchies.", - type: "string", - examples: ["formal"], - "x-go-name": "Slug", - }, - curated_products: { - description: - "A list of curated products for a node. You can curate your products in your nodes product lists. Product curation allows you to promote specific products within each node in a hierarchy, enabling you to create unique product collections in your storefront.", - type: "array", - items: { - type: "string", - examples: ["8dbb35b2-ef04-477e-974d-e5f3abe6faae"], - }, - "x-omitempty": true, - }, - status: { - type: "string", - examples: ["live"], - "x-go-name": "Status", - }, - updated_at: { - description: "The date and time a node was updated.", - type: "string", - format: "date-time", - examples: ["1970-01-01T00:00:00.000"], - "x-go-name": "UpdatedAt", - }, - }, - title: "NodeAttributes", - "x-go-name": "NodeAttributes", -} as const - -export const $node_create_data = { - description: "Container for nodes.", - type: "object", - properties: { - data: { - description: - "A node in a catalog (e.g. a category node). Nodes can have child nodes, as well as a list of attached products", - type: "object", - properties: { - attributes: { - description: "Resource attributes of a catalog node.", - type: "object", - properties: { - description: { - type: "string", - examples: ["Formal dresswear"], - "x-go-name": "Description", - }, - hierarchy_id: { - description: "hierarchy id of the node", - type: "string", - examples: ["ddd401ac-db06-4d9e-af60-cf5206abb9bc"], - }, - label: { - type: "string", - examples: ["category"], - "x-go-name": "Label", - }, - name: { - type: "string", - examples: ["Formal dresswear"], - "x-go-name": "Name", - }, - slug: { - type: "string", - examples: ["formal"], - "x-go-name": "Slug", - }, - status: { - type: "string", - examples: ["Live"], - "x-go-name": "Status", - }, - locales: { - type: "object", - additionalProperties: { - type: "object", - additionalProperties: { - type: "string", - }, - }, - }, - }, - required: ["name"], - title: "NodeCreateAttributes", - }, - relationships: { - $ref: "#/components/schemas/node-relationships", - }, - id: { - type: "string", - examples: ["8fccaa19-dba9-4621-8d11-31a222a68c7c"], - "x-go-name": "ID", - }, - type: { - type: "string", - examples: ["node"], - "x-go-name": "Type", - }, - }, - required: ["type", "attributes"], - title: "NodeCreateArgs", - }, - links: { - $ref: "#/components/schemas/links", - }, - }, - required: ["data"], - title: "NodeCreateData", -} as const - -export const $node_data = { - description: "Container for nodes.", - type: "object", - properties: { - data: { - $ref: "#/components/schemas/node", - }, - links: { - $ref: "#/components/schemas/links", - }, - }, - title: "NodeData", -} as const - -export const $node_list_data = { - description: "Container for a list of nodes.", - type: "object", - properties: { - meta: { - $ref: "#/components/schemas/page-meta", - }, - data: { - type: "array", - items: { - $ref: "#/components/schemas/node", - }, - }, - links: { - $ref: "#/components/schemas/links", - }, - }, - title: "NodeListData", -} as const - -export const $node_meta = { - description: "A node's metadata.", - type: "object", - properties: { - language: { - description: "The node details localized in the supported languages.", - type: "string", - examples: ["en-GB"], - }, - bread_crumb: { - description: - "Helps you understand the association of products with nodes. It explains how products are associated with parent nodes and the relationship among the array of nodes. This is useful if you want to improve how your shoppers search within you store.", - type: "array", - items: { - type: "string", - examples: ["8dbb35b2-ef04-477e-974d-e5f3abe6faae"], - }, - "x-omitempty": true, - }, - }, - title: "NodeMeta", - "x-go-name": "NodeMeta", - "x-omitempty": true, -} as const - -export const $node_reference = { - description: "Minimum set of information to identify a catalog node.", - type: "object", - properties: { - id: { - description: "The unique identifier of a hierarchy.", - type: "string", - examples: ["65477ce0-fcb8-436b-a120-3d57979421dd"], - "x-go-name": "ID", - }, - label: { - description: "A label for a hierarchy.", - type: "string", - examples: ["category"], - "x-go-name": "Label", - }, - name: { - description: "The name of a hierarchy.", - type: "string", - examples: ["Formal dresswear"], - "x-go-name": "Name", - }, - }, - title: "NodeReference", - "x-go-name": "NodeReference", -} as const - -export const $node_relationships = { - description: "Relationships to parent and child nodes, and products.", - type: "object", - properties: { - products: { - description: "A URL to all products associated with a node.", - type: "object", - properties: { - data: { - type: "array", - items: { - $ref: "#/components/schemas/product-reference", - }, - "x-omitempty": true, - }, - links: { - $ref: "#/components/schemas/related-link", - }, - }, - }, - children: { - description: "A URL to all child nodes associated with a node.", - type: "object", - properties: { - links: { - $ref: "#/components/schemas/related-link", - }, - }, - required: ["links"], - }, - parent: { - description: "A URL to all parent nodes associated with a node.", - type: "object", - properties: { - data: { - type: "object", - properties: { - type: { - type: "string", - examples: ["node"], - const: "node", - }, - id: { - type: "string", - examples: ["8fccaa19-dba9-4621-8d11-31a222a68c7c"], - "x-go-name": "ID", - }, - }, - required: ["id", "type"], - }, - links: { - $ref: "#/components/schemas/related-link", - }, - }, - required: ["data"], - }, - hierarchy: { - description: "A URL to the hierarchies associated with a node.", - type: "object", - properties: { - data: { - type: "object", - properties: { - type: { - type: "string", - examples: ["hierarchy"], - const: "hierarchy", - }, - id: { - type: "string", - examples: ["8fccaa19-dba9-4621-8d11-31a222a68c7c"], - "x-go-name": "ID", - }, - }, - required: ["id", "type"], - }, - links: { - $ref: "#/components/schemas/related-link", - }, - }, - required: ["data"], - }, - }, - title: "NodeRelationships", - "x-go-name": "NodeRelationships", -} as const - -export const $node_relationships_data = { - description: "Container for node relationships.", - type: "object", - properties: { - data: { - $ref: "#/components/schemas/node-relationships", - }, - links: { - $ref: "#/components/schemas/links", - }, - }, - title: "NodeRelationshipsData", -} as const - -export const $page_meta = { - description: "Contains the results for the entire collection.", - type: "object", - properties: { - results: { - description: "Total number of results for the entire collection.", - type: "object", - properties: { - total: { - description: "Total number of results for the entire collection.", - type: "integer", - format: "int64", - }, - }, - }, - page: { - type: "object", - properties: { - limit: { - description: "The maximum number of records for all pages.", - type: "integer", - format: "int64", - }, - offset: { - description: "The current offset by number of pages.", - type: "integer", - format: "int64", - }, - current: { - description: "The current number of pages.", - type: "integer", - format: "int64", - }, - total: { - description: "The total number of records for the entire collection.", - type: "integer", - format: "int64", - }, - }, - }, - }, - title: "PageMeta", -} as const - -export const $pricebook = { - description: - "Top level entity in the pricebooks domain model. It contains a list of product prices.", - type: "object", - properties: { - id: { - description: "The unique identifier of a price book.", - type: "string", - examples: ["4c45e4ec-26e0-4043-86e4-c15b9cf985a7"], - "x-go-name": "ID", - }, - type: { - description: - "This represents the type of object being returned. Always `pricebook`.", - type: "string", - examples: ["pricebook"], - default: "pricebook", - const: "pricebook", - "x-go-name": "Type", - }, - attributes: { - type: "object", - properties: { - created_at: { - type: "string", - format: "date-time", - examples: ["2020-09-22T09:00:00"], - "x-go-name": "CreatedAt", - }, - description: { - type: ["string", "null"], - examples: ["This is a pricebook"], - "x-go-name": "Description", - }, - name: { - type: ["string", "null"], - examples: ["pricebook-store-abc"], - "x-go-name": "Name", - }, - updated_at: { - type: "string", - format: "date-time", - examples: ["2020-09-22T09:00:00"], - "x-go-name": "UpdatedAt", - }, - }, - required: ["name"], - }, - }, - additionalProperties: false, - required: ["type", "attributes"], - title: "Pricebook", - "x-go-name": "Pricebook", -} as const - -export const $pricebook_create_data = { - description: "Container for pricebooks.", - type: "object", - properties: { - data: { - description: "New top level pricebook.", - type: "object", - additionalProperties: false, - properties: { - type: { - type: "string", - examples: ["pricebook"], - default: "pricebook", - const: "pricebook", - "x-go-name": "Type", - }, - attributes: { - type: "object", - properties: { - description: { - type: ["string", "null"], - examples: ["This is a pricebook"], - "x-go-name": "Description", - }, - name: { - type: ["string", "null"], - examples: ["pricebook-store-abc"], - "x-go-name": "Name", - }, - }, - required: ["name"], - }, - }, - required: ["type", "attributes"], - title: "PricebookCreateArgs", - }, - links: { - $ref: "#/components/schemas/links", - }, - }, - required: ["data"], - title: "PricebookData", -} as const - -export const $pricebook_data = { - description: "Container for pricebooks.", - type: "object", - properties: { - data: { - $ref: "#/components/schemas/pricebook", - }, - links: { - $ref: "#/components/schemas/links", - }, - }, - required: ["data"], - title: "PricebookData", -} as const - -export const $pricebook_price = { - description: - "ProductPrice associates a collection of locale specific prices with a product ID.", - type: "object", - properties: { - type: { - type: "string", - examples: ["product-price"], - default: "product-price", - const: "product-price", - }, - attributes: { - type: "object", - properties: { - currencies: { - $ref: "#/components/schemas/tiered-currencies", - }, - sales: { - $ref: "#/components/schemas/sales", - }, - sku: { - type: "string", - examples: ["4c45e4ec-sku"], - }, - }, - required: ["currencies", "sku"], - }, - id: { - type: "string", - examples: ["4c45e4ec-26e0-4043-86e4-c15b9cf985a7"], - "x-go-name": "ID", - }, - }, - additionalProperties: false, - required: ["type", "id", "attributes"], - title: "PricebookPrice", -} as const - -export const $pricebook_price_create_data = { - description: "Container for pricebook prices.", - type: "object", - properties: { - data: { - description: - "ProductPrice associates a collection of locale specific prices with a product ID.", - type: "object", - properties: { - type: { - type: "string", - examples: ["product-price"], - default: "product-price", - const: "product-price", - }, - attributes: { - type: "object", - properties: { - currencies: { - $ref: "#/components/schemas/tiered-currencies", - }, - sales: { - $ref: "#/components/schemas/sales", - }, - sku: { - type: "string", - examples: ["4c45e4ec-sku"], - }, - }, - required: ["currencies", "sku"], - }, - }, - required: ["type", "attributes"], - title: "PricebookPriceCreateArgs", - }, - links: { - $ref: "#/components/schemas/links", - }, - }, - required: ["data"], - title: "PricebookPriceCreateData", -} as const - -export const $pricebook_price_data = { - description: "Container for pricebook prices.", - type: "object", - properties: { - data: { - $ref: "#/components/schemas/pricebook-price", - }, - links: { - $ref: "#/components/schemas/links", - }, - }, - required: ["data"], - title: "PricebookPriceData", -} as const - -export const $product = { - description: "A product in a catalog with the following attributes.", - type: "object", - properties: { - attributes: { - $ref: "#/components/schemas/product-attributes", - }, - id: { - description: "A unique identifier for a product.", - type: "string", - examples: ["8fccaa19-dba9-4621-8d11-31a222a68c7c"], - "x-go-name": "ID", - }, - relationships: { - $ref: "#/components/schemas/product-relationships", - }, - type: { - description: - "This represents the type of object being returned. Always `product`.", - type: "string", - examples: ["product"], - "x-go-name": "Type", - }, - meta: { - $ref: "#/components/schemas/product-meta", - }, - }, - title: "Product", - "x-go-name": "Product", -} as const - -export const $product_attributes = { - description: "A product's attributes.", - type: "object", - properties: { - published_at: { - description: "The date and time a product was published in a catalog.", - type: ["string", "null"], - format: "date-time", - examples: ["1970-01-01T00:00:00.000"], - }, - base_product: { - description: - "If this product is a `parent` product. A `parent` product is a product that has child products that have been built using the `build child products` endpoint.", - type: "boolean", - examples: [false], - default: false, - "x-go-name": "BaseProduct", - }, - base_product_id: { - description: "The unique identifier of a `parent` product.", - type: "string", - examples: ["cdf574bc-e36e-48fc-9eac-01c87839b285"], - "x-go-name": "BaseProductID", - }, - commodity_type: { - description: "The commodity type, either `physical` or `digital`.", - type: "string", - examples: ["physical"], - "x-go-name": "CommodityType", - }, - curated_product: { - description: - "If a product is curated, then the `curated_product` attribute with a value of `true` is displayed. If a product is not curated, the `curated_product` attribute is not displayed.", - type: "boolean", - examples: [true], - "x-go-name": "CuratedProduct", - "x-omitempty": true, - }, - upc_ean: { - description: - "The universal product code or european article number of the product.", - type: "string", - examples: ["0123456"], - "x-go-name": "UpcEan", - }, - manufacturer_part_num: { - description: "The manufacturer part number of the product.", - type: "string", - examples: ["mfn1"], - "x-go-name": "ManufacturerPartNum", - }, - tags: { - description: - "A list of tags associated with the product. A tag must be HTML compatible characters excluding commas and will be stored in lowercase letters.", - type: "array", - items: { - description: "A tag associated with the product.", - type: "string", - examples: ["tag-a"], - }, - "x-go-name": "Tags", - "x-omitempty": true, - }, - price_modifiers: { - description: "A list of price modifier names.", - type: "array", - items: { - description: "A list of price modifier names.", - type: "string", - examples: ["modifier-1"], - }, - "x-go-name": "PriceModifiers", - "x-omitempty": true, - }, - created_at: { - description: "The date and time a product was created.", - type: "string", - format: "date-time", - examples: ["1970-01-01T00:00:00.000"], - "x-go-name": "CreatedAt", - }, - description: { - description: "A description of the product.", - type: "string", - examples: ["This is a product"], - "x-go-name": "Description", - }, - name: { - description: "A name of a product.", - type: "string", - examples: ["Blue shirt"], - "x-go-name": "Name", - }, - price: { - $ref: "#/components/schemas/currencies", - }, - shopper_attributes: { - $ref: "#/components/schemas/shopper_attributes", - }, - tiers: { - $ref: "#/components/schemas/tiers", - }, - components: { - $ref: "#/components/schemas/components", - }, - custom_inputs: { - $ref: "#/components/schemas/custom_inputs", - }, - sku: { - description: "The unique stock keeping unit of the product.", - type: "string", - examples: ["blue-shirt"], - "x-go-name": "Sku", - }, - slug: { - description: - "A label for the product that is used in the URL paths. A slug can contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. By default, the product name is used as the slug.", - type: "string", - examples: ["blue-shirt"], - "x-go-name": "Slug", - }, - status: { - description: "The status of the product, either `live` or `draft`.", - type: "string", - examples: ["live"], - "x-go-name": "Status", - }, - external_ref: { - description: - "The unique attribute associated with the product. This could be an external reference from a separate company system, for example.", - type: ["string", "null"], - "x-go-name": "ExternalRef", - }, - updated_at: { - description: "The date and time a product was updated.", - type: "string", - format: "date-time", - examples: ["1970-01-01T00:00:00.000"], - "x-go-name": "UpdatedAt", - }, - extensions: { - $ref: "#/components/schemas/extensions", - }, - }, - title: "ProductAttributes", - "x-go-name": "ProductAttributes", -} as const - -export const $product_create_data = { - description: "Container for products.", - type: "object", - properties: { - data: { - description: "A new product in a catalog.", - type: "object", - properties: { - attributes: { - description: "A product's attributes.", - type: "object", - properties: { - description: { - type: "string", - examples: ["This is a product"], - }, - name: { - type: "string", - examples: ["Blue shirt"], - }, - sku: { - type: "string", - examples: ["blue-shirt"], - }, - slug: { - type: "string", - examples: ["blue-shirt"], - }, - status: { - type: "string", - examples: ["live"], - }, - locales: { - type: "object", - additionalProperties: { - type: "object", - additionalProperties: { - type: "string", - }, - }, - }, - }, - required: ["name", "status"], - title: "ProductCreateAttributes", - }, - id: { - type: "string", - examples: ["8fccaa19-dba9-4621-8d11-31a222a68c7c"], - "x-go-name": "ID", - }, - type: { - type: "string", - examples: ["product"], - "x-go-name": "Type", - }, - }, - required: ["attributes", "type"], - title: "ProductCreateArgs", - }, - links: { - $ref: "#/components/schemas/links", - }, - }, - title: "ProductData", -} as const - -export const $product_data = { - description: "Container for products.", - type: "object", - properties: { - data: { - $ref: "#/components/schemas/product", - }, - links: { - $ref: "#/components/schemas/links", - }, - included: { - $ref: "#/components/schemas/included", - }, - }, - title: "ProductData", -} as const - -export const $product_diff = { - type: "object", - properties: { - id: { - type: "string", - examples: ["e871df93-c769-49a9-9394-a6fd555b8e8a"], - "x-go-name": "ID", - }, - type: { - type: "string", - examples: ["product_diff"], - "x-go-name": "Type", - }, - attributes: { - type: "object", - properties: { - sku: { - type: "string", - }, - this_release_id: { - type: "string", - }, - other_release_id: { - type: "string", - }, - diff_created_at: { - type: "string", - format: "date-time", - examples: ["1970-01-01T00:00:00.000"], - }, - exists: { - type: "object", - properties: { - this: { - type: "boolean", - }, - other: { - type: "boolean", - }, - }, - required: ["this", "other"], - "x-go-name": "ProductDiffExists", - }, - updated_at: { - type: "object", - properties: { - this: { - type: ["string", "null"], - format: "date-time", - examples: ["1970-01-01T00:00:00.000"], - "x-omitempty": true, - }, - other: { - type: ["string", "null"], - format: "date-time", - examples: ["1970-01-01T00:00:00.000"], - "x-omitempty": true, - }, - }, - "x-go-name": "ProductDiffUpdatedAt", - }, - }, - }, - }, - "x-go-name": "ProductDiff", -} as const - -export const $product_list_data = { - description: "Container for a list of products.", - type: "object", - properties: { - meta: { - $ref: "#/components/schemas/page-meta", - }, - data: { - type: "array", - items: { - $ref: "#/components/schemas/product", - }, - "x-go-name": "Data", - }, - links: { - $ref: "#/components/schemas/links", - }, - included: { - $ref: "#/components/schemas/included", - }, - }, - title: "ProductListData", -} as const - -export const $product_meta = { - description: - "A product's metadata contains information about products, for example, the nodes a product is associated with, any child products, bundle configurations, and so on.", - type: "object", - properties: { - bread_crumbs: { - description: - "The relationship among the array of nodes a product is associated with, demonstrating the linking of the children nodes with the parent nodes. Up to 10 levels of parent nodes are displayed, depending on the number of levels of parent nodes you have.", - type: "object", - additionalProperties: { - type: "array", - items: { - type: "string", - examples: ["8dbb35b2-ef04-477e-974d-e5f3abe6faae"], - }, - }, - "x-omitempty": true, - }, - bread_crumb_nodes: { - description: - "An array of parent node IDs that a product is associated with. Up to 10 levels of parent nodes are displayed, depending on the number of levels of parent nodes you have.", - type: "array", - items: { - type: "string", - examples: ["8dbb35b2-ef04-477e-974d-e5f3abe6faae"], - }, - "x-omitempty": true, - }, - catalog_id: { - description: - "A unique identifier of the catalog a product is associated with.", - type: "string", - examples: ["362a16dc-f7c6-4280-83d6-4fcc152af091"], - "x-go-name": "CatalogID", - }, - pricebook_id: { - description: - "The unique identifier of the price book a product is associated with.", - type: ["string", "null"], - examples: ["f5466169-0037-460c-b181-b02682b6f4de"], - "x-go-name": "PricebookID", - }, - display_price: { - $ref: "#/components/schemas/display-price", - }, - catalog_source: { - description: "The source of a catalog. Always `pim`.", - type: "string", - examples: ["pim"], - const: "pim", - "x-go-name": "CatalogSource", - }, - sale_id: { - description: - "With sales pricing, a store can optionally add a sale price to a product price. For example, a store can schedule seasonal pricing on products without creating a new price book and catalog ruleset. Optionally, a store can schedule the date ranges for the sale products. This is the unique identifier of a sale.", - type: "string", - "x-go-name": "SaleID", - }, - sale_expires: { - description: "The date and time a sale expires.", - type: ["string", "null"], - format: "date-time", - examples: ["1970-01-01T00:00:00.000"], - "x-go-name": "SaleExpires", - }, - original_price: { - $ref: "#/components/schemas/currencies", - }, - original_display_price: { - $ref: "#/components/schemas/display-price", - }, - bundle_configuration: { - $ref: "#/components/schemas/bundle-configuration", - }, - component_products: { - description: - "A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity.", - type: "object", - additionalProperties: { - type: "object", - properties: { - sale_id: { - description: - "With sales pricing, a store can optionally add a sale price to a product price. For example, a store can schedule seasonal pricing on products without creating a new price book and catalog ruleset. Optionally, a store can schedule the date ranges for the sale products. This is the unique identifier of a sale.", - type: "string", - "x-go-name": "SaleID", - }, - sale_expires: { - description: "The date and time a sale expires.", - type: ["string", "null"], - format: "date-time", - examples: ["1970-01-01T00:00:00.000"], - "x-go-name": "SaleExpires", - }, - price: { - $ref: "#/components/schemas/currencies", - }, - display_price: { - $ref: "#/components/schemas/display-price", - }, - original_price: { - $ref: "#/components/schemas/currencies", - }, - original_display_price: { - $ref: "#/components/schemas/display-price", - }, - pricebook_id: { - type: ["string", "null"], - examples: ["f5466169-0037-460c-b181-b02682b6f4de"], - "x-go-name": "PricebookID", - }, - }, - "x-go-name": "ComponentProductMeta", - }, - }, - price_modifiers: { - description: - "You can use price modifiers to change the price property of child products. By default, child products inherit the same price as their base products. Using price modifiers, you can enable child products to inherit a different price.", - type: "object", - additionalProperties: { - description: - "A name for the modifier. The name must be unique and is case-sensitive.", - type: "object", - properties: { - modifier_type: { - description: `There are three modifier types. - - - The \`price_increment\` type increases the prices of a product. - - The \`price_decrement\` type decreases the price of a product. - - The \`price_equals\` type sets the price of a product to an amount you specify. -`, - type: "string", - examples: ["price_equals"], - }, - currencies: { - $ref: "#/components/schemas/currencies", - }, - }, - "x-go-name": "PriceModifierMeta", - }, - }, - tiers: { - description: - "You can use tiers to allow your store to offer different pricing for minimum quantities of items that your shoppers purchase.", - type: "object", - additionalProperties: { - description: "The name of the tier, such as `Pencils`.", - type: "object", - properties: { - sale_id: { - description: "The unique identifier of a sale.", - type: "string", - "x-go-name": "SaleID", - }, - sale_expires: { - description: "The date and time a sale expires.", - type: ["string", "null"], - format: "date-time", - examples: ["1970-01-01T00:00:00.000"], - "x-go-name": "SaleExpires", - }, - display_price: { - $ref: "#/components/schemas/display-price", - }, - original_price: { - $ref: "#/components/schemas/currencies", - }, - original_display_price: { - $ref: "#/components/schemas/display-price", - }, - }, - "x-go-name": "ProductMetaTier", - }, - "x-go-name": "ProductMetaTiers", - }, - variation_matrix: { - description: - "The `variation_matrix` object lists the variation IDs and variation option IDs and their corresponding product IDs that are generated when the variation and variation options are built with a product. If no variations are available, the `variation_matrix` is empty.", - type: "object", - }, - variations: { - description: - "If you specified `build_rules` for a product, the `variations` object lists the variation option IDs that you specified to include when building your child products. If no `build_rules` are specified, all the variation and variation options available for a product are displayed. If a product does not have any variations, then the `variations` object is not displayed.", - type: "array", - items: { - $ref: "#/components/schemas/variation", - }, - "x-omitempty": true, - }, - child_option_ids: { - description: - "An array of variation options IDs that a child product has.", - type: ["array", "null"], - items: { - type: "string", - examples: [ - [ - "8dbb35b2-ef04-477e-974d-e5f3abe6faae", - "6ddf2a66-d805-449c-a0e1-8e81335e31a6", - ], - ], - }, - "x-omitempty": true, - }, - child_variations: { - description: - "If this is a child product, the `child_variations` object lists the variation option IDs that define this child product.", - type: ["array", "null"], - items: { - $ref: "#/components/schemas/variation", - }, - "x-omitempty": true, - }, - product_types: { - description: `Commerce automatically assigns types to the products you create. In Commerce Manager, you can see at a glance the product types in a list of a products. In addition, you can filter on product types in both the API and Commerce Manager. - - Product types can also be used in catalogs. For example, in your catalog, you can filter on parent so that only your parent products are displayed in your storefront. - - Products have one of the following types: - - - **standard** - Standard products are a standalone products. - - **parent** - A parent product is a product that has child products that have been built using the \`Build Child Products\` endpoint. - - **child** - When you configure product variations and variation options for parent products, the child products derived from the parent products are automatically created in Commerce. - - **bundle** - A bundle is a purchasable product, comprising two or more standalone products (in other words, components) to be sold together. -`, - type: "array", - items: { - type: "string", - }, - "x-go-name": "ProductTypes", - "x-omitempty": true, - }, - language: { - description: - "If you storefront supports multiple languages, your storefront's preferred language and locale.", - type: "string", - examples: ["en-GB"], - }, - }, - title: "ProductMeta", - "x-go-name": "ProductMeta", - "x-omitempty": true, -} as const - -export const $variation_option = { - description: "The options available for a variation.", - type: "object", - properties: { - id: { - description: "A unique identifier for an option.", - type: "string", - format: "uuid", - "x-go-name": "ID", - }, - name: { - description: "The name of the option.", - type: "string", - }, - sort_order: { - description: - "If you specified a `sort_order` when creating your variations and variation options, then use the `sort_order` value to program your storefront to display the variations and variation options in the order that you want.", - type: ["integer", "null"], - "x-go-name": "Sort Order", - }, - description: { - description: "The option description to display to customers.", - type: "string", - }, - }, - "x-go-name": "ProductVariationOption", -} as const - -export const $variation = { - type: "object", - properties: { - id: { - description: "A unique identifier of a variation.", - type: "string", - format: "uuid", - "x-go-name": "ID", - }, - name: { - description: "The name of a variation.", - type: "string", - }, - sort_order: { - description: - "If you specified a `sort_order` when creating your variations and variation options, then use the `sort_order` value to program your storefront to display the variations and variation options in the order that you want.", - type: ["integer", "null"], - "x-go-name": "Sort Order", - }, - option: { - $ref: "#/components/schemas/variation_option", - }, - options: { - description: "The options available for this variation.", - type: "array", - items: { - $ref: "#/components/schemas/variation_option", - }, - "x-omitempty": true, - }, - }, - "x-go-name": "ProductVariation", -} as const - -export const $bundle_configuration_data = { - description: "Container for a bundle configuration.", - type: "object", - properties: { - data: { - $ref: "#/components/schemas/bundle-configuration", - }, - }, - required: ["data"], - title: "BundleConfigurationData", -} as const - -export const $bundle_configuration = { - description: - "A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity.", - type: "object", - properties: { - selected_options: { - description: - "The product options included in a component. This can be the ID of another bundle.", - type: "object", - additionalProperties: { - description: - "The unique identifier of the component, for example, `games`.", - type: "object", - additionalProperties: { - description: - "The number of this product option that a shopper must purchase.", - type: "integer", - format: "int64", - }, - }, - }, - }, - required: ["selected_options"], - title: "BundleConfiguration", - "x-go-name": "ProductBundleConfiguration", -} as const - -export const $product_reference = { - description: "A product identifier.", - type: "object", - properties: { - id: { - description: "A unique identifier for a product.", - type: "string", - format: "uuid", - "x-go-name": "ID", - }, - type: { - description: - "This represents the type of object being returned. Always `product`.", - type: "string", - examples: ["product"], - const: "product", - "x-go-name": "Type", - }, - }, - title: "ProductReference", - "x-go-name": "ProductReference", - "x-nullable": "true", -} as const - -export const $product_reference_list_data = { - description: "Container for a list of product references.", - type: "object", - properties: { - meta: { - $ref: "#/components/schemas/page-meta", - }, - data: { - $ref: "#/components/schemas/product-references", - }, - links: { - $ref: "#/components/schemas/links", - }, - }, - title: "ProductReferenceListData", -} as const - -export const $product_references = { - description: "A list of product identifiers.", - type: "array", - items: { - $ref: "#/components/schemas/product-reference", - }, - title: "ProductReferences", - "x-go-name": "ProductReferences", -} as const - -export const $product_relationships = { - description: - "Relationships allow you to move between requests. Includes links to the parent and child products, bundle component products, files, and main images associated with a product.", - type: "object", - properties: { - parent: { - description: - "The details of a `parent` product. A `parent` product is a product that has child products that have been built using the `Build Child Products` endpoint.", - type: "object", - properties: { - data: { - $ref: "#/components/schemas/product-reference", - }, - }, - "x-go-name": "Parent", - "x-omitempty": true, - }, - children: { - description: - "The details of a `child` product. When you configure product variations and variation options for parent products, the child products derived from the parent products are automatically created in Commerce.", - type: "object", - properties: { - data: { - $ref: "#/components/schemas/product-references", - }, - links: { - $ref: "#/components/schemas/self-link", - }, - }, - "x-go-name": "Children", - "x-omitempty": true, - }, - files: { - $ref: "#/components/schemas/files-relationship", - }, - main_image: { - $ref: "#/components/schemas/main-image-relationship", - }, - component_products: { - $ref: "#/components/schemas/component-products-relationship", - }, - }, - title: "ProductRelationships", - "x-go-name": "ProductRelationships", - "x-omitempty": true, -} as const - -export const $product_relationships_data = { - description: "Container for product relationships.", - type: "object", - properties: { - data: { - $ref: "#/components/schemas/product-relationships", - }, - links: { - $ref: "#/components/schemas/links", - }, - }, - title: "ProductRelationshipsData", -} as const - -export const $products_for_cart = { - description: - "A list of products to be added to cart. Can be type product-data or error-response.", - type: "object", - properties: { - data: { - type: "array", - items: {}, - "x-go-name": "Data", - }, - included: { - type: ["object", "null"], - properties: { - component_products: { - type: "array", - items: { - $ref: "#/components/schemas/product", - }, - "x-go-name": "ComponentProducts", - }, - }, - "x-go-name": "Included", - }, - }, - required: ["data"], - title: "ProductsForCart", - "x-go-name": "ProductsForCart", -} as const - -export const $products_for_cart_configuration = { - description: "A list of product id or sku and bundle configuration for cart.", - type: "object", - properties: { - data: { - type: "array", - items: { - type: "object", - properties: { - id: { - type: ["string", "null"], - format: "uuid", - "x-go-name": "ID", - }, - sku: { - type: ["string", "null"], - "x-go-name": "SKU", - }, - bundle_configuration: { - $ref: "#/components/schemas/bundle-configuration", - }, - }, - }, - minItems: 1, - "x-go-name": "Data", - }, - }, - required: ["data"], - title: "ProductsForCartConfiguration", - "x-go-name": "ProductsForCartConfiguration", -} as const - -export const $related_link = { - description: - "A URL to a related object, for example, catalog rules, hierarchies, price books, products and deltas.", - type: "object", - properties: { - related: { - description: - "A URL to a related object, for example, catalog rules, hierarchies, price books, products and deltas.", - type: "string", - }, - }, - required: ["related"], -} as const - -export const $self_link = { - description: "Links are used to allow you to move between requests.", - type: "object", - properties: { - self: { - description: - "Single entities use a self parameter with a link to that specific resource.", - type: "string", - }, - }, - required: ["self"], -} as const - -export const $release = { - description: - "A catalog release represents a collection of hierarchical product data, price books and catalogs rules.", - type: "object", - properties: { - id: { - description: "A unique identifier for the catalog release.", - type: "string", - examples: ["8dbb35b2-ef04-477e-974d-e5f3abe6faae"], - "x-go-name": "ID", - }, - attributes: { - type: "object", - properties: { - name: { - description: "The name of a release.", - type: "string", - examples: ["Clothing"], - }, - published_at: { - description: "The date and time a release was published.", - type: ["string", "null"], - format: "date-time", - examples: ["1970-01-01T00:00:00.000"], - }, - catalog_id: { - description: "A unique identifier for the catalog.", - type: "string", - examples: ["0194f54d-f2a1-4e33-9a6e-9ec366152490"], - }, - description: { - description: "A description of the catalog release.", - type: "string", - examples: ["Catalog for Store 123"], - default: "", - }, - hierarchies: { - description: "An array of hierarchy IDs associated with the release.", - type: "array", - items: { - $ref: "#/components/schemas/node-reference", - }, - "x-go-name": "RootNodes", - }, - }, - }, - relationships: { - $ref: "#/components/schemas/release-relationships", - }, - type: { - description: - "This represents the type of object being returned. Always `catalog-release`.", - type: "string", - "x-go-name": "Type", - }, - meta: { - $ref: "#/components/schemas/release-meta", - }, - }, - title: "Release", - "x-go-name": "Release", -} as const - -export const $release_data = { - description: "Container for a catalog release.", - type: "object", - properties: { - data: { - $ref: "#/components/schemas/release", - }, - links: { - $ref: "#/components/schemas/links", - }, - }, - title: "Release Data", -} as const - -export const $release_list_data = { - description: "Container for a list of catalog releases.", - type: "object", - properties: { - data: { - type: "array", - items: { - $ref: "#/components/schemas/release", - }, - }, - links: { - $ref: "#/components/schemas/links", - }, - }, - title: "ReleaseListData", -} as const - -export const $release_meta = { - description: "A release's metadata.", - type: "object", - properties: { - created_at: { - description: "The date and time a release is created.", - type: "string", - format: "date-time", - examples: ["1970-01-01T00:00:00.000"], - }, - started_at: { - description: - "The date and time a release is available for use. In other words, the date and time the status of a catalog release changes to PUBLISHED, rather than IN PROGRESS.", - type: ["string", "null"], - format: "date-time", - examples: ["1970-01-01T00:00:00.000"], - }, - updated_at: { - description: "The date and time a release is updated.", - type: ["string", "null"], - format: "date-time", - examples: ["1970-01-01T00:00:00.000"], - }, - release_status: { - description: "The status of the current release.", - type: "string", - enum: ["PENDING", "IN_PROGRESS", "FAILED", "PUBLISHED"], - }, - language: { - description: "Your storefront's preferred language code and locale.", - type: "string", - examples: ["en-GB"], - }, - is_full_publish: { - description: `Indicates that a full publish was performed (either because this is the first time a catalog has been published or because of a change that occurred, for example, adding/removing a price book or hierarchy). When determining whether delta data needs to be refreshed, ignore this attribute and always use the \`is_full_delta\` attribute. -`, - type: "boolean", - examples: [false], - default: false, - "x-go-name": "IsFullPublish", - }, - is_full_delta: { - description: `Indicates whether the release delta file contains the full content of a catalog release. Using a search service as an example, if the \`is_full_delta\` attribute is \`true\`, you should remove all data about that catalog release from the search service before injecting fresh data from the delta file. If the \`is_full_delta\` attribute is \`false\`, then data from the previous catalog release overlays the existing data in the delta file. The \`is_full_delta\` attribute is always \`true\` the first time a catalog is published. -`, - type: "boolean", - examples: [false], - default: false, - "x-go-name": "IsFullDelta", - }, - total_products: { - description: - "The total number of products displayed in a catalog release.", - type: ["integer", "null"], - format: "int64", - "x-go-name": "TotalProducts", - }, - total_nodes: { - description: - "The total number of hierarchy nodes displayed in a catalog release.", - type: ["integer", "null"], - format: "int64", - "x-go-name": "TotalNodes", - }, - percent_completed: { - description: - "An integer that represents the progress of a catalog publish. The attribute starts at `0` and reaches `100` when publishing is complete.", - type: ["integer", "null"], - format: "int32", - "x-go-name": "PercentCompleted", - }, - owner: { - description: - "The owner of the resource, can be either `organization` or `store`.", - type: ["string", "null"], - enum: ["store", "organization"], - "x-go-name": "Owner", - }, - }, - title: "ReleaseMeta", - "x-go-name": "ReleaseMeta", - "x-omitempty": true, -} as const - -export const $release_relationships = { - description: - "Relationships are established between different catalog entities. For example, products, hierarchies, price books, and catalog rules are related to a catalog, as they are associated with it.", - type: "object", - properties: { - delta: { - description: - "A URL to a delta document that describes the changes between catalog releases.", - type: "object", - properties: { - links: { - $ref: "#/components/schemas/related-link", - }, - }, - }, - products: { - description: "A URL to all products included in a catalog release.", - type: "object", - properties: { - links: { - $ref: "#/components/schemas/related-link", - }, - }, - }, - hierarchies: { - description: "A URL to all hierarchies included in a catalog release.", - type: "object", - properties: { - links: { - $ref: "#/components/schemas/related-link", - }, - }, - required: ["links"], - }, - }, - title: "ReleaseRelationships", - "x-go-name": "ReleaseRelationships", -} as const - -export const $rule = { - description: - "A catalog rule specifies which catalog to use for a given shopper context.", - type: "object", - properties: { - id: { - description: - "The catalog rule ID. Use this to get, modify, or delete the catalog rule.", - type: "string", - examples: ["8dbb35b2-ef04-477e-974d-e5f3abe6faae"], - }, - attributes: { - type: "object", - properties: { - name: { - description: - "The name of a catalog rule. The name must not contain any spaces.", - type: "string", - examples: ["rule-123"], - }, - description: { - description: "A brief description of the purpose of a catalog rule.", - type: "string", - examples: ["Catalog Rule for most favored customers"], - default: "", - "x-omitempty": true, - }, - account_ids: { - description: - "The list of accounts who are eligible to see this catalog. If this field is empty, the rule matches all accounts.", - type: "array", - items: { - type: "string", - }, - "x-omitempty": true, - }, - customer_ids: { - description: - "The list of customers who are eligible to see this catalog. If empty, the rule matches all customers.", - type: "array", - items: { - type: "string", - }, - "x-omitempty": true, - }, - channels: { - description: - "The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests.", - type: "array", - items: { - type: "string", - }, - "x-omitempty": true, - }, - tags: { - description: - "A list of user-defined tags that can be used to further restrict the eligibility criteria for this rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header.", - type: "array", - items: { - type: "string", - }, - "x-omitempty": true, - }, - schedules: { - description: `Specifies a time period when a catalog is displayed, such as on a specific date or during summer. Requests populate the rule tag using the \`EP-Context-Tag\` header. - -The schedules attribute must include the following. - -- \`valid_from\` matches the date and time that the catalog is displayed from. -- \`valid_to\` matches the date and time the catalog is displayed to. - -Commerce runs on UTC time. - -You can offset the timezone by adding the offset to the end of the date and time. For example, a catalog which contains a sale hierarchy that should appear for a set timeframe may be scheduled to publish on a given date and time within a given timezone. For instance, a sale that should begin on 1st of June 2022 05:00 ET and end on the 15th of June 2022 at 23:50 PT would have a valid schedule of \`"valid_from": "2022-06-01T05:00:00.000-05:00"\`, \`"valid_to": "2022-06-15T11:59:99.000-08:00"\`. -`, - type: "array", - items: { - $ref: "#/components/schemas/rule-schedule", - }, - "x-omitempty": true, - }, - catalog_id: { - description: "The unique identifier of a catalog.", - type: "string", - examples: ["d09b4e16-08a5-4f42-817c-6e0d98acbb63"], - }, - created_at: { - description: "The date and time a catalog rule was created.", - type: "string", - format: "date-time", - examples: ["2020-09-22T09:00:00"], - }, - updated_at: { - description: "The date and time a catalog release is updated.", - type: "string", - format: "date-time", - examples: ["2020-09-22T09:00:00"], - }, - }, - required: ["name", "catalog_id", "created_at", "updated_at"], - }, - type: { - description: - "This represents the type of object being returned. Always `catalog_rule`.", - type: "string", - examples: ["catalog_rule"], - const: "catalog_rule", - }, - }, - required: ["id", "type", "attributes"], - title: "Catalog Rule", -} as const - -export const $rule_create_data = { - description: - "A catalog rule specifies which catalog to use for a given shopper context.", - type: "object", - properties: { - data: { - type: "object", - properties: { - attributes: { - type: "object", - properties: { - name: { - description: - "The name of a catalog rule. The name must not contain spaces.", - type: "string", - examples: ["rule-123"], - minLength: 1, - }, - description: { - description: - "A brief description of the purpose of a catalog rule.", - type: ["string", "null"], - examples: ["Catalog Rule for most favored customers"], - default: "", - }, - account_ids: { - description: - "The list of accounts who are eligible to see this catalog. If this field is empty, the rule matches all accounts.", - type: ["array", "null"], - items: { - type: "string", - }, - }, - customer_ids: { - description: - "The list of customers who are eligible to see this catalog. If empty, the rule matches all customers.", - type: ["array", "null"], - items: { - type: "string", - }, - }, - channels: { - description: - "The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests.", - type: ["array", "null"], - items: { - type: "string", - }, - }, - tags: { - description: - "A list of user-defined tags that can be used to further restrict the eligibility criteria for this rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header.", - type: ["array", "null"], - items: { - type: "string", - }, - }, - schedules: { - description: `Specifies a time period when a catalog is displayed, such as on a specific date or during summer. Requests populate the rule tag using the \`EP-Context-Tag\` header. - -The schedules attribute must include the following. - -- \`valid_from\` matches the date and time that the catalog is displayed from. -- \`valid_to\` matches the date and time the catalog is displayed to. - -Commerce runs on UTC time. - -You can offset the timezone by adding the offset to the end of the date and time. For example, a catalog which contains a sale hierarchy that should appear for a set timeframe may be scheduled to publish on a given date and time within a given timezone. For instance, a sale that should begin on 1st of June 2022 05:00 ET and end on the 15th of June 2022 at 23:50 PT would have a valid schedule of \`"valid_from": "2022-06-01T05:00:00.000-05:00"\`, \`"valid_to": "2022-06-15T11:59:99.000-08:00"\`. -`, - type: ["array", "null"], - items: { - $ref: "#/components/schemas/rule-schedule", - }, - }, - catalog_id: { - description: "The unique identifier of a catalog.", - type: "string", - examples: ["d09b4e16-08a5-4f42-817c-6e0d98acbb63"], - }, - }, - required: ["name", "catalog_id"], - }, - type: { - description: - "This represents the type of object being returned. Always `catalog_rule`.", - type: "string", - examples: ["catalog_rule"], - const: "catalog_rule", - }, - }, - required: ["type", "attributes"], - }, - }, - required: ["data"], - title: "CatalogRuleCreateData", -} as const - -export const $rule_data = { - description: "Container for a single catalog rule.", - type: "object", - properties: { - data: { - $ref: "#/components/schemas/rule", - }, - links: { - $ref: "#/components/schemas/links", - }, - }, - required: ["data"], - title: "CatalogRuleData", -} as const - -export const $rule_list_data = { - description: "Container for a list of catalog rules.", - type: "object", - properties: { - meta: { - $ref: "#/components/schemas/page-meta", - }, - data: { - type: "array", - items: { - $ref: "#/components/schemas/rule", - }, - }, - links: { - $ref: "#/components/schemas/links", - }, - }, - required: ["data"], - title: "CatalogRuleListData", -} as const - -export const $rule_schedule = { - description: "A period of time during which a catalog is valid", - type: "object", - properties: { - valid_from: { - description: - "Matches the date and time that the catalog is displayed from.", - type: ["string", "null"], - format: "date-time", - examples: ["2020-09-22T09:00:00"], - "x-go-name": "ValidFrom", - }, - valid_to: { - description: "Matches the date and time the catalog is displayed to.", - type: ["string", "null"], - format: "date-time", - examples: ["2020-09-22T09:00:00"], - "x-go-name": "ValidTo", - }, - }, - title: "Catalog Schedule", - "x-go-name": "RuleSchedule", -} as const - -export const $rule_update_data = { - description: - "A catalog rule specifies which catalog to use for a given shopper context.", - type: "object", - properties: { - data: { - type: "object", - properties: { - id: { - description: - "The catalog rule ID. Use this to get, modify, or delete the catalog rule.", - type: "string", - examples: ["8dbb35b2-ef04-477e-974d-e5f3abe6faae"], - }, - attributes: { - type: "object", - properties: { - name: { - description: - "The name of a catalog rule. The name must not contain spaces.", - type: ["string", "null"], - examples: ["rule-123"], - minLength: 1, - }, - description: { - description: "A description of the purpose of a catalog rule.", - type: ["string", "null"], - examples: ["Catalog Rule for most favored customers"], - default: "", - }, - account_ids: { - description: - "Specifies the list of accounts who are eligible to see this catalog. If this field is empty, the rule matches all accounts.", - type: ["array", "null"], - items: { - type: "string", - }, - }, - customer_ids: { - description: - "The list of customers who are eligible to see this catalog. If empty, the rule matches all customers.", - type: ["array", "null"], - items: { - type: "string", - }, - }, - channels: { - description: - "The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests.", - type: ["array", "null"], - items: { - type: "string", - }, - }, - schedules: { - description: `Specifies a time period when a catalog is displayed, such as on a specific date or during summer. Requests populate the rule tag using the \`EP-Context-Tag\` header. - -The schedules attribute must include the following. - -- \`valid_from\` matches the date and time that the catalog is displayed from. -- \`valid_to\` matches the date and time the catalog is displayed to. - -Commerce runs on UTC time. - -You can offset the timezone by adding the offset to the end of the date and time. For example, a catalog which contains a sale hierarchy that should appear for a set timeframe may be scheduled to publish on a given date and time within a given timezone. For instance, a sale that should begin on 1st of June 2022 05:00 ET and end on the 15th of June 2022 at 23:50 PT would have a valid schedule of \`"valid_from": "2022-06-01T05:00:00.000-05:00"\`, \`"valid_to": "2022-06-15T11:59:99.000-08:00"\`. -`, - type: ["array", "null"], - items: { - $ref: "#/components/schemas/rule-schedule", - }, - }, - tags: { - description: - "A list of user-defined tags that can be used to further restrict the eligibility criteria for this rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header.", - type: ["array", "null"], - items: { - type: "string", - }, - }, - catalog_id: { - description: "The unique identifier of a catalog rule.", - type: ["string", "null"], - examples: ["d09b4e16-08a5-4f42-817c-6e0d98acbb63"], - }, - }, - }, - type: { - description: - "This represents the type of object being returned. Always `catalog_rule`.", - type: "string", - examples: ["catalog_rule"], - const: "catalog_rule", - }, - }, - required: ["id", "type"], - }, - }, - required: ["data"], - title: "CatalogRuleUpdateData", -} as const - -export const $sale = { - description: "A set of sale prices and a validity period.", - type: "object", - properties: { - schedule: { - $ref: "#/components/schemas/schedule", - }, - currencies: { - $ref: "#/components/schemas/tiered-currencies", - }, - }, -} as const - -export const $sales = { - description: "A set of sale specifications", - type: "object", - additionalProperties: { - $ref: "#/components/schemas/sale", - }, - title: "Sales", -} as const - -export const $schedule = { - description: "A definition of the times at which a sale is valid", - type: "object", - properties: { - valid_from: { - type: ["string", "null"], - format: "date-time", - examples: ["2020-09-22T09:00:00"], - "x-go-name": "ValidFrom", - }, - valid_to: { - type: ["string", "null"], - format: "date-time", - examples: ["2020-09-22T09:00:00"], - "x-go-name": "ValidTo", - }, - }, - "x-go-name": "Schedule", -} as const - -export const $tier = { - description: "The name of the tier, for example, `Pencils`.", - type: "object", - properties: { - minimum_quantity: { - description: - "The minimum quantity of 1 or more defined for the specified price. If a minimum quantity is not specified, an error is returned.", - type: "integer", - examples: ["5"], - }, - price: { - $ref: "#/components/schemas/currencies", - }, - }, - title: "Tier", -} as const - -export const $tiered_amount = { - description: - "The three-letter ISO code for the currency associated with this price.", - type: "object", - properties: { - amount: { - description: - "The price in the lowest denomination for the specified currency. This is a product's list price.", - type: "integer", - format: "int64", - examples: [100], - "x-go-name": "Amount", - "x-omitempty": false, - }, - includes_tax: { - description: "Whether this price includes tax.", - type: "boolean", - examples: [false], - default: false, - "x-go-name": "IncludesTax", - }, - tiers: { - description: - "The price tier that an item is eligible for based on the quantity purchased. You cannot have conflicting tiers within the same currencies block.", - type: "object", - additionalProperties: { - description: "The name of the tier, for example, `Pencils`.", - type: "object", - properties: { - minimum_quantity: { - description: - "The minimum quantity of 1 or more defined for the specified price. If a minimum quantity is not specified, an error is returned.", - type: "integer", - examples: [5], - "x-go-name": "MinimumQuantity", - }, - amount: { - description: "The price for each quantity.", - type: "integer", - format: "int64", - examples: [100], - "x-go-name": "Amount", - "x-omitempty": false, - }, - }, - "x-go-name": "TierAmount", - }, - "x-go-name": "Tiers", - }, - }, - title: "TieredAmount", - "x-go-name": "TieredAmount", -} as const - -export const $tiered_currencies = { - description: "Collection of currency specific prices for a product.", - type: "object", - additionalProperties: { - $ref: "#/components/schemas/tiered-amount", - }, - title: "TieredCurrencies", -} as const - -export const $tiers = { - description: - "The price tier that an item is eligible for based on the quantity purchased. You cannot have conflicting tiers within the same currencies block.", - type: "object", - additionalProperties: { - $ref: "#/components/schemas/tier", - }, - title: "Tiers", -} as const - -export const $catalog_release_create_data = { - description: "Creates a catalog release with the following attributes.", - type: "object", - properties: { - data: { - type: "object", - properties: { - export_full_delta: { - description: `Set to \`true\` if you want to export all the data from a catalog release in a delta link. The \`is_full_delta\` attribute is returned from the \`get a release of a catalog\` endpoint. The \`is_full_delta\` attribute tells you if the delta file contains the full content of a catalog release. You can use the \`is_full_delta\` to determine if you need to refresh the data in your company system before publishing a catalog release with fresh data in a delta link. Using a search service as an example, if the \`is_full_delta\` attribute is true, you should remove all data about that catalog from the search service before publishing a catalog release and injecting fresh data from the delta file. If the \`is_full_delta\` attribute is false, then data from the previous catalog overlays the existing data in the delta file. The \`is_full_delta\` attribute is always \`true\` the first time a catalog is published. -`, - type: "boolean", - "x-go-name": "ExportFullDelta", - }, - include_organization_resources: { - description: - "If you are publishing a catalog in a store that contains resources from an organization, you must set this to true and you must enable the **Include Organization Resources in Catalog Publishes** checkbox in Commerce Manager. See [**Multi-Store Management Solutions**](/docs/api/pxm/catalog/publish-release).", - type: ["boolean", "null"], - "x-go-name": "IncludeOrganizationResources", - }, - }, - }, - }, - title: "CatalogReleaseCreateData", -} as const - -export const $included = { - description: - "Included is an array of resources that are included in the response.", - type: "object", - properties: { - main_images: { - description: "The main images associated with a product.", - type: "array", - items: { - $ref: "#/components/schemas/elastic-path-file", - }, - }, - component_products: { - description: "The component products associated with a product.", - type: "array", - items: { - $ref: "#/components/schemas/product", - }, - }, - files: { - description: "The files associated with a product.", - type: "array", - items: { - $ref: "#/components/schemas/elastic-path-file", - }, - }, - }, -} as const - -export const $elastic_path_file = { - type: "object", - properties: { - id: { - description: "The unique identifier for this file.", - type: "string", - format: "uuid", - }, - type: { - description: "The type represents the object being returned.", - type: "string", - examples: ["file"], - }, - file_name: { - description: "The name of the file.", - type: "string", - examples: ["file_name.jpg"], - }, - mime_type: { - description: "The mime type of the file.", - type: "string", - examples: ["image/jpeg"], - }, - file_size: { - description: "The size of the file. Required when uploading files.", - type: "integer", - examples: [36000], - }, - public: { - description: - "DEPRECATED Whether the file public or not. Required when uploading files.", - type: "boolean", - examples: [true], - }, - meta: { - $ref: "#/components/schemas/file-meta", - }, - links: { - $ref: "#/components/schemas/links", - }, - link: { - $ref: "#/components/schemas/file-link", - }, - }, - title: "ElasticPathFile", -} as const - -export const $file_meta = { - properties: { - timestamps: { - description: "The date and time the file was created.", - type: "object", - properties: { - created_at: { - description: "The date and time the file was created.", - type: "string", - examples: ["2023-10-11T13:02:25.293Z"], - }, - }, - }, - dimensions: { - description: "The file dimensions.", - type: "object", - properties: { - width: { - description: "The width of the file.", - type: "integer", - examples: [1800], - }, - height: { - description: "The height of the file.", - type: "integer", - examples: [1000], - }, - }, - }, - }, -} as const - -export const $file_link = { - description: "The publicly available URL for this file.", - type: "object", - properties: { - href: { - description: "The publicly available URL for this file.", - type: "string", - examples: [ - "https://files-eu.epusercontent.com/e8c53cb0-120d-4ea5-8941-ce74dec06038/f8cf26b3-6d38-4275-937a-624a83994702.png", - ], - }, - }, -} as const - -export const $CartsRequest = { - title: "CartsRequest", - type: "object", - properties: { - description: { - type: "string", - description: "The cart description.", - example: "cart description", - }, - discount_settings: { - $ref: "#/components/schemas/DiscountSettings", - }, - name: { - description: - "The cart name provided by the shopper. A cart name must contain 1 to 255 characters. You cannot use whitespace characters, but special characters are permitted. For more information, see the [Safe Characters](/guides/Getting-Started/safe-characters) section.", - type: "string", - example: "my cart name", - }, - snapshot_date: { - description: - "This optional parameter sets a reference date for the cart. If this parameter is set, it allows the cart to act as one that might occur on that specified date. For example, such future carts might acquire future-enabled discounts, allowing users to test and validate future interactions with carts. The snapshot_date must be in the format 2026-02-21T15:07:25Z. By default, this parameter is left empty.", - type: "string", - example: "2026-09-10T00:12:00Z", - }, - custom_attributes: { - $ref: "#/components/schemas/CustomAttributes", - }, - payment_intent_id: { - description: - "To remove the Stripe payment intent from a cart, pass the empty value in the `payment_intent_id` field. You must use an empty value for this field. You cannot use this endpoint to directly update the cart to use an existing Payment Intent.", - type: "string", - example: "", - }, - }, -} as const - -export const $DiscountSettings = { - title: "DiscountSettings", - type: "object", - properties: { - custom_discounts_enabled: { - description: - "This parameter enables custom discounts for a cart. When set to true, Elastic Path promotions will not be applied to the new carts. Default is set from cart discount settings for the store. See [Cart Settings](/docs/api/settings/put-v-2-settings-cart).", - type: "boolean", - example: false, - }, - use_rule_promotions: { - description: - "When set to true, this parameter allows the cart to use rule promotions.", - type: "boolean", - example: false, - }, - }, -} as const - -export const $CustomAttributes = { - title: "CustomAttributes", - type: "object", - properties: { - custom_attributes: { - description: - "Specifies the custom attributes for the cart object. The attribute can be any string, numerical, and underscore. A cart can have maximum of 20 custom attributes.", - type: "object", - properties: { - attribute: { - description: "Specifies the attribute `type` and `value`.", - type: "object", - properties: { - type: { - description: - "Specifies the type of the attribute such as string, integer, boolean, and float.", - type: "string", - }, - value: { - description: "Specifies the value of the attribute.", - oneOf: [ - { - type: "string", - }, - { - type: "number", - }, - { - type: "boolean", - }, - ], - }, - }, - }, - }, - }, - }, -} as const - -export const $CartResponse = { - title: "CartResponse", - type: "object", - properties: { - id: { - description: - "The unique identifier for the cart. Use SDK or create it yourself.", - type: "string", - }, - type: { - description: "The type of object being returned.", - type: "string", - example: "cart", - }, - name: { - description: "The name of this cart.", - type: "string", - example: "cart name", - }, - description: { - description: "A description of the cart.", - type: "string", - example: "cart description", - }, - discount_settings: { - $ref: "#/components/schemas/DiscountSettings", - }, - payment_intent_id: { - description: - "Stripe-assigned unique identifier for the linked Payment Intent", - type: "string", - }, - links: { - type: "object", - properties: { - self: { - description: "A link to that specific resource.", - type: "string", - }, - }, - example: "https://useast.api.elasticpath.com/v2/carts/1", - }, - meta: { - type: "object", - properties: { - display_price: { - type: "object", - properties: { - with_tax: { - $ref: "#/components/schemas/FormattedPriceData", - }, - without_tax: { - $ref: "#/components/schemas/FormattedPriceData", - }, - tax: { - $ref: "#/components/schemas/FormattedPriceData", - }, - discount: { - $ref: "#/components/schemas/FormattedPriceData", - }, - without_discount: { - $ref: "#/components/schemas/FormattedPriceData", - }, - shipping: { - $ref: "#/components/schemas/FormattedPriceData", - }, - }, - }, - timestamps: { - $ref: "#/components/schemas/Timestamps", - }, - }, - }, - relationships: { - type: "object", - properties: { - customers: { - type: "object", - properties: { - data: { - type: "object", - properties: { - type: { - description: "The type of related object.", - type: "string", - example: "customers", - }, - id: { - description: "The ID of the customer.", - type: "string", - format: "uuid", - readOnly: true, - example: "662461ad-ddcb-4dbd-8ed7-ade9aa63b5f9", - }, - }, - }, - }, - }, - items: { - type: "object", - properties: { - data: { - type: "object", - properties: { - type: { - description: "The type of related object.", - type: "string", - example: "cart_item", - }, - id: { - description: "The unique identifier for the cart item", - type: "string", - format: "uuid", - readOnly: true, - example: "1cf8b15b-4f12-43c5-837c-dbbc09aefa55", - }, - }, - }, - }, - }, - }, - }, - }, -} as const - -export const $CartItemsObjectRequest = { - title: "Cart Items Object Request", - oneOf: [ - { - $ref: "#/components/schemas/CartItemObject", - }, - { - $ref: "#/components/schemas/CartMergeObjectRequest", - }, - { - $ref: "#/components/schemas/CustomItemObject", - }, - { - $ref: "#/components/schemas/ReOrderObjectRequest", - }, - { - $ref: "#/components/schemas/PromotionItemObject", - }, - ], -} as const - -export const $CartItemObject = { - title: "Cart Item Object", - type: "object", - properties: { - data: { - allOf: [ - { - $ref: "#/components/schemas/CartItemObjectData", - }, - { - $ref: "#/components/schemas/CartItemResponse", - }, - ], - }, - }, -} as const - -export const $CartItemObjectData = { - title: "Cart Item Object Data", - type: "object", - required: ["type", "quantity"], - properties: { - type: { - description: "The type of object being returned.", - type: "string", - enum: ["cart_item"], - }, - quantity: { - description: "The number of items added to the cart.", - type: "number", - example: 2, - }, - id: { - type: "string", - format: "uuid", - description: - "Specifies the ID of the product you want to add to cart. (use this OR sku)", - example: "78d7b5c2-c852-40ad-87bb-beb161f61f37", - }, - sku: { - type: "string", - description: - "Specifies the item SKU that you want to add to cart. (use this OR id)", - example: "my-item", - }, - custom_inputs: { - description: "The custom text to be added to a product.", - type: "object", - }, - bundle_configuration: { - description: "Object used to describe the bundle options selected.", - type: "object", - properties: { - selected_options: { - description: "Specifies selected options.", - type: "object", - }, - }, - }, - shipping_group_id: { - description: "Identifier for a created Cart Shipping Group", - type: "string", - }, - }, -} as const - -export const $CartMergeObjectRequest = { - title: "Cart Merge Object Request", - type: "object", - properties: { - data: { - type: "array", - items: { - allOf: [ - { - $ref: "#/components/schemas/CartMergeObject", - }, - ], - }, - description: "", - }, - options: { - $ref: "#/components/schemas/AddAllOrNothingOptionsObject", - }, - }, -} as const - -export const $CartMergeObject = { - title: "Cart Merge Object", - type: "object", - required: ["type", "cart_id"], - properties: { - type: { - description: "The type of object being returned. Must be `cart_items`.", - type: "string", - enum: ["cart_items"], - }, - cart_id: { - description: "The original cart to be merged from.", - type: "string", - format: "uuid", - example: "78d7b5c2-c852-40ad-87bb-beb161f61f37", - }, - }, -} as const - -export const $CustomItemObject = { - title: "Custom Item Object", - type: "object", - properties: { - data: { - allOf: [ - { - $ref: "#/components/schemas/CustomItemObjectData", - }, - ], - description: "", - }, - }, -} as const - -export const $CustomItemObjectData = { - title: "Custom Item Object Data", - type: "object", - required: ["type", "name", "quantity", "price"], - properties: { - type: { - description: "The type of object being returned. Must be `custom_item`.", - type: "string", - enum: ["custom_item"], - }, - quantity: { - description: "The number of custom items to add to cart.", - type: "number", - example: 2, - }, - price: { - type: "object", - required: ["amount"], - properties: { - amount: { - description: "The unit price of the custom item.", - type: "number", - example: 10000, - }, - includes_tax: { - description: - "Set to`true` if relevant taxes have been included in the price, `false` if not. Defaults to `true`.", - type: "boolean", - }, - }, - }, - description: { - description: "A description of the custom item.", - type: "string", - example: "My first custom item!", - }, - sku: { - type: "string", - description: - "The `SKU` code to use for the custom item. See [best practices](https://elasticpath.dev/docs/commerce-cloud/carts/cart-items/add-custom-item-to-cart#best-practices) to use the `SKU` code.", - example: "my-custom-item", - }, - name: { - type: "string", - description: "The name of the custom item.", - example: "My Custom Item", - }, - custom_inputs: { - description: "The custom text to be added to a product.", - type: "object", - }, - shipping_group_id: { - description: "Identifier for a created Cart Shipping Group", - type: "string", - }, - }, -} as const - -export const $ReOrderObjectRequest = { - title: "Re-Order Object Request", - type: "object", - properties: { - data: { - allOf: [ - { - $ref: "#/components/schemas/ReOrderObject", - }, - ], - }, - options: { - $ref: "#/components/schemas/AddAllOrNothingOptionsObject", - }, - }, -} as const - -export const $ReOrderObject = { - title: "Re Order Object", - type: "object", - required: ["type", "order_id"], - properties: { - type: { - description: "The type of resource being returned. Use `order_items`.", - type: "string", - enum: ["order_items"], - }, - order_id: { - description: "The unique identifier of the order.", - type: "string", - format: "uuid", - example: "78d7b5c2-c852-40ad-87bb-beb161f61f37", - }, - }, -} as const - -export const $BulkAddItemsRequest = { - title: "Bulk Add Items Request", - type: "object", - properties: { - data: { - anyOf: [ - { - $ref: "#/components/schemas/CartItemsObjectRequest", - }, - { - $ref: "#/components/schemas/CartMergeObjectRequest", - }, - { - $ref: "#/components/schemas/CustomItemObject", - }, - { - $ref: "#/components/schemas/ReOrderObjectRequest", - }, - { - $ref: "#/components/schemas/PromotionItemObject", - }, - ], - }, - }, -} as const - -export const $PromotionItemObject = { - title: "Promotion Item Object", - type: "object", - properties: { - data: { - allOf: [ - { - $ref: "#/components/schemas/PromotionItemObjectData", - }, - ], - }, - }, -} as const - -export const $PromotionItemObjectData = { - title: "Promotion Item Object Data", - type: "object", - required: ["type", "code"], - properties: { - type: { - description: "Specifies the type of resource, which is `promotion_item`.", - type: "string", - enum: ["promotion_item"], - }, - code: { - description: - "Specifies the promotion code. For more information about codes[].user[], see the [Create Promotion codes](/docs/api/promotions/create-promotion-codes) section.", - type: "string", - example: "PROMO_CODE", - }, - }, -} as const - -export const $BulkUpdateCartsItems = { - title: "Bulk Update Carts Items", - type: "object", - required: ["id", "quantity"], - properties: { - data: { - type: "array", - items: { - type: "object", - properties: { - id: { - description: - "Specifies the ID of the cart item that you want to update in cart.", - type: "string", - example: "{{cartitemID}}", - }, - quantity: { - description: "Specifies the amount of items to update in the cart.", - type: "number", - example: 2, - }, - custom_inputs: { - description: - "Specifies the custom text to be added to a product. See [custom inputs](https://elasticpath.dev/docs/pxm/products/ep-pxm-products-api/update-a-product#using-custom-inputs-attribute).", - type: "object", - }, - }, - }, - }, - options: { - $ref: "#/components/schemas/UpdateAllOrNothingOptionsObject", - }, - }, -} as const - -export const $UpdateCartsItems = { - title: "Update Carts Items", - type: "object", - required: ["quantity"], - properties: { - data: { - type: "object", - properties: { - id: { - description: "The unique identifier of the cart item.", - type: "string", - format: "uuid", - example: "{{cartitemID}}", - }, - quantity: { - description: "The amount of products to add to cart.", - type: "number", - example: 2, - }, - custom_inputs: { - description: "The custom text to be added to a product.", - type: "object", - }, - shipping_group_id: { - description: - "The unique identifier of the shipping group to be added to the cart.", - type: "string", - format: "uuid", - example: "900ab9c1-4b39-43fe-b080-0dc2806065d9", - }, - }, - }, - }, -} as const - -export const $AddAllOrNothingOptionsObject = { - title: "Add All Or Nothing Options Object", - type: "object", - properties: { - add_all_or_nothing: { - description: - "When `true`, if an error occurs for any item, no items are added to the cart. When `false`, valid items are added to the cart and the items with errors are reported in the response. Default is `false`.", - type: "boolean", - example: false, - }, - }, -} as const - -export const $UpdateAllOrNothingOptionsObject = { - title: "Update All Or Nothing Options Object", - type: "object", - properties: { - update_all_or_nothing: { - description: - "When set to`true`, if an error occurs for any item, no items are updated in the cart. When set to `false`, valid items are updated in the cart and the items with errors are reported in the response. Default is `true`.", - type: "boolean", - example: false, - }, - }, -} as const - -export const $CartItemResponse = { - title: "Cart Item Relationship", - type: "object", - properties: { - product_id: { - description: "The unique ID of the product.", - type: "string", - format: "uuid", - readOnly: true, - example: "55cda543-f9d7-42a4-b40a-665f2e4ff7c5", - }, - name: { - description: "The name of this item", - type: "string", - readOnly: true, - example: "shirt", - }, - description: { - description: "A description of the cart item.", - type: "string", - readOnly: true, - example: "T-shirt.", - }, - catalog_id: { - description: - "The unique identifier of the catalog associated with the product is shown if catalog_source=pim is set.", - type: "string", - readOnly: true, - format: "uuid", - example: "11d3f9d2-c99b-472c-96c3-51842333daea", - }, - catalog_source: { - description: "The catalog source. Always `pim` or `legacy`.", - type: "string", - readOnly: true, - example: "pim", - }, - image: { - type: "object", - readOnly: true, - properties: { - mime_type: { - description: "The MIME type for the uploaded file.", - type: "string", - readOnly: true, - example: "image/png", - }, - file_name: { - description: "The name of the image file that was uploaded.", - type: "string", - readOnly: true, - example: "shirt-trans.png", - }, - href: { - description: "The link to the image.", - type: "string", - readOnly: true, - example: - "https://files-eu.epusercontent.com/e8c53cb0-120d-4ea5-8941-ce74dec06038/7cc08cbb-256e-4271-9b01-d03a9fac9f0a.png", - }, - }, - }, - manage_stock: { - description: null, - type: "boolean", - readOnly: true, - example: true, - }, - unit_price: { - readOnly: true, - $ref: "#/components/schemas/ItemPriceData", - }, - value: { - readOnly: true, - $ref: "#/components/schemas/ItemPriceData", - }, - links: { - type: "object", - readOnly: true, - properties: { - product: { - description: "A URL related to the resource.", - type: "string", - example: - "https://useast.api.elasticpath.com/products/9eda5ba0-4f4a-4074-8547-ccb05d1b5981", - }, - }, - }, - meta: { - type: "object", - readOnly: true, - properties: { - display_price: { - type: "object", - properties: { - with_tax: { - $ref: "#/components/schemas/FormattedPriceData", - }, - without_tax: { - $ref: "#/components/schemas/FormattedPriceData", - }, - tax: { - $ref: "#/components/schemas/FormattedPriceData", - }, - discount: { - $ref: "#/components/schemas/FormattedPriceData", - }, - without_discount: { - $ref: "#/components/schemas/FormattedPriceData", - }, - }, - }, - timestamps: { - $ref: "#/components/schemas/Timestamps", - }, - }, - }, - }, -} as const - -export const $CartsResponse = { - title: "Carts Response", - type: "object", - properties: { - data: { - type: "array", - items: { - type: "object", - anyOf: [ - { - $ref: "#/components/schemas/CartItemObject", - }, - ], - }, - }, - meta: { - type: "object", - properties: { - display_price: { - type: "object", - properties: { - with_tax: { - $ref: "#/components/schemas/FormattedPriceData", - }, - without_tax: { - $ref: "#/components/schemas/FormattedPriceData", - }, - tax: { - $ref: "#/components/schemas/FormattedPriceData", - }, - discount: { - $ref: "#/components/schemas/FormattedPriceData", - }, - without_discount: { - $ref: "#/components/schemas/FormattedPriceData", - }, - discounts: { - type: "object", - additionalProperties: { - type: "object", - properties: { - amount: { - type: "number", - example: -1000, - }, - currency: { - type: "string", - example: "USD", - }, - formatted: { - type: "string", - example: "-$1.00", - }, - }, - }, - }, - }, - }, - timestamps: { - $ref: "#/components/schemas/CartTimestamps", - }, - }, - }, - }, -} as const - -export const $ItemPriceData = { - title: "Order Price Data", - type: "object", - properties: { - amount: { - description: "The amount for this item as an integer.", - type: "number", - readOnly: true, - example: 10000, - }, - currency: { - description: "The currency this item was added to the cart as.", - type: "string", - readOnly: true, - example: "USD", - }, - includes_tax: { - description: "Whether or not this price is tax inclusive.", - type: "boolean", - readOnly: true, - example: false, - }, - }, -} as const - -export const $CartsRelationshipsAccountsData = { - title: "Carts Relationships Accounts Data", - type: "object", - properties: { - data: { - type: "array", - items: { - properties: { - id: { - description: "The ID of the account.", - type: "string", - example: "{{accountID}}", - }, - type: { - description: - "The type of related object. Ensure that it is account.", - type: "string", - example: "account", - }, - }, - }, - }, - }, -} as const - -export const $CartsRelationshipsCustomersData = { - title: "Carts Relationships Customers Data", - type: "object", - properties: { - data: { - type: "array", - items: { - properties: { - id: { - description: "The ID of the customer.", - type: "string", - example: "{{customerID}}", - }, - type: { - description: - "The type of related object. Ensure that it is customer.", - type: "string", - example: "customer", - }, - }, - }, - }, - }, -} as const - -export const $CartsItemsTaxesObject = { - title: "Carts Items Taxes Object", - type: "object", - required: ["type", "rate"], - properties: { - code: { - description: "A unique tax code in this jurisdiction.", - type: "string", - example: "TAX01", - }, - jurisdiction: { - description: "The relevant tax jurisdiction.", - type: "string", - example: "UK", - }, - name: { - description: "The name of the tax item.", - type: "string", - example: "Tax name", - }, - rate: { - description: "The tax rate represented as a decimal (12.5% -> 0.125).", - type: "number", - example: 0.2, - }, - type: { - description: "The type of object being returned. Use `tax_item`.", - type: "string", - example: "tax_item", - }, - id: { - description: "The unique identifier for this tax item.", - type: "string", - format: "uuid", - readOnly: true, - example: "662461ad-ddcb-4dbd-8ed7-ade9aa63b5f9", - }, - }, -} as const - -export const $CartsBulkCustomDiscounts = { - title: "CartsBulkCustomDiscounts", - type: "object", - properties: { - data: { - type: "array", - items: { - allOf: [ - { - $ref: "#/components/schemas/CartsCustomDiscountsObject", - }, - { - $ref: "#/components/schemas/CartItemBulkCustomDiscountObject", - }, - ], - }, - }, - options: { - $ref: "#/components/schemas/AddAllOrNothingOptionsObject", - }, - }, -} as const - -export const $CartsBulkCustomDiscountsResponse = { - title: "CartsBulkCustomDiscountsResponse", - type: "object", - properties: { - data: { - type: "array", - items: { - allOf: [ - { - $ref: "#/components/schemas/CartsCustomDiscountsResponse", - }, - { - $ref: "#/components/schemas/artItemBulkCustomDiscountResponse", - }, - ], - }, - }, - options: { - $ref: "#/components/schemas/AddAllOrNothingOptionsObject", - }, - }, -} as const - -export const $CartItemBulkCustomDiscountObject = { - title: "CartItemBulkCustomDiscountObject", - type: "object", - allOf: [ - { - $ref: "#/components/schemas/CartsCustomDiscountsObject", - }, - { - $ref: "#/components/schemas/CustomDiscountRelationshipsCartItemRequest", - }, - ], -} as const - -export const $artItemBulkCustomDiscountResponse = { - title: "artItemBulkCustomDiscountResponse", - type: "object", - allOf: [ - { - $ref: "#/components/schemas/CartsCustomDiscountsResponse", - }, - { - $ref: "#/components/schemas/CustomDiscountRelationshipsCartItemRequest", - }, - ], -} as const - -export const $CartsCustomDiscountsObject = { - title: "CartsCustomDiscountsObject", - type: "object", - required: [ - "amount", - "description", - "discount_code", - "discount_engine", - "external_id", - "type", - ], - properties: { - amount: { - description: - "Specifies an amount to be applied for the custom discount. It must be less than zero.", - type: "number", - example: -1000, - }, - description: { - description: "Specifies a description for the custom discount.", - type: "string", - example: "Custom discount description", - }, - discount_code: { - description: "Specifies the discount code used for the custom discount.", - type: "string", - example: "cart-custom-promo-code", - }, - discount_engine: { - description: - "Specifies from where the custom discount is applied. For example, Talon.one.", - type: "string", - example: "Custom Discount Engine", - }, - external_id: { - description: "Specifies an external id for the custom discount.", - type: "string", - example: "custom-discount-external-id", - }, - type: { - description: - "Specifies the type of the resource. Always `custom_discount`.", - type: "string", - example: "custom_discount", - }, - }, -} as const - -export const $CartsCustomDiscountsResponse = { - title: "CartsCustomDiscountsResponse", - type: "object", - properties: { - amount: { - type: "object", - properties: { - amount: { - description: - "Specifies an amount to be applied for the custom discount. It must be less than zero.", - type: "number", - example: -1000, - }, - currency: { - description: "The currency set for the custom discount.", - type: "string", - example: "USD", - }, - formatted: { - description: "The formatted value for the custom discount.", - type: "string", - example: "-$10.00", - }, - }, - }, - description: { - description: "Specifies a description for the custom discount.", - type: "string", - example: "Custom discount description", - }, - discount_code: { - description: "Specifies the discount code used for the custom discount.", - type: "string", - example: "cart-custom-promo-code", - }, - discount_engine: { - description: - "Specifies from where the custom discount is applied. For example, Talon.one.", - type: "string", - example: "Custom Discount Engine", - }, - external_id: { - description: "Specifies an external id for the custom discount.", - type: "string", - example: "custom-discount-external-id", - }, - type: { - description: - "Specifies the type of the resource. Always `custom_discount`.", - type: "string", - example: "custom_discount", - }, - id: { - description: "Specifies the UUID of the custom discount.", - type: "string", - format: "uuid", - readOnly: true, - example: "662461ad-ddcb-4dbd-8ed7-ade9aa63b5f9", - }, - }, -} as const - -export const $CustomDiscountRelationshipsCartItemRequest = { - title: "CustomDiscountRelationshipsCartItemRequest", - type: "object", - required: ["type", "id"], - properties: { - relationships: { - type: "object", - properties: { - item: { - type: "object", - properties: { - data: { - type: "object", - properties: { - type: { - description: - "Specifies the type of item. For example, `custom_item` or `cart_item`.", - type: "string", - example: "cart_item", - }, - id: { - description: - "Specifies the unique identifier of the `cart_item` or `custom_item` in the cart.", - type: "string", - format: "uuid", - example: "5601a4b1-9d13-42d3-8fb7-03b35169d1b6", - }, - }, - }, - }, - }, - }, - }, - }, -} as const - -export const $CartItemRelationship = { - title: "CartItemRelationship", - type: "object", - required: ["type", "id"], - properties: { - relationships: { - type: "object", - properties: { - order: { - type: "object", - properties: { - data: { - type: "object", - properties: { - type: { - description: "This specifies the type of item.", - type: "string", - example: "order", - }, - id: { - description: - "This specifies the ID of the cart_item or custom_item in the cart.", - type: "string", - format: "uuid", - example: "5601a4b1-9d13-42d3-8fb7-03b35169d1b6", - }, - }, - }, - }, - }, - }, - }, - }, -} as const - -export const $CartsBulkTaxes = { - title: "CartsBulkTaxes", - type: "object", - properties: { - data: { - type: "array", - items: { - allOf: [ - { - $ref: "#/components/schemas/CartsItemsTaxesObject", - }, - { - $ref: "#/components/schemas/CartItemRelationship", - }, - ], - }, - }, - options: { - $ref: "#/components/schemas/AddAllOrNothingOptionsObject", - }, - }, -} as const - -export const $OrdersAnonymizeRequest = { - title: "OrdersAnonymizeRequest", - type: "object", - properties: { - data: { - $ref: "#/components/schemas/OrdersAnonymizeData", - }, - }, -} as const - -export const $OrdersAnonymizeData = { - title: "OrdersAnonymizeData", - type: "object", - properties: { - order_ids: { - description: - "The unique identifiers of the orders to be anonymized. You can anonymize multiple orders at the same time.", - type: "array", - items: { - type: "string", - }, - example: "{{orderID}}", - }, - }, -} as const - -export const $OrdersUpdateRequest = { - title: "OrdersUpdateRequest", - type: "object", - properties: { - data: { - oneOf: [ - { - $ref: "#/components/schemas/OrdersAddressData", - }, - { - $ref: "#/components/schemas/OrdersCancelData", - }, - { - $ref: "#/components/schemas/OrdersFulfulledData", - }, - ], - }, - }, -} as const - -export const $OrdersAddressData = { - title: "OrdersAddressData", - type: "object", - required: ["type", "shipping_address"], - properties: { - external_ref: { - description: - "Represents an optional external ID reference for an order. It can contain alphanumeric characters, special characters, and spaces, and does not required to be unique. The maximum allowed length is 64 characters. It can be used to include an external reference from a separate company system.", - type: "string", - example: "external_order_123", - }, - shipping_address: { - type: "object", - properties: { - first_name: { - description: "Specifies the first name of the address holder.", - type: "string", - example: "James", - }, - last_name: { - description: "Specifies the last name of the address holder.", - type: "string", - example: "Doe", - }, - phone_number: { - description: "Specifies the phone number of the address holder.", - type: "string", - example: 5558679305, - }, - company_name: { - description: "Specifies the company name.", - type: "string", - example: "company name", - }, - line_1: { - description: "Specifies the first line of the address.", - type: "string", - example: "1234 Disney Drive", - }, - line_2: { - description: "Specifies the second line of the address.", - type: "string", - example: "Disney Resort", - }, - city: { - description: - "Specifies the name of the city in the shipping address.", - type: "string", - example: "Anaheim", - }, - county: { - description: "Specifies the county of the shipping address.", - type: "string", - example: "Orange", - }, - region: { - description: - "Specifies the state, province, or region of the shipping address.", - type: "string", - example: "CA", - }, - postcode: { - description: "Specifies the postcode or ZIP code of the address.", - type: "string", - example: 92802, - }, - country: { - description: "Specifies the country in the shipping address.", - type: "string", - example: "US", - }, - instructions: { - description: - "Specifies any instructions provided with the shipping address.", - type: "string", - example: "Buzzer 10233", - }, - }, - }, - }, -} as const - -export const $OrdersCancelData = { - title: "OrdersCancelData", - type: "object", - required: ["type", "status"], - properties: { - status: { - description: - "The status of the order. You can only update the status to `cancelled`.", - type: "string", - example: "cancelled", - }, - type: { - description: "The type of the resource. You must use order.", - type: "string", - example: "order", - }, - external_ref: { - description: - "Represents an optional external ID reference for an order. It can contain alphanumeric characters, special characters, and spaces, and does not required to be unique. The maximum allowed length is 64 characters. It can be used to include an external reference from a separate company system.", - type: "string", - example: "external_order_123", - }, - }, -} as const - -export const $OrdersFulfulledData = { - title: "OrdersFulfulledData", - type: "object", - required: ["type", "shipping"], - properties: { - shipping: { - description: - "The shipping status of the order. You can only update the shipping status to `fulfilled`.", - type: "string", - example: "fulfilled", - }, - type: { - description: "The type of the resource. You must use order.", - type: "string", - example: "order", - }, - external_ref: { - description: - "Represents an optional external ID reference for an order. It can contain alphanumeric characters, special characters, and spaces, and does not required to be unique. The maximum allowed length is 64 characters. It can be used to include an external reference from a separate company system.", - type: "string", - example: "external_order_123", - }, - }, -} as const - -export const $PaymentsRequest = { - title: "PaymentsRequest", - type: "object", - properties: { - data: { - $ref: "#/components/schemas/Data.PaymentObject", - }, - }, -} as const - -export const $Data_BasePayments = { - title: "Data.BasePayments", - type: "object", - required: ["gateway", "method"], - properties: { - gateway: { - type: "string", - enum: [ - "adyen", - "authorize_net", - "braintree", - "card_connect", - "cyber_source", - "elastic_path_payments_stripe", - "manual", - "paypal_express_checkout", - "stripe", - "stripe_connect", - "stripe_payment_intents", - ], - }, - method: { - description: - "Specifies the transaction method, such as `purchase` or `authorize`.", - type: "string", - enum: ["authorize", "purchase", "purchase_setup", "authorize_setup"], - }, - amount: { - description: "The amount to be paid for the transaction.", - type: "number", - example: 10000, - }, - }, -} as const - -export const $Data_AdyenPayment = { - title: "Data.AdyenPayment", - required: ["payment", "gateway"], - allOf: [ - { - $ref: "#/components/schemas/Data.BasePayments", - }, - { - type: "object", - properties: { - gateway: { - description: "Specifies the gateway. You must use `adyen`.", - type: "string", - enum: ["adyen"], - }, - options: { - type: "object", - properties: { - shopper_reference: { - description: - "The shopper reference token associated with the saved payment method.", - type: "string", - }, - recurring_processing_model: { - description: "Enter CardOnFile for a one-time purchase.", - type: "string", - }, - }, - }, - payment: { - description: - "The Adyen recurringDetailReference payment method identifier.", - type: "string", - }, - }, - }, - ], -} as const - -export const $Data_AuthorizeNetPayment = { - title: "Data.AuthorizeNetPayment", - required: ["payment", "gateway"], - allOf: [ - { - $ref: "#/components/schemas/Data.BasePayments", - }, - { - type: "object", - properties: { - gateway: { - description: "Specifies the gateway. You must use `authorize_net`.", - type: "string", - enum: ["authorize_net"], - }, - options: { - type: "object", - properties: { - customer_payment_profile_id: { - description: "The Authorize.net customer payment profile ID.", - type: "string", - }, - }, - }, - payment: { - description: "The Authorize.net customer profile ID.", - type: "string", - }, - }, - }, - ], -} as const - -export const $Data_BraintreePayment = { - title: "Data.BraintreePayment", - required: ["payment", "gateway"], - allOf: [ - { - $ref: "#/components/schemas/Data.BasePayments", - }, - { - type: "object", - properties: { - gateway: { - description: "Specifies the gateway. You must use `braintree`.", - type: "string", - enum: ["braintree"], - }, - payment: { - description: "The Braintree Customer ID that you want to bill.", - type: "string", - }, - }, - }, - ], -} as const - -export const $Data_CardConnectPayment = { - title: "Data.CardConnectPayment", - required: ["payment", "gateway"], - allOf: [ - { - $ref: "#/components/schemas/Data.BasePayments", - }, - { - type: "object", - properties: { - gateway: { - description: "Specifies the gateway. You must use `card_connect`.", - type: "string", - enum: ["card_connect"], - }, - payment: { - description: - "Enter account_id, profile_id from CardPointe API. For example, 1|16178397535388255208.", - type: "string", - }, - }, - }, - ], -} as const - -export const $Data_CyberSourcePayment = { - title: "Data.CyberSourcePayment", - required: ["payment", "gateway"], - allOf: [ - { - $ref: "#/components/schemas/Data.BasePayments", - }, - { - type: "object", - properties: { - gateway: { - description: "Specifies the gateway. You must use `cyber_source`.", - type: "string", - enum: ["cyber_source"], - }, - payment: { - description: "The CyberSource token.", - type: "string", - }, - }, - }, - ], -} as const - -export const $ElasticPathPaymentsPoweredByStripePayment = { - title: "Elastic Path Payments Powered By Stripe", - required: ["gateway"], - allOf: [ - { - $ref: "#/components/schemas/Data.BasePayments", - }, - { - type: "object", - properties: { - gateway: { - description: - "Specifies the gateway. You must use `elastic_path_payments_stripe`.", - type: "string", - enum: ["elastic_path_payments_stripe"], - }, - options: { - type: "object", - properties: { - receipt_email: { - description: - "Provides the email address to which you want to send the Stripe receipts for the transactions within the store. This feature is available only in the live mode.", - type: "string", - }, - automatic_payment_methods: { - type: "object", - description: - "Parent object determining whether to use Stripe's `automatic_payment_methods` setting.", - properties: { - enabled: { - type: "boolean", - description: - "When set to true, it displays all enabled payment methods from the Stripe dashboard. When set to false, the Stripe default, which is card, is used.", - }, - }, - }, - }, - }, - payment_method_types: { - type: "array", - items: { - type: "string", - }, - description: - "Specifies the Stripe payment method types configured for the store. See [Stripe Documentation](https://docs.stripe.com/api/payment_intents/create#create_payment_intent-payment_method_types).", - example: "card", - }, - payment: { - description: "Specifies the Stripe token or source.", - type: "string", - }, - }, - }, - ], -} as const - -export const $Data_ManualPayment = { - title: "Data.ManualPayment", - required: ["gateway"], - allOf: [ - { - $ref: "#/components/schemas/Data.BasePayments", - }, - { - type: "object", - properties: { - gateway: { - description: - "Specifies the type of payment gateway. You must use `manual`.", - type: "string", - enum: ["manual"], - }, - paymentmethod_meta: { - type: "object", - properties: { - custom_reference: { - description: - "A reference associated with the payment method. This might include loyalty points or gift card identifiers. We recommend not to include personal information in this field.", - type: "string", - }, - name: { - description: "A custom name associated with the payment method.", - type: "string", - }, - }, - }, - }, - }, - ], -} as const - -export const $Data_PayPalExpressCheckoutPayment = { - title: "Data.PayPalExpressCheckoutPayment", - required: ["gateway"], - allOf: [ - { - $ref: "#/components/schemas/Data.BasePayments", - }, - { - type: "object", - properties: { - gateway: { - description: - "Specifies the type of payment gateway. You must use `paypal_express_checkout`.", - type: "string", - enum: ["paypal_express_checkout"], - }, - options: { - type: "object", - properties: { - description: { - description: "The description for the payment.", - type: "string", - }, - soft_descriptor: { - description: - "The descriptor appended to PayPal generated descriptor that is visible on the card statement of the payer.", - type: "string", - }, - application_context: { - type: "object", - properties: { - brand_name: { - description: - "The label that overrides the business name in the PayPal account on the payPal site.", - type: "string", - }, - locale: { - description: - "The locale pages that appear based on language and country code. PayPal supports a five-character code. For example, ja-JP.", - type: "string", - }, - landing_page: { - description: - "The type of landing page to show on the PayPal site for customer checkout. Use values LOGIN, BILLING, or NO_PREFERENCE.", - type: "string", - }, - shipping_preference: { - description: - "The shipping preference. Use SET_PROVIDED_ADDRESS value. This parameter does allow the user to change their address on PayPal site.", - type: "string", - }, - user_action: { - description: - "If you set `useraction=commit` in the query string, the flow redirects the buyer to the PayPal payment page and displays a Pay Now button. When the shopper clicks **Pay Now**, call `DoExpressCheckoutPayment` to complete the payment without additional interaction from the shopper. Choose this flow when you know the final payment amount when you initiate the checkout flow.", - type: "string", - }, - return_url: { - description: - "The callback URL for PayPal to redirect the user in the case of approved payment.", - type: "string", - }, - cancel_url: { - description: - "The callback URL for PayPal to redirect user in the case a cancelled payment.", - type: "string", - }, - }, - }, - }, - }, - }, - }, - ], -} as const - -export const $Data_StripePayment = { - title: "Data.StripePayment", - required: ["gateway"], - allOf: [ - { - $ref: "#/components/schemas/Data.BasePayments", - }, - { - type: "object", - properties: { - gateway: { - description: - "Specifies the type of payment gateway. You must use `stripe`.", - type: "string", - enum: ["stripe"], - }, - options: { - type: "object", - properties: { - receipt_email: { - description: - "The option to provide an email for Stripe receipts. Specify live mode to access this feature.", - type: "string", - }, - }, - }, - payment: { - description: "The Stripe token or source.", - type: "string", - }, - }, - }, - ], -} as const - -export const $Data_StripeConnectPayment = { - title: "Data.StripeConnectPayment", - required: ["gateway"], - allOf: [ - { - $ref: "#/components/schemas/Data.BasePayments", - }, - { - type: "object", - properties: { - gateway: { - description: - "Specifies the type of payment gateway. You must use `stripe_connect`.", - type: "string", - enum: ["stripe_connect"], - }, - options: { - type: "object", - properties: { - receipt_email: { - description: - "Provides the email address to which you want to send the Stripe receipts for the transactions within the store. This feature is available only in the live mode.", - type: "string", - }, - }, - }, - payment: { - description: "Specifies the Stripe token or source.", - type: "string", - }, - }, - }, - ], -} as const - -export const $Data_StripePaymentIntentsPayment = { - title: "Data.StripePaymentIntentsPayment", - required: ["gateway"], - allOf: [ - { - $ref: "#/components/schemas/Data.BasePayments", - }, - { - type: "object", - properties: { - gateway: { - description: - "Specifies the type of payment gateway. You must use `stripe_payment_intents`.", - type: "string", - enum: ["stripe_payment_intents"], - }, - options: { - type: "object", - properties: { - receipt_email: { - description: - "Provides the email address to which you want to send the Stripe receipts for the transactions within the store. This feature is available only in the live mode.", - type: "string", - }, - }, - }, - payment: { - description: "Specifies the Stripe token or source.", - type: "string", - }, - }, - }, - ], -} as const - -export const $Data_PaymentObject = { - oneOf: [ - { - $ref: "#/components/schemas/Data.AdyenPayment", - }, - { - $ref: "#/components/schemas/Data.AuthorizeNetPayment", - }, - { - $ref: "#/components/schemas/Data.BraintreePayment", - }, - { - $ref: "#/components/schemas/Data.CardConnectPayment", - }, - { - $ref: "#/components/schemas/Data.CyberSourcePayment", - }, - { - $ref: "#/components/schemas/ElasticPathPaymentsPoweredByStripePayment", - }, - { - $ref: "#/components/schemas/Data.ManualPayment", - }, - { - $ref: "#/components/schemas/Data.PayPalExpressCheckoutPayment", - }, - { - $ref: "#/components/schemas/Data.StripePayment", - }, - { - $ref: "#/components/schemas/Data.StripeConnectPayment", - }, - { - $ref: "#/components/schemas/Data.StripePaymentIntentsPayment", - }, - ], -} as const - -export const $TransactionResponse = { - title: "TransactionResponse", - type: "object", - properties: { - id: { - description: "The ID of the transaction.", - type: "string", - format: "uuid", - readOnly: true, - }, - reference: { - description: "The payment gateway reference.", - type: "string", - example: "manual", - }, - name: { - description: "A custom name associated with the payment method.", - type: "string", - example: "payment method name", - }, - custom_reference: { - description: - "A reference associated with the payment method. This might include loyalty points or gift card identifiers. We recommend you not to include personal information in this field.", - type: "string", - example: "custom reference", - }, - gateway: { - description: "The name of the payment gateway used.", - type: "string", - enum: [ - "adyen", - "authorize_net", - "braintree", - "card_connect", - "cyber_source", - "elastic_path_payments_stripe", - "manual", - "paypal_express_checkout", - "stripe", - "stripe_connect", - "stripe_payment_intents", - ], - }, - amount: { - description: "The amount for this transaction.", - type: "number", - example: 10000, - }, - refunded_amount: { - description: "The refunded amount.", - type: "number", - example: 0, - }, - currency: { - description: "The transaction currency.", - type: "string", - example: "USD", - }, - "transaction-type": { - description: - "The type of transaction, such as `purchase`, `capture`, `authorize` or `refund`.", - type: "string", - example: "capture", - }, - status: { - description: - "The status provided by the gateway for this transaction, such as `complete` or `failed`.", - type: "string", - example: "complete", - }, - relationships: { - type: "object", - properties: { - order: { - type: "object", - properties: { - data: { - type: "object", - properties: { - type: { - description: - "Represents the type of the object being returned. It is always `order`.", - type: "string", - example: "order", - }, - id: { - description: "The ID of the order.", - type: "string", - format: "uuid", - example: "5601a4b1-9d13-42d3-8fb7-03b35169d1b6", - }, - }, - }, - }, - }, - }, - }, - meta: { - type: "object", - properties: { - display_price: { - $ref: "#/components/schemas/FormattedPriceData", - }, - display_refunded_amount: { - $ref: "#/components/schemas/FormattedPriceData", - }, - timestamps: { - $ref: "#/components/schemas/Timestamps", - }, - }, - }, - }, -} as const - -export const $OrdersTransactionsConfirmRequest = { - title: "OrdersTransactionsConfirmRequest", - type: "object", - properties: { - data: { - type: "object", - }, - }, -} as const - -export const $OrdersTransactionsCaptureRequest = { - title: "OrdersTransactionsCaptureRequest", - type: "object", - properties: { - data: { - type: "object", - properties: { - options: { - type: "object", - properties: { - soft_descriptor: { - type: "string", - }, - note_to_payer: { - type: "string", - }, - }, - }, - }, - }, - }, -} as const - -export const $OrdersTransactionsRefundRequest = { - title: "OrdersTransactionsRefundRequest", - type: "object", - properties: { - data: { - type: "object", - properties: { - amount: { - description: - "The amount value to be refunded. If this field is not provided, it will be considered as manual refund (Mark as Refunded) and the refund process must be manually handled via payment provider. If the amount value is same as payment value, then it will be treated as a full refund and sent to the payment provider to process refund automatically.", - type: "number", - example: 1000, - }, - options: { - type: "object", - properties: { - note: { - description: - "Provides comments about the refund. It is used by PayPal Express.", - type: "string", - }, - }, - }, - }, - }, - }, -} as const - -export const $OrdersTransactionsCancelRequest = { - title: "OrdersTransactionsCancelRequest", - type: "object", - properties: { - data: { - type: "object", - properties: { - options: { - type: "object", - }, - reason: { - description: - "Specifies the reason for canceling the transaction. The reason may include `duplicate`, `fraudulent`, `requested_by_customer`, or `abandoned`.", - type: "string", - example: "requested_by_customer", - }, - }, - }, - }, -} as const - -export const $OrderPriceData = { - title: "OrderPriceData", - type: "object", - properties: { - amount: { - description: "The amount for this item.", - type: "number", - example: 10000, - }, - currency: { - description: "The currency this item.", - type: "string", - example: "USD", - }, - includes_tax: { - description: "Whether or not this price is tax inclusive.", - type: "boolean", - example: false, - }, - }, -} as const - -export const $FormattedPriceData = { - title: "FormattedPriceData", - type: "object", - properties: { - amount: { - description: "The raw total of this cart.", - type: "number", - example: 10000, - }, - currency: { - description: "The currency set for this cart.", - type: "string", - example: "USD", - }, - formatted: { - description: "The tax inclusive formatted total based on the currency.", - type: "string", - example: "$10.00", - }, - }, -} as const - -export const $OrderItemFormattedUnitPriceData = { - title: "OrderItemFormattedUnitPriceData", - type: "object", - properties: { - unit: { - $ref: "#/components/schemas/FormattedPriceData", - }, - value: { - $ref: "#/components/schemas/FormattedPriceData", - }, - }, -} as const - -export const $DiscountData = { - title: "DiscountData", - type: "object", - properties: { - amount: { - $ref: "#/components/schemas/OrderPriceData", - }, - code: { - type: "string", - example: "10_off", - }, - id: { - type: "string", - format: "uuid", - readOnly: true, - example: "a01cf221-751b-46e4-b612-57ad3c645ee6", - }, - }, -} as const - -export const $OrderItemResponse = { - title: "OrderItemResponse", - type: "object", - properties: { - type: { - description: "The type represents the object being returned.", - type: "string", - example: "order_item", - }, - id: { - description: "The unique identifier for this order item.", - type: "string", - format: "uuid", - readOnly: true, - example: "68bf8510-bebf-47b1-96ba-8a9930c7d928", - }, - quantity: { - description: "The quantity of this item were ordered.", - type: "number", - example: 1, - }, - product_id: { - description: "The unique identifier for this order item.", - type: "string", - format: "uuid", - readOnly: true, - example: "4e9c6098-9701-4839-a69c-54d8256d9012", - }, - name: { - description: "The name of this order item.", - type: "string", - example: "Product 123", - }, - sku: { - description: "The SKU code for the order item.", - type: "string", - example: "IFD-1", - }, - unit_price: { - $ref: "#/components/schemas/OrderPriceData", - }, - value: { - $ref: "#/components/schemas/OrderPriceData", - }, - discounts: { - type: "array", - items: { - $ref: "#/components/schemas/DiscountData", - }, - }, - links: { - type: "object", - }, - meta: { - type: "object", - properties: { - display_price: { - type: "object", - properties: { - with_tax: { - $ref: "#/components/schemas/OrderItemFormattedUnitPriceData", - }, - without_tax: { - $ref: "#/components/schemas/OrderItemFormattedUnitPriceData", - }, - tax: { - $ref: "#/components/schemas/OrderItemFormattedUnitPriceData", - }, - discount: { - $ref: "#/components/schemas/OrderItemFormattedUnitPriceData", - }, - without_discount: { - $ref: "#/components/schemas/OrderItemFormattedUnitPriceData", - }, - discounts: { - type: "object", - additionalProperties: { - type: "object", - properties: { - amount: { - type: "number", - example: -1000, - }, - currency: { - type: "string", - example: "USD", - }, - formatted: { - type: "string", - example: "-$1.00", - }, - }, - }, - }, - }, - }, - timestamps: { - $ref: "#/components/schemas/Timestamps", - }, - }, - }, - relationships: { - type: "object", - properties: { - cart_item: { - type: "object", - properties: { - data: { - type: "object", - properties: { - type: { - description: "The type represents the object being returned.", - type: "string", - example: "order_item", - }, - id: { - description: "The unique identifier for this item.", - type: "string", - format: "uuid", - readOnly: true, - example: "5601a4b1-9d13-42d3-8fb7-03b35169d1b6", - }, - }, - }, - }, - }, - }, - }, - catalog_id: { - description: - "The unique identifier of the catalog associated with the product is shown if `catalog_source=pim` is set.", - type: "string", - example: "default", - }, - catalog_source: { - description: "The catalog source. Always `pim` or `legacy`.", - type: "string", - example: "pim - legacy", - }, - }, -} as const - -export const $OrderResponse = { - title: "OrderResponse", - type: "object", - properties: { - type: { - description: - "Specifies the type of object being returned. You must use `order`.", - type: "string", - example: "order", - }, - id: { - description: "Specifies the unique identifier of the order.", - type: "string", - format: "uuid", - readOnly: true, - example: "aa854b8f-5930-476d-951a-e9b9cfbdefb1", - }, - status: { - description: - "Specifies the status of the order, such as `incomplete`, `complete`, `processing`, or `cancelled`.", - type: "string", - example: "complete - incomplete - cancelled", - }, - payment: { - description: - "Specifies the status of the payment, such as `unpaid`, `authorized`, `paid`, or `refunded`.", - type: "string", - example: "authorized - paid - unpaid - refunded", - }, - shipping: { - description: - "Specifies the status of the shipment, such as `fulfilled` or `unfulfilled`.", - type: "string", - example: "unfulfilled - fulfilled", - }, - anonymized: { - description: "Specifies if the order is anonymized.", - type: "boolean", - example: false, - }, - meta: { - $ref: "#/components/schemas/OrderMeta", - }, - billing_address: { - $ref: "#/components/schemas/BillingAddress", - }, - contact: { - $ref: "#/components/schemas/Contact", - }, - shipping_address: { - $ref: "#/components/schemas/ShippingAddress", - }, - }, -} as const - -export const $OrderMeta = { - title: "OrderMeta", - type: "object", - properties: { - timestamps: { - $ref: "#/components/schemas/Timestamps", - }, - with_tax: { - $ref: "#/components/schemas/FormattedPriceData", - }, - without_tax: { - $ref: "#/components/schemas/FormattedPriceData", - }, - tax: { - $ref: "#/components/schemas/FormattedPriceData", - }, - discount: { - $ref: "#/components/schemas/FormattedPriceData", - }, - paid: { - $ref: "#/components/schemas/FormattedPriceData", - }, - authorized: { - $ref: "#/components/schemas/FormattedPriceData", - }, - without_discount: { - $ref: "#/components/schemas/FormattedPriceData", - }, - }, -} as const - -export const $CustomerCheckout = { - title: "Customer Checkout", - type: "object", - properties: { - data: { - type: "object", - properties: { - customer: { - type: "object", - properties: { - id: { - description: "The ID of the customer.", - type: "string", - }, - }, - }, - billing_address: { - $ref: "#/components/schemas/BillingAddress", - }, - shipping_address: { - $ref: "#/components/schemas/ShippingAddress", - }, - }, - }, - }, -} as const - -export const $AccountCheckout = { - title: "Account Checkout", - type: "object", - properties: { - data: { - type: "object", - properties: { - account: { - type: "object", - properties: { - id: { - description: "The account ID.", - type: "string", - }, - member_id: { - description: "The account member ID.", - type: "string", - }, - }, - }, - contact: { - type: "object", - properties: { - name: { - description: "The name of the account member.", - type: "string", - }, - email: { - description: "The email address of the account member.", - type: "string", - format: "email", - }, - }, - }, - billing_address: { - $ref: "#/components/schemas/BillingAddress", - }, - shipping_address: { - $ref: "#/components/schemas/ShippingAddress", - }, - }, - }, - }, -} as const - -export const $BillingAddress = { - title: "BillingAddress", - type: "object", - required: [ - "first_name", - "last_name", - "line_1", - "region", - "postcode", - "country", - ], - properties: { - company_name: { - description: "Company name of the billing recipient.", - type: "string", - example: "John Doe Enterprises", - }, - country: { - description: "Specifies the country of the billing address.", - type: "string", - example: "US", - }, - county: { - description: "Specifies the county of the billing address.", - type: "string", - example: "Orange", - }, - first_name: { - description: "First name of the billing recipient.", - type: "string", - example: "John", - }, - last_name: { - description: "Last name of the billing recipient.", - type: "string", - example: "Doe", - }, - line_1: { - description: "First line of the billing address.", - type: "string", - example: "1 Sunny Street", - }, - line_2: { - description: "Second line of the billing address.", - type: "string", - }, - postcode: { - description: "Postcode of the billing address.", - type: "string", - example: "92802", - }, - region: { - description: - "Specifies state, province, or region of the billing address.", - type: "string", - example: "CA", - }, - }, -} as const - -export const $Contact = { - title: "Contact", - type: "object", - properties: { - email: { - description: "The email address of the contact.", - type: "string", - example: "johndoe@email.com", - }, - name: { - description: "The name of the contact.", - type: "string", - example: "John Doe", - }, - }, -} as const - -export const $ShippingAddress = { - title: "ShippingAddress", - type: "object", - required: [ - "first_name", - "last_name", - "line_1", - "region", - "postcode", - "country", - ], - properties: { - company_name: { - description: "Company of the shipping recipient.", - type: "string", - example: "John Doe Enterprises", - }, - country: { - description: "Specifies the country of the shipping address.", - type: "string", - example: "US", - }, - county: { - description: "Specifies the county of the shipping address.", - type: "string", - example: "Orange", - }, - first_name: { - description: "First name of the shipping recipient.", - type: "string", - example: "John", - }, - last_name: { - description: "Last name of the shipping recipient.", - type: "string", - example: "Doe", - }, - line_1: { - description: "First line of the shipping address.", - type: "string", - example: "1 Sunny Street", - }, - line_2: { - description: "Second line of the shipping address.", - type: "string", - }, - postcode: { - description: "Post code of the shipping address.", - type: "string", - example: "92802", - }, - region: { - description: - "Specifies the state, province, or region of the shipping address.", - type: "string", - example: "CA", - }, - }, -} as const - -export const $Response_Meta_Carts = { - type: "object", - properties: { - page: { - $ref: "#/components/schemas/Response.PaginationPage", - }, - results: { - $ref: "#/components/schemas/Response.PaginationResults", - }, - }, -} as const - -export const $Response_Meta_Orders = { - type: "object", - properties: { - page: { - $ref: "#/components/schemas/Response.PaginationPage", - }, - results: { - $ref: "#/components/schemas/Response.PaginationResults", - }, - }, -} as const - -export const $Response_PaginationPage = { - type: "object", - properties: { - current: { - description: "The current page.", - type: "integer", - }, - limit: { - description: - "The maximum number of records per page for this response. You can set this value up to 100.", - type: "integer", - }, - offset: { - description: - "The current offset by number of records, not pages. Offset is zero-based.", - type: "integer", - }, - total: { - description: "The total page count.", - type: "integer", - }, - }, -} as const - -export const $Response_PaginationResults = { - type: "object", - properties: { - total: { - description: "The total page count.", - type: "integer", - }, - }, -} as const - -export const $Response_PageLinks = { - type: "object", - properties: { - current: { - description: "Always the current page.", - type: "string", - }, - first: { - description: "Always the first page.", - type: "string", - }, - last: { - description: "If there is only one page, it is `null`.", - type: "string", - }, - next: { - description: "If there is only one page, it is `null`.", - type: "string", - }, - prev: { - description: "if the user is on the first page, it is `null`.", - type: "string", - }, - }, -} as const - -export const $Response_Data = { - type: "object", - properties: { - data: {}, - }, -} as const - -export const $Response_Error = { - type: "array", - properties: { - detail: { - type: "string", - }, - status: { - type: "string", - }, - title: { - type: "string", - }, - }, -} as const - -export const $Timestamps = { - type: "object", - properties: { - created_at: { - description: "The date this was created.", - type: "string", - example: "2023-11-07T23:04:18.845Z", - }, - updated_at: { - description: "The date this was last updated.", - example: "2023-11-07T23:04:18.845Z", - }, - }, -} as const - -export const $CartTimestamps = { - type: "object", - properties: { - created_at: { - type: "string", - example: "2023-11-07T23:04:18.845Z", - }, - updated_at: { - example: "2023-11-07T23:04:18.845Z", - }, - expires_at: { - example: "2023-11-12T23:04:18.845Z", - }, - }, -} as const diff --git a/packages/sdks/shopper/src/client/services.gen.ts b/packages/sdks/shopper/src/client/sdk.gen.ts similarity index 87% rename from packages/sdks/shopper/src/client/services.gen.ts rename to packages/sdks/shopper/src/client/sdk.gen.ts index 1b5091be..dbdddb34 100644 --- a/packages/sdks/shopper/src/client/services.gen.ts +++ b/packages/sdks/shopper/src/client/sdk.gen.ts @@ -1,294 +1,257 @@ // This file is auto-generated by @hey-api/openapi-ts import { createClient, createConfig, type Options } from "@hey-api/client-fetch" -import { - type GetByContextReleaseData, - type GetByContextReleaseError, - type GetByContextReleaseResponse, - type GetByContextAllHierarchiesData, - type GetByContextAllHierarchiesError, - type GetByContextAllHierarchiesResponse, - type GetByContextHierarchyData, - type GetByContextHierarchyError, - type GetByContextHierarchyResponse, - type GetByContextHierarchyNodesData, - type GetByContextHierarchyNodesError, - type GetByContextHierarchyNodesResponse, - type GetByContextHierarchyChildNodesData, - type GetByContextHierarchyChildNodesError, - type GetByContextHierarchyChildNodesResponse, - type GetByContextAllNodesData, - type GetByContextAllNodesError, - type GetByContextAllNodesResponse, - type GetByContextNodeData, - type GetByContextNodeError, - type GetByContextNodeResponse, - type GetByContextChildNodesData, - type GetByContextChildNodesError, - type GetByContextChildNodesResponse, - type GetByContextAllProductsData, - type GetByContextAllProductsError, - type GetByContextAllProductsResponse, - type GetByContextProductData, - type GetByContextProductError, - type GetByContextProductResponse, - type GetByContextComponentProductIdsData, - type GetByContextComponentProductIdsError, - type GetByContextComponentProductIdsResponse, - type GetByContextChildProductsData, - type GetByContextChildProductsError, - type GetByContextChildProductsResponse, - type GetByContextProductsForHierarchyData, - type GetByContextProductsForHierarchyError, - type GetByContextProductsForHierarchyResponse, - type GetByContextProductsForNodeData, - type GetByContextProductsForNodeError, - type GetByContextProductsForNodeResponse, - type ConfigureByContextProductData, - type ConfigureByContextProductError, - type ConfigureByContextProductResponse, - type CreateCatalogData, - type CreateCatalogError, - type CreateCatalogResponse, - type GetCatalogsError, - type GetCatalogsResponse, - type GetCatalogByIdData, - type GetCatalogByIdError, - type GetCatalogByIdResponse, - type UpdateCatalogData, - type UpdateCatalogError, - type UpdateCatalogResponse, - type DeleteCatalogByIdData, - type DeleteCatalogByIdError, - type DeleteCatalogByIdResponse, - type PublishReleaseData, - type PublishReleaseError, - type PublishReleaseResponse, - type GetReleasesData, - type GetReleasesError, - type GetReleasesResponse, - type DeleteReleasesData, - type DeleteReleasesError, - type DeleteReleasesResponse, - type GetReleaseByIdData, - type GetReleaseByIdError, - type GetReleaseByIdResponse, - type DeleteReleaseByIdData, - type DeleteReleaseByIdError, - type DeleteReleaseByIdResponse, - type CreateRuleData, - type CreateRuleError, - type CreateRuleResponse, - type GetRulesData, - type GetRulesError, - type GetRulesResponse, - type GetRuleByIdData, - type GetRuleByIdError, - type GetRuleByIdResponse, - type UpdateRuleData, - type UpdateRuleError, - type UpdateRuleResponse, - type DeleteRuleByIdData, - type DeleteRuleByIdError, - type DeleteRuleByIdResponse, - type GetAllHierarchiesData, - type GetAllHierarchiesError, - type GetAllHierarchiesResponse, - type GetHierarchyData, - type GetHierarchyError, - type GetHierarchyResponse, - type GetHierarchyNodesData, - type GetHierarchyNodesError, - type GetHierarchyNodesResponse, - type GetHierarchyChildNodesData, - type GetHierarchyChildNodesError, - type GetHierarchyChildNodesResponse, - type GetAllNodesData, - type GetAllNodesError, - type GetAllNodesResponse, - type GetNodeData, - type GetNodeError, - type GetNodeResponse, - type GetChildNodesData, - type GetChildNodesError, - type GetChildNodesResponse, - type GetAllProductsData, - type GetAllProductsError, - type GetAllProductsResponse, - type GetProductData, - type GetProductError, - type GetProductResponse, - type GetComponentProductIdsData, - type GetComponentProductIdsError, - type GetComponentProductIdsResponse, - type GetChildProductsData, - type GetChildProductsError, - type GetChildProductsResponse, - type GetProductsForHierarchyData, - type GetProductsForHierarchyError, - type GetProductsForHierarchyResponse, - type GetProductsForNodeData, - type GetProductsForNodeError, - type GetProductsForNodeResponse, - type GetCartsData, - type GetCartsError, - type GetCartsResponse, - type CreateAcartData, - type CreateAcartError, - type CreateAcartResponse, - type GetCartData, - type GetCartError, - type GetCartResponse, - type UpdateAcartData, - type UpdateAcartError, - type UpdateAcartResponse, - type DeleteAcartData, - type DeleteAcartError, - type DeleteAcartResponse, - type GetCartItemsData, - type GetCartItemsError, - type GetCartItemsResponse, - type BulkUpdateItemsInCartData, - type BulkUpdateItemsInCartError, - type BulkUpdateItemsInCartResponse, - type ManageCartsData, - type ManageCartsError, - type ManageCartsResponse, - type DeleteAllCartItemsData, - type DeleteAllCartItemsError, - type DeleteAllCartItemsResponse, - type UpdateAcartItemData, - type UpdateAcartItemError, - type UpdateAcartItemResponse, - type DeleteAcartItemData, - type DeleteAcartItemError, - type DeleteAcartItemResponse, - type CreateAccountCartAssociationData, - type CreateAccountCartAssociationError, - type CreateAccountCartAssociationResponse, - type DeleteAccountCartAssociationData, - type DeleteAccountCartAssociationError, - type DeleteAccountCartAssociationResponse, - type CreateCustomerCartAssociationData, - type CreateCustomerCartAssociationError, - type CreateCustomerCartAssociationResponse, - type DeleteCustomerCartAssociationData, - type DeleteCustomerCartAssociationError, - type DeleteCustomerCartAssociationResponse, - type DeleteApromotionViaPromotionCodeData, - type DeleteApromotionViaPromotionCodeError, - type DeleteApromotionViaPromotionCodeResponse, - type AddTaxItemToCartData, - type AddTaxItemToCartError, - type AddTaxItemToCartResponse, - type BulkAddTaxItemsToCartData, - type BulkAddTaxItemsToCartError, - type BulkAddTaxItemsToCartResponse, - type BulkDeleteTaxItemsFromCartData, - type BulkDeleteTaxItemsFromCartError, - type BulkDeleteTaxItemsFromCartResponse, - type UpdateAtaxItemData, - type UpdateAtaxItemError, - type UpdateAtaxItemResponse, - type DeleteAtaxItemData, - type DeleteAtaxItemError, - type DeleteAtaxItemResponse, - type BulkAddCustomDiscountsToCartData, - type BulkAddCustomDiscountsToCartError, - type BulkAddCustomDiscountsToCartResponse, - type BulkDeleteCustomDiscountsFromCartData, - type BulkDeleteCustomDiscountsFromCartError, - type BulkDeleteCustomDiscountsFromCartResponse, - type UpdateCustomDiscountForCartData, - type UpdateCustomDiscountForCartError, - type UpdateCustomDiscountForCartResponse, - type DeleteCustomDiscountFromCartData, - type DeleteCustomDiscountFromCartError, - type DeleteCustomDiscountFromCartResponse, - type AddCustomDiscountToCartItemData, - type UpdateCustomDiscountForCartItemData, - type DeleteCustomDiscountFromCartItemData, - type DeleteCustomDiscountFromCartItemError, - type DeleteCustomDiscountFromCartItemResponse, - type CreateCartPaymentIntentData, - type CreateCartPaymentIntentError, - type CreateCartPaymentIntentResponse, - type CheckoutApiData, - type CheckoutApiError, - type CheckoutApiResponse, - type GetCustomerOrdersData, - type GetCustomerOrdersError, - type GetCustomerOrdersResponse, - type GetAnOrderData, - type GetAnOrderError, - type GetAnOrderResponse, - type UpdateAnOrderData, - type UpdateAnOrderError, - type UpdateAnOrderResponse, - type GetOrderItemsData, - type GetOrderItemsError, - type GetOrderItemsResponse, - type AnonymizeOrdersData, - type AnonymizeOrdersError, - type AnonymizeOrdersResponse, - type AuthorizeSetupData, - type AuthorizeSetupError, - type AuthorizeSetupResponse, - type ConfirmSetupData, - type ConfirmSetupError, - type ConfirmSetupResponse, - type CaptureAtransactionData, - type CaptureAtransactionError, - type CaptureAtransactionResponse, - type RefundAtransactionData, - type RefundAtransactionError, - type RefundAtransactionResponse, - type GetOrderTransactionsData, - type GetOrderTransactionsError, - type GetOrderTransactionsResponse, - type GetAtransactionData, - type GetAtransactionError, - type GetAtransactionResponse, - type CancelAtransactionData, - type CancelAtransactionError, - type CancelAtransactionResponse, - GetByContextReleaseResponseTransformer, - GetByContextAllHierarchiesResponseTransformer, - GetByContextHierarchyResponseTransformer, - GetByContextHierarchyNodesResponseTransformer, - GetByContextHierarchyChildNodesResponseTransformer, - GetByContextAllNodesResponseTransformer, - GetByContextNodeResponseTransformer, - GetByContextChildNodesResponseTransformer, - GetByContextAllProductsResponseTransformer, - GetByContextProductResponseTransformer, - GetByContextChildProductsResponseTransformer, - GetByContextProductsForHierarchyResponseTransformer, - GetByContextProductsForNodeResponseTransformer, - ConfigureByContextProductResponseTransformer, - CreateCatalogResponseTransformer, - GetCatalogsResponseTransformer, - GetCatalogByIdResponseTransformer, - UpdateCatalogResponseTransformer, - PublishReleaseResponseTransformer, - GetReleasesResponseTransformer, - GetReleaseByIdResponseTransformer, - CreateRuleResponseTransformer, - GetRulesResponseTransformer, - GetRuleByIdResponseTransformer, - UpdateRuleResponseTransformer, - GetAllHierarchiesResponseTransformer, - GetHierarchyResponseTransformer, - GetHierarchyNodesResponseTransformer, - GetHierarchyChildNodesResponseTransformer, - GetAllNodesResponseTransformer, - GetNodeResponseTransformer, - GetChildNodesResponseTransformer, - GetAllProductsResponseTransformer, - GetProductResponseTransformer, - GetChildProductsResponseTransformer, - GetProductsForHierarchyResponseTransformer, - GetProductsForNodeResponseTransformer, +import type { + GetByContextReleaseData, + GetByContextReleaseError, + GetByContextReleaseResponse, + GetByContextAllHierarchiesData, + GetByContextAllHierarchiesError, + GetByContextAllHierarchiesResponse, + GetByContextHierarchyData, + GetByContextHierarchyError, + GetByContextHierarchyResponse, + GetByContextHierarchyNodesData, + GetByContextHierarchyNodesError, + GetByContextHierarchyNodesResponse, + GetByContextHierarchyChildNodesData, + GetByContextHierarchyChildNodesError, + GetByContextHierarchyChildNodesResponse, + GetByContextAllNodesData, + GetByContextAllNodesError, + GetByContextAllNodesResponse, + GetByContextNodeData, + GetByContextNodeError, + GetByContextNodeResponse, + GetByContextChildNodesData, + GetByContextChildNodesError, + GetByContextChildNodesResponse, + GetByContextAllProductsData, + GetByContextAllProductsError, + GetByContextAllProductsResponse, + GetByContextProductData, + GetByContextProductError, + GetByContextProductResponse, + GetByContextComponentProductIdsData, + GetByContextComponentProductIdsError, + GetByContextComponentProductIdsResponse, + GetByContextChildProductsData, + GetByContextChildProductsError, + GetByContextChildProductsResponse, + GetByContextProductsForHierarchyData, + GetByContextProductsForHierarchyError, + GetByContextProductsForHierarchyResponse, + GetByContextProductsForNodeData, + GetByContextProductsForNodeError, + GetByContextProductsForNodeResponse, + ConfigureByContextProductData, + ConfigureByContextProductError, + ConfigureByContextProductResponse, + GetCatalogsData, + GetCatalogsError, + GetCatalogsResponse, + CreateCatalogData, + CreateCatalogError, + CreateCatalogResponse, + DeleteCatalogByIdData, + DeleteCatalogByIdError, + DeleteCatalogByIdResponse, + GetCatalogByIdData, + GetCatalogByIdError, + GetCatalogByIdResponse, + UpdateCatalogData, + UpdateCatalogError, + UpdateCatalogResponse, + DeleteReleasesData, + DeleteReleasesError, + DeleteReleasesResponse, + GetReleasesData, + GetReleasesError, + GetReleasesResponse, + PublishReleaseData, + PublishReleaseError, + PublishReleaseResponse, + DeleteReleaseByIdData, + DeleteReleaseByIdError, + DeleteReleaseByIdResponse, + GetReleaseByIdData, + GetReleaseByIdError, + GetReleaseByIdResponse, + GetRulesData, + GetRulesError, + GetRulesResponse, + CreateRuleData, + CreateRuleError, + CreateRuleResponse, + DeleteRuleByIdData, + DeleteRuleByIdError, + DeleteRuleByIdResponse, + GetRuleByIdData, + GetRuleByIdError, + GetRuleByIdResponse, + UpdateRuleData, + UpdateRuleError, + UpdateRuleResponse, + GetAllHierarchiesData, + GetAllHierarchiesError, + GetAllHierarchiesResponse, + GetHierarchyData, + GetHierarchyError, + GetHierarchyResponse, + GetHierarchyNodesData, + GetHierarchyNodesError, + GetHierarchyNodesResponse, + GetHierarchyChildNodesData, + GetHierarchyChildNodesError, + GetHierarchyChildNodesResponse, + GetAllNodesData, + GetAllNodesError, + GetAllNodesResponse, + GetNodeData, + GetNodeError, + GetNodeResponse, + GetChildNodesData, + GetChildNodesError, + GetChildNodesResponse, + GetAllProductsData, + GetAllProductsError, + GetAllProductsResponse, + GetProductData, + GetProductError, + GetProductResponse, + GetComponentProductIdsData, + GetComponentProductIdsError, + GetComponentProductIdsResponse, + GetChildProductsData, + GetChildProductsError, + GetChildProductsResponse, + GetProductsForHierarchyData, + GetProductsForHierarchyError, + GetProductsForHierarchyResponse, + GetProductsForNodeData, + GetProductsForNodeError, + GetProductsForNodeResponse, + GetCartsData, + GetCartsError, + GetCartsResponse, + CreateACartData, + CreateACartError, + CreateACartResponse, + DeleteACartData, + DeleteACartError, + DeleteACartResponse, + GetCartData, + GetCartError, + GetCartResponse, + UpdateACartData, + UpdateACartError, + UpdateACartResponse, + DeleteAllCartItemsData, + DeleteAllCartItemsError, + DeleteAllCartItemsResponse, + GetCartItemsData, + GetCartItemsError, + GetCartItemsResponse, + ManageCartsData, + ManageCartsError, + ManageCartsResponse, + BulkUpdateItemsInCartData, + BulkUpdateItemsInCartError, + DeleteACartItemData, + DeleteACartItemError, + DeleteACartItemResponse, + UpdateACartItemData, + UpdateACartItemError, + UpdateACartItemResponse, + DeleteAccountCartAssociationData, + DeleteAccountCartAssociationError, + DeleteAccountCartAssociationResponse, + CreateAccountCartAssociationData, + CreateAccountCartAssociationError, + CreateAccountCartAssociationResponse, + DeleteCustomerCartAssociationData, + DeleteCustomerCartAssociationError, + DeleteCustomerCartAssociationResponse, + CreateCustomerCartAssociationData, + CreateCustomerCartAssociationError, + CreateCustomerCartAssociationResponse, + DeleteAPromotionViaPromotionCodeData, + DeleteAPromotionViaPromotionCodeError, + DeleteAPromotionViaPromotionCodeResponse, + AddTaxItemToCartData, + AddTaxItemToCartError, + AddTaxItemToCartResponse, + BulkDeleteTaxItemsFromCartData, + BulkDeleteTaxItemsFromCartError, + BulkDeleteTaxItemsFromCartResponse, + BulkAddTaxItemsToCartData, + BulkAddTaxItemsToCartError, + BulkAddTaxItemsToCartResponse, + DeleteATaxItemData, + DeleteATaxItemError, + DeleteATaxItemResponse, + UpdateATaxItemData, + UpdateATaxItemError, + UpdateATaxItemResponse, + BulkDeleteCustomDiscountsFromCartData, + BulkDeleteCustomDiscountsFromCartError, + BulkDeleteCustomDiscountsFromCartResponse, + BulkAddCustomDiscountsToCartData, + BulkAddCustomDiscountsToCartError, + BulkAddCustomDiscountsToCartResponse, + DeleteCustomDiscountFromCartData, + DeleteCustomDiscountFromCartError, + DeleteCustomDiscountFromCartResponse, + UpdateCustomDiscountForCartData, + UpdateCustomDiscountForCartError, + UpdateCustomDiscountForCartResponse, + AddCustomDiscountToCartItemData, + DeleteCustomDiscountFromCartItemData, + DeleteCustomDiscountFromCartItemError, + DeleteCustomDiscountFromCartItemResponse, + UpdateCustomDiscountForCartItemData, + CreateCartPaymentIntentData, + CreateCartPaymentIntentError, + CreateCartPaymentIntentResponse, + CheckoutApiData, + CheckoutApiError, + CheckoutApiResponse, + GetCustomerOrdersData, + GetCustomerOrdersError, + GetCustomerOrdersResponse, + GetAnOrderData, + GetAnOrderError, + GetAnOrderResponse, + UpdateAnOrderData, + UpdateAnOrderError, + UpdateAnOrderResponse, + GetOrderItemsData, + GetOrderItemsError, + GetOrderItemsResponse, + AnonymizeOrdersData, + AnonymizeOrdersError, + AnonymizeOrdersResponse, + AuthorizeSetupData, + AuthorizeSetupError, + AuthorizeSetupResponse, + ConfirmSetupData, + ConfirmSetupError, + ConfirmSetupResponse, + CaptureATransactionData, + CaptureATransactionError, + CaptureATransactionResponse, + RefundATransactionData, + RefundATransactionError, + RefundATransactionResponse, + GetOrderTransactionsData, + GetOrderTransactionsError, + GetOrderTransactionsResponse, + GetATransactionData, + GetATransactionError, + GetATransactionResponse, + CancelATransactionData, + CancelATransactionError, + CancelATransactionResponse, } from "./types.gen" export const client = createClient(createConfig()) @@ -306,8 +269,13 @@ export const getByContextRelease = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalog", - responseTransformer: GetByContextReleaseResponseTransformer, }) } @@ -348,8 +316,13 @@ export const getByContextAllHierarchies = < ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalog/hierarchies", - responseTransformer: GetByContextAllHierarchiesResponseTransformer, }) } @@ -369,8 +342,13 @@ export const getByContextHierarchy = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalog/hierarchies/{hierarchy_id}", - responseTransformer: GetByContextHierarchyResponseTransformer, }) } @@ -413,8 +391,13 @@ export const getByContextHierarchyNodes = < ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalog/hierarchies/{hierarchy_id}/nodes", - responseTransformer: GetByContextHierarchyNodesResponseTransformer, }) } @@ -461,8 +444,13 @@ export const getByContextHierarchyChildNodes = < ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalog/hierarchies/{hierarchy_id}/children", - responseTransformer: GetByContextHierarchyChildNodesResponseTransformer, }) } @@ -511,8 +499,13 @@ export const getByContextAllNodes = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalog/nodes", - responseTransformer: GetByContextAllNodesResponseTransformer, }) } @@ -542,8 +535,13 @@ export const getByContextNode = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalog/nodes/{node_id}", - responseTransformer: GetByContextNodeResponseTransformer, }) } @@ -593,8 +591,13 @@ export const getByContextChildNodes = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalog/nodes/{node_id}/relationships/children", - responseTransformer: GetByContextChildNodesResponseTransformer, }) } @@ -652,8 +655,13 @@ export const getByContextAllProducts = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalog/products", - responseTransformer: GetByContextAllProductsResponseTransformer, }) } @@ -685,8 +693,13 @@ export const getByContextProduct = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalog/products/{product_id}", - responseTransformer: GetByContextProductResponseTransformer, }) } @@ -710,6 +723,12 @@ export const getByContextComponentProductIds = < ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalog/products/{product_id}/relationships/component_products", }) } @@ -763,8 +782,13 @@ export const getByContextChildProducts = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalog/products/{product_id}/relationships/children", - responseTransformer: GetByContextChildProductsResponseTransformer, }) } @@ -820,8 +844,13 @@ export const getByContextProductsForHierarchy = < ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalog/hierarchies/{hierarchy_id}/products", - responseTransformer: GetByContextProductsForHierarchyResponseTransformer, }) } @@ -876,8 +905,13 @@ export const getByContextProductsForNode = < ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalog/nodes/{node_id}/relationships/products", - responseTransformer: GetByContextProductsForNodeResponseTransformer, }) } @@ -914,8 +948,45 @@ export const configureByContextProduct = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalog/products/{product_id}/configure", - responseTransformer: ConfigureByContextProductResponseTransformer, + }) +} + +/** + * Gets all authorized catalogs + * Retrieves a list of all the catalogs that you are authorized to view. Currently, published catalogs are limited to the current release and two releases prior to the current release. You can see the differences between the last 2 consecutive catalog releases using the delta link returned in the response of a [publish a catalog](/docs/api/pxm/catalog/publish-release) endpoint. + * + * You can use the `is_full_delta` attribute returned from the `get a release of a catalog` endpoint to determine if you need to refresh the data in your company system before publishing a catalog release and injecting fresh data in a delta link. The `is_full_delta` attribute tells you if this is a full publish of a catalog release. Using a search service as an example, if the `is_full_delta` attribute is `true`, you should remove all data about that catalog from the search service before publishing a catalog release and injecting fresh data from the delta file. See [Publish a catalog](/docs/api/pxm/catalog/publish-release). + * + * If the `is_full_publish` attribute returned in the response is `false`, data from the previous catalog release overlaid the existing data in the delta file. The `is_full_publish` attribute is always `true` the first time a catalog is published. + * + */ +export const getCatalogs = ( + options?: Options, +) => { + return (options?.client ?? client).get< + GetCatalogsResponse, + GetCatalogsError, + ThrowOnError + >({ + ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/catalogs", }) } @@ -937,31 +1008,40 @@ export const createCatalog = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalogs", - responseTransformer: CreateCatalogResponseTransformer, }) } /** - * Gets all authorized catalogs - * Retrieves a list of all the catalogs that you are authorized to view. Currently, published catalogs are limited to the current release and two releases prior to the current release. You can see the differences between the last 2 consecutive catalog releases using the delta link returned in the response of a [publish a catalog](/docs/api/pxm/catalog/publish-release) endpoint. - * - * You can use the `is_full_delta` attribute returned from the `get a release of a catalog` endpoint to determine if you need to refresh the data in your company system before publishing a catalog release and injecting fresh data in a delta link. The `is_full_delta` attribute tells you if this is a full publish of a catalog release. Using a search service as an example, if the `is_full_delta` attribute is `true`, you should remove all data about that catalog from the search service before publishing a catalog release and injecting fresh data from the delta file. See [Publish a catalog](/docs/api/pxm/catalog/publish-release). - * - * If the `is_full_publish` attribute returned in the response is `false`, data from the previous catalog release overlaid the existing data in the delta file. The `is_full_publish` attribute is always `true` the first time a catalog is published. - * + * Deletes a catalog + * Deletes an unpublished catalog. Use [**Delete a Release**](/docs/api/pxm/catalog/delete-release-by-id) and [**Delete All Releases**](/docs/api/pxm/catalog/delete-releases) to delete releases of a catalog. If the catalog is associated with any catalog rules, you must first update the catalog rules to remove the catalog. */ -export const getCatalogs = ( - options?: Options, +export const deleteCatalogById = ( + options: Options, ) => { - return (options?.client ?? client).get< - GetCatalogsResponse, - GetCatalogsError, + return (options?.client ?? client).delete< + DeleteCatalogByIdResponse, + DeleteCatalogByIdError, ThrowOnError >({ ...options, - url: "/catalogs", - responseTransformer: GetCatalogsResponseTransformer, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/catalogs/{catalog_id}", }) } @@ -978,8 +1058,13 @@ export const getCatalogById = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalogs/{catalog_id}", - responseTransformer: GetCatalogByIdResponseTransformer, }) } @@ -996,25 +1081,68 @@ export const updateCatalog = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalogs/{catalog_id}", - responseTransformer: UpdateCatalogResponseTransformer, }) } /** - * Deletes a catalog - * Deletes an unpublished catalog. Use [**Delete a Release**](/docs/api/pxm/catalog/delete-release-by-id) and [**Delete All Releases**](/docs/api/pxm/catalog/delete-releases) to delete releases of a catalog. If the catalog is associated with any catalog rules, you must first update the catalog rules to remove the catalog. + * Deletes all releases + * Deletes all releases of the specified published catalog. */ -export const deleteCatalogById = ( - options: Options, +export const deleteReleases = ( + options: Options, ) => { return (options?.client ?? client).delete< - DeleteCatalogByIdResponse, - DeleteCatalogByIdError, + DeleteReleasesResponse, + DeleteReleasesError, ThrowOnError >({ ...options, - url: "/catalogs/{catalog_id}", + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/catalogs/{catalog_id}/releases", + }) +} + +/** + * Gets all authorized catalog releases + * Returns a list of all published releases of the specified catalog. Currently, published catalogs are limited to the current release and two releases prior to the current release. You can see the differences between the last 2 consecutive catalog releases using the `delta` link returned in the response of a `publish a catalog` endpoint. + * + * You can use the `is_full_delta` attribute returned from the `get a release of a catalog` endpoint to determine if you need to refresh the data in your company system before publishing a catalog release and injecting fresh data in a delta link. The `is_full_delta` attribute tells you if this is a full publish of a catalog release. Using a search service as an example, if the `is_full_delta` attribute is `true`, you should remove all data about that catalog from the search service before publishing a catalog release and injecting fresh data from the delta file. + * + * If the `is_full_publish` attribute returned in the response is `false`, data from the previous catalog release overlaid the existing data in the delta file. The `is_full_publish` attribute is always `true` the first time a catalog is published. + * + */ +export const getReleases = ( + options: Options, +) => { + return (options?.client ?? client).get< + GetReleasesResponse, + GetReleasesError, + ThrowOnError + >({ + ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/catalogs/{catalog_id}/releases", }) } @@ -1075,48 +1203,40 @@ export const publishRelease = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalogs/{catalog_id}/releases", - responseTransformer: PublishReleaseResponseTransformer, - }) -} - -/** - * Gets all authorized catalog releases - * Returns a list of all published releases of the specified catalog. Currently, published catalogs are limited to the current release and two releases prior to the current release. You can see the differences between the last 2 consecutive catalog releases using the `delta` link returned in the response of a `publish a catalog` endpoint. - * - * You can use the `is_full_delta` attribute returned from the `get a release of a catalog` endpoint to determine if you need to refresh the data in your company system before publishing a catalog release and injecting fresh data in a delta link. The `is_full_delta` attribute tells you if this is a full publish of a catalog release. Using a search service as an example, if the `is_full_delta` attribute is `true`, you should remove all data about that catalog from the search service before publishing a catalog release and injecting fresh data from the delta file. - * - * If the `is_full_publish` attribute returned in the response is `false`, data from the previous catalog release overlaid the existing data in the delta file. The `is_full_publish` attribute is always `true` the first time a catalog is published. - * - */ -export const getReleases = ( - options: Options, -) => { - return (options?.client ?? client).get< - GetReleasesResponse, - GetReleasesError, - ThrowOnError - >({ - ...options, - url: "/catalogs/{catalog_id}/releases", - responseTransformer: GetReleasesResponseTransformer, }) } /** - * Deletes all releases - * Deletes all releases of the specified published catalog. + * Deletes a release + * Deletes the specified published catalog release. */ -export const deleteReleases = ( - options: Options, +export const deleteReleaseById = ( + options: Options, ) => { return (options?.client ?? client).delete< - DeleteReleasesResponse, - DeleteReleasesError, + DeleteReleaseByIdResponse, + DeleteReleaseByIdError, ThrowOnError >({ ...options, - url: "/catalogs/{catalog_id}/releases", + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/catalogs/{catalog_id}/releases/{release_id}", }) } @@ -1133,25 +1253,45 @@ export const getReleaseById = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalogs/{catalog_id}/releases/{release_id}", - responseTransformer: GetReleaseByIdResponseTransformer, }) } /** - * Deletes a release - * Deletes the specified published catalog release. + * Gets all authorized catalog rules + * Retrieves all authorized catalog rules. + * + * ### Filtering + * + * This endpoint supports filtering. For general filtering syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are supported. + * + * | Operator | Description | Supported Attributes | Example | + * |:--- |:--- |:--- |:--- | + * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | + * */ -export const deleteReleaseById = ( - options: Options, +export const getRules = ( + options?: Options, ) => { - return (options?.client ?? client).delete< - DeleteReleaseByIdResponse, - DeleteReleaseByIdError, + return (options?.client ?? client).get< + GetRulesResponse, + GetRulesError, ThrowOnError >({ ...options, - url: "/catalogs/{catalog_id}/releases/{release_id}", + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/catalogs/rules", }) } @@ -1179,35 +1319,39 @@ export const createRule = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalogs/rules", - responseTransformer: CreateRuleResponseTransformer, }) } /** - * Gets all authorized catalog rules - * Retrieves all authorized catalog rules. - * - * ### Filtering - * - * This endpoint supports filtering. For general filtering syntax, see [Filtering](/guides/Getting-Started/filtering). The following operators and attributes are supported. - * - * | Operator | Description | Supported Attributes | Example | - * |:--- |:--- |:--- |:--- | - * | `In` | Checks if the values are included in the specified string. If they are, the condition is true. | `id` | `filter=in(id,some-id)` | - * + * Deletes a catalog rule */ -export const getRules = ( - options?: Options, +export const deleteRuleById = ( + options: Options, ) => { - return (options?.client ?? client).get< - GetRulesResponse, - GetRulesError, + return (options?.client ?? client).delete< + DeleteRuleByIdResponse, + DeleteRuleByIdError, ThrowOnError >({ ...options, - url: "/catalogs/rules", - responseTransformer: GetRulesResponseTransformer, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/catalogs/rules/{catalog_rule_id}", }) } @@ -1223,8 +1367,13 @@ export const getRuleById = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalogs/rules/{catalog_rule_id}", - responseTransformer: GetRuleByIdResponseTransformer, }) } @@ -1241,23 +1390,16 @@ export const updateRule = ( ThrowOnError >({ ...options, - url: "/catalogs/rules/{catalog_rule_id}", - responseTransformer: UpdateRuleResponseTransformer, - }) -} - -/** - * Deletes a catalog rule - */ -export const deleteRuleById = ( - options: Options, -) => { - return (options?.client ?? client).delete< - DeleteRuleByIdResponse, - DeleteRuleByIdError, - ThrowOnError - >({ - ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalogs/rules/{catalog_rule_id}", }) } @@ -1301,8 +1443,13 @@ export const getAllHierarchies = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalogs/{catalog_id}/releases/{release_id}/hierarchies", - responseTransformer: GetAllHierarchiesResponseTransformer, }) } @@ -1326,8 +1473,13 @@ export const getHierarchy = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}", - responseTransformer: GetHierarchyResponseTransformer, }) } @@ -1372,8 +1524,13 @@ export const getHierarchyNodes = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/nodes", - responseTransformer: GetHierarchyNodesResponseTransformer, }) } @@ -1420,8 +1577,13 @@ export const getHierarchyChildNodes = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/children", - responseTransformer: GetHierarchyChildNodesResponseTransformer, }) } @@ -1477,8 +1639,13 @@ export const getAllNodes = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalogs/{catalog_id}/releases/{release_id}/nodes", - responseTransformer: GetAllNodesResponseTransformer, }) } @@ -1512,8 +1679,13 @@ export const getNode = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}", - responseTransformer: GetNodeResponseTransformer, }) } @@ -1569,8 +1741,13 @@ export const getChildNodes = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/children", - responseTransformer: GetChildNodesResponseTransformer, }) } @@ -1623,8 +1800,13 @@ export const getAllProducts = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalogs/{catalog_id}/releases/{release_id}/products", - responseTransformer: GetAllProductsResponseTransformer, }) } @@ -1662,8 +1844,13 @@ export const getProduct = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}", - responseTransformer: GetProductResponseTransformer, }) } @@ -1697,6 +1884,12 @@ export const getComponentProductIds = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/component_products", }) } @@ -1750,8 +1943,13 @@ export const getChildProducts = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/children", - responseTransformer: GetChildProductsResponseTransformer, }) } @@ -1806,8 +2004,13 @@ export const getProductsForHierarchy = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/products", - responseTransformer: GetProductsForHierarchyResponseTransformer, }) } @@ -1868,8 +2071,13 @@ export const getProductsForNode = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/products", - responseTransformer: GetProductsForNodeResponseTransformer, }) } @@ -1895,6 +2103,12 @@ export const getCarts = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/carts", }) } @@ -1931,19 +2145,69 @@ export const getCarts = ( * - In the case of preview carts (those with `snapshot_date`), an error is returned for invalid actions, such as removing the preview date, setting a preview date in the past, or attempting to checkout a cart with a `snapshot_date`. * */ -export const createAcart = ( - options?: Options, +export const createACart = ( + options?: Options, ) => { return (options?.client ?? client).post< - CreateAcartResponse, - CreateAcartError, + CreateACartResponse, + CreateACartError, ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/carts", }) } +/** + * Delete a Cart + * You can delete a cart, including the items, name, description, and remove all associations. + * + * ### Errors + * + * The following error message is received when you attempt to delete a cart that is associated with a customer. Before deletion, ensure that the cart is disassociated. + * + * ```json + * message: { + * errors: [ + * { + * status: 400, + * title: 'Last cart', + * detail: 'This is the last cart associated with a customer and it cannot be deleted, try disassociating instead' + * } + * ] + * } + * ```` + * + */ +export const deleteACart = ( + options: Options, +) => { + return (options?.client ?? client).delete< + DeleteACartResponse, + DeleteACartError, + ThrowOnError + >({ + ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/v2/carts/{cartID}", + }) +} + /** * Get a Cart * Use this endpoint to retrieve a specific cart. If a cart ID does not exist, a new cart will be automatically created. If the cart is associated with shipping groups, calling this endpoint displays the associated shipping group IDs in the `relationships` section. @@ -1980,6 +2244,12 @@ export const getCart = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/carts/{cartID}", }) } @@ -1991,50 +2261,50 @@ export const getCart = ( * You can also update a cart to specify custom discounts. You can enable custom discounts when the `discount_settings.custom_discounts_enabled` field is set to `true`. Default is set from cart discount settings for the store. See [Cart Settings](/docs/api/settings/put-v-2-settings-cart). * */ -export const updateAcart = ( - options: Options, +export const updateACart = ( + options: Options, ) => { return (options?.client ?? client).put< - UpdateAcartResponse, - UpdateAcartError, + UpdateACartResponse, + UpdateACartError, ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/carts/{cartID}", }) } /** - * Delete a Cart - * You can delete a cart, including the items, name, description, and remove all associations. - * - * ### Errors - * - * The following error message is received when you attempt to delete a cart that is associated with a customer. Before deletion, ensure that the cart is disassociated. - * - * ```json - * message: { - * errors: [ - * { - * status: 400, - * title: 'Last cart', - * detail: 'This is the last cart associated with a customer and it cannot be deleted, try disassociating instead' - * } - * ] - * } - * ```` + * Delete all Cart Items + * A shopper can clean up their cart, deleting custom items, promotions, and so on, while the empty cart remains available. The cart id, name, description, and any account or customer associations persist. The shopper can continue to add items to the cart. * */ -export const deleteAcart = ( - options: Options, +export const deleteAllCartItems = ( + options: Options, ) => { return (options?.client ?? client).delete< - DeleteAcartResponse, - DeleteAcartError, + DeleteAllCartItemsResponse, + DeleteAllCartItemsError, ThrowOnError >({ ...options, - url: "/v2/carts/{cartID}", + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/v2/carts/{cartID}/items", }) } @@ -2230,26 +2500,12 @@ export const getCartItems = ( ThrowOnError >({ ...options, - url: "/v2/carts/{cartID}/items", - }) -} - -/** - * Bulk Update Items in Cart - * The bulk update feature allows shoppers to update an array of items to their cart in one action, rather than updating each item one at a time. Shoppers can update quantity and shipping group details in bulk requests. This minimizes the time for shoppers while updating items to their cart. Shoppers can even update multiple items with the same or different shipping groups to their cart. - * - * When you update multiple items that qualify for free gifts in the cart, the corresponding free gifts for all eligible products are also automatically updated in the cart. - * - */ -export const bulkUpdateItemsInCart = ( - options: Options, -) => { - return (options?.client ?? client).put< - BulkUpdateItemsInCartResponse, - BulkUpdateItemsInCartError, - ThrowOnError - >({ - ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/carts/{cartID}/items", }) } @@ -2518,59 +2774,126 @@ export const manageCarts = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/carts/{cartID}/items", }) } /** - * Delete all Cart Items - * A shopper can clean up their cart, deleting custom items, promotions, and so on, while the empty cart remains available. The cart id, name, description, and any account or customer associations persist. The shopper can continue to add items to the cart. + * Bulk Update Items in Cart + * The bulk update feature allows shoppers to update an array of items to their cart in one action, rather than updating each item one at a time. Shoppers can update quantity and shipping group details in bulk requests. This minimizes the time for shoppers while updating items to their cart. Shoppers can even update multiple items with the same or different shipping groups to their cart. + * + * When you update multiple items that qualify for free gifts in the cart, the corresponding free gifts for all eligible products are also automatically updated in the cart. * */ -export const deleteAllCartItems = ( - options: Options, +export const bulkUpdateItemsInCart = ( + options: Options, ) => { - return (options?.client ?? client).delete< - DeleteAllCartItemsResponse, - DeleteAllCartItemsError, + return (options?.client ?? client).put< + unknown, + BulkUpdateItemsInCartError, ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/carts/{cartID}/items", }) } +/** + * Delete a Cart Item + * Use this endpoint to delete a cart item. + */ +export const deleteACartItem = ( + options: Options, +) => { + return (options?.client ?? client).delete< + DeleteACartItemResponse, + DeleteACartItemError, + ThrowOnError + >({ + ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/v2/carts/{cartID}/items/{cartitemID}", + }) +} + /** * Update a Cart Item * You can easily update a cart item. A successful update returns the cart items. */ -export const updateAcartItem = ( - options: Options, +export const updateACartItem = ( + options: Options, ) => { return (options?.client ?? client).put< - UpdateAcartItemResponse, - UpdateAcartItemError, + UpdateACartItemResponse, + UpdateACartItemError, ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/carts/{cartID}/items/{cartitemID}", }) } /** - * Delete a Cart Item - * Use this endpoint to delete a cart item. + * Delete Account Cart Association + * You can delete an association between an account and a cart. */ -export const deleteAcartItem = ( - options: Options, +export const deleteAccountCartAssociation = < + ThrowOnError extends boolean = false, +>( + options: Options, ) => { return (options?.client ?? client).delete< - DeleteAcartItemResponse, - DeleteAcartItemError, + DeleteAccountCartAssociationResponse, + DeleteAccountCartAssociationError, ThrowOnError >({ ...options, - url: "/v2/carts/{cartID}/items/{cartitemID}", + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/v2/carts/{cartID}/relationships/accounts", }) } @@ -2589,26 +2912,46 @@ export const createAccountCartAssociation = < ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/carts/{cartID}/relationships/accounts", }) } /** - * Delete Account Cart Association - * You can delete an association between an account and a cart. + * Delete Customer Cart Association + * You can delete an association between a customer and a cart. */ -export const deleteAccountCartAssociation = < +export const deleteCustomerCartAssociation = < ThrowOnError extends boolean = false, >( - options: Options, + options: Options, ) => { return (options?.client ?? client).delete< - DeleteAccountCartAssociationResponse, - DeleteAccountCartAssociationError, + DeleteCustomerCartAssociationResponse, + DeleteCustomerCartAssociationError, ThrowOnError >({ ...options, - url: "/v2/carts/{cartID}/relationships/accounts", + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/v2/carts/{cartID}/relationships/customers", }) } @@ -2627,25 +2970,16 @@ export const createCustomerCartAssociation = < ThrowOnError >({ ...options, - url: "/v2/carts/{cartID}/relationships/customers", - }) -} - -/** - * Delete Customer Cart Association - * You can delete an association between a customer and a cart. - */ -export const deleteCustomerCartAssociation = < - ThrowOnError extends boolean = false, ->( - options: Options, -) => { - return (options?.client ?? client).delete< - DeleteCustomerCartAssociationResponse, - DeleteCustomerCartAssociationError, - ThrowOnError - >({ - ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/carts/{cartID}/relationships/customers", }) } @@ -2654,17 +2988,23 @@ export const deleteCustomerCartAssociation = < * Delete a Promotion via Promotion Code * You can remove promotion code from a cart if it was applied manually. This endpoint does not work if the promotion is applied automatically. */ -export const deleteApromotionViaPromotionCode = < +export const deleteAPromotionViaPromotionCode = < ThrowOnError extends boolean = false, >( - options: Options, + options: Options, ) => { return (options?.client ?? client).delete< - DeleteApromotionViaPromotionCodeResponse, - DeleteApromotionViaPromotionCodeError, + DeleteAPromotionViaPromotionCodeResponse, + DeleteAPromotionViaPromotionCodeError, ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/carts/{cartID}/discounts/{promoCode}", }) } @@ -2690,10 +3030,45 @@ export const addTaxItemToCart = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/carts/{cartID}/items/{cartitemID}/taxes", }) } +/** + * Bulk Delete Tax Items from Cart + * Use this endpoint to bulk delete tax items from cart. + */ +export const bulkDeleteTaxItemsFromCart = < + ThrowOnError extends boolean = false, +>( + options: Options, +) => { + return (options?.client ?? client).delete< + BulkDeleteTaxItemsFromCartResponse, + BulkDeleteTaxItemsFromCartError, + ThrowOnError + >({ + ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/v2/carts/{cartID}/taxes", + }) +} + /** * Bulk Add Tax Items to Cart * :::note @@ -2768,26 +3143,40 @@ export const bulkAddTaxItemsToCart = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/carts/{cartID}/taxes", }) } /** - * Bulk Delete Tax Items from Cart - * Use this endpoint to bulk delete tax items from cart. + * Delete a Tax Item + * Use this endpoint to delete a tax item. */ -export const bulkDeleteTaxItemsFromCart = < - ThrowOnError extends boolean = false, ->( - options: Options, +export const deleteATaxItem = ( + options: Options, ) => { return (options?.client ?? client).delete< - BulkDeleteTaxItemsFromCartResponse, - BulkDeleteTaxItemsFromCartError, + DeleteATaxItemResponse, + DeleteATaxItemError, ThrowOnError >({ ...options, - url: "/v2/carts/{cartID}/taxes", + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/v2/carts/{cartID}/items/{cartitemID}/taxes/{taxitemID}", }) } @@ -2795,33 +3184,51 @@ export const bulkDeleteTaxItemsFromCart = < * Update a TaxItem * Use this endpoint to update a tax item. */ -export const updateAtaxItem = ( - options: Options, +export const updateATaxItem = ( + options: Options, ) => { return (options?.client ?? client).put< - UpdateAtaxItemResponse, - UpdateAtaxItemError, + UpdateATaxItemResponse, + UpdateATaxItemError, ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/carts/{cartID}/items/{cartitemID}/taxes/{taxitemID}", }) } /** - * Delete a Tax Item - * Use this endpoint to delete a tax item. + * Bulk Delete Custom Discounts From Cart + * Use this endpoint to bulk delete custom discounts from cart. */ -export const deleteAtaxItem = ( - options: Options, +export const bulkDeleteCustomDiscountsFromCart = < + ThrowOnError extends boolean = false, +>( + options: Options, ) => { return (options?.client ?? client).delete< - DeleteAtaxItemResponse, - DeleteAtaxItemError, + BulkDeleteCustomDiscountsFromCartResponse, + BulkDeleteCustomDiscountsFromCartError, ThrowOnError >({ ...options, - url: "/v2/carts/{cartID}/items/{cartitemID}/taxes/{taxitemID}", + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/v2/carts/{cartID}/custom-discounts", }) } @@ -2843,26 +3250,42 @@ export const bulkAddCustomDiscountsToCart = < ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/carts/{cartID}/custom-discounts", }) } /** - * Bulk Delete Custom Discounts From Cart - * Use this endpoint to bulk delete custom discounts from cart. + * Delete Custom Discount From Cart + * Use this endpoint to delete custom discount from cart. */ -export const bulkDeleteCustomDiscountsFromCart = < +export const deleteCustomDiscountFromCart = < ThrowOnError extends boolean = false, >( - options: Options, + options: Options, ) => { return (options?.client ?? client).delete< - BulkDeleteCustomDiscountsFromCartResponse, - BulkDeleteCustomDiscountsFromCartError, + DeleteCustomDiscountFromCartResponse, + DeleteCustomDiscountFromCartError, ThrowOnError >({ ...options, - url: "/v2/carts/{cartID}/custom-discounts", + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/v2/carts/{cartID}/custom-discounts/{customdiscountID}", }) } @@ -2881,25 +3304,16 @@ export const updateCustomDiscountForCart = < ThrowOnError >({ ...options, - url: "/v2/carts/{cartID}/custom-discounts/{customdiscountID}", - }) -} - -/** - * Delete Custom Discount From Cart - * Use this endpoint to delete custom discount from cart. - */ -export const deleteCustomDiscountFromCart = < - ThrowOnError extends boolean = false, ->( - options: Options, -) => { - return (options?.client ?? client).delete< - DeleteCustomDiscountFromCartResponse, - DeleteCustomDiscountFromCartError, - ThrowOnError - >({ - ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/carts/{cartID}/custom-discounts/{customdiscountID}", }) } @@ -2913,27 +3327,22 @@ export const addCustomDiscountToCartItem = < >( options: Options, ) => { - return (options?.client ?? client).post({ - ...options, + return (options?.client ?? client).post({ + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/carts/{cartID}/items/{cartitemID}/custom-discounts", }) } -/** - * Update Custom Discount For Cart Item - * Use this endpoint to update a custom discount in your cart item. - */ -export const updateCustomDiscountForCartItem = < - ThrowOnError extends boolean = false, ->( - options: Options, -) => { - return (options?.client ?? client).put({ - ...options, - url: "/v2/carts/{cartID}/items/{cartitemID}/custom-discounts/{customdiscountID}", - }) -} - /** * Delete Custom Discount From Cart Item * Use this endpoint to delete custom discount from cart item. @@ -2949,6 +3358,37 @@ export const deleteCustomDiscountFromCartItem = < ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/v2/carts/{cartID}/items/{cartitemID}/custom-discounts/{customdiscountID}", + }) +} + +/** + * Update Custom Discount For Cart Item + * Use this endpoint to update a custom discount in your cart item. + */ +export const updateCustomDiscountForCartItem = < + ThrowOnError extends boolean = false, +>( + options: Options, +) => { + return (options?.client ?? client).put({ + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/carts/{cartID}/items/{cartitemID}/custom-discounts/{customdiscountID}", }) } @@ -2990,6 +3430,16 @@ export const createCartPaymentIntent = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/carts/{cartID}/payments", }) } @@ -3057,6 +3507,16 @@ export const checkoutApi = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/carts/{cartID}/checkout", }) } @@ -3110,6 +3570,12 @@ export const getCustomerOrders = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/orders", }) } @@ -3127,6 +3593,12 @@ export const getAnOrder = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/orders/{orderID}", }) } @@ -3158,6 +3630,16 @@ export const updateAnOrder = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/orders/{orderID}", }) } @@ -3175,6 +3657,12 @@ export const getOrderItems = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/orders/{orderID}/items", }) } @@ -3195,6 +3683,16 @@ export const anonymizeOrders = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/orders/anonymize", }) } @@ -3212,6 +3710,16 @@ export const authorizeSetup = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/orders/{orderID}/payments", }) } @@ -3229,6 +3737,16 @@ export const confirmSetup = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/orders/{orderID}/transactions/{transactionID}/confirm", }) } @@ -3237,15 +3755,25 @@ export const confirmSetup = ( * Capture a Transaction * Use this endpoint to capture a previously authorized payment. In this step, you can also pass in a custom reference, such as the payment reference from your chosen gateway. */ -export const captureAtransaction = ( - options: Options, +export const captureATransaction = ( + options: Options, ) => { return (options?.client ?? client).post< - CaptureAtransactionResponse, - CaptureAtransactionError, + CaptureATransactionResponse, + CaptureATransactionError, ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/orders/{orderID}/transactions/{transactionID}/capture", }) } @@ -3264,15 +3792,25 @@ export const captureAtransaction = ( * ::: * */ -export const refundAtransaction = ( - options: Options, +export const refundATransaction = ( + options: Options, ) => { return (options?.client ?? client).post< - RefundAtransactionResponse, - RefundAtransactionError, + RefundATransactionResponse, + RefundATransactionError, ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/orders/{orderID}/transactions/{transactionID}/refund", }) } @@ -3290,6 +3828,12 @@ export const getOrderTransactions = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/orders/{orderID}/transactions", }) } @@ -3298,15 +3842,21 @@ export const getOrderTransactions = ( * Get a Transaction * Retrieves a transaction */ -export const getAtransaction = ( - options: Options, +export const getATransaction = ( + options: Options, ) => { return (options?.client ?? client).get< - GetAtransactionResponse, - GetAtransactionError, + GetATransactionResponse, + GetATransactionError, ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/orders/{orderID}/transactions/{transactionID}", }) } @@ -3322,15 +3872,25 @@ export const getAtransaction = ( * ::: * */ -export const cancelAtransaction = ( - options: Options, +export const cancelATransaction = ( + options: Options, ) => { return (options?.client ?? client).post< - CancelAtransactionResponse, - CancelAtransactionError, + CancelATransactionResponse, + CancelATransactionError, ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/v2/orders/{orderID}/transactions/{transactionID}/cancel", }) } diff --git a/packages/sdks/shopper/src/client/transformers.gen.ts b/packages/sdks/shopper/src/client/transformers.gen.ts new file mode 100644 index 00000000..5271a562 --- /dev/null +++ b/packages/sdks/shopper/src/client/transformers.gen.ts @@ -0,0 +1,626 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { + GetByContextReleaseResponse, + GetByContextAllHierarchiesResponse, + GetByContextHierarchyResponse, + GetByContextHierarchyNodesResponse, + GetByContextHierarchyChildNodesResponse, + GetByContextAllNodesResponse, + GetByContextNodeResponse, + GetByContextChildNodesResponse, + GetByContextAllProductsResponse, + GetByContextProductResponse, + GetByContextComponentProductIdsResponse, + GetByContextChildProductsResponse, + GetByContextProductsForHierarchyResponse, + GetByContextProductsForNodeResponse, + ConfigureByContextProductResponse, + GetCatalogsResponse, + CreateCatalogResponse, + GetCatalogByIdResponse, + UpdateCatalogResponse, + GetReleasesResponse, + PublishReleaseResponse, + GetReleaseByIdResponse, + GetRulesResponse, + CreateRuleResponse, + GetRuleByIdResponse, + UpdateRuleResponse, + GetAllHierarchiesResponse, + GetHierarchyResponse, + GetHierarchyNodesResponse, + GetHierarchyChildNodesResponse, + GetAllNodesResponse, + GetNodeResponse, + GetChildNodesResponse, + GetAllProductsResponse, + GetProductResponse, + GetComponentProductIdsResponse, + GetChildProductsResponse, + GetProductsForHierarchyResponse, + GetProductsForNodeResponse, +} from "./types.gen" + +const releaseMetaSchemaResponseTransformer = (data: any) => { + if (data.created_at) { + data.created_at = new Date(data.created_at) + } + if (data.started_at) { + data.started_at = new Date(data.started_at) + } + if (data.updated_at) { + data.updated_at = new Date(data.updated_at) + } + if (data.total_products) { + data.total_products = BigInt(data.total_products.toString()) + } + if (data.total_nodes) { + data.total_nodes = BigInt(data.total_nodes.toString()) + } + return data +} + +const releaseSchemaResponseTransformer = (data: any) => { + if (data.attributes) { + if (data.attributes.published_at) { + data.attributes.published_at = new Date(data.attributes.published_at) + } + return data.attributes + } + if (data.meta) { + data.meta = releaseMetaSchemaResponseTransformer(data.meta) + } + return data +} + +const releaseDataSchemaResponseTransformer = (data: any) => { + if (data.data) { + data.data = releaseSchemaResponseTransformer(data.data) + } + return data +} + +export const getByContextReleaseResponseTransformer = async ( + data: any, +): Promise => { + data = releaseDataSchemaResponseTransformer(data) + return data +} + +const pageMetaSchemaResponseTransformer = (data: any) => { + if (data.results) { + if (data.results.total) { + data.results.total = BigInt(data.results.total.toString()) + } + return data.results + } + if (data.page) { + if (data.page.limit) { + data.page.limit = BigInt(data.page.limit.toString()) + } + if (data.page.offset) { + data.page.offset = BigInt(data.page.offset.toString()) + } + if (data.page.current) { + data.page.current = BigInt(data.page.current.toString()) + } + if (data.page.total) { + data.page.total = BigInt(data.page.total.toString()) + } + return data.page + } + return data +} + +const hierarchyAttributesSchemaResponseTransformer = (data: any) => { + if (data.created_at) { + data.created_at = new Date(data.created_at) + } + if (data.published_at) { + data.published_at = new Date(data.published_at) + } + if (data.updated_at) { + data.updated_at = new Date(data.updated_at) + } + return data +} + +const hierarchySchemaResponseTransformer = (data: any) => { + if (data.attributes) { + data.attributes = hierarchyAttributesSchemaResponseTransformer( + data.attributes, + ) + } + return data +} + +const hierarchyListDataSchemaResponseTransformer = (data: any) => { + if (data.meta) { + data.meta = pageMetaSchemaResponseTransformer(data.meta) + } + if (data.data) { + data.data = data.data.map((item: any) => { + return hierarchySchemaResponseTransformer(item) + }) + } + return data +} + +export const getByContextAllHierarchiesResponseTransformer = async ( + data: any, +): Promise => { + data = hierarchyListDataSchemaResponseTransformer(data) + return data +} + +const hierarchyDataSchemaResponseTransformer = (data: any) => { + if (data.data) { + data.data = hierarchySchemaResponseTransformer(data.data) + } + return data +} + +export const getByContextHierarchyResponseTransformer = async ( + data: any, +): Promise => { + data = hierarchyDataSchemaResponseTransformer(data) + return data +} + +const nodeAttributesSchemaResponseTransformer = (data: any) => { + if (data.created_at) { + data.created_at = new Date(data.created_at) + } + if (data.published_at) { + data.published_at = new Date(data.published_at) + } + if (data.updated_at) { + data.updated_at = new Date(data.updated_at) + } + return data +} + +const nodeSchemaResponseTransformer = (data: any) => { + if (data.attributes) { + data.attributes = nodeAttributesSchemaResponseTransformer(data.attributes) + } + return data +} + +const nodeListDataSchemaResponseTransformer = (data: any) => { + if (data.meta) { + data.meta = pageMetaSchemaResponseTransformer(data.meta) + } + if (data.data) { + data.data = data.data.map((item: any) => { + return nodeSchemaResponseTransformer(item) + }) + } + return data +} + +export const getByContextHierarchyNodesResponseTransformer = async ( + data: any, +): Promise => { + data = nodeListDataSchemaResponseTransformer(data) + return data +} + +export const getByContextHierarchyChildNodesResponseTransformer = async ( + data: any, +): Promise => { + data = nodeListDataSchemaResponseTransformer(data) + return data +} + +export const getByContextAllNodesResponseTransformer = async ( + data: any, +): Promise => { + data = nodeListDataSchemaResponseTransformer(data) + return data +} + +const nodeDataSchemaResponseTransformer = (data: any) => { + if (data.data) { + data.data = nodeSchemaResponseTransformer(data.data) + } + return data +} + +export const getByContextNodeResponseTransformer = async ( + data: any, +): Promise => { + data = nodeDataSchemaResponseTransformer(data) + return data +} + +export const getByContextChildNodesResponseTransformer = async ( + data: any, +): Promise => { + data = nodeListDataSchemaResponseTransformer(data) + return data +} + +const productAttributesSchemaResponseTransformer = (data: any) => { + if (data.published_at) { + data.published_at = new Date(data.published_at) + } + if (data.created_at) { + data.created_at = new Date(data.created_at) + } + if (data.updated_at) { + data.updated_at = new Date(data.updated_at) + } + return data +} + +const fileReferenceSchemaResponseTransformer = (data: any) => { + if (data.created_at) { + data.created_at = new Date(data.created_at) + } + return data +} + +const filesRelationshipSchemaResponseTransformer = (data: any) => { + if (data.data) { + data.data = data.data.map((item: any) => { + return fileReferenceSchemaResponseTransformer(item) + }) + } + return data +} + +const productRelationshipsSchemaResponseTransformer = (data: any) => { + if (data.files) { + data.files = filesRelationshipSchemaResponseTransformer(data.files) + } + return data +} + +const productMetaSchemaResponseTransformer = (data: any) => { + if (data.sale_expires) { + data.sale_expires = new Date(data.sale_expires) + } + return data +} + +const productSchemaResponseTransformer = (data: any) => { + if (data.attributes) { + data.attributes = productAttributesSchemaResponseTransformer( + data.attributes, + ) + } + if (data.relationships) { + data.relationships = productRelationshipsSchemaResponseTransformer( + data.relationships, + ) + } + if (data.meta) { + data.meta = productMetaSchemaResponseTransformer(data.meta) + } + return data +} + +const includedSchemaResponseTransformer = (data: any) => { + if (data.component_products) { + data.component_products = data.component_products.map((item: any) => { + return productSchemaResponseTransformer(item) + }) + } + return data +} + +const productListDataSchemaResponseTransformer = (data: any) => { + if (data.meta) { + data.meta = pageMetaSchemaResponseTransformer(data.meta) + } + if (data.data) { + data.data = data.data.map((item: any) => { + return productSchemaResponseTransformer(item) + }) + } + if (data.included) { + data.included = includedSchemaResponseTransformer(data.included) + } + return data +} + +export const getByContextAllProductsResponseTransformer = async ( + data: any, +): Promise => { + data = productListDataSchemaResponseTransformer(data) + return data +} + +const productDataSchemaResponseTransformer = (data: any) => { + if (data.data) { + data.data = productSchemaResponseTransformer(data.data) + } + if (data.included) { + data.included = includedSchemaResponseTransformer(data.included) + } + return data +} + +export const getByContextProductResponseTransformer = async ( + data: any, +): Promise => { + data = productDataSchemaResponseTransformer(data) + return data +} + +const productReferenceListDataSchemaResponseTransformer = (data: any) => { + if (data.meta) { + data.meta = pageMetaSchemaResponseTransformer(data.meta) + } + return data +} + +export const getByContextComponentProductIdsResponseTransformer = async ( + data: any, +): Promise => { + data = productReferenceListDataSchemaResponseTransformer(data) + return data +} + +export const getByContextChildProductsResponseTransformer = async ( + data: any, +): Promise => { + data = productListDataSchemaResponseTransformer(data) + return data +} + +export const getByContextProductsForHierarchyResponseTransformer = async ( + data: any, +): Promise => { + data = productListDataSchemaResponseTransformer(data) + return data +} + +export const getByContextProductsForNodeResponseTransformer = async ( + data: any, +): Promise => { + data = productListDataSchemaResponseTransformer(data) + return data +} + +export const configureByContextProductResponseTransformer = async ( + data: any, +): Promise => { + data = productDataSchemaResponseTransformer(data) + return data +} + +const catalogSchemaResponseTransformer = (data: any) => { + data.attributes.created_at = new Date(data.attributes.created_at) + data.attributes.updated_at = new Date(data.attributes.updated_at) + return data.attributes + return data +} + +const catalogListDataSchemaResponseTransformer = (data: any) => { + data.data = data.data.map((item: any) => { + return catalogSchemaResponseTransformer(item) + }) + return data +} + +export const getCatalogsResponseTransformer = async ( + data: any, +): Promise => { + data = catalogListDataSchemaResponseTransformer(data) + return data +} + +const catalogDataSchemaResponseTransformer = (data: any) => { + data.data = catalogSchemaResponseTransformer(data.data) + return data +} + +export const createCatalogResponseTransformer = async ( + data: any, +): Promise => { + data = catalogDataSchemaResponseTransformer(data) + return data +} + +export const getCatalogByIdResponseTransformer = async ( + data: any, +): Promise => { + data = catalogDataSchemaResponseTransformer(data) + return data +} + +export const updateCatalogResponseTransformer = async ( + data: any, +): Promise => { + data = catalogDataSchemaResponseTransformer(data) + return data +} + +const releaseListDataSchemaResponseTransformer = (data: any) => { + if (data.data) { + data.data = data.data.map((item: any) => { + return releaseSchemaResponseTransformer(item) + }) + } + return data +} + +export const getReleasesResponseTransformer = async ( + data: any, +): Promise => { + data = releaseListDataSchemaResponseTransformer(data) + return data +} + +export const publishReleaseResponseTransformer = async ( + data: any, +): Promise => { + data = releaseDataSchemaResponseTransformer(data) + return data +} + +export const getReleaseByIdResponseTransformer = async ( + data: any, +): Promise => { + data = releaseDataSchemaResponseTransformer(data) + return data +} + +const ruleScheduleSchemaResponseTransformer = (data: any) => { + if (data.valid_from) { + data.valid_from = new Date(data.valid_from) + } + if (data.valid_to) { + data.valid_to = new Date(data.valid_to) + } + return data +} + +const ruleSchemaResponseTransformer = (data: any) => { + if (data.attributes.schedules) { + data.attributes.schedules = data.attributes.schedules.map((item: any) => { + return ruleScheduleSchemaResponseTransformer(item) + }) + } + data.attributes.created_at = new Date(data.attributes.created_at) + data.attributes.updated_at = new Date(data.attributes.updated_at) + return data.attributes + return data +} + +const ruleListDataSchemaResponseTransformer = (data: any) => { + if (data.meta) { + data.meta = pageMetaSchemaResponseTransformer(data.meta) + } + data.data = data.data.map((item: any) => { + return ruleSchemaResponseTransformer(item) + }) + return data +} + +export const getRulesResponseTransformer = async ( + data: any, +): Promise => { + data = ruleListDataSchemaResponseTransformer(data) + return data +} + +const ruleDataSchemaResponseTransformer = (data: any) => { + data.data = ruleSchemaResponseTransformer(data.data) + return data +} + +export const createRuleResponseTransformer = async ( + data: any, +): Promise => { + data = ruleDataSchemaResponseTransformer(data) + return data +} + +export const getRuleByIdResponseTransformer = async ( + data: any, +): Promise => { + data = ruleDataSchemaResponseTransformer(data) + return data +} + +export const updateRuleResponseTransformer = async ( + data: any, +): Promise => { + data = ruleDataSchemaResponseTransformer(data) + return data +} + +export const getAllHierarchiesResponseTransformer = async ( + data: any, +): Promise => { + data = hierarchyListDataSchemaResponseTransformer(data) + return data +} + +export const getHierarchyResponseTransformer = async ( + data: any, +): Promise => { + data = hierarchyDataSchemaResponseTransformer(data) + return data +} + +export const getHierarchyNodesResponseTransformer = async ( + data: any, +): Promise => { + data = nodeListDataSchemaResponseTransformer(data) + return data +} + +export const getHierarchyChildNodesResponseTransformer = async ( + data: any, +): Promise => { + data = nodeListDataSchemaResponseTransformer(data) + return data +} + +export const getAllNodesResponseTransformer = async ( + data: any, +): Promise => { + data = nodeListDataSchemaResponseTransformer(data) + return data +} + +export const getNodeResponseTransformer = async ( + data: any, +): Promise => { + data = nodeDataSchemaResponseTransformer(data) + return data +} + +export const getChildNodesResponseTransformer = async ( + data: any, +): Promise => { + data = nodeListDataSchemaResponseTransformer(data) + return data +} + +export const getAllProductsResponseTransformer = async ( + data: any, +): Promise => { + data = productListDataSchemaResponseTransformer(data) + return data +} + +export const getProductResponseTransformer = async ( + data: any, +): Promise => { + data = productDataSchemaResponseTransformer(data) + return data +} + +export const getComponentProductIdsResponseTransformer = async ( + data: any, +): Promise => { + data = productReferenceListDataSchemaResponseTransformer(data) + return data +} + +export const getChildProductsResponseTransformer = async ( + data: any, +): Promise => { + data = productListDataSchemaResponseTransformer(data) + return data +} + +export const getProductsForHierarchyResponseTransformer = async ( + data: any, +): Promise => { + data = productListDataSchemaResponseTransformer(data) + return data +} + +export const getProductsForNodeResponseTransformer = async ( + data: any, +): Promise => { + data = productListDataSchemaResponseTransformer(data) + return data +} diff --git a/packages/sdks/shopper/src/client/types.gen.ts b/packages/sdks/shopper/src/client/types.gen.ts index b2fa74fd..e9f9520f 100644 --- a/packages/sdks/shopper/src/client/types.gen.ts +++ b/packages/sdks/shopper/src/client/types.gen.ts @@ -7,7 +7,7 @@ export type Amount = { /** * The price in the lowest denomination for the specified currency. This is a product's list price. */ - amount?: number + amount?: BigInt /** * Whether this price includes tax. */ @@ -28,6 +28,11 @@ export type PrioritizedPricebooks = Array<{ priority: number }> +/** + * The owner of this resource, can be either `organization` or `store`. + */ +export type Owner = "store" | "organization" + /** * Creates a catalog with the following attributes. */ @@ -73,7 +78,7 @@ export type Catalog = { /** * The owner of this resource, can be either `organization` or `store`. */ - owner?: ("store" | "organization") | null + owner?: "store" | "organization" } /** * Relationships are established between different catalog entities. For example, a catalog rule and a price book are related to a catalog, as both are associated with it. @@ -101,11 +106,6 @@ export type Catalog = { type: "catalog" } -/** - * The owner of this resource, can be either `organization` or `store`. - */ -export type owner = "store" | "organization" - /** * Creates a catalog with the following attributes. */ @@ -348,7 +348,7 @@ export type DisplayPrice = { /** * APIError is a json-api style part of an error response. */ -export type Error = { +export type _Error = { detail?: string status?: string title?: string @@ -358,7 +358,7 @@ export type Error = { * ErrorResponse is a json-api style Error response. */ export type ErrorResponse = { - errors?: Array + errors?: Array<_Error> } /** @@ -765,25 +765,25 @@ export type PageMeta = { /** * Total number of results for the entire collection. */ - total?: number + total?: BigInt } page?: { /** * The maximum number of records for all pages. */ - limit?: number + limit?: BigInt /** * The current offset by number of pages. */ - offset?: number + offset?: BigInt /** * The current number of pages. */ - current?: number + current?: BigInt /** * The total number of records for the entire collection. */ - total?: number + total?: BigInt } } @@ -1224,7 +1224,7 @@ export type BundleConfiguration = { */ selected_options: { [key: string]: { - [key: string]: number + [key: string]: BigInt } } } @@ -1382,6 +1382,11 @@ export type ReleaseListData = { links?: Links } +/** + * The status of the current release. + */ +export type ReleaseStatus = "PENDING" | "IN_PROGRESS" | "FAILED" | "PUBLISHED" + /** * A release's metadata. */ @@ -1419,11 +1424,11 @@ export type ReleaseMeta = { /** * The total number of products displayed in a catalog release. */ - total_products?: number | null + total_products?: BigInt | null /** * The total number of hierarchy nodes displayed in a catalog release. */ - total_nodes?: number | null + total_nodes?: BigInt | null /** * An integer that represents the progress of a catalog publish. The attribute starts at `0` and reaches `100` when publishing is complete. */ @@ -1431,14 +1436,9 @@ export type ReleaseMeta = { /** * The owner of the resource, can be either `organization` or `store`. */ - owner?: ("store" | "organization") | null + owner?: "store" | "organization" } -/** - * The status of the current release. - */ -export type release_status = "PENDING" | "IN_PROGRESS" | "FAILED" | "PUBLISHED" - /** * Relationships are established between different catalog entities. For example, products, hierarchies, price books, and catalog rules are related to a catalog, as they are associated with it. */ @@ -1717,7 +1717,7 @@ export type TieredAmount = { /** * The price in the lowest denomination for the specified currency. This is a product's list price. */ - amount?: number + amount?: BigInt /** * Whether this price includes tax. */ @@ -1734,7 +1734,7 @@ export type TieredAmount = { /** * The price for each quantity. */ - amount?: number + amount?: BigInt } } } @@ -1984,6 +1984,11 @@ export type CartItemObject = { data?: CartItemObjectData & CartItemResponse } +/** + * The type of object being returned. + */ +export type Type = "cart_item" + export type CartItemObjectData = { /** * The type of object being returned. @@ -2024,11 +2029,6 @@ export type CartItemObjectData = { shipping_group_id?: string } -/** - * The type of object being returned. - */ -export type type = "cart_item" - export type CartMergeObjectRequest = { data?: Array options?: AddAllOrNothingOptionsObject @@ -2045,11 +2045,6 @@ export type CartMergeObject = { cart_id: string } -/** - * The type of object being returned. Must be `cart_items`. - */ -export type type2 = "cart_items" - export type CustomItemObject = { data?: CustomItemObjectData } @@ -2097,11 +2092,6 @@ export type CustomItemObjectData = { shipping_group_id?: string } -/** - * The type of object being returned. Must be `custom_item`. - */ -export type type3 = "custom_item" - export type ReOrderObjectRequest = { data?: ReOrderObject options?: AddAllOrNothingOptionsObject @@ -2118,11 +2108,6 @@ export type ReOrderObject = { order_id: string } -/** - * The type of resource being returned. Use `order_items`. - */ -export type type4 = "order_items" - export type BulkAddItemsRequest = { data?: | CartItemsObjectRequest @@ -2147,11 +2132,6 @@ export type PromotionItemObjectData = { code: string } -/** - * Specifies the type of resource, which is `promotion_item`. - */ -export type type5 = "promotion_item" - export type BulkUpdateCartsItems = { data?: Array<{ /** @@ -2245,8 +2225,8 @@ export type CartItemResponse = { readonly href?: string } readonly manage_stock?: boolean - readonly unit_price?: ItemPriceData - readonly value?: ItemPriceData + unit_price?: ItemPriceData + value?: ItemPriceData readonly links?: { /** * A URL related to the resource. @@ -2583,6 +2563,28 @@ export type PaymentsRequest = { data?: DataPaymentObject } +export type Gateway = + | "adyen" + | "authorize_net" + | "braintree" + | "card_connect" + | "cyber_source" + | "elastic_path_payments_stripe" + | "manual" + | "paypal_express_checkout" + | "stripe" + | "stripe_connect" + | "stripe_payment_intents" + +/** + * Specifies the transaction method, such as `purchase` or `authorize`. + */ +export type Method = + | "authorize" + | "purchase" + | "purchase_setup" + | "authorize_setup" + export type DataBasePayments = { gateway: | "adyen" @@ -2606,33 +2608,11 @@ export type DataBasePayments = { amount?: number } -export type gateway = - | "adyen" - | "authorize_net" - | "braintree" - | "card_connect" - | "cyber_source" - | "elastic_path_payments_stripe" - | "manual" - | "paypal_express_checkout" - | "stripe" - | "stripe_connect" - | "stripe_payment_intents" - -/** - * Specifies the transaction method, such as `purchase` or `authorize`. - */ -export type method = - | "authorize" - | "purchase" - | "purchase_setup" - | "authorize_setup" - export type DataAdyenPayment = DataBasePayments & { /** * Specifies the gateway. You must use `adyen`. */ - gateway?: "adyen" + gateway: "adyen" options?: { /** * The shopper reference token associated with the saved payment method. @@ -2643,67 +2623,30 @@ export type DataAdyenPayment = DataBasePayments & { */ recurring_processing_model?: string } - /** - * The Adyen recurringDetailReference payment method identifier. - */ - payment?: string -} & { - /** - * Specifies the gateway. You must use `adyen`. - */ - gateway: "adyen" /** * The Adyen recurringDetailReference payment method identifier. */ payment: string } -/** - * Specifies the gateway. You must use `adyen`. - */ -export type gateway2 = "adyen" - export type DataAuthorizeNetPayment = DataBasePayments & { /** * Specifies the gateway. You must use `authorize_net`. */ - gateway?: "authorize_net" + gateway: "authorize_net" options?: { /** * The Authorize.net customer payment profile ID. */ customer_payment_profile_id?: string } - /** - * The Authorize.net customer profile ID. - */ - payment?: string -} & { - /** - * Specifies the gateway. You must use `authorize_net`. - */ - gateway: "authorize_net" /** * The Authorize.net customer profile ID. */ payment: string } -/** - * Specifies the gateway. You must use `authorize_net`. - */ -export type gateway3 = "authorize_net" - export type DataBraintreePayment = DataBasePayments & { - /** - * Specifies the gateway. You must use `braintree`. - */ - gateway?: "braintree" - /** - * The Braintree Customer ID that you want to bill. - */ - payment?: string -} & { /** * Specifies the gateway. You must use `braintree`. */ @@ -2714,21 +2657,7 @@ export type DataBraintreePayment = DataBasePayments & { payment: string } -/** - * Specifies the gateway. You must use `braintree`. - */ -export type gateway4 = "braintree" - export type DataCardConnectPayment = DataBasePayments & { - /** - * Specifies the gateway. You must use `card_connect`. - */ - gateway?: "card_connect" - /** - * Enter account_id, profile_id from CardPointe API. For example, 1|16178397535388255208. - */ - payment?: string -} & { /** * Specifies the gateway. You must use `card_connect`. */ @@ -2739,21 +2668,7 @@ export type DataCardConnectPayment = DataBasePayments & { payment: string } -/** - * Specifies the gateway. You must use `card_connect`. - */ -export type gateway5 = "card_connect" - export type DataCyberSourcePayment = DataBasePayments & { - /** - * Specifies the gateway. You must use `cyber_source`. - */ - gateway?: "cyber_source" - /** - * The CyberSource token. - */ - payment?: string -} & { /** * Specifies the gateway. You must use `cyber_source`. */ @@ -2764,16 +2679,11 @@ export type DataCyberSourcePayment = DataBasePayments & { payment: string } -/** - * Specifies the gateway. You must use `cyber_source`. - */ -export type gateway6 = "cyber_source" - export type ElasticPathPaymentsPoweredByStripePayment = DataBasePayments & { /** * Specifies the gateway. You must use `elastic_path_payments_stripe`. */ - gateway?: "elastic_path_payments_stripe" + gateway: "elastic_path_payments_stripe" options?: { /** * Provides the email address to which you want to send the Stripe receipts for the transactions within the store. This feature is available only in the live mode. @@ -2797,23 +2707,13 @@ export type ElasticPathPaymentsPoweredByStripePayment = DataBasePayments & { * Specifies the Stripe token or source. */ payment?: string -} & { - /** - * Specifies the gateway. You must use `elastic_path_payments_stripe`. - */ - gateway: "elastic_path_payments_stripe" } -/** - * Specifies the gateway. You must use `elastic_path_payments_stripe`. - */ -export type gateway7 = "elastic_path_payments_stripe" - export type DataManualPayment = DataBasePayments & { /** * Specifies the type of payment gateway. You must use `manual`. */ - gateway?: "manual" + gateway: "manual" paymentmethod_meta?: { /** * A reference associated with the payment method. This might include loyalty points or gift card identifiers. We recommend not to include personal information in this field. @@ -2824,23 +2724,13 @@ export type DataManualPayment = DataBasePayments & { */ name?: string } -} & { - /** - * Specifies the type of payment gateway. You must use `manual`. - */ - gateway: "manual" } -/** - * Specifies the type of payment gateway. You must use `manual`. - */ -export type gateway8 = "manual" - export type DataPayPalExpressCheckoutPayment = DataBasePayments & { /** * Specifies the type of payment gateway. You must use `paypal_express_checkout`. */ - gateway?: "paypal_express_checkout" + gateway: "paypal_express_checkout" options?: { /** * The description for the payment. @@ -2881,23 +2771,13 @@ export type DataPayPalExpressCheckoutPayment = DataBasePayments & { cancel_url?: string } } -} & { - /** - * Specifies the type of payment gateway. You must use `paypal_express_checkout`. - */ - gateway: "paypal_express_checkout" } -/** - * Specifies the type of payment gateway. You must use `paypal_express_checkout`. - */ -export type gateway9 = "paypal_express_checkout" - export type DataStripePayment = DataBasePayments & { /** * Specifies the type of payment gateway. You must use `stripe`. */ - gateway?: "stripe" + gateway: "stripe" options?: { /** * The option to provide an email for Stripe receipts. Specify live mode to access this feature. @@ -2908,23 +2788,13 @@ export type DataStripePayment = DataBasePayments & { * The Stripe token or source. */ payment?: string -} & { - /** - * Specifies the type of payment gateway. You must use `stripe`. - */ - gateway: "stripe" } -/** - * Specifies the type of payment gateway. You must use `stripe`. - */ -export type gateway10 = "stripe" - export type DataStripeConnectPayment = DataBasePayments & { /** * Specifies the type of payment gateway. You must use `stripe_connect`. */ - gateway?: "stripe_connect" + gateway: "stripe_connect" options?: { /** * Provides the email address to which you want to send the Stripe receipts for the transactions within the store. This feature is available only in the live mode. @@ -2935,23 +2805,13 @@ export type DataStripeConnectPayment = DataBasePayments & { * Specifies the Stripe token or source. */ payment?: string -} & { - /** - * Specifies the type of payment gateway. You must use `stripe_connect`. - */ - gateway: "stripe_connect" } -/** - * Specifies the type of payment gateway. You must use `stripe_connect`. - */ -export type gateway11 = "stripe_connect" - export type DataStripePaymentIntentsPayment = DataBasePayments & { /** * Specifies the type of payment gateway. You must use `stripe_payment_intents`. */ - gateway?: "stripe_payment_intents" + gateway: "stripe_payment_intents" options?: { /** * Provides the email address to which you want to send the Stripe receipts for the transactions within the store. This feature is available only in the live mode. @@ -2962,18 +2822,8 @@ export type DataStripePaymentIntentsPayment = DataBasePayments & { * Specifies the Stripe token or source. */ payment?: string -} & { - /** - * Specifies the type of payment gateway. You must use `stripe_payment_intents`. - */ - gateway: "stripe_payment_intents" } -/** - * Specifies the type of payment gateway. You must use `stripe_payment_intents`. - */ -export type gateway12 = "stripe_payment_intents" - export type DataPaymentObject = | DataAdyenPayment | DataAuthorizeNetPayment @@ -3449,11 +3299,7 @@ export type ResponseData = { data?: unknown } -export type ResponseError = { - detail?: string - status?: string - title?: string -} +export type ResponseError = Array export type Timestamps = { /** @@ -3475,67 +3321,76 @@ export type CartTimestamps = { /** * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). */ -export type ParameterAcceptLanguage = string +export type AcceptLanguage = string /** * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. */ -export type ParameterChannel = string +export type Channel = string /** * This endpoints supports filtering. See [Filtering](#filtering). * */ -export type ParameterFilterHierarchy = string +export type FilterHierarchy = string /** * This endpoint supports filtering, see [Filtering](#filtering). * */ -export type ParameterFilterNode = string +export type FilterNode = string /** * This endpoints support filtering. See [Filtering](#filtering). * */ -export type ParameterFilterProduct = string +export type FilterProduct = string /** * This endpoint supports filtering. See [Filtering](#filtering). * */ -export type ParameterFilterRule = string +export type FilterRule = string /** * Using the `include` parameter, you can retrieve top-level resources, such as, files or main image, bundle component products. * */ -export type ParameterInclude = Array< - "main_images" | "files" | "component_products" -> +export type Include = Array<"main_images" | "files" | "component_products"> /** * Using the `include=component_products` parameter, you can retrieve key attribute data for the bundle component products in the product bundle, such as SKU or slug . * */ -export type ParameterIncludeComponentProducts = string +export type IncludeComponentProducts = string /** * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ -export type ParameterLimit = number +export type Limit = BigInt /** * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ -export type ParameterOffset = number +export type Offset = BigInt /** * Product tags are used to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. You can enhance your product list using tags, enabling you to refine your product list and run targeted promotions. Tags are used to refine the eligibility criteria for a rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. */ -export type ParameterTag = string +export type Tag = string + +/** + * The bundle configuration. + */ +export type BundleConfigurationData2 = BundleConfigurationData + +/** + * A list of product id or sku and bundle configuration for cart. + */ +export type ProductsForCartConfiguration2 = ProductsForCartConfiguration export type GetByContextReleaseData = { + body?: never headers?: { /** * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). @@ -3550,13 +3405,33 @@ export type GetByContextReleaseData = { */ "EP-Context-Tag"?: string } + path?: never + query?: never + url: "/catalog" +} + +export type GetByContextReleaseErrors = { + /** + * The unexpected error. + */ + default: ErrorResponse } -export type GetByContextReleaseResponse = ReleaseData +export type GetByContextReleaseError = + GetByContextReleaseErrors[keyof GetByContextReleaseErrors] + +export type GetByContextReleaseResponses = { + /** + * The catalog. + */ + 200: ReleaseData +} -export type GetByContextReleaseError = ErrorResponse +export type GetByContextReleaseResponse = + GetByContextReleaseResponses[keyof GetByContextReleaseResponses] export type GetByContextAllHierarchiesData = { + body?: never headers?: { /** * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). @@ -3571,6 +3446,7 @@ export type GetByContextAllHierarchiesData = { */ "EP-Context-Tag"?: string } + path?: never query?: { /** * This endpoints supports filtering. See [Filtering](#filtering). @@ -3580,19 +3456,37 @@ export type GetByContextAllHierarchiesData = { /** * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[limit]"?: number + "page[limit]"?: BigInt /** * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[offset]"?: number + "page[offset]"?: BigInt } + url: "/catalog/hierarchies" +} + +export type GetByContextAllHierarchiesErrors = { + /** + * An unexpected error. + */ + default: ErrorResponse } -export type GetByContextAllHierarchiesResponse = HierarchyListData +export type GetByContextAllHierarchiesError = + GetByContextAllHierarchiesErrors[keyof GetByContextAllHierarchiesErrors] + +export type GetByContextAllHierarchiesResponses = { + /** + * The hierarchies of the catalog. + */ + 200: HierarchyListData +} -export type GetByContextAllHierarchiesError = ErrorResponse +export type GetByContextAllHierarchiesResponse = + GetByContextAllHierarchiesResponses[keyof GetByContextAllHierarchiesResponses] export type GetByContextHierarchyData = { + body?: never headers?: { /** * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). @@ -3613,18 +3507,33 @@ export type GetByContextHierarchyData = { */ hierarchy_id: string } + query?: never + url: "/catalog/hierarchies/{hierarchy_id}" +} + +export type GetByContextHierarchyErrors = { + /** + * The unexpected error. + */ + default: ErrorResponse } -export type GetByContextHierarchyResponse = HierarchyData +export type GetByContextHierarchyError = + GetByContextHierarchyErrors[keyof GetByContextHierarchyErrors] + +export type GetByContextHierarchyResponses = { + /** + * The catalog hierarchy. + */ + 200: HierarchyData +} -export type GetByContextHierarchyError = ErrorResponse +export type GetByContextHierarchyResponse = + GetByContextHierarchyResponses[keyof GetByContextHierarchyResponses] export type GetByContextHierarchyNodesData = { + body?: never headers?: { - /** - * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). - */ - "accept-language"?: string /** * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. */ @@ -3633,6 +3542,10 @@ export type GetByContextHierarchyNodesData = { * Product tags are used to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. You can enhance your product list using tags, enabling you to refine your product list and run targeted promotions. Tags are used to refine the eligibility criteria for a rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. */ "EP-Context-Tag"?: string + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string } path: { /** @@ -3649,24 +3562,38 @@ export type GetByContextHierarchyNodesData = { /** * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[limit]"?: number + "page[limit]"?: BigInt /** * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[offset]"?: number + "page[offset]"?: BigInt } + url: "/catalog/hierarchies/{hierarchy_id}/nodes" +} + +export type GetByContextHierarchyNodesErrors = { + /** + * The unexpected error. + */ + default: ErrorResponse } -export type GetByContextHierarchyNodesResponse = NodeListData +export type GetByContextHierarchyNodesError = + GetByContextHierarchyNodesErrors[keyof GetByContextHierarchyNodesErrors] + +export type GetByContextHierarchyNodesResponses = { + /** + * The child nodes of a catalog hierarchy. + */ + 200: NodeListData +} -export type GetByContextHierarchyNodesError = ErrorResponse +export type GetByContextHierarchyNodesResponse = + GetByContextHierarchyNodesResponses[keyof GetByContextHierarchyNodesResponses] export type GetByContextHierarchyChildNodesData = { + body?: never headers?: { - /** - * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). - */ - "accept-language"?: string /** * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. */ @@ -3675,6 +3602,10 @@ export type GetByContextHierarchyChildNodesData = { * Product tags are used to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. You can enhance your product list using tags, enabling you to refine your product list and run targeted promotions. Tags are used to refine the eligibility criteria for a rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. */ "EP-Context-Tag"?: string + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string } path: { /** @@ -3691,24 +3622,38 @@ export type GetByContextHierarchyChildNodesData = { /** * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[limit]"?: number + "page[limit]"?: BigInt /** * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[offset]"?: number + "page[offset]"?: BigInt } + url: "/catalog/hierarchies/{hierarchy_id}/children" +} + +export type GetByContextHierarchyChildNodesErrors = { + /** + * The unexpected error. + */ + default: ErrorResponse } -export type GetByContextHierarchyChildNodesResponse = NodeListData +export type GetByContextHierarchyChildNodesError = + GetByContextHierarchyChildNodesErrors[keyof GetByContextHierarchyChildNodesErrors] + +export type GetByContextHierarchyChildNodesResponses = { + /** + * The child nodes of a catalog hierarchy. + */ + 200: NodeListData +} -export type GetByContextHierarchyChildNodesError = ErrorResponse +export type GetByContextHierarchyChildNodesResponse = + GetByContextHierarchyChildNodesResponses[keyof GetByContextHierarchyChildNodesResponses] export type GetByContextAllNodesData = { + body?: never headers?: { - /** - * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). - */ - "accept-language"?: string /** * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. */ @@ -3717,7 +3662,12 @@ export type GetByContextAllNodesData = { * Product tags are used to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. You can enhance your product list using tags, enabling you to refine your product list and run targeted promotions. Tags are used to refine the eligibility criteria for a rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. */ "EP-Context-Tag"?: string + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string } + path?: never query?: { /** * This endpoint supports filtering, see [Filtering](#filtering). @@ -3727,24 +3677,38 @@ export type GetByContextAllNodesData = { /** * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[limit]"?: number + "page[limit]"?: BigInt /** * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[offset]"?: number + "page[offset]"?: BigInt } + url: "/catalog/nodes" } -export type GetByContextAllNodesResponse = NodeListData - -export type GetByContextAllNodesError = ErrorResponse +export type GetByContextAllNodesErrors = { + /** + * An unexpected error. + */ + default: ErrorResponse +} + +export type GetByContextAllNodesError = + GetByContextAllNodesErrors[keyof GetByContextAllNodesErrors] + +export type GetByContextAllNodesResponses = { + /** + * The nodes of the catalog. + */ + 200: NodeListData +} + +export type GetByContextAllNodesResponse = + GetByContextAllNodesResponses[keyof GetByContextAllNodesResponses] export type GetByContextNodeData = { + body?: never headers?: { - /** - * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). - */ - "accept-language"?: string /** * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. */ @@ -3753,6 +3717,10 @@ export type GetByContextNodeData = { * Product tags are used to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. You can enhance your product list using tags, enabling you to refine your product list and run targeted promotions. Tags are used to refine the eligibility criteria for a rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. */ "EP-Context-Tag"?: string + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string } path: { /** @@ -3760,18 +3728,33 @@ export type GetByContextNodeData = { */ node_id: string } + query?: never + url: "/catalog/nodes/{node_id}" +} + +export type GetByContextNodeErrors = { + /** + * The unexpected error. + */ + default: ErrorResponse } -export type GetByContextNodeResponse = NodeData +export type GetByContextNodeError = + GetByContextNodeErrors[keyof GetByContextNodeErrors] + +export type GetByContextNodeResponses = { + /** + * The catalog node. + */ + 200: NodeData +} -export type GetByContextNodeError = ErrorResponse +export type GetByContextNodeResponse = + GetByContextNodeResponses[keyof GetByContextNodeResponses] export type GetByContextChildNodesData = { + body?: never headers?: { - /** - * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). - */ - "accept-language"?: string /** * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. */ @@ -3780,6 +3763,10 @@ export type GetByContextChildNodesData = { * Product tags are used to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. You can enhance your product list using tags, enabling you to refine your product list and run targeted promotions. Tags are used to refine the eligibility criteria for a rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. */ "EP-Context-Tag"?: string + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string } path: { /** @@ -3796,19 +3783,37 @@ export type GetByContextChildNodesData = { /** * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[limit]"?: number + "page[limit]"?: BigInt /** * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[offset]"?: number + "page[offset]"?: BigInt } + url: "/catalog/nodes/{node_id}/relationships/children" +} + +export type GetByContextChildNodesErrors = { + /** + * The unexpected error. + */ + default: ErrorResponse } -export type GetByContextChildNodesResponse = NodeListData +export type GetByContextChildNodesError = + GetByContextChildNodesErrors[keyof GetByContextChildNodesErrors] + +export type GetByContextChildNodesResponses = { + /** + * The child nodes of a catalog node. + */ + 200: NodeListData +} -export type GetByContextChildNodesError = ErrorResponse +export type GetByContextChildNodesResponse = + GetByContextChildNodesResponses[keyof GetByContextChildNodesResponses] export type GetByContextAllProductsData = { + body?: never headers?: { /** * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). @@ -3823,6 +3828,7 @@ export type GetByContextAllProductsData = { */ "EP-Context-Tag"?: string } + path?: never query?: { /** * This endpoints support filtering. See [Filtering](#filtering). @@ -3832,19 +3838,37 @@ export type GetByContextAllProductsData = { /** * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[limit]"?: number + "page[limit]"?: BigInt /** * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[offset]"?: number + "page[offset]"?: BigInt } + url: "/catalog/products" +} + +export type GetByContextAllProductsErrors = { + /** + * The unexpected error. + */ + default: ErrorResponse } -export type GetByContextAllProductsResponse = ProductListData +export type GetByContextAllProductsError = + GetByContextAllProductsErrors[keyof GetByContextAllProductsErrors] + +export type GetByContextAllProductsResponses = { + /** + * The products of a catalog. + */ + 200: ProductListData +} -export type GetByContextAllProductsError = ErrorResponse +export type GetByContextAllProductsResponse = + GetByContextAllProductsResponses[keyof GetByContextAllProductsResponses] export type GetByContextProductData = { + body?: never headers?: { /** * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. @@ -3868,13 +3892,31 @@ export type GetByContextProductData = { */ include?: Array<"main_images" | "files" | "component_products"> } + url: "/catalog/products/{product_id}" +} + +export type GetByContextProductErrors = { + /** + * The unexpected error. + */ + default: ErrorResponse } -export type GetByContextProductResponse = ProductData +export type GetByContextProductError = + GetByContextProductErrors[keyof GetByContextProductErrors] + +export type GetByContextProductResponses = { + /** + * The product of a catalog. + */ + 200: ProductData +} -export type GetByContextProductError = ErrorResponse +export type GetByContextProductResponse = + GetByContextProductResponses[keyof GetByContextProductResponses] export type GetByContextComponentProductIdsData = { + body?: never headers?: { /** * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. @@ -3895,24 +3937,38 @@ export type GetByContextComponentProductIdsData = { /** * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[limit]"?: number + "page[limit]"?: BigInt /** * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[offset]"?: number + "page[offset]"?: BigInt } + url: "/catalog/products/{product_id}/relationships/component_products" +} + +export type GetByContextComponentProductIdsErrors = { + /** + * The unexpected error. + */ + default: ErrorResponse } -export type GetByContextComponentProductIdsResponse = ProductReferenceListData +export type GetByContextComponentProductIdsError = + GetByContextComponentProductIdsErrors[keyof GetByContextComponentProductIdsErrors] + +export type GetByContextComponentProductIdsResponses = { + /** + * The list of component product IDs of a bundle product from a catalog. + */ + 200: ProductReferenceListData +} -export type GetByContextComponentProductIdsError = ErrorResponse +export type GetByContextComponentProductIdsResponse = + GetByContextComponentProductIdsResponses[keyof GetByContextComponentProductIdsResponses] export type GetByContextChildProductsData = { + body?: never headers?: { - /** - * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). - */ - "accept-language"?: string /** * The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests. */ @@ -3921,6 +3977,10 @@ export type GetByContextChildProductsData = { * Product tags are used to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. You can enhance your product list using tags, enabling you to refine your product list and run targeted promotions. Tags are used to refine the eligibility criteria for a rule. Requests populate the catalog rule tag using the `EP-Context-Tag` header. */ "EP-Context-Tag"?: string + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string } path: { /** @@ -3937,19 +3997,37 @@ export type GetByContextChildProductsData = { /** * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[limit]"?: number + "page[limit]"?: BigInt /** * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[offset]"?: number + "page[offset]"?: BigInt } + url: "/catalog/products/{product_id}/relationships/children" +} + +export type GetByContextChildProductsErrors = { + /** + * The unexpected error. + */ + default: ErrorResponse } -export type GetByContextChildProductsResponse = ProductListData +export type GetByContextChildProductsError = + GetByContextChildProductsErrors[keyof GetByContextChildProductsErrors] + +export type GetByContextChildProductsResponses = { + /** + * The list of child products of a parent product from a catalog. + */ + 200: ProductListData +} -export type GetByContextChildProductsError = ErrorResponse +export type GetByContextChildProductsResponse = + GetByContextChildProductsResponses[keyof GetByContextChildProductsResponses] export type GetByContextProductsForHierarchyData = { + body?: never headers?: { /** * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). @@ -3979,19 +4057,37 @@ export type GetByContextProductsForHierarchyData = { /** * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[limit]"?: number + "page[limit]"?: BigInt /** * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[offset]"?: number + "page[offset]"?: BigInt } + url: "/catalog/hierarchies/{hierarchy_id}/products" +} + +export type GetByContextProductsForHierarchyErrors = { + /** + * The unexpected error. + */ + default: ErrorResponse } -export type GetByContextProductsForHierarchyResponse = ProductListData +export type GetByContextProductsForHierarchyError = + GetByContextProductsForHierarchyErrors[keyof GetByContextProductsForHierarchyErrors] + +export type GetByContextProductsForHierarchyResponses = { + /** + * The products of a catalog hierarchy. + */ + 200: ProductListData +} -export type GetByContextProductsForHierarchyError = ErrorResponse +export type GetByContextProductsForHierarchyResponse = + GetByContextProductsForHierarchyResponses[keyof GetByContextProductsForHierarchyResponses] export type GetByContextProductsForNodeData = { + body?: never headers?: { /** * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). @@ -4021,23 +4117,40 @@ export type GetByContextProductsForNodeData = { /** * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[limit]"?: number + "page[limit]"?: BigInt /** * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[offset]"?: number + "page[offset]"?: BigInt } + url: "/catalog/nodes/{node_id}/relationships/products" +} + +export type GetByContextProductsForNodeErrors = { + /** + * The unexpected error. + */ + default: ErrorResponse } -export type GetByContextProductsForNodeResponse = ProductListData +export type GetByContextProductsForNodeError = + GetByContextProductsForNodeErrors[keyof GetByContextProductsForNodeErrors] + +export type GetByContextProductsForNodeResponses = { + /** + * The products of a catalog node. + */ + 200: ProductListData +} -export type GetByContextProductsForNodeError = ErrorResponse +export type GetByContextProductsForNodeResponse = + GetByContextProductsForNodeResponses[keyof GetByContextProductsForNodeResponses] export type ConfigureByContextProductData = { /** * The bundle configuration. */ - body: BundleConfigurationData + body: BundleConfigurationData2 headers?: { /** * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). @@ -4058,88 +4171,217 @@ export type ConfigureByContextProductData = { */ product_id: string } + query?: never + url: "/catalog/products/{product_id}/configure" +} + +export type ConfigureByContextProductErrors = { + /** + * The unexpected error. + */ + default: ErrorResponse +} + +export type ConfigureByContextProductError = + ConfigureByContextProductErrors[keyof ConfigureByContextProductErrors] + +export type ConfigureByContextProductResponses = { + /** + * The configured product of a catalog. + */ + 200: ProductData +} + +export type ConfigureByContextProductResponse = + ConfigureByContextProductResponses[keyof ConfigureByContextProductResponses] + +export type GetCatalogsData = { + body?: never + path?: never + query?: never + url: "/catalogs" +} + +export type GetCatalogsErrors = { + /** + * An unexpected error. + */ + default: ErrorResponse } -export type ConfigureByContextProductResponse = ProductData +export type GetCatalogsError = GetCatalogsErrors[keyof GetCatalogsErrors] + +export type GetCatalogsResponses = { + /** + * The list of catalogs. + */ + 200: CatalogListData +} -export type ConfigureByContextProductError = ErrorResponse +export type GetCatalogsResponse = + GetCatalogsResponses[keyof GetCatalogsResponses] export type CreateCatalogData = { /** * Creates a catalog with the following attributes. */ body: CatalogCreateData + path?: never + query?: never + url: "/catalogs" } -export type CreateCatalogResponse = CatalogData +export type CreateCatalogErrors = { + /** + * Unexpected error. + */ + default: ErrorResponse +} -export type CreateCatalogError = ErrorResponse +export type CreateCatalogError = CreateCatalogErrors[keyof CreateCatalogErrors] -export type GetCatalogsResponse = CatalogListData +export type CreateCatalogResponses = { + /** + * The created catalog + */ + 201: CatalogData +} -export type GetCatalogsError = ErrorResponse +export type CreateCatalogResponse = + CreateCatalogResponses[keyof CreateCatalogResponses] -export type GetCatalogByIdData = { +export type DeleteCatalogByIdData = { + body?: never path: { /** * The catalog ID. */ catalog_id: string } + query?: never + url: "/catalogs/{catalog_id}" } -export type GetCatalogByIdResponse = CatalogData +export type DeleteCatalogByIdErrors = { + /** + * Unexpected error. + */ + default: ErrorResponse +} -export type GetCatalogByIdError = ErrorResponse +export type DeleteCatalogByIdError = + DeleteCatalogByIdErrors[keyof DeleteCatalogByIdErrors] -export type UpdateCatalogData = { +export type DeleteCatalogByIdResponses = { /** - * Updated catalog. + * A 204 response indicates that the catalog has been deleted. */ - body: CatalogUpdateData + 204: void +} + +export type DeleteCatalogByIdResponse = + DeleteCatalogByIdResponses[keyof DeleteCatalogByIdResponses] + +export type GetCatalogByIdData = { + body?: never path: { /** * The catalog ID. */ catalog_id: string } + query?: never + url: "/catalogs/{catalog_id}" +} + +export type GetCatalogByIdErrors = { + /** + * An unexpected error. + */ + default: ErrorResponse } -export type UpdateCatalogResponse = CatalogData +export type GetCatalogByIdError = + GetCatalogByIdErrors[keyof GetCatalogByIdErrors] + +export type GetCatalogByIdResponses = { + /** + * The catalog. + */ + 200: CatalogData +} -export type UpdateCatalogError = ErrorResponse +export type GetCatalogByIdResponse = + GetCatalogByIdResponses[keyof GetCatalogByIdResponses] -export type DeleteCatalogByIdData = { +export type UpdateCatalogData = { + /** + * Updated catalog. + */ + body: CatalogUpdateData path: { /** * The catalog ID. */ catalog_id: string } + query?: never + url: "/catalogs/{catalog_id}" } -export type DeleteCatalogByIdResponse = void +export type UpdateCatalogErrors = { + /** + * Unexpected error. + */ + default: ErrorResponse +} -export type DeleteCatalogByIdError = ErrorResponse +export type UpdateCatalogError = UpdateCatalogErrors[keyof UpdateCatalogErrors] -export type PublishReleaseData = { +export type UpdateCatalogResponses = { /** - * Options for catalog release publishing + * An updated catalog with the following attributes. */ - body?: CatalogReleaseCreateData + 200: CatalogData +} + +export type UpdateCatalogResponse = + UpdateCatalogResponses[keyof UpdateCatalogResponses] + +export type DeleteReleasesData = { + body?: never path: { /** * The catalog ID. */ catalog_id: string } + query?: never + url: "/catalogs/{catalog_id}/releases" +} + +export type DeleteReleasesErrors = { + /** + * Unexpected error. + */ + default: ErrorResponse } -export type PublishReleaseResponse = ReleaseData +export type DeleteReleasesError = + DeleteReleasesErrors[keyof DeleteReleasesErrors] + +export type DeleteReleasesResponses = { + /** + * A 204 response indicates that the releases have been deleted. + */ + 204: void +} -export type PublishReleaseError = ErrorResponse +export type DeleteReleasesResponse = + DeleteReleasesResponses[keyof DeleteReleasesResponses] export type GetReleasesData = { + body?: never headers?: { /** * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). @@ -4152,32 +4394,66 @@ export type GetReleasesData = { */ catalog_id: string } + query?: never + url: "/catalogs/{catalog_id}/releases" +} + +export type GetReleasesErrors = { + /** + * The unexpected error. + */ + default: ErrorResponse } -export type GetReleasesResponse = ReleaseListData +export type GetReleasesError = GetReleasesErrors[keyof GetReleasesErrors] + +export type GetReleasesResponses = { + /** + * The list of catalogs. + */ + 200: ReleaseListData +} -export type GetReleasesError = ErrorResponse +export type GetReleasesResponse = + GetReleasesResponses[keyof GetReleasesResponses] -export type DeleteReleasesData = { +export type PublishReleaseData = { + /** + * Options for catalog release publishing + */ + body?: CatalogReleaseCreateData path: { /** * The catalog ID. */ catalog_id: string } + query?: never + url: "/catalogs/{catalog_id}/releases" } -export type DeleteReleasesResponse = void +export type PublishReleaseErrors = { + /** + * Unexpected error. + */ + default: ErrorResponse +} -export type DeleteReleasesError = ErrorResponse +export type PublishReleaseError = + PublishReleaseErrors[keyof PublishReleaseErrors] -export type GetReleaseByIdData = { - headers?: { - /** - * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). - */ - "accept-language"?: string - } +export type PublishReleaseResponses = { + /** + * Publishes a catalog release with the following attributes. + */ + 201: ReleaseData +} + +export type PublishReleaseResponse = + PublishReleaseResponses[keyof PublishReleaseResponses] + +export type DeleteReleaseByIdData = { + body?: never path: { /** * The catalog ID. @@ -4188,13 +4464,38 @@ export type GetReleaseByIdData = { */ release_id: string } + query?: never + url: "/catalogs/{catalog_id}/releases/{release_id}" +} + +export type DeleteReleaseByIdErrors = { + /** + * Unexpected error. + */ + default: ErrorResponse } -export type GetReleaseByIdResponse = ReleaseData +export type DeleteReleaseByIdError = + DeleteReleaseByIdErrors[keyof DeleteReleaseByIdErrors] + +export type DeleteReleaseByIdResponses = { + /** + * A 204 response indicates that the release has been deleted. + */ + 204: void +} -export type GetReleaseByIdError = ErrorResponse +export type DeleteReleaseByIdResponse = + DeleteReleaseByIdResponses[keyof DeleteReleaseByIdResponses] -export type DeleteReleaseByIdData = { +export type GetReleaseByIdData = { + body?: never + headers?: { + /** + * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). + */ + "accept-language"?: string + } path: { /** * The catalog ID. @@ -4205,24 +4506,33 @@ export type DeleteReleaseByIdData = { */ release_id: string } + query?: never + url: "/catalogs/{catalog_id}/releases/{release_id}" } -export type DeleteReleaseByIdResponse = void +export type GetReleaseByIdErrors = { + /** + * The unexpected error. + */ + default: ErrorResponse +} -export type DeleteReleaseByIdError = ErrorResponse +export type GetReleaseByIdError = + GetReleaseByIdErrors[keyof GetReleaseByIdErrors] -export type CreateRuleData = { +export type GetReleaseByIdResponses = { /** - * Creates a catalog rule with the following attributes. + * The catalog. */ - body: RuleCreateData + 200: ReleaseData } -export type CreateRuleResponse = RuleData - -export type CreateRuleError = ErrorResponse +export type GetReleaseByIdResponse = + GetReleaseByIdResponses[keyof GetReleaseByIdResponses] export type GetRulesData = { + body?: never + path?: never query?: { /** * This endpoint supports filtering. See [Filtering](#filtering). @@ -4232,63 +4542,160 @@ export type GetRulesData = { /** * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[limit]"?: number + "page[limit]"?: BigInt /** * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[offset]"?: number + "page[offset]"?: BigInt } + url: "/catalogs/rules" } -export type GetRulesResponse = RuleListData +export type GetRulesErrors = { + /** + * An unexpected error. + */ + default: ErrorResponse +} -export type GetRulesError = ErrorResponse +export type GetRulesError = GetRulesErrors[keyof GetRulesErrors] -export type GetRuleByIdData = { - path: { - /** - * The catalog rule ID. - */ - catalog_rule_id: string - } +export type GetRulesResponses = { + /** + * The list of catalog rules. + */ + 200: RuleListData } -export type GetRuleByIdResponse = RuleData +export type GetRulesResponse = GetRulesResponses[keyof GetRulesResponses] -export type GetRuleByIdError = ErrorResponse +export type CreateRuleData = { + /** + * Creates a catalog rule with the following attributes. + */ + body: RuleCreateData + path?: never + query?: never + url: "/catalogs/rules" +} -export type UpdateRuleData = { +export type CreateRuleErrors = { /** - * An updated catalog rule with the following attributes. + * Unexpected error. */ - body: RuleUpdateData - path: { - /** - * The catalog rule ID. - */ - catalog_rule_id: string - } + default: ErrorResponse } -export type UpdateRuleResponse = RuleData +export type CreateRuleError = CreateRuleErrors[keyof CreateRuleErrors] + +export type CreateRuleResponses = { + /** + * The created catalog rule + */ + 201: RuleData +} -export type UpdateRuleError = ErrorResponse +export type CreateRuleResponse = CreateRuleResponses[keyof CreateRuleResponses] export type DeleteRuleByIdData = { + body?: never path: { /** * The catalog rule ID. */ catalog_rule_id: string } + query?: never + url: "/catalogs/rules/{catalog_rule_id}" } -export type DeleteRuleByIdResponse = void +export type DeleteRuleByIdErrors = { + /** + * Unexpected error. + */ + default: ErrorResponse +} -export type DeleteRuleByIdError = ErrorResponse +export type DeleteRuleByIdError = + DeleteRuleByIdErrors[keyof DeleteRuleByIdErrors] -export type GetAllHierarchiesData = { - headers?: { +export type DeleteRuleByIdResponses = { + /** + * A 204 response indicates that the catalog rule has been deleted. + */ + 204: void +} + +export type DeleteRuleByIdResponse = + DeleteRuleByIdResponses[keyof DeleteRuleByIdResponses] + +export type GetRuleByIdData = { + body?: never + path: { + /** + * The catalog rule ID. + */ + catalog_rule_id: string + } + query?: never + url: "/catalogs/rules/{catalog_rule_id}" +} + +export type GetRuleByIdErrors = { + /** + * An unexpected error. + */ + default: ErrorResponse +} + +export type GetRuleByIdError = GetRuleByIdErrors[keyof GetRuleByIdErrors] + +export type GetRuleByIdResponses = { + /** + * The catalog rile. + */ + 200: RuleData +} + +export type GetRuleByIdResponse = + GetRuleByIdResponses[keyof GetRuleByIdResponses] + +export type UpdateRuleData = { + /** + * An updated catalog rule with the following attributes. + */ + body: RuleUpdateData + path: { + /** + * The catalog rule ID. + */ + catalog_rule_id: string + } + query?: never + url: "/catalogs/rules/{catalog_rule_id}" +} + +export type UpdateRuleErrors = { + /** + * Unexpected error. + */ + default: ErrorResponse +} + +export type UpdateRuleError = UpdateRuleErrors[keyof UpdateRuleErrors] + +export type UpdateRuleResponses = { + /** + * An Updated catalog rule with the following attributes. + */ + 200: RuleData +} + +export type UpdateRuleResponse = UpdateRuleResponses[keyof UpdateRuleResponses] + +export type GetAllHierarchiesData = { + body?: never + headers?: { /** * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). */ @@ -4313,19 +4720,37 @@ export type GetAllHierarchiesData = { /** * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[limit]"?: number + "page[limit]"?: BigInt /** * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[offset]"?: number + "page[offset]"?: BigInt } + url: "/catalogs/{catalog_id}/releases/{release_id}/hierarchies" +} + +export type GetAllHierarchiesErrors = { + /** + * An unexpected error. + */ + default: ErrorResponse } -export type GetAllHierarchiesResponse = HierarchyListData +export type GetAllHierarchiesError = + GetAllHierarchiesErrors[keyof GetAllHierarchiesErrors] + +export type GetAllHierarchiesResponses = { + /** + * The hierarchies of a catalog. + */ + 200: HierarchyListData +} -export type GetAllHierarchiesError = ErrorResponse +export type GetAllHierarchiesResponse = + GetAllHierarchiesResponses[keyof GetAllHierarchiesResponses] export type GetHierarchyData = { + body?: never headers?: { /** * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). @@ -4337,22 +4762,40 @@ export type GetHierarchyData = { * The catalog ID. */ catalog_id: string - /** - * The catalog hierarchy ID. - */ - hierarchy_id: string /** * The unique identifier of a published release of the catalog or `latest` for the most recently published version. */ release_id: string + /** + * The catalog hierarchy ID. + */ + hierarchy_id: string } + query?: never + url: "/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}" +} + +export type GetHierarchyErrors = { + /** + * The unexpected error. + */ + default: ErrorResponse } -export type GetHierarchyResponse = HierarchyData +export type GetHierarchyError = GetHierarchyErrors[keyof GetHierarchyErrors] + +export type GetHierarchyResponses = { + /** + * The catalog hierarchy. + */ + 200: HierarchyData +} -export type GetHierarchyError = ErrorResponse +export type GetHierarchyResponse = + GetHierarchyResponses[keyof GetHierarchyResponses] export type GetHierarchyNodesData = { + body?: never headers?: { /** * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). @@ -4364,14 +4807,14 @@ export type GetHierarchyNodesData = { * The catalog ID. */ catalog_id: string - /** - * The catalog hierarchy ID. - */ - hierarchy_id: string /** * The catalog release ID. */ release_id: string + /** + * The catalog hierarchy ID. + */ + hierarchy_id: string } query?: { /** @@ -4382,19 +4825,37 @@ export type GetHierarchyNodesData = { /** * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[limit]"?: number + "page[limit]"?: BigInt /** * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[offset]"?: number + "page[offset]"?: BigInt } + url: "/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/nodes" +} + +export type GetHierarchyNodesErrors = { + /** + * The unexpected error. + */ + default: ErrorResponse } -export type GetHierarchyNodesResponse = NodeListData +export type GetHierarchyNodesError = + GetHierarchyNodesErrors[keyof GetHierarchyNodesErrors] + +export type GetHierarchyNodesResponses = { + /** + * The child nodes of a catalog hierarchy. + */ + 200: NodeListData +} -export type GetHierarchyNodesError = ErrorResponse +export type GetHierarchyNodesResponse = + GetHierarchyNodesResponses[keyof GetHierarchyNodesResponses] export type GetHierarchyChildNodesData = { + body?: never headers?: { /** * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). @@ -4406,14 +4867,14 @@ export type GetHierarchyChildNodesData = { * The catalog ID. */ catalog_id: string - /** - * The catalog hierarchy ID. - */ - hierarchy_id: string /** * The unique identifier of a published release of the catalog or `latest` for the most recently published version. */ release_id: string + /** + * The catalog hierarchy ID. + */ + hierarchy_id: string } query?: { /** @@ -4424,19 +4885,37 @@ export type GetHierarchyChildNodesData = { /** * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[limit]"?: number + "page[limit]"?: BigInt /** * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[offset]"?: number + "page[offset]"?: BigInt } + url: "/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/children" +} + +export type GetHierarchyChildNodesErrors = { + /** + * The unexpected error. + */ + default: ErrorResponse } -export type GetHierarchyChildNodesResponse = NodeListData +export type GetHierarchyChildNodesError = + GetHierarchyChildNodesErrors[keyof GetHierarchyChildNodesErrors] + +export type GetHierarchyChildNodesResponses = { + /** + * The child nodes of a catalog hierarchy. + */ + 200: NodeListData +} -export type GetHierarchyChildNodesError = ErrorResponse +export type GetHierarchyChildNodesResponse = + GetHierarchyChildNodesResponses[keyof GetHierarchyChildNodesResponses] export type GetAllNodesData = { + body?: never headers?: { /** * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). @@ -4462,19 +4941,36 @@ export type GetAllNodesData = { /** * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[limit]"?: number + "page[limit]"?: BigInt /** * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[offset]"?: number + "page[offset]"?: BigInt } + url: "/catalogs/{catalog_id}/releases/{release_id}/nodes" +} + +export type GetAllNodesErrors = { + /** + * An unexpected error. + */ + default: ErrorResponse } -export type GetAllNodesResponse = NodeListData +export type GetAllNodesError = GetAllNodesErrors[keyof GetAllNodesErrors] + +export type GetAllNodesResponses = { + /** + * The nodes of a catalog. + */ + 200: NodeListData +} -export type GetAllNodesError = ErrorResponse +export type GetAllNodesResponse = + GetAllNodesResponses[keyof GetAllNodesResponses] export type GetNodeData = { + body?: never headers?: { /** * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). @@ -4486,22 +4982,39 @@ export type GetNodeData = { * The catalog ID. */ catalog_id: string - /** - * The catalog node ID. - */ - node_id: string /** * The unique identifier of a published release of the catalog or `latest` for the most recently published version. */ release_id: string + /** + * The catalog node ID. + */ + node_id: string } + query?: never + url: "/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}" +} + +export type GetNodeErrors = { + /** + * The unexpected error. + */ + default: ErrorResponse } -export type GetNodeResponse = NodeData +export type GetNodeError = GetNodeErrors[keyof GetNodeErrors] + +export type GetNodeResponses = { + /** + * The catalog node. + */ + 200: NodeData +} -export type GetNodeError = ErrorResponse +export type GetNodeResponse = GetNodeResponses[keyof GetNodeResponses] export type GetChildNodesData = { + body?: never headers?: { /** * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). @@ -4513,14 +5026,14 @@ export type GetChildNodesData = { * The catalog ID. */ catalog_id: string - /** - * The catalog node ID. - */ - node_id: string /** * The unique identifier of a published release of the catalog or `latest` for the most recently published version. */ release_id: string + /** + * The catalog node ID. + */ + node_id: string } query?: { /** @@ -4531,19 +5044,36 @@ export type GetChildNodesData = { /** * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[limit]"?: number + "page[limit]"?: BigInt /** * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[offset]"?: number + "page[offset]"?: BigInt } + url: "/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/children" +} + +export type GetChildNodesErrors = { + /** + * The unexpected error. + */ + default: ErrorResponse } -export type GetChildNodesResponse = NodeListData +export type GetChildNodesError = GetChildNodesErrors[keyof GetChildNodesErrors] + +export type GetChildNodesResponses = { + /** + * The child nodes of a catalog node. + */ + 200: NodeListData +} -export type GetChildNodesError = ErrorResponse +export type GetChildNodesResponse = + GetChildNodesResponses[keyof GetChildNodesResponses] export type GetAllProductsData = { + body?: never headers?: { /** * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). @@ -4569,19 +5099,37 @@ export type GetAllProductsData = { /** * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[limit]"?: number + "page[limit]"?: BigInt /** * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[offset]"?: number + "page[offset]"?: BigInt } + url: "/catalogs/{catalog_id}/releases/{release_id}/products" +} + +export type GetAllProductsErrors = { + /** + * The unexpected error. + */ + default: ErrorResponse } -export type GetAllProductsResponse = ProductListData +export type GetAllProductsError = + GetAllProductsErrors[keyof GetAllProductsErrors] + +export type GetAllProductsResponses = { + /** + * The products of a catalog. + */ + 200: ProductListData +} -export type GetAllProductsError = ErrorResponse +export type GetAllProductsResponse = + GetAllProductsResponses[keyof GetAllProductsResponses] export type GetProductData = { + body?: never headers?: { /** * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). @@ -4593,53 +5141,88 @@ export type GetProductData = { * The catalog ID. */ catalog_id: string - /** - * The product ID. - */ - product_id: string /** * The unique identifier of a published release of the catalog or `latest` for the most recently published version. */ release_id: string + /** + * The product ID. + */ + product_id: string } + query?: never + url: "/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}" +} + +export type GetProductErrors = { + /** + * The unexpected error. + */ + default: ErrorResponse } -export type GetProductResponse = ProductData +export type GetProductError = GetProductErrors[keyof GetProductErrors] + +export type GetProductResponses = { + /** + * The product of a catalog. + */ + 200: ProductData +} -export type GetProductError = ErrorResponse +export type GetProductResponse = GetProductResponses[keyof GetProductResponses] export type GetComponentProductIdsData = { + body?: never path: { /** * The catalog ID. */ catalog_id: string - /** - * The product ID. - */ - product_id: string /** * The unique identifier of a published release of the catalog or `latest` for the most recently published version. */ release_id: string + /** + * The product ID. + */ + product_id: string } query?: { /** * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[limit]"?: number + "page[limit]"?: BigInt /** * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[offset]"?: number + "page[offset]"?: BigInt } + url: "/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/component_products" +} + +export type GetComponentProductIdsErrors = { + /** + * The unexpected error. + */ + default: ErrorResponse } -export type GetComponentProductIdsResponse = ProductReferenceListData +export type GetComponentProductIdsError = + GetComponentProductIdsErrors[keyof GetComponentProductIdsErrors] + +export type GetComponentProductIdsResponses = { + /** + * The list of component product IDs of a specific bundle product from a catalog. + */ + 200: ProductReferenceListData +} -export type GetComponentProductIdsError = ErrorResponse +export type GetComponentProductIdsResponse = + GetComponentProductIdsResponses[keyof GetComponentProductIdsResponses] export type GetChildProductsData = { + body?: never headers?: { /** * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). @@ -4651,14 +5234,14 @@ export type GetChildProductsData = { * The catalog ID. */ catalog_id: string - /** - * The product ID. - */ - product_id: string /** * The unique identifier of a published release of the catalog or `latest` for the most recently published version. */ release_id: string + /** + * The product ID. + */ + product_id: string } query?: { /** @@ -4669,19 +5252,37 @@ export type GetChildProductsData = { /** * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[limit]"?: number + "page[limit]"?: BigInt /** * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[offset]"?: number + "page[offset]"?: BigInt } + url: "/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/children" +} + +export type GetChildProductsErrors = { + /** + * The unexpected error. + */ + default: ErrorResponse } -export type GetChildProductsResponse = ProductListData +export type GetChildProductsError = + GetChildProductsErrors[keyof GetChildProductsErrors] + +export type GetChildProductsResponses = { + /** + * The list of child products of a specific base product from a catalog. + */ + 200: ProductListData +} -export type GetChildProductsError = ErrorResponse +export type GetChildProductsResponse = + GetChildProductsResponses[keyof GetChildProductsResponses] export type GetProductsForHierarchyData = { + body?: never headers?: { /** * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). @@ -4693,14 +5294,14 @@ export type GetProductsForHierarchyData = { * The catalog ID. */ catalog_id: string - /** - * The catalog hierarchy ID. - */ - hierarchy_id: string /** * The unique identifier of a published release of the catalog or `latest` for the most recently published version. */ release_id: string + /** + * The catalog hierarchy ID. + */ + hierarchy_id: string } query?: { /** @@ -4711,19 +5312,37 @@ export type GetProductsForHierarchyData = { /** * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[limit]"?: number + "page[limit]"?: BigInt /** * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[offset]"?: number + "page[offset]"?: BigInt } + url: "/catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/products" +} + +export type GetProductsForHierarchyErrors = { + /** + * The unexpected error. + */ + default: ErrorResponse } -export type GetProductsForHierarchyResponse = ProductListData +export type GetProductsForHierarchyError = + GetProductsForHierarchyErrors[keyof GetProductsForHierarchyErrors] + +export type GetProductsForHierarchyResponses = { + /** + * The products of a catalog hierarchy. + */ + 200: ProductListData +} -export type GetProductsForHierarchyError = ErrorResponse +export type GetProductsForHierarchyResponse = + GetProductsForHierarchyResponses[keyof GetProductsForHierarchyResponses] export type GetProductsForNodeData = { + body?: never headers?: { /** * The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language). @@ -4735,14 +5354,14 @@ export type GetProductsForNodeData = { * The catalog ID. */ catalog_id: string - /** - * The catalog node ID. - */ - node_id: string /** * The unique identifier of a published release of the catalog or `latest` for the most recently published version. */ release_id: string + /** + * The catalog node ID. + */ + node_id: string } query?: { /** @@ -4753,19 +5372,37 @@ export type GetProductsForNodeData = { /** * The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[limit]"?: number + "page[limit]"?: BigInt /** * The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used. */ - "page[offset]"?: number + "page[offset]"?: BigInt } + url: "/catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/products" +} + +export type GetProductsForNodeErrors = { + /** + * The unexpected error. + */ + default: ErrorResponse } -export type GetProductsForNodeResponse = ProductListData +export type GetProductsForNodeError = + GetProductsForNodeErrors[keyof GetProductsForNodeErrors] + +export type GetProductsForNodeResponses = { + /** + * The products of a catalog node. + */ + 200: ProductListData +} -export type GetProductsForNodeError = ErrorResponse +export type GetProductsForNodeResponse = + GetProductsForNodeResponses[keyof GetProductsForNodeResponses] export type GetCartsData = { + body?: never headers?: { /** * An Account Management Authentication token to access a specific account's carts. @@ -4776,17 +5413,31 @@ export type GetCartsData = { */ "x-moltin-customer-token"?: string } + path?: never + query?: never + url: "/v2/carts" +} + +export type GetCartsErrors = { + /** + * Unauthorized + */ + 401: ResponseError } -export type GetCartsResponse = ResponseData & { - data?: Array - links?: ResponsePageLinks - meta?: ResponseMetaCarts +export type GetCartsError = GetCartsErrors[keyof GetCartsErrors] + +export type GetCartsResponses = { + 200: ResponseData & { + data?: Array + links?: ResponsePageLinks + meta?: ResponseMetaCarts + } } -export type GetCartsError = ResponseError +export type GetCartsResponse = GetCartsResponses[keyof GetCartsResponses] -export type CreateAcartData = { +export type CreateACartData = { body?: CartsRequest headers?: { /** @@ -4794,84 +5445,181 @@ export type CreateAcartData = { */ "x-moltin-customer-token"?: string } + path?: never + query?: never + url: "/v2/carts" } -export type CreateAcartResponse = ResponseData & { - data?: CartResponse +export type CreateACartErrors = { + /** + * Unauthorized + */ + 401: ResponseError } -export type CreateAcartError = ResponseError +export type CreateACartError = CreateACartErrors[keyof CreateACartErrors] -export type GetCartData = { - path: { - /** - * The unique identifier for this cart that you created. - */ - cartID: string +export type CreateACartResponses = { + 200: ResponseData & { + data?: CartResponse } } -export type GetCartResponse = ResponseData & { - data?: CartResponse -} - -export type GetCartError = ResponseError +export type CreateACartResponse = + CreateACartResponses[keyof CreateACartResponses] -export type UpdateAcartData = { - body?: CartsRequest +export type DeleteACartData = { + body?: never path: { /** - * The unique identifier of a cart created by you. + * The unique identifier of the cart that you want to delete. */ cartID: string } + query?: never + url: "/v2/carts/{cartID}" } -export type UpdateAcartResponse = ResponseData & { - data?: CartResponse +export type DeleteACartErrors = { + /** + * Unauthorized + */ + 401: ResponseError } -export type UpdateAcartError = ResponseError +export type DeleteACartError = DeleteACartErrors[keyof DeleteACartErrors] -export type DeleteAcartData = { - path: { - /** - * The unique identifier of the cart that you want to delete. +export type DeleteACartResponses = { + /** + * No Content + */ + 204: void +} + +export type DeleteACartResponse = + DeleteACartResponses[keyof DeleteACartResponses] + +export type GetCartData = { + body?: never + path: { + /** + * The unique identifier for this cart that you created. */ cartID: string } + query?: never + url: "/v2/carts/{cartID}" } -export type DeleteAcartResponse = void +export type GetCartErrors = { + /** + * Unauthorized + */ + 401: ResponseError +} -export type DeleteAcartError = ResponseError +export type GetCartError = GetCartErrors[keyof GetCartErrors] -export type GetCartItemsData = { +export type GetCartResponses = { + /** + * OK + */ + 200: ResponseData & { + data?: CartResponse + } +} + +export type GetCartResponse = GetCartResponses[keyof GetCartResponses] + +export type UpdateACartData = { + body?: CartsRequest path: { /** - * The unique identifier of the cart that you created. + * The unique identifier of a cart created by you. */ cartID: string } + query?: never + url: "/v2/carts/{cartID}" +} + +export type UpdateACartErrors = { + /** + * Unauthorized + */ + 401: ResponseError } -export type GetCartItemsResponse = CartsResponse +export type UpdateACartError = UpdateACartErrors[keyof UpdateACartErrors] + +export type UpdateACartResponses = { + 200: ResponseData & { + data?: CartResponse + } +} -export type GetCartItemsError = ResponseError +export type UpdateACartResponse = + UpdateACartResponses[keyof UpdateACartResponses] -export type BulkUpdateItemsInCartData = { - body?: BulkUpdateCartsItems +export type DeleteAllCartItemsData = { + body?: never + path: { + /** + * The unique identifier of the cart created by you. + */ + cartID: string + } + query?: never + url: "/v2/carts/{cartID}/items" +} + +export type DeleteAllCartItemsErrors = { + /** + * Unauthorized + */ + 401: ResponseError +} + +export type DeleteAllCartItemsError = + DeleteAllCartItemsErrors[keyof DeleteAllCartItemsErrors] + +export type DeleteAllCartItemsResponses = { + /** + * No Content + */ + 204: void +} + +export type DeleteAllCartItemsResponse = + DeleteAllCartItemsResponses[keyof DeleteAllCartItemsResponses] + +export type GetCartItemsData = { + body?: never path: { /** * The unique identifier of the cart that you created. */ cartID: string } + query?: never + url: "/v2/carts/{cartID}/items" +} + +export type GetCartItemsErrors = { + /** + * Unauthorized + */ + 401: ResponseError } -export type BulkUpdateItemsInCartResponse = unknown +export type GetCartItemsError = GetCartItemsErrors[keyof GetCartItemsErrors] -export type BulkUpdateItemsInCartError = ResponseError +export type GetCartItemsResponses = { + 200: CartsResponse +} + +export type GetCartItemsResponse = + GetCartItemsResponses[keyof GetCartItemsResponses] export type ManageCartsData = { body?: @@ -4887,61 +5635,122 @@ export type ManageCartsData = { */ cartID: string } + query?: never + url: "/v2/carts/{cartID}/items" +} + +export type ManageCartsErrors = { + /** + * Unauthorized + */ + 401: ResponseError } -export type ManageCartsResponse = CartsResponse +export type ManageCartsError = ManageCartsErrors[keyof ManageCartsErrors] -export type ManageCartsError = ResponseError +export type ManageCartsResponses = { + 200: CartsResponse +} -export type DeleteAllCartItemsData = { +export type ManageCartsResponse = + ManageCartsResponses[keyof ManageCartsResponses] + +export type BulkUpdateItemsInCartData = { + body?: BulkUpdateCartsItems path: { /** - * The unique identifier of the cart created by you. + * The unique identifier of the cart that you created. */ cartID: string } + query?: never + url: "/v2/carts/{cartID}/items" +} + +export type BulkUpdateItemsInCartErrors = { + /** + * Unauthorized + */ + 401: ResponseError } -export type DeleteAllCartItemsResponse = void +export type BulkUpdateItemsInCartError = + BulkUpdateItemsInCartErrors[keyof BulkUpdateItemsInCartErrors] -export type DeleteAllCartItemsError = ResponseError +export type BulkUpdateItemsInCartResponses = { + 200: unknown +} -export type UpdateAcartItemData = { - body?: UpdateCartsItems +export type DeleteACartItemData = { + body?: never path: { /** - * A unique identifier of the cart that you created. + * The unique identifier of the cart created by you. */ cartID: string /** - * A unique identifier of the cart item. + * The unique identifier of the cart that you want to delete. */ cartitemID: string } + query?: never + url: "/v2/carts/{cartID}/items/{cartitemID}" +} + +export type DeleteACartItemErrors = { + /** + * Unauthorized + */ + 401: ResponseError } -export type UpdateAcartItemResponse = CartsResponse +export type DeleteACartItemError = + DeleteACartItemErrors[keyof DeleteACartItemErrors] + +export type DeleteACartItemResponses = { + /** + * No Content + */ + 204: void +} -export type UpdateAcartItemError = ResponseError +export type DeleteACartItemResponse = + DeleteACartItemResponses[keyof DeleteACartItemResponses] -export type DeleteAcartItemData = { +export type UpdateACartItemData = { + body?: UpdateCartsItems path: { /** - * The unique identifier of the cart created by you. + * A unique identifier of the cart that you created. */ cartID: string /** - * The unique identifier of the cart that you want to delete. + * A unique identifier of the cart item. */ cartitemID: string } + query?: never + url: "/v2/carts/{cartID}/items/{cartitemID}" } -export type DeleteAcartItemResponse = void +export type UpdateACartItemErrors = { + /** + * Unauthorized + */ + 401: ResponseError +} -export type DeleteAcartItemError = ResponseError +export type UpdateACartItemError = + UpdateACartItemErrors[keyof UpdateACartItemErrors] -export type CreateAccountCartAssociationData = { +export type UpdateACartItemResponses = { + 200: CartsResponse +} + +export type UpdateACartItemResponse = + UpdateACartItemResponses[keyof UpdateACartItemResponses] + +export type DeleteAccountCartAssociationData = { body?: CartsRelationshipsAccountsData headers?: { /** @@ -4951,18 +5760,35 @@ export type CreateAccountCartAssociationData = { } path: { /** - * The ID for the cart created by the account. Ensure that you follow the guidelines for [Safe Characters](/guides/Getting-Started/safe-characters). + * The ID for the cart created by the account. */ cartID: string } + query?: never + url: "/v2/carts/{cartID}/relationships/accounts" } -export type CreateAccountCartAssociationResponse = - CartsRelationshipsAccountsData | void +export type DeleteAccountCartAssociationErrors = { + /** + * Unauthorized + */ + 401: ResponseError +} -export type CreateAccountCartAssociationError = ResponseError +export type DeleteAccountCartAssociationError = + DeleteAccountCartAssociationErrors[keyof DeleteAccountCartAssociationErrors] -export type DeleteAccountCartAssociationData = { +export type DeleteAccountCartAssociationResponses = { + /** + * No Content + */ + 204: void +} + +export type DeleteAccountCartAssociationResponse = + DeleteAccountCartAssociationResponses[keyof DeleteAccountCartAssociationResponses] + +export type CreateAccountCartAssociationData = { body?: CartsRelationshipsAccountsData headers?: { /** @@ -4972,17 +5798,39 @@ export type DeleteAccountCartAssociationData = { } path: { /** - * The ID for the cart created by the account. + * The ID for the cart created by the account. Ensure that you follow the guidelines for [Safe Characters](/guides/Getting-Started/safe-characters). */ cartID: string } + query?: never + url: "/v2/carts/{cartID}/relationships/accounts" } -export type DeleteAccountCartAssociationResponse = void +export type CreateAccountCartAssociationErrors = { + /** + * Unauthorized + */ + 401: ResponseError +} -export type DeleteAccountCartAssociationError = ResponseError +export type CreateAccountCartAssociationError = + CreateAccountCartAssociationErrors[keyof CreateAccountCartAssociationErrors] -export type CreateCustomerCartAssociationData = { +export type CreateAccountCartAssociationResponses = { + /** + * OK + */ + 200: CartsRelationshipsAccountsData + /** + * No Content is sent back in case the account has already been associated to the cart. + */ + 204: void +} + +export type CreateAccountCartAssociationResponse = + CreateAccountCartAssociationResponses[keyof CreateAccountCartAssociationResponses] + +export type DeleteCustomerCartAssociationData = { body?: CartsRelationshipsCustomersData headers?: { /** @@ -4992,18 +5840,35 @@ export type CreateCustomerCartAssociationData = { } path: { /** - * The ID for the cart created by the customer. Ensure that you follow the guidelines for [Safe Characters](/guides/Getting-Started/safe-characters). + * The ID for the cart created by the customer. */ cartID: string } + query?: never + url: "/v2/carts/{cartID}/relationships/customers" } -export type CreateCustomerCartAssociationResponse = - CartsRelationshipsCustomersData +export type DeleteCustomerCartAssociationErrors = { + /** + * Unauthorized + */ + 401: ResponseError +} -export type CreateCustomerCartAssociationError = ResponseError +export type DeleteCustomerCartAssociationError = + DeleteCustomerCartAssociationErrors[keyof DeleteCustomerCartAssociationErrors] -export type DeleteCustomerCartAssociationData = { +export type DeleteCustomerCartAssociationResponses = { + /** + * No Content + */ + 204: void +} + +export type DeleteCustomerCartAssociationResponse = + DeleteCustomerCartAssociationResponses[keyof DeleteCustomerCartAssociationResponses] + +export type CreateCustomerCartAssociationData = { body?: CartsRelationshipsCustomersData headers?: { /** @@ -5013,17 +5878,36 @@ export type DeleteCustomerCartAssociationData = { } path: { /** - * The ID for the cart created by the customer. + * The ID for the cart created by the customer. Ensure that you follow the guidelines for [Safe Characters](/guides/Getting-Started/safe-characters). */ cartID: string } + query?: never + url: "/v2/carts/{cartID}/relationships/customers" +} + +export type CreateCustomerCartAssociationErrors = { + /** + * Unauthorized + */ + 401: ResponseError } -export type DeleteCustomerCartAssociationResponse = void +export type CreateCustomerCartAssociationError = + CreateCustomerCartAssociationErrors[keyof CreateCustomerCartAssociationErrors] + +export type CreateCustomerCartAssociationResponses = { + /** + * OK + */ + 200: CartsRelationshipsCustomersData +} -export type DeleteCustomerCartAssociationError = ResponseError +export type CreateCustomerCartAssociationResponse = + CreateCustomerCartAssociationResponses[keyof CreateCustomerCartAssociationResponses] -export type DeleteApromotionViaPromotionCodeData = { +export type DeleteAPromotionViaPromotionCodeData = { + body?: never path: { /** * Specifies the unique identifier of a cart created by you. @@ -5034,11 +5918,29 @@ export type DeleteApromotionViaPromotionCodeData = { */ promoCode: string } + query?: never + url: "/v2/carts/{cartID}/discounts/{promoCode}" } -export type DeleteApromotionViaPromotionCodeResponse = void +export type DeleteAPromotionViaPromotionCodeErrors = { + /** + * Unauthorized + */ + 401: ResponseError +} + +export type DeleteAPromotionViaPromotionCodeError = + DeleteAPromotionViaPromotionCodeErrors[keyof DeleteAPromotionViaPromotionCodeErrors] + +export type DeleteAPromotionViaPromotionCodeResponses = { + /** + * No Content + */ + 204: void +} -export type DeleteApromotionViaPromotionCodeError = ResponseError +export type DeleteAPromotionViaPromotionCodeResponse = + DeleteAPromotionViaPromotionCodeResponses[keyof DeleteAPromotionViaPromotionCodeResponses] export type AddTaxItemToCartData = { body?: ResponseData & { @@ -5054,45 +5956,96 @@ export type AddTaxItemToCartData = { */ cartitemID: string } + query?: never + url: "/v2/carts/{cartID}/items/{cartitemID}/taxes" } -export type AddTaxItemToCartResponse = ResponseData & { - data?: CartsItemsTaxesObject +export type AddTaxItemToCartErrors = { + /** + * Unauthorized + */ + 401: ResponseError + /** + * Unauthorized + */ + 422: ResponseError } -export type AddTaxItemToCartError = ResponseError +export type AddTaxItemToCartError = + AddTaxItemToCartErrors[keyof AddTaxItemToCartErrors] -export type BulkAddTaxItemsToCartData = { - body?: CartsBulkTaxes +export type AddTaxItemToCartResponses = { + 200: ResponseData & { + data?: CartsItemsTaxesObject + } +} + +export type AddTaxItemToCartResponse = + AddTaxItemToCartResponses[keyof AddTaxItemToCartResponses] + +export type BulkDeleteTaxItemsFromCartData = { + body?: never path: { /** * The unique identifier of the cart. */ cartID: string } + query?: never + url: "/v2/carts/{cartID}/taxes" } -export type BulkAddTaxItemsToCartResponse = CartsBulkTaxes +export type BulkDeleteTaxItemsFromCartErrors = { + /** + * Unauthorized + */ + 401: ResponseError +} -export type BulkAddTaxItemsToCartError = ResponseError +export type BulkDeleteTaxItemsFromCartError = + BulkDeleteTaxItemsFromCartErrors[keyof BulkDeleteTaxItemsFromCartErrors] -export type BulkDeleteTaxItemsFromCartData = { +export type BulkDeleteTaxItemsFromCartResponses = { + /** + * No Content + */ + 204: void +} + +export type BulkDeleteTaxItemsFromCartResponse = + BulkDeleteTaxItemsFromCartResponses[keyof BulkDeleteTaxItemsFromCartResponses] + +export type BulkAddTaxItemsToCartData = { + body?: CartsBulkTaxes path: { /** * The unique identifier of the cart. */ cartID: string } + query?: never + url: "/v2/carts/{cartID}/taxes" +} + +export type BulkAddTaxItemsToCartErrors = { + /** + * Unauthorized + */ + 401: ResponseError } -export type BulkDeleteTaxItemsFromCartResponse = void +export type BulkAddTaxItemsToCartError = + BulkAddTaxItemsToCartErrors[keyof BulkAddTaxItemsToCartErrors] + +export type BulkAddTaxItemsToCartResponses = { + 200: CartsBulkTaxes +} -export type BulkDeleteTaxItemsFromCartError = ResponseError +export type BulkAddTaxItemsToCartResponse = + BulkAddTaxItemsToCartResponses[keyof BulkAddTaxItemsToCartResponses] -export type UpdateAtaxItemData = { - body?: ResponseData & { - data?: CartsItemsTaxesObject - } +export type DeleteATaxItemData = { + body?: never path: { /** * The unique identifier of the cart. @@ -5107,15 +6060,34 @@ export type UpdateAtaxItemData = { */ taxitemID: string } + query?: never + url: "/v2/carts/{cartID}/items/{cartitemID}/taxes/{taxitemID}" } -export type UpdateAtaxItemResponse = ResponseData & { - data?: CartsItemsTaxesObject +export type DeleteATaxItemErrors = { + /** + * Unauthorized + */ + 401: ResponseError +} + +export type DeleteATaxItemError = + DeleteATaxItemErrors[keyof DeleteATaxItemErrors] + +export type DeleteATaxItemResponses = { + /** + * No Content + */ + 204: void } -export type UpdateAtaxItemError = ResponseError +export type DeleteATaxItemResponse = + DeleteATaxItemResponses[keyof DeleteATaxItemResponses] -export type DeleteAtaxItemData = { +export type UpdateATaxItemData = { + body?: ResponseData & { + data?: CartsItemsTaxesObject + } path: { /** * The unique identifier of the cart. @@ -5130,63 +6102,92 @@ export type DeleteAtaxItemData = { */ taxitemID: string } + query?: never + url: "/v2/carts/{cartID}/items/{cartitemID}/taxes/{taxitemID}" } -export type DeleteAtaxItemResponse = void +export type UpdateATaxItemErrors = { + /** + * Unauthorized + */ + 401: ResponseError +} -export type DeleteAtaxItemError = ResponseError +export type UpdateATaxItemError = + UpdateATaxItemErrors[keyof UpdateATaxItemErrors] -export type BulkAddCustomDiscountsToCartData = { - body?: CartsBulkCustomDiscounts - path: { - /** - * Specifies the system generated ID for the cart that the shopper created. - */ - cartID: string +export type UpdateATaxItemResponses = { + 200: ResponseData & { + data?: CartsItemsTaxesObject } } -export type BulkAddCustomDiscountsToCartResponse = - CartsBulkCustomDiscountsResponse - -export type BulkAddCustomDiscountsToCartError = ResponseError +export type UpdateATaxItemResponse = + UpdateATaxItemResponses[keyof UpdateATaxItemResponses] export type BulkDeleteCustomDiscountsFromCartData = { + body?: never path: { /** * Specifies the unique ID for the cart. */ cartID: string } + query?: never + url: "/v2/carts/{cartID}/custom-discounts" } -export type BulkDeleteCustomDiscountsFromCartResponse = void +export type BulkDeleteCustomDiscountsFromCartErrors = { + /** + * Unauthorized + */ + 401: ResponseError +} -export type BulkDeleteCustomDiscountsFromCartError = ResponseError +export type BulkDeleteCustomDiscountsFromCartError = + BulkDeleteCustomDiscountsFromCartErrors[keyof BulkDeleteCustomDiscountsFromCartErrors] -export type UpdateCustomDiscountForCartData = { - body?: ResponseData & { - data?: CartsCustomDiscountsObject - } +export type BulkDeleteCustomDiscountsFromCartResponses = { + /** + * No Content + */ + 204: void +} + +export type BulkDeleteCustomDiscountsFromCartResponse = + BulkDeleteCustomDiscountsFromCartResponses[keyof BulkDeleteCustomDiscountsFromCartResponses] + +export type BulkAddCustomDiscountsToCartData = { + body?: CartsBulkCustomDiscounts path: { /** - * Specifies the unique ID for the cart. + * Specifies the system generated ID for the cart that the shopper created. */ cartID: string - /** - * Specifies the ID for the custom discount to be updated. - */ - customdiscountID: string } + query?: never + url: "/v2/carts/{cartID}/custom-discounts" +} + +export type BulkAddCustomDiscountsToCartErrors = { + /** + * Unauthorized + */ + 401: ResponseError } -export type UpdateCustomDiscountForCartResponse = ResponseData & { - data?: CartsCustomDiscountsResponse +export type BulkAddCustomDiscountsToCartError = + BulkAddCustomDiscountsToCartErrors[keyof BulkAddCustomDiscountsToCartErrors] + +export type BulkAddCustomDiscountsToCartResponses = { + 200: CartsBulkCustomDiscountsResponse } -export type UpdateCustomDiscountForCartError = ResponseError +export type BulkAddCustomDiscountsToCartResponse = + BulkAddCustomDiscountsToCartResponses[keyof BulkAddCustomDiscountsToCartResponses] export type DeleteCustomDiscountFromCartData = { + body?: never path: { /** * Specifies the unique ID for the cart. @@ -5197,17 +6198,72 @@ export type DeleteCustomDiscountFromCartData = { */ customdiscountID: string } + query?: never + url: "/v2/carts/{cartID}/custom-discounts/{customdiscountID}" } -export type DeleteCustomDiscountFromCartResponse = void +export type DeleteCustomDiscountFromCartErrors = { + /** + * Unauthorized + */ + 401: ResponseError +} -export type DeleteCustomDiscountFromCartError = ResponseError +export type DeleteCustomDiscountFromCartError = + DeleteCustomDiscountFromCartErrors[keyof DeleteCustomDiscountFromCartErrors] -export type AddCustomDiscountToCartItemData = { - body?: CartsCustomDiscountsObject +export type DeleteCustomDiscountFromCartResponses = { + /** + * No Content + */ + 204: void +} + +export type DeleteCustomDiscountFromCartResponse = + DeleteCustomDiscountFromCartResponses[keyof DeleteCustomDiscountFromCartResponses] + +export type UpdateCustomDiscountForCartData = { + body?: ResponseData & { + data?: CartsCustomDiscountsObject + } path: { /** - * Specifies the ID for the cart. + * Specifies the unique ID for the cart. + */ + cartID: string + /** + * Specifies the ID for the custom discount to be updated. + */ + customdiscountID: string + } + query?: never + url: "/v2/carts/{cartID}/custom-discounts/{customdiscountID}" +} + +export type UpdateCustomDiscountForCartErrors = { + /** + * Unauthorized + */ + 401: ResponseError +} + +export type UpdateCustomDiscountForCartError = + UpdateCustomDiscountForCartErrors[keyof UpdateCustomDiscountForCartErrors] + +export type UpdateCustomDiscountForCartResponses = { + 200: ResponseData & { + data?: CartsCustomDiscountsResponse + } +} + +export type UpdateCustomDiscountForCartResponse = + UpdateCustomDiscountForCartResponses[keyof UpdateCustomDiscountForCartResponses] + +export type AddCustomDiscountToCartItemData = { + body?: CartsCustomDiscountsObject + path: { + /** + * Specifies the ID for the cart. */ cartID: string /** @@ -5215,12 +6271,12 @@ export type AddCustomDiscountToCartItemData = { */ cartitemID: string } + query?: never + url: "/v2/carts/{cartID}/items/{cartitemID}/custom-discounts" } -export type UpdateCustomDiscountForCartItemData = { - body?: ResponseData & { - data?: CartsCustomDiscountsObject - } +export type DeleteCustomDiscountFromCartItemData = { + body?: never path: { /** * Specifies the ID for the cart. @@ -5231,13 +6287,38 @@ export type UpdateCustomDiscountForCartItemData = { */ cartitemID: string /** - * Specifies the ID for the custom discount to be updated. + * Specifies the ID for the custom discount to be deleted. */ customdiscountID: string } + query?: never + url: "/v2/carts/{cartID}/items/{cartitemID}/custom-discounts/{customdiscountID}" } -export type DeleteCustomDiscountFromCartItemData = { +export type DeleteCustomDiscountFromCartItemErrors = { + /** + * Unauthorized + */ + 401: ResponseError +} + +export type DeleteCustomDiscountFromCartItemError = + DeleteCustomDiscountFromCartItemErrors[keyof DeleteCustomDiscountFromCartItemErrors] + +export type DeleteCustomDiscountFromCartItemResponses = { + /** + * No Content + */ + 204: void +} + +export type DeleteCustomDiscountFromCartItemResponse = + DeleteCustomDiscountFromCartItemResponses[keyof DeleteCustomDiscountFromCartItemResponses] + +export type UpdateCustomDiscountForCartItemData = { + body?: ResponseData & { + data?: CartsCustomDiscountsObject + } path: { /** * Specifies the ID for the cart. @@ -5248,16 +6329,14 @@ export type DeleteCustomDiscountFromCartItemData = { */ cartitemID: string /** - * Specifies the ID for the custom discount to be deleted. + * Specifies the ID for the custom discount to be updated. */ customdiscountID: string } + query?: never + url: "/v2/carts/{cartID}/items/{cartitemID}/custom-discounts/{customdiscountID}" } -export type DeleteCustomDiscountFromCartItemResponse = void - -export type DeleteCustomDiscountFromCartItemError = ResponseError - export type CreateCartPaymentIntentData = { body?: ElasticPathPaymentsPoweredByStripePayment path: { @@ -5266,11 +6345,29 @@ export type CreateCartPaymentIntentData = { */ cartID: string } + query?: never + url: "/v2/carts/{cartID}/payments" +} + +export type CreateCartPaymentIntentErrors = { + /** + * Unauthorized + */ + 401: ResponseError } -export type CreateCartPaymentIntentResponse = CartResponse +export type CreateCartPaymentIntentError = + CreateCartPaymentIntentErrors[keyof CreateCartPaymentIntentErrors] -export type CreateCartPaymentIntentError = ResponseError +export type CreateCartPaymentIntentResponses = { + /** + * Payment Intent created successfully. + */ + 201: CartResponse +} + +export type CreateCartPaymentIntentResponse = + CreateCartPaymentIntentResponses[keyof CreateCartPaymentIntentResponses] export type CheckoutApiData = { body?: CustomerCheckout | AccountCheckout @@ -5286,45 +6383,96 @@ export type CheckoutApiData = { */ cartID: string } + query?: never + url: "/v2/carts/{cartID}/checkout" +} + +export type CheckoutApiErrors = { + /** + * Unauthorized + */ + 401: ResponseError } -export type CheckoutApiResponse = ResponseData & { - data?: OrderResponse +export type CheckoutApiError = CheckoutApiErrors[keyof CheckoutApiErrors] + +export type CheckoutApiResponses = { + /** + * OK + */ + 200: ResponseData & { + data?: OrderResponse + } } -export type CheckoutApiError = ResponseError +export type CheckoutApiResponse = + CheckoutApiResponses[keyof CheckoutApiResponses] export type GetCustomerOrdersData = { + body?: never headers?: { /** * A customer token to access a specific customer's orders. */ "x-moltin-customer-token"?: string } + path?: never + query?: never + url: "/v2/orders" } -export type GetCustomerOrdersResponse = ResponseData & { - data?: Array - links?: ResponsePageLinks - meta?: ResponseMetaOrders +export type GetCustomerOrdersErrors = { + /** + * Unauthorized + */ + 401: ResponseError +} + +export type GetCustomerOrdersError = + GetCustomerOrdersErrors[keyof GetCustomerOrdersErrors] + +export type GetCustomerOrdersResponses = { + 200: ResponseData & { + data?: Array + links?: ResponsePageLinks + meta?: ResponseMetaOrders + } } -export type GetCustomerOrdersError = ResponseError +export type GetCustomerOrdersResponse = + GetCustomerOrdersResponses[keyof GetCustomerOrdersResponses] export type GetAnOrderData = { + body?: never path: { /** * The ID of the order. */ orderID: string } + query?: never + url: "/v2/orders/{orderID}" } -export type GetAnOrderResponse = ResponseData & { - data?: OrderResponse +export type GetAnOrderErrors = { + /** + * Unauthorized + */ + 401: ResponseError +} + +export type GetAnOrderError = GetAnOrderErrors[keyof GetAnOrderErrors] + +export type GetAnOrderResponses = { + /** + * OK + */ + 200: ResponseData & { + data?: OrderResponse + } } -export type GetAnOrderError = ResponseError +export type GetAnOrderResponse = GetAnOrderResponses[keyof GetAnOrderResponses] export type UpdateAnOrderData = { body?: OrdersUpdateRequest @@ -5334,38 +6482,93 @@ export type UpdateAnOrderData = { */ orderID: string } + query?: never + url: "/v2/orders/{orderID}" } -export type UpdateAnOrderResponse = ResponseData & { - data?: OrderResponse +export type UpdateAnOrderErrors = { + /** + * Unauthorized + */ + 401: ResponseError } -export type UpdateAnOrderError = ResponseError +export type UpdateAnOrderError = UpdateAnOrderErrors[keyof UpdateAnOrderErrors] + +export type UpdateAnOrderResponses = { + /** + * OK + */ + 200: ResponseData & { + data?: OrderResponse + } +} + +export type UpdateAnOrderResponse = + UpdateAnOrderResponses[keyof UpdateAnOrderResponses] export type GetOrderItemsData = { + body?: never path: { /** * The ID of the order. */ orderID: string } + query?: never + url: "/v2/orders/{orderID}/items" } -export type GetOrderItemsResponse = ResponseData & { - data?: Array +export type GetOrderItemsErrors = { + /** + * Unauthorized + */ + 401: ResponseError } -export type GetOrderItemsError = ResponseError +export type GetOrderItemsError = GetOrderItemsErrors[keyof GetOrderItemsErrors] + +export type GetOrderItemsResponses = { + 200: ResponseData & { + data?: Array + } +} + +export type GetOrderItemsResponse = + GetOrderItemsResponses[keyof GetOrderItemsResponses] export type AnonymizeOrdersData = { body?: OrdersAnonymizeRequest + path?: never + query?: never + url: "/v2/orders/anonymize" +} + +export type AnonymizeOrdersErrors = { + /** + * Unauthorized + */ + 401: ResponseError + /** + * Not Found + */ + 422: ResponseError } -export type AnonymizeOrdersResponse = ResponseData & { - data?: OrderResponse +export type AnonymizeOrdersError = + AnonymizeOrdersErrors[keyof AnonymizeOrdersErrors] + +export type AnonymizeOrdersResponses = { + /** + * OK + */ + 200: ResponseData & { + data?: OrderResponse + } } -export type AnonymizeOrdersError = ResponseError +export type AnonymizeOrdersResponse = + AnonymizeOrdersResponses[keyof AnonymizeOrdersResponses] export type AuthorizeSetupData = { body?: PaymentsRequest @@ -5375,13 +6578,31 @@ export type AuthorizeSetupData = { */ orderID: string } + query?: never + url: "/v2/orders/{orderID}/payments" +} + +export type AuthorizeSetupErrors = { + /** + * Unauthorized + */ + 401: ResponseError } -export type AuthorizeSetupResponse = ResponseData & { - data?: TransactionResponse +export type AuthorizeSetupError = + AuthorizeSetupErrors[keyof AuthorizeSetupErrors] + +export type AuthorizeSetupResponses = { + /** + * OK + */ + 200: ResponseData & { + data?: TransactionResponse + } } -export type AuthorizeSetupError = ResponseError +export type AuthorizeSetupResponse = + AuthorizeSetupResponses[keyof AuthorizeSetupResponses] export type ConfirmSetupData = { body?: OrdersTransactionsConfirmRequest @@ -5395,15 +6616,29 @@ export type ConfirmSetupData = { */ transactionID: string } + query?: never + url: "/v2/orders/{orderID}/transactions/{transactionID}/confirm" +} + +export type ConfirmSetupErrors = { + /** + * Unauthorized + */ + 401: ResponseError } -export type ConfirmSetupResponse = ResponseData & { - data?: TransactionResponse +export type ConfirmSetupError = ConfirmSetupErrors[keyof ConfirmSetupErrors] + +export type ConfirmSetupResponses = { + 200: ResponseData & { + data?: TransactionResponse + } } -export type ConfirmSetupError = ResponseError +export type ConfirmSetupResponse = + ConfirmSetupResponses[keyof ConfirmSetupResponses] -export type CaptureAtransactionData = { +export type CaptureATransactionData = { body?: OrdersTransactionsCaptureRequest path: { /** @@ -5415,15 +6650,30 @@ export type CaptureAtransactionData = { */ transactionID: string } + query?: never + url: "/v2/orders/{orderID}/transactions/{transactionID}/capture" +} + +export type CaptureATransactionErrors = { + /** + * Unauthorized + */ + 401: ResponseError } -export type CaptureAtransactionResponse = ResponseData & { - data?: TransactionResponse +export type CaptureATransactionError = + CaptureATransactionErrors[keyof CaptureATransactionErrors] + +export type CaptureATransactionResponses = { + 200: ResponseData & { + data?: TransactionResponse + } } -export type CaptureAtransactionError = ResponseError +export type CaptureATransactionResponse = + CaptureATransactionResponses[keyof CaptureATransactionResponses] -export type RefundAtransactionData = { +export type RefundATransactionData = { body?: OrdersTransactionsRefundRequest path: { /** @@ -5435,30 +6685,62 @@ export type RefundAtransactionData = { */ transactionID: string } + query?: never + url: "/v2/orders/{orderID}/transactions/{transactionID}/refund" +} + +export type RefundATransactionErrors = { + /** + * Unauthorized + */ + 401: ResponseError } -export type RefundAtransactionResponse = ResponseData & { - data?: TransactionResponse +export type RefundATransactionError = + RefundATransactionErrors[keyof RefundATransactionErrors] + +export type RefundATransactionResponses = { + 200: ResponseData & { + data?: TransactionResponse + } } -export type RefundAtransactionError = ResponseError +export type RefundATransactionResponse = + RefundATransactionResponses[keyof RefundATransactionResponses] export type GetOrderTransactionsData = { + body?: never path: { /** * The unique identifier of the order. */ orderID: string } + query?: never + url: "/v2/orders/{orderID}/transactions" +} + +export type GetOrderTransactionsErrors = { + /** + * Unauthorized + */ + 401: ResponseError } -export type GetOrderTransactionsResponse = ResponseData & { - data?: Array +export type GetOrderTransactionsError = + GetOrderTransactionsErrors[keyof GetOrderTransactionsErrors] + +export type GetOrderTransactionsResponses = { + 200: ResponseData & { + data?: Array + } } -export type GetOrderTransactionsError = ResponseError +export type GetOrderTransactionsResponse = + GetOrderTransactionsResponses[keyof GetOrderTransactionsResponses] -export type GetAtransactionData = { +export type GetATransactionData = { + body?: never path: { /** * The unique identifier of the order that you require transactions for. @@ -5469,15 +6751,30 @@ export type GetAtransactionData = { */ transactionID: string } + query?: never + url: "/v2/orders/{orderID}/transactions/{transactionID}" +} + +export type GetATransactionErrors = { + /** + * Unauthorized + */ + 401: ResponseError } -export type GetAtransactionResponse = ResponseData & { - data?: TransactionResponse +export type GetATransactionError = + GetATransactionErrors[keyof GetATransactionErrors] + +export type GetATransactionResponses = { + 200: ResponseData & { + data?: TransactionResponse + } } -export type GetAtransactionError = ResponseError +export type GetATransactionResponse = + GetATransactionResponses[keyof GetATransactionResponses] -export type CancelAtransactionData = { +export type CancelATransactionData = { body?: OrdersTransactionsCancelRequest path: { /** @@ -5489,731 +6786,25 @@ export type CancelAtransactionData = { */ transactionID: string } + query?: never + url: "/v2/orders/{orderID}/transactions/{transactionID}/cancel" } -export type CancelAtransactionResponse = ResponseData & { - data?: TransactionResponse -} - -export type CancelAtransactionError = ResponseError - -export type GetByContextReleaseResponseTransformer = ( - data: any, -) => Promise - -export type ReleaseDataModelResponseTransformer = (data: any) => ReleaseData - -export type ReleaseModelResponseTransformer = (data: any) => Release - -export type ReleaseMetaModelResponseTransformer = (data: any) => ReleaseMeta - -export const ReleaseMetaModelResponseTransformer: ReleaseMetaModelResponseTransformer = - (data) => { - if (data?.created_at) { - data.created_at = new Date(data.created_at) - } - if (data?.started_at) { - data.started_at = new Date(data.started_at) - } - if (data?.updated_at) { - data.updated_at = new Date(data.updated_at) - } - return data - } - -export const ReleaseModelResponseTransformer: ReleaseModelResponseTransformer = - (data) => { - if (data?.attributes?.published_at) { - data.attributes.published_at = new Date(data.attributes.published_at) - } - if (data?.meta) { - ReleaseMetaModelResponseTransformer(data.meta) - } - return data - } - -export const ReleaseDataModelResponseTransformer: ReleaseDataModelResponseTransformer = - (data) => { - if (data?.data) { - ReleaseModelResponseTransformer(data.data) - } - return data - } - -export const GetByContextReleaseResponseTransformer: GetByContextReleaseResponseTransformer = - async (data) => { - ReleaseDataModelResponseTransformer(data) - return data - } - -export type GetByContextAllHierarchiesResponseTransformer = ( - data: any, -) => Promise - -export type HierarchyListDataModelResponseTransformer = ( - data: any, -) => HierarchyListData - -export type HierarchyModelResponseTransformer = (data: any) => Hierarchy - -export type HierarchyAttributesModelResponseTransformer = ( - data: any, -) => HierarchyAttributes - -export const HierarchyAttributesModelResponseTransformer: HierarchyAttributesModelResponseTransformer = - (data) => { - if (data?.created_at) { - data.created_at = new Date(data.created_at) - } - if (data?.published_at) { - data.published_at = new Date(data.published_at) - } - if (data?.updated_at) { - data.updated_at = new Date(data.updated_at) - } - return data - } - -export const HierarchyModelResponseTransformer: HierarchyModelResponseTransformer = - (data) => { - if (data?.attributes) { - HierarchyAttributesModelResponseTransformer(data.attributes) - } - return data - } - -export const HierarchyListDataModelResponseTransformer: HierarchyListDataModelResponseTransformer = - (data) => { - if (Array.isArray(data?.data)) { - data.data.forEach(HierarchyModelResponseTransformer) - } - return data - } - -export const GetByContextAllHierarchiesResponseTransformer: GetByContextAllHierarchiesResponseTransformer = - async (data) => { - HierarchyListDataModelResponseTransformer(data) - return data - } - -export type GetByContextHierarchyResponseTransformer = ( - data: any, -) => Promise - -export type HierarchyDataModelResponseTransformer = (data: any) => HierarchyData - -export const HierarchyDataModelResponseTransformer: HierarchyDataModelResponseTransformer = - (data) => { - if (data?.data) { - HierarchyModelResponseTransformer(data.data) - } - return data - } - -export const GetByContextHierarchyResponseTransformer: GetByContextHierarchyResponseTransformer = - async (data) => { - HierarchyDataModelResponseTransformer(data) - return data - } - -export type GetByContextHierarchyNodesResponseTransformer = ( - data: any, -) => Promise - -export type NodeListDataModelResponseTransformer = (data: any) => NodeListData - -export type NodeModelResponseTransformer = (data: any) => Node - -export type NodeAttributesModelResponseTransformer = ( - data: any, -) => NodeAttributes - -export const NodeAttributesModelResponseTransformer: NodeAttributesModelResponseTransformer = - (data) => { - if (data?.created_at) { - data.created_at = new Date(data.created_at) - } - if (data?.published_at) { - data.published_at = new Date(data.published_at) - } - if (data?.updated_at) { - data.updated_at = new Date(data.updated_at) - } - return data - } - -export const NodeModelResponseTransformer: NodeModelResponseTransformer = ( - data, -) => { - if (data?.attributes) { - NodeAttributesModelResponseTransformer(data.attributes) - } - return data -} - -export const NodeListDataModelResponseTransformer: NodeListDataModelResponseTransformer = - (data) => { - if (Array.isArray(data?.data)) { - data.data.forEach(NodeModelResponseTransformer) - } - return data - } - -export const GetByContextHierarchyNodesResponseTransformer: GetByContextHierarchyNodesResponseTransformer = - async (data) => { - NodeListDataModelResponseTransformer(data) - return data - } - -export type GetByContextHierarchyChildNodesResponseTransformer = ( - data: any, -) => Promise - -export const GetByContextHierarchyChildNodesResponseTransformer: GetByContextHierarchyChildNodesResponseTransformer = - async (data) => { - NodeListDataModelResponseTransformer(data) - return data - } - -export type GetByContextAllNodesResponseTransformer = ( - data: any, -) => Promise - -export const GetByContextAllNodesResponseTransformer: GetByContextAllNodesResponseTransformer = - async (data) => { - NodeListDataModelResponseTransformer(data) - return data - } - -export type GetByContextNodeResponseTransformer = ( - data: any, -) => Promise - -export type NodeDataModelResponseTransformer = (data: any) => NodeData - -export const NodeDataModelResponseTransformer: NodeDataModelResponseTransformer = - (data) => { - if (data?.data) { - NodeModelResponseTransformer(data.data) - } - return data - } - -export const GetByContextNodeResponseTransformer: GetByContextNodeResponseTransformer = - async (data) => { - NodeDataModelResponseTransformer(data) - return data - } - -export type GetByContextChildNodesResponseTransformer = ( - data: any, -) => Promise - -export const GetByContextChildNodesResponseTransformer: GetByContextChildNodesResponseTransformer = - async (data) => { - NodeListDataModelResponseTransformer(data) - return data - } - -export type GetByContextAllProductsResponseTransformer = ( - data: any, -) => Promise - -export type ProductListDataModelResponseTransformer = ( - data: any, -) => ProductListData - -export type ProductModelResponseTransformer = (data: any) => Product - -export type ProductAttributesModelResponseTransformer = ( - data: any, -) => ProductAttributes - -export const ProductAttributesModelResponseTransformer: ProductAttributesModelResponseTransformer = - (data) => { - if (data?.published_at) { - data.published_at = new Date(data.published_at) - } - if (data?.created_at) { - data.created_at = new Date(data.created_at) - } - if (data?.updated_at) { - data.updated_at = new Date(data.updated_at) - } - return data - } - -export type ProductRelationshipsModelResponseTransformer = ( - data: any, -) => ProductRelationships - -export type FilesRelationshipModelResponseTransformer = ( - data: any, -) => FilesRelationship - -export type FileReferenceModelResponseTransformer = (data: any) => FileReference - -export const FileReferenceModelResponseTransformer: FileReferenceModelResponseTransformer = - (data) => { - if (data?.created_at) { - data.created_at = new Date(data.created_at) - } - return data - } - -export const FilesRelationshipModelResponseTransformer: FilesRelationshipModelResponseTransformer = - (data) => { - if (Array.isArray(data?.data)) { - data.data.forEach(FileReferenceModelResponseTransformer) - } - return data - } - -export const ProductRelationshipsModelResponseTransformer: ProductRelationshipsModelResponseTransformer = - (data) => { - if (data?.files) { - FilesRelationshipModelResponseTransformer(data.files) - } - return data - } - -export type ProductMetaModelResponseTransformer = (data: any) => ProductMeta - -export const ProductMetaModelResponseTransformer: ProductMetaModelResponseTransformer = - (data) => { - if (data?.sale_expires) { - data.sale_expires = new Date(data.sale_expires) - } - return data - } - -export const ProductModelResponseTransformer: ProductModelResponseTransformer = - (data) => { - if (data?.attributes) { - ProductAttributesModelResponseTransformer(data.attributes) - } - if (data?.relationships) { - ProductRelationshipsModelResponseTransformer(data.relationships) - } - if (data?.meta) { - ProductMetaModelResponseTransformer(data.meta) - } - return data - } - -export type IncludedModelResponseTransformer = (data: any) => Included - -export const IncludedModelResponseTransformer: IncludedModelResponseTransformer = - (data) => { - if (Array.isArray(data?.component_products)) { - data.component_products.forEach(ProductModelResponseTransformer) - } - return data - } - -export const ProductListDataModelResponseTransformer: ProductListDataModelResponseTransformer = - (data) => { - if (Array.isArray(data?.data)) { - data.data.forEach(ProductModelResponseTransformer) - } - if (data?.included) { - IncludedModelResponseTransformer(data.included) - } - return data - } - -export const GetByContextAllProductsResponseTransformer: GetByContextAllProductsResponseTransformer = - async (data) => { - ProductListDataModelResponseTransformer(data) - return data - } - -export type GetByContextProductResponseTransformer = ( - data: any, -) => Promise - -export type ProductDataModelResponseTransformer = (data: any) => ProductData - -export const ProductDataModelResponseTransformer: ProductDataModelResponseTransformer = - (data) => { - if (data?.data) { - ProductModelResponseTransformer(data.data) - } - if (data?.included) { - IncludedModelResponseTransformer(data.included) - } - return data - } - -export const GetByContextProductResponseTransformer: GetByContextProductResponseTransformer = - async (data) => { - ProductDataModelResponseTransformer(data) - return data - } - -export type GetByContextChildProductsResponseTransformer = ( - data: any, -) => Promise - -export const GetByContextChildProductsResponseTransformer: GetByContextChildProductsResponseTransformer = - async (data) => { - ProductListDataModelResponseTransformer(data) - return data - } - -export type GetByContextProductsForHierarchyResponseTransformer = ( - data: any, -) => Promise - -export const GetByContextProductsForHierarchyResponseTransformer: GetByContextProductsForHierarchyResponseTransformer = - async (data) => { - ProductListDataModelResponseTransformer(data) - return data - } - -export type GetByContextProductsForNodeResponseTransformer = ( - data: any, -) => Promise - -export const GetByContextProductsForNodeResponseTransformer: GetByContextProductsForNodeResponseTransformer = - async (data) => { - ProductListDataModelResponseTransformer(data) - return data - } - -export type ConfigureByContextProductResponseTransformer = ( - data: any, -) => Promise - -export const ConfigureByContextProductResponseTransformer: ConfigureByContextProductResponseTransformer = - async (data) => { - ProductDataModelResponseTransformer(data) - return data - } - -export type CreateCatalogResponseTransformer = ( - data: any, -) => Promise - -export type CatalogDataModelResponseTransformer = (data: any) => CatalogData - -export type CatalogModelResponseTransformer = (data: any) => Catalog - -export const CatalogModelResponseTransformer: CatalogModelResponseTransformer = - (data) => { - if (data?.attributes?.created_at) { - data.attributes.created_at = new Date(data.attributes.created_at) - } - if (data?.attributes?.updated_at) { - data.attributes.updated_at = new Date(data.attributes.updated_at) - } - return data - } - -export const CatalogDataModelResponseTransformer: CatalogDataModelResponseTransformer = - (data) => { - if (data?.data) { - CatalogModelResponseTransformer(data.data) - } - return data - } - -export const CreateCatalogResponseTransformer: CreateCatalogResponseTransformer = - async (data) => { - CatalogDataModelResponseTransformer(data) - return data - } - -export type GetCatalogsResponseTransformer = ( - data: any, -) => Promise - -export type CatalogListDataModelResponseTransformer = ( - data: any, -) => CatalogListData - -export const CatalogListDataModelResponseTransformer: CatalogListDataModelResponseTransformer = - (data) => { - if (Array.isArray(data?.data)) { - data.data.forEach(CatalogModelResponseTransformer) - } - return data - } - -export const GetCatalogsResponseTransformer: GetCatalogsResponseTransformer = - async (data) => { - CatalogListDataModelResponseTransformer(data) - return data - } - -export type GetCatalogByIdResponseTransformer = ( - data: any, -) => Promise - -export const GetCatalogByIdResponseTransformer: GetCatalogByIdResponseTransformer = - async (data) => { - CatalogDataModelResponseTransformer(data) - return data - } - -export type UpdateCatalogResponseTransformer = ( - data: any, -) => Promise - -export const UpdateCatalogResponseTransformer: UpdateCatalogResponseTransformer = - async (data) => { - CatalogDataModelResponseTransformer(data) - return data - } - -export type PublishReleaseResponseTransformer = ( - data: any, -) => Promise - -export const PublishReleaseResponseTransformer: PublishReleaseResponseTransformer = - async (data) => { - ReleaseDataModelResponseTransformer(data) - return data - } - -export type GetReleasesResponseTransformer = ( - data: any, -) => Promise - -export type ReleaseListDataModelResponseTransformer = ( - data: any, -) => ReleaseListData - -export const ReleaseListDataModelResponseTransformer: ReleaseListDataModelResponseTransformer = - (data) => { - if (Array.isArray(data?.data)) { - data.data.forEach(ReleaseModelResponseTransformer) - } - return data - } - -export const GetReleasesResponseTransformer: GetReleasesResponseTransformer = - async (data) => { - ReleaseListDataModelResponseTransformer(data) - return data - } - -export type GetReleaseByIdResponseTransformer = ( - data: any, -) => Promise - -export const GetReleaseByIdResponseTransformer: GetReleaseByIdResponseTransformer = - async (data) => { - ReleaseDataModelResponseTransformer(data) - return data - } - -export type CreateRuleResponseTransformer = ( - data: any, -) => Promise - -export type RuleDataModelResponseTransformer = (data: any) => RuleData - -export type RuleModelResponseTransformer = (data: any) => Rule - -export type RuleScheduleModelResponseTransformer = (data: any) => RuleSchedule - -export const RuleScheduleModelResponseTransformer: RuleScheduleModelResponseTransformer = - (data) => { - if (data?.valid_from) { - data.valid_from = new Date(data.valid_from) - } - if (data?.valid_to) { - data.valid_to = new Date(data.valid_to) - } - return data - } - -export const RuleModelResponseTransformer: RuleModelResponseTransformer = ( - data, -) => { - if (Array.isArray(data?.attributes?.schedules)) { - data.attributes.schedules.forEach(RuleScheduleModelResponseTransformer) - } - if (data?.attributes?.created_at) { - data.attributes.created_at = new Date(data.attributes.created_at) - } - if (data?.attributes?.updated_at) { - data.attributes.updated_at = new Date(data.attributes.updated_at) - } - return data -} - -export const RuleDataModelResponseTransformer: RuleDataModelResponseTransformer = - (data) => { - if (data?.data) { - RuleModelResponseTransformer(data.data) - } - return data - } - -export const CreateRuleResponseTransformer: CreateRuleResponseTransformer = - async (data) => { - RuleDataModelResponseTransformer(data) - return data - } - -export type GetRulesResponseTransformer = ( - data: any, -) => Promise - -export type RuleListDataModelResponseTransformer = (data: any) => RuleListData - -export const RuleListDataModelResponseTransformer: RuleListDataModelResponseTransformer = - (data) => { - if (Array.isArray(data?.data)) { - data.data.forEach(RuleModelResponseTransformer) - } - return data - } - -export const GetRulesResponseTransformer: GetRulesResponseTransformer = async ( - data, -) => { - RuleListDataModelResponseTransformer(data) - return data +export type CancelATransactionErrors = { + /** + * Unauthorized + */ + 401: ResponseError } -export type GetRuleByIdResponseTransformer = ( - data: any, -) => Promise - -export const GetRuleByIdResponseTransformer: GetRuleByIdResponseTransformer = - async (data) => { - RuleDataModelResponseTransformer(data) - return data - } - -export type UpdateRuleResponseTransformer = ( - data: any, -) => Promise - -export const UpdateRuleResponseTransformer: UpdateRuleResponseTransformer = - async (data) => { - RuleDataModelResponseTransformer(data) - return data - } - -export type GetAllHierarchiesResponseTransformer = ( - data: any, -) => Promise - -export const GetAllHierarchiesResponseTransformer: GetAllHierarchiesResponseTransformer = - async (data) => { - HierarchyListDataModelResponseTransformer(data) - return data - } - -export type GetHierarchyResponseTransformer = ( - data: any, -) => Promise - -export const GetHierarchyResponseTransformer: GetHierarchyResponseTransformer = - async (data) => { - HierarchyDataModelResponseTransformer(data) - return data - } - -export type GetHierarchyNodesResponseTransformer = ( - data: any, -) => Promise +export type CancelATransactionError = + CancelATransactionErrors[keyof CancelATransactionErrors] -export const GetHierarchyNodesResponseTransformer: GetHierarchyNodesResponseTransformer = - async (data) => { - NodeListDataModelResponseTransformer(data) - return data +export type CancelATransactionResponses = { + 200: ResponseData & { + data?: TransactionResponse } - -export type GetHierarchyChildNodesResponseTransformer = ( - data: any, -) => Promise - -export const GetHierarchyChildNodesResponseTransformer: GetHierarchyChildNodesResponseTransformer = - async (data) => { - NodeListDataModelResponseTransformer(data) - return data - } - -export type GetAllNodesResponseTransformer = ( - data: any, -) => Promise - -export const GetAllNodesResponseTransformer: GetAllNodesResponseTransformer = - async (data) => { - NodeListDataModelResponseTransformer(data) - return data - } - -export type GetNodeResponseTransformer = (data: any) => Promise - -export const GetNodeResponseTransformer: GetNodeResponseTransformer = async ( - data, -) => { - NodeDataModelResponseTransformer(data) - return data } -export type GetChildNodesResponseTransformer = ( - data: any, -) => Promise - -export const GetChildNodesResponseTransformer: GetChildNodesResponseTransformer = - async (data) => { - NodeListDataModelResponseTransformer(data) - return data - } - -export type GetAllProductsResponseTransformer = ( - data: any, -) => Promise - -export const GetAllProductsResponseTransformer: GetAllProductsResponseTransformer = - async (data) => { - ProductListDataModelResponseTransformer(data) - return data - } - -export type GetProductResponseTransformer = ( - data: any, -) => Promise - -export const GetProductResponseTransformer: GetProductResponseTransformer = - async (data) => { - ProductDataModelResponseTransformer(data) - return data - } - -export type GetChildProductsResponseTransformer = ( - data: any, -) => Promise - -export const GetChildProductsResponseTransformer: GetChildProductsResponseTransformer = - async (data) => { - ProductListDataModelResponseTransformer(data) - return data - } - -export type GetProductsForHierarchyResponseTransformer = ( - data: any, -) => Promise - -export const GetProductsForHierarchyResponseTransformer: GetProductsForHierarchyResponseTransformer = - async (data) => { - ProductListDataModelResponseTransformer(data) - return data - } - -export type GetProductsForNodeResponseTransformer = ( - data: any, -) => Promise - -export const GetProductsForNodeResponseTransformer: GetProductsForNodeResponseTransformer = - async (data) => { - ProductListDataModelResponseTransformer(data) - return data - } +export type CancelATransactionResponse = + CancelATransactionResponses[keyof CancelATransactionResponses] diff --git a/packages/sdks/shopper/src/index.ts b/packages/sdks/shopper/src/index.ts index 7d27f04a..fdfe747b 100644 --- a/packages/sdks/shopper/src/index.ts +++ b/packages/sdks/shopper/src/index.ts @@ -1,5 +1,5 @@ export * from "./client" import { Client, createClient } from "@hey-api/client-fetch" export { createClient, Client } -export { client } from "./client/services.gen" +export { client } from "./client/sdk.gen" export { extractProductImage } from "./utils" diff --git a/packages/sdks/specs/config/redocly.yaml b/packages/sdks/specs/config/redocly.yaml index 236b4c75..474d07f8 100644 --- a/packages/sdks/specs/config/redocly.yaml +++ b/packages/sdks/specs/config/redocly.yaml @@ -4,11 +4,13 @@ extends: apis: cart-checkout@v1: root: ../cart_checkout.yaml + output: ../bundled/cart_checkout.yaml decorators: override/operation-property-override: operationIds: getACart: /Users/robert.field/Documents/Projects/EP/muse/composable-frontend/packages/sdks/specs/overrides/getACart.yaml catalog_view@v1: + output: ../bundled/catalog_view.yaml root: ../catalog_view.yaml decorators: override/component-merge: From 68cd4eb14d37645bf56d5e19eac7925594949b75 Mon Sep 17 00:00:00 2001 From: Robert Field Date: Thu, 9 Jan 2025 17:31:10 +0000 Subject: [PATCH 25/30] feat: updated hey-api for next --- packages/sdks/nextjs/package.json | 2 +- pnpm-lock.yaml | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/sdks/nextjs/package.json b/packages/sdks/nextjs/package.json index 5ed4a3d0..91da979e 100644 --- a/packages/sdks/nextjs/package.json +++ b/packages/sdks/nextjs/package.json @@ -29,6 +29,6 @@ "next": "^14.0.0" }, "dependencies": { - "@hey-api/client-fetch": "^0.2.4" + "@hey-api/client-fetch": "^0.6.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 51e5cd88..3f2d971a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1472,8 +1472,8 @@ importers: packages/sdks/nextjs: dependencies: '@hey-api/client-fetch': - specifier: ^0.2.4 - version: 0.2.4 + specifier: ^0.6.0 + version: 0.6.0 devDependencies: next: specifier: ^14.0.0 @@ -6839,10 +6839,6 @@ packages: react: 18.3.1 dev: false - /@hey-api/client-fetch@0.2.4: - resolution: {integrity: sha512-SGTVAVw3PlKDLw+IyhNhb/jCH3P1P2xJzLxA8Kyz1g95HrkYOJdRpl9F5I7LLwo9aCIB7nwR2NrSeX7QaQD7vQ==} - dev: false - /@hey-api/client-fetch@0.6.0: resolution: {integrity: sha512-FlhFsVeH8RxJe/nq8xUzxNbiOpe+GadxlD2pfvDyOyLdCTU4o/LRv46ZVWstaW7DgF4nxhI328chy3+AulwVXw==} dev: false From a4a31a3d53f2523dee204dd8217a278a163851cd Mon Sep 17 00:00:00 2001 From: Robert Field Date: Thu, 9 Jan 2025 18:11:34 +0000 Subject: [PATCH 26/30] feat: export tanstack options --- packages/sdks/shopper/src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/sdks/shopper/src/index.ts b/packages/sdks/shopper/src/index.ts index fdfe747b..f69ea039 100644 --- a/packages/sdks/shopper/src/index.ts +++ b/packages/sdks/shopper/src/index.ts @@ -1,4 +1,5 @@ export * from "./client" +export * from "./client/@tanstack/react-query.gen" import { Client, createClient } from "@hey-api/client-fetch" export { createClient, Client } export { client } from "./client/sdk.gen" From 48a4976eafdef4685646d86197ab9f9eac666623 Mon Sep 17 00:00:00 2001 From: Robert Field Date: Thu, 9 Jan 2025 18:12:13 +0000 Subject: [PATCH 27/30] feat: wip creating contextually aware hooks with new tanstack options --- .../src/cart/hooks/use-cart-add-product.tsx | 20 +++++++++++++------ .../src/cart/hooks/use-cart.tsx | 9 ++------- .../src/elasticpath/elasticpath.tsx | 15 +++++--------- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/packages/react-shopper-hooks/src/cart/hooks/use-cart-add-product.tsx b/packages/react-shopper-hooks/src/cart/hooks/use-cart-add-product.tsx index d4559e49..33bd6f58 100644 --- a/packages/react-shopper-hooks/src/cart/hooks/use-cart-add-product.tsx +++ b/packages/react-shopper-hooks/src/cart/hooks/use-cart-add-product.tsx @@ -1,9 +1,8 @@ "use client" -import { useAddProductToCart } from "./use-add-product" +import { getCartQueryKey, manageCartsMutation } from "@epcc-sdk/sdks-shopper" import { createCartItemsUpdater, useCart } from "./use-cart" -import { useQueryClient } from "@tanstack/react-query" -import { cartQueryKeys } from "./use-get-cart" +import { useMutation, useQueryClient } from "@tanstack/react-query" import { useEventInternal } from "../../event/use-event-internal" export function useCartAddProduct() { @@ -13,11 +12,20 @@ export function useCartAddProduct() { const cartId = data?.cartId! - return useAddProductToCart(cartId, { + return useMutation({ + ...manageCartsMutation({ + path: { + cartID: cartId, + }, + }), onSuccess: (updatedData, req) => { // Updates the cart items in the query cache + if (!updatedData.data) return + + const queryKey = getCartQueryKey({ path: { cartID: cartId } }) + queryClient.setQueryData( - cartQueryKeys.detail(cartId), + queryKey, createCartItemsUpdater(updatedData.data), ) @@ -29,7 +37,7 @@ export function useCartAddProduct() { }) return queryClient.invalidateQueries({ - queryKey: cartQueryKeys.detail(cartId), + queryKey, }) }, }) diff --git a/packages/react-shopper-hooks/src/cart/hooks/use-cart.tsx b/packages/react-shopper-hooks/src/cart/hooks/use-cart.tsx index 7d8af5ac..0fa7b935 100644 --- a/packages/react-shopper-hooks/src/cart/hooks/use-cart.tsx +++ b/packages/react-shopper-hooks/src/cart/hooks/use-cart.tsx @@ -1,12 +1,6 @@ "use client" import React from "react" -import { - Cart, - CartIncluded, - ResourceIncluded, - CartItem, -} from "@elasticpath/js-sdk" import { CartState } from "../types/cart-types" import { enhanceCartResponse } from "../util/enhance-cart-response" import { StoreEvent } from "../../shared" @@ -15,6 +9,7 @@ import { useElasticPath } from "../../elasticpath" import { UseQueryOptionsWrapper } from "../../types" import { UseQueryResult } from "@tanstack/react-query/build/modern/index" import { useQuery } from "@tanstack/react-query" +import { CartItemObject } from "@epcc-sdk/sdks-shopper" export type UseCartData = { state: CartState @@ -22,7 +17,7 @@ export type UseCartData = { emit?: (event: StoreEvent) => void } -export function createCartItemsUpdater(updatedData: CartItem[]) { +export function createCartItemsUpdater(updatedData: CartItemObject[]) { return function cartItemsUpdater( oldData: ResourceIncluded, ) { diff --git a/packages/react-shopper-hooks/src/elasticpath/elasticpath.tsx b/packages/react-shopper-hooks/src/elasticpath/elasticpath.tsx index a683c392..2535df69 100644 --- a/packages/react-shopper-hooks/src/elasticpath/elasticpath.tsx +++ b/packages/react-shopper-hooks/src/elasticpath/elasticpath.tsx @@ -1,6 +1,7 @@ "use client" -import { gateway, ElasticPath as ElasticPath } from "@elasticpath/js-sdk" +// import { gateway, ElasticPath as ElasticPath } from "@elasticpath/js-sdk" +import { client as defaultClient, Client } from "@epcc-sdk/sdks-shopper" import { QueryClientProvider, QueryClientProviderProps, @@ -9,7 +10,7 @@ import React, { ReactElement } from "react" import { _eventBus$, EventContext } from "../event/event-context" interface ElasticPathContextState { - client: ElasticPath + client: Client } const ElasticPathContext = React.createContext( @@ -36,7 +37,7 @@ export type ElasticPathProviderPropsWithClient = } export type ElasticPathProviderPropsCustom = ElasticPathProviderPropsBase & { - client: ElasticPath + client: Client } export type ElasticPathProviderProps = @@ -46,13 +47,7 @@ export type ElasticPathProviderProps = export function ElasticPathProvider( props: ElasticPathProviderProps, ): ReactElement { - const client: ElasticPath = - "client" in props - ? props.client - : gateway({ - client_id: props.clientId, - host: props.host, - }) + const client: Client = "client" in props ? props.client : defaultClient return ( From cf80da889a3912d44a4180bc2a1a04f3b401926b Mon Sep 17 00:00:00 2001 From: Robert Field Date: Fri, 10 Jan 2025 15:59:04 +0000 Subject: [PATCH 28/30] feat: using PascalCase for types correctly --- packages/sdks/pim/openapi-ts.config.ts | 19 +- packages/sdks/pim/src/client/types.gen.ts | 1335 ++++++++++++++------- 2 files changed, 909 insertions(+), 445 deletions(-) diff --git a/packages/sdks/pim/openapi-ts.config.ts b/packages/sdks/pim/openapi-ts.config.ts index 7b5affbe..e53954e7 100644 --- a/packages/sdks/pim/openapi-ts.config.ts +++ b/packages/sdks/pim/openapi-ts.config.ts @@ -1,12 +1,19 @@ -import { defineConfig } from "@hey-api/openapi-ts" +import { defaultPlugins, defineConfig } from "@hey-api/openapi-ts" export default defineConfig({ client: "@hey-api/client-fetch", input: "../specs/pim.yaml", output: { path: "src/client", format: "prettier" }, - types: { - name: "PascalCase", - enums: false, - dates: "types+transform", - }, + plugins: [ + ...defaultPlugins, + { + style: "PascalCase", + exportInlineEnums: false, + name: "@hey-api/typescript", + }, + { + dates: true, + name: "@hey-api/transformers", + }, + ], }) diff --git a/packages/sdks/pim/src/client/types.gen.ts b/packages/sdks/pim/src/client/types.gen.ts index 2ce3514e..eeb943d8 100644 --- a/packages/sdks/pim/src/client/types.gen.ts +++ b/packages/sdks/pim/src/client/types.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -export type attributes = { +export type Attributes = { /** * The name of the node, such as `Ranges` or `Refrigerators`. Names must be unique among sibling nodes in the hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies. */ @@ -34,7 +34,7 @@ export type attributes = { }; }; -export type attributes_custom_relationship = { +export type AttributesCustomRelationship = { /** * The name of the custom relationship, such as `Kitchen electrics`. */ @@ -49,7 +49,7 @@ export type attributes_custom_relationship = { slug?: string; }; -export type attributes_hierarchy = { +export type AttributesHierarchy = { /** * The name of a hierarchy, such as `Major Appliances`. */ @@ -79,7 +79,7 @@ export type attributes_hierarchy = { }; }; -export type attributes_nodes = { +export type AttributesNodes = { /** * The name of the node, such as `Ranges` or `Refrigerators`. Names must be unique among sibling nodes in the hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies. */ @@ -113,7 +113,7 @@ export type attributes_nodes = { }; }; -export type component_products_response = { +export type ComponentProductsResponse = { data?: Array<{ /** * The unique identifier of a product component generated when a product is created. @@ -126,13 +126,13 @@ export type component_products_response = { }>; }; -export type create_custom_relationship = { +export type CreateCustomRelationship = { data?: { /** * This represents the type of resource object being returned. Always `custom-relationship`. */ type: 'custom-relationship'; - attributes: req_attributes_custom_relationship; + attributes: ReqAttributesCustomRelationship; }; }; @@ -141,31 +141,17 @@ export type create_custom_relationship = { */ export type type = 'custom-relationship'; -export type create_hierarchy = { +export type CreatedModifier = { data?: { /** - * This represents the type of resource object being returned. Always `hierarchy`. + * A unique identifier for a modifier that is generated automatically when a modifier is created. */ - type: 'hierarchy'; - attributes: req_attributes_hierarchy; - }; -}; - -/** - * This represents the type of resource object being returned. Always `hierarchy`. - */ -export type type2 = 'hierarchy'; - -/** - * Use modifiers to change the properties of child products that are inherited from a parent product. With modifiers, you only need to have one parent product with a variation attached to the product. - */ -export type create_modifier = { - data: { + id?: string; /** - * This represents the type of resource object being returned. Always `product-variation-modifier`. + * This represents the type of resource object being returned. Always `product-variation-modifier'. */ - type: 'product-variation-modifier'; - attributes: { + type?: 'product-variation-modifier'; + attributes?: { /** * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. * @@ -192,7 +178,7 @@ export type create_modifier = { * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | * */ - type: 'commodity_type' | 'status' | 'price' | 'name_append' | 'name_prepend' | 'name_equals' | 'sku_append' | 'sku_prepend' | 'sku_equals' | 'sku_builder' | 'slug_append' | 'slug_prepend' | 'slug_equals' | 'slug_builder' | 'description_append' | 'description_prepend' | 'description_equals' | 'custom_inputs_equals' | 'build_rules_equals' | 'locales_equals' | 'upc_ean_equals' | 'mpn_equals' | 'external_ref_equals'; + type?: 'commodity_type' | 'status' | 'price' | 'name_append' | 'name_prepend' | 'name_equals' | 'sku_append' | 'sku_prepend' | 'sku_equals' | 'sku_builder' | 'slug_append' | 'slug_prepend' | 'slug_equals' | 'slug_builder' | 'description_append' | 'description_prepend' | 'description_equals' | 'custom_inputs_equals' | 'build_rules_equals' | 'locales_equals' | 'upc_ean_equals' | 'mpn_equals' | 'external_ref_equals'; /** * Required for non-builder modifiers. The value of the modifier type. */ @@ -206,71 +192,66 @@ export type create_modifier = { */ set?: string; /** - * A name for the modifier. + * The name of the modifier. */ reference_name?: string; }; - }; -}; - -/** - * This represents the type of resource object being returned. Always `product-variation-modifier`. - */ -export type type3 = 'product-variation-modifier'; - -export type create_node = { - data?: { - /** - * This represents the type of resource object being returned. Always `node`. - */ - type: 'node'; - attributes: attributes_nodes; meta?: { /** - * You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. The `sort_order` for each node. This value determines the order of nodes in the response for the `Get a Node’s Children` request. The node with the highest value of sort_order is displayed first. For example, a node with a sort_order value of 3 appears before a node with a sort_order value of 2. - * - * - If you don’t provide `sort_order` when creating nodes, all child nodes in the response for `Get a Node’s Children` request are ordered by the `updated_at` time in descending order, with the most recently updated child node first. - * - If you set `sort_order` for only a few child nodes or not all, the child nodes with a `sort_order` value appear first and then other child nodes appear in the order of `updated_at` time. See [Sorting Nodes in a hierarchy](). - * + * The owner of the resource, either `organization` or `store`. */ - sort_order?: number; + owner?: 'organization' | 'store'; }; }; }; /** - * This represents the type of resource object being returned. Always `node`. + * This represents the type of resource object being returned. Always `product-variation-modifier'. */ -export type type4 = 'node'; +export type type2 = 'product-variation-modifier'; -export type create_option = { +/** + * The owner of the resource, either `organization` or `store`. + */ +export type owner = 'organization' | 'store'; + +export type CreatedOption = { data: { + /** + * A unique identifier that is generated when an option is created. + */ + id?: string; /** * This represents the type of resource object being returned. Always `product-variation-option`. */ type: 'product-variation-option'; attributes: { /** - * A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + * A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. */ name?: string; /** - * By default, variations and variation options are sorted alphabetically. You can use the `sort_order` attribute to sort the order of your variation and variation options in the `variation_matrix`. - * - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. - * - * The variation option with the highest value of `sort_order` is displayed first. For example, a variation option with a `sort_order` value of `3` appears before a variation option with a `sort_order` value of `2`. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, and so on, zero or negative numbers. - * - * You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - * - * You must rebuild your products for the sort order changes to take effect. - * + * A human-recognizable description for the option. + */ + description?: string; + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. */ sort_order?: number; + }; + meta?: { /** - * A description of a product variation option. + * The owner of a resource, either `organization` or `store`. */ - description?: string; + owner?: 'organization' | 'store'; + /** + * The date and time an option is created. + */ + created_at?: Date; + /** + * The date and time an option is updated. + */ + updated_at?: Date; }; }; }; @@ -278,82 +259,75 @@ export type create_option = { /** * This represents the type of resource object being returned. Always `product-variation-option`. */ -export type type5 = 'product-variation-option'; +export type type3 = 'product-variation-option'; -export type create_product_request = { +export type CreatedVariation = { data: { /** - * This represents the type of resource being returned. Always `product`. - */ - type: 'product'; - attributes: product_attributes; - /** - * Relationships are established between different product entities. + * A unique identifier generated when a variation is created. */ - relationships?: { - variations?: { - data?: Array<{ - /** - * A unique identifier for a resource. - */ - id?: string; - /** - * This represents the type of resource object being returned. - */ - type?: string; - }>; - }; - }; - }; -}; - -/** - * This represents the type of resource being returned. Always `product`. - */ -export type type6 = 'product'; - -export type create_variation = { - data: { + id: string; /** * This represents the type of resource object being returned. Always `product-variation`. */ type: 'product-variation'; attributes: { /** - * The variation name. + * A human-recognizable identifier for a variation. */ name?: string; /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. - * - * The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. - * - * You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - * - * You must rebuild your products for the sort order changes to take effect. - * + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. */ sort_order?: number; }; + meta: { + /** + * The owner of the resource, either `organization` or `store`. + */ + owner?: 'organization' | 'store'; + /** + * The date and time a variation is created. + */ + created_at?: Date; + /** + * The date and time a variation is updated. + */ + updated_at?: Date; + }; }; }; /** * This represents the type of resource object being returned. Always `product-variation`. */ -export type type7 = 'product-variation'; +export type type4 = 'product-variation'; -export type created_modifier = { +export type CreateHierarchy = { data?: { /** - * A unique identifier for a modifier that is generated automatically when a modifier is created. + * This represents the type of resource object being returned. Always `hierarchy`. */ - id?: string; + type: 'hierarchy'; + attributes: ReqAttributesHierarchy; + }; +}; + +/** + * This represents the type of resource object being returned. Always `hierarchy`. + */ +export type type5 = 'hierarchy'; + +/** + * Use modifiers to change the properties of child products that are inherited from a parent product. With modifiers, you only need to have one parent product with a variation attached to the product. + */ +export type CreateModifier = { + data: { /** - * This represents the type of resource object being returned. Always `product-variation-modifier'. + * This represents the type of resource object being returned. Always `product-variation-modifier`. */ - type?: 'product-variation-modifier'; - attributes?: { + type: 'product-variation-modifier'; + attributes: { /** * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. * @@ -380,7 +354,7 @@ export type created_modifier = { * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | * */ - type?: 'commodity_type' | 'status' | 'price' | 'name_append' | 'name_prepend' | 'name_equals' | 'sku_append' | 'sku_prepend' | 'sku_equals' | 'sku_builder' | 'slug_append' | 'slug_prepend' | 'slug_equals' | 'slug_builder' | 'description_append' | 'description_prepend' | 'description_equals' | 'custom_inputs_equals' | 'build_rules_equals' | 'locales_equals' | 'upc_ean_equals' | 'mpn_equals' | 'external_ref_equals'; + type: 'commodity_type' | 'status' | 'price' | 'name_append' | 'name_prepend' | 'name_equals' | 'sku_append' | 'sku_prepend' | 'sku_equals' | 'sku_builder' | 'slug_append' | 'slug_prepend' | 'slug_equals' | 'slug_builder' | 'description_append' | 'description_prepend' | 'description_equals' | 'custom_inputs_equals' | 'build_rules_equals' | 'locales_equals' | 'upc_ean_equals' | 'mpn_equals' | 'external_ref_equals'; /** * Required for non-builder modifiers. The value of the modifier type. */ @@ -394,103 +368,129 @@ export type created_modifier = { */ set?: string; /** - * The name of the modifier. + * A name for the modifier. */ reference_name?: string; }; + }; +}; + +export type CreateNode = { + data?: { + /** + * This represents the type of resource object being returned. Always `node`. + */ + type: 'node'; + attributes: AttributesNodes; meta?: { /** - * The owner of the resource, either `organization` or `store`. + * You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. The `sort_order` for each node. This value determines the order of nodes in the response for the `Get a Node’s Children` request. The node with the highest value of sort_order is displayed first. For example, a node with a sort_order value of 3 appears before a node with a sort_order value of 2. + * + * - If you don’t provide `sort_order` when creating nodes, all child nodes in the response for `Get a Node’s Children` request are ordered by the `updated_at` time in descending order, with the most recently updated child node first. + * - If you set `sort_order` for only a few child nodes or not all, the child nodes with a `sort_order` value appear first and then other child nodes appear in the order of `updated_at` time. See [Sorting Nodes in a hierarchy](). + * */ - owner?: 'organization' | 'store'; + sort_order?: number; }; }; }; /** - * The owner of the resource, either `organization` or `store`. + * This represents the type of resource object being returned. Always `node`. */ -export type owner = 'organization' | 'store'; +export type type6 = 'node'; -export type created_option = { +export type CreateOption = { data: { - /** - * A unique identifier that is generated when an option is created. - */ - id?: string; /** * This represents the type of resource object being returned. Always `product-variation-option`. */ type: 'product-variation-option'; attributes: { /** - * A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + * A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. */ name?: string; /** - * A human-recognizable description for the option. - */ - description?: string; - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + * By default, variations and variation options are sorted alphabetically. You can use the `sort_order` attribute to sort the order of your variation and variation options in the `variation_matrix`. + * + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. + * + * The variation option with the highest value of `sort_order` is displayed first. For example, a variation option with a `sort_order` value of `3` appears before a variation option with a `sort_order` value of `2`. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, and so on, zero or negative numbers. + * + * You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + * + * You must rebuild your products for the sort order changes to take effect. + * */ sort_order?: number; - }; - meta?: { - /** - * The owner of a resource, either `organization` or `store`. - */ - owner?: 'organization' | 'store'; /** - * The date and time an option is created. - */ - created_at?: string; - /** - * The date and time an option is updated. + * A description of a product variation option. */ - updated_at?: string; + description?: string; }; }; }; -export type created_variation = { +export type CreateProductRequest = { data: { /** - * A unique identifier generated when a variation is created. + * This represents the type of resource being returned. Always `product`. */ - id: string; + type: 'product'; + attributes: ProductAttributes; + /** + * Relationships are established between different product entities. + */ + relationships?: { + variations?: { + data?: Array<{ + /** + * A unique identifier for a resource. + */ + id?: string; + /** + * This represents the type of resource object being returned. + */ + type?: string; + }>; + }; + }; + }; +}; + +/** + * This represents the type of resource being returned. Always `product`. + */ +export type type7 = 'product'; + +export type CreateVariation = { + data: { /** * This represents the type of resource object being returned. Always `product-variation`. */ type: 'product-variation'; attributes: { /** - * A human-recognizable identifier for a variation. + * The variation name. */ name?: string; /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. + * + * The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. + * + * You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + * + * You must rebuild your products for the sort order changes to take effect. + * */ sort_order?: number; }; - meta: { - /** - * The owner of the resource, either `organization` or `store`. - */ - owner?: 'organization' | 'store'; - /** - * The date and time a variation is created. - */ - created_at?: string; - /** - * The date and time a variation is updated. - */ - updated_at?: string; - }; }; }; -export type custom_relationship = { +export type CustomRelationship = { /** * A unique identifier generated when a custom relationship is created. */ @@ -499,7 +499,7 @@ export type custom_relationship = { * This represents the type of resource object being returned. Always `hierarchy`. */ type?: 'custom-relationship'; - attributes?: attributes_custom_relationship; + attributes?: AttributesCustomRelationship; meta?: { /** * The owner of the resource. @@ -509,16 +509,16 @@ export type custom_relationship = { /** * The date and time the resource is created. */ - created_at?: string; + created_at?: Date; /** * The date and time the resource is updated. */ - updated_at?: string; + updated_at?: Date; }; }; }; -export type duplicate_job = { +export type DuplicateJob = { data?: { /** * This represents the type of resource object being returned. Always `hierarchy`. @@ -541,7 +541,7 @@ export type duplicate_job = { }; }; -export type error = { +export type Error = { errors: Array<{ /** * The HTTP response code of the error. @@ -568,7 +568,7 @@ export type error = { }>; }; -export type errors = { +export type Errors = { /** * An array of job errors. */ @@ -590,7 +590,7 @@ export type errors = { }>; }; -export type file_response = { +export type FileResponse = { data?: Array<{ /** * The unique identifier of the new file. @@ -603,7 +603,7 @@ export type file_response = { }>; }; -export type hierarchy = { +export type Hierarchy = { /** * A unique identifier generated when a hierarchy is created. */ @@ -612,17 +612,17 @@ export type hierarchy = { * This represents the type of resource object being returned. Always `hierarchy`. */ type?: 'hierarchy'; - attributes?: attributes_hierarchy; - relationships?: relationships_hierarchy; + attributes?: AttributesHierarchy; + relationships?: RelationshipsHierarchy; meta?: { /** * The date and time a hierarchy is created. */ - created_at?: string; + created_at?: Date; /** * The date and time a hierarchy is updated. */ - updated_at?: string; + updated_at?: Date; /** * The owner of a resource, either `organization` or `store`. */ @@ -630,7 +630,7 @@ export type hierarchy = { }; }; -export type job = { +export type Job = { /** * A unique identifier generated when a job is created. */ @@ -643,19 +643,19 @@ export type job = { /** * The date and time a job is started. */ - started_at?: (string) | null; + started_at?: (Date) | null; /** * The date and time a job is completed. */ - completed_at?: (string) | null; + completed_at?: (Date) | null; /** * The date and time a job is created. */ - created_at?: string; + created_at?: Date; /** * The date and time a job is updated. */ - updated_at?: string; + updated_at?: Date; /** * The status of a job. * @@ -699,7 +699,7 @@ export type type8 = 'pim-job'; export type status = 'pending' | 'cancelled' | 'started' | 'success' | 'failed'; -export type main_image_request = { +export type MainImageRequest = { data?: { /** * The ID of the image file. @@ -717,7 +717,7 @@ export type main_image_request = { */ export type type9 = 'file'; -export type main_image_response = { +export type MainImageResponse = { data?: Array<{ /** * A unique identifier for the image file generated automatically when a file is created. @@ -730,11 +730,11 @@ export type main_image_response = { }>; }; -export type multi = { +export type Multi = { /** * An array of jobs. */ - data?: Array; + data?: Array; meta?: { /** * Contains the results for the entire collection. @@ -748,16 +748,16 @@ export type multi = { }; }; -export type multi_hierarchy = { - data?: Array; - links?: multi_links; - meta?: multi_meta; +export type MultiHierarchy = { + data?: Array; + links?: MultiLinks; + meta?: MultiMeta; }; /** * Links are used to allow you to move between requests. */ -export type multi_links = { +export type MultiLinks = { /** * Always the first page. */ @@ -776,7 +776,7 @@ export type multi_links = { prev?: string; }; -export type multi_meta = { +export type MultiMeta = { /** * Contains the results for the entire collection. */ @@ -788,7 +788,7 @@ export type multi_meta = { }; }; -export type multi_modifiers = { +export type MultiModifiers = { data?: Array<{ /** * A unique identifier for a modifier that is generated automatically when a modifier is created. @@ -863,16 +863,16 @@ export type multi_modifiers = { }; }; -export type multi_nodes = { +export type MultiNodes = { /** * An array of nodes. */ - data?: Array; - meta?: multi_meta; - links?: multi_links; + data?: Array; + meta?: MultiMeta; + links?: MultiLinks; }; -export type multi_options = { +export type MultiOptions = { data?: Array<{ /** * A unique identifier generated when an option is created. @@ -904,11 +904,11 @@ export type multi_options = { /** * The date and time an option is created. */ - created_at?: string; + created_at?: Date; /** * The date and time an option is updated. */ - updated_at?: string; + updated_at?: Date; }; }>; meta?: { @@ -924,8 +924,8 @@ export type multi_options = { }; }; -export type multi_product_response = { - data?: Array; +export type MultiProductResponse = { + data?: Array; /** * Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. */ @@ -933,7 +933,7 @@ export type multi_product_response = { /** * Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. */ - component_products?: Array; + component_products?: Array; }; meta?: { /** @@ -948,11 +948,11 @@ export type multi_product_response = { }; }; -export type multi_tag = { +export type MultiTag = { /** * An array of tags. */ - data?: Array; + data?: Array; meta?: { /** * Contains the results for the entire collection. @@ -966,7 +966,7 @@ export type multi_tag = { }; }; -export type multi_variations = { +export type MultiVariations = { data?: Array<{ /** * A unique identifier for a variation. @@ -1003,11 +1003,11 @@ export type multi_variations = { /** * The date and time an option is created. */ - created_at?: string; + created_at?: Date; /** * The date and time an option is updated. */ - updated_at?: string; + updated_at?: Date; /** * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. */ @@ -1020,11 +1020,11 @@ export type multi_variations = { /** * The date and time a variation is created. */ - created_at?: string; + created_at?: Date; /** * The date and time a variation is updated. */ - updated_at?: string; + updated_at?: Date; }; }>; meta?: { @@ -1040,7 +1040,7 @@ export type multi_variations = { }; }; -export type node = { +export type Node = { /** * The unique identifier of a node. */ @@ -1049,8 +1049,8 @@ export type node = { * This represents the type of resource object being returned. Always `node`. */ type?: 'node'; - attributes?: attributes; - relationships?: relationships; + attributes?: Attributes; + relationships?: Relationships; meta?: { /** * The sort order value. The node with the highest value of `sort_order` is displayed first. For example, a node with a `sort_order` value of `3` appears before a node with a `sort_order` value of `2`. See [Sorting Nodes in a hierarchy](/docs/api/pxm/products/create-node#sorting-nodes-in-a-hierarchy). @@ -1059,11 +1059,11 @@ export type node = { /** * The date and time a node is created. */ - created_at?: string; + created_at?: Date; /** * The date and time a node was updated. */ - updated_at?: string; + updated_at?: Date; /** * The name of the parent of the node if one exists. */ @@ -1075,7 +1075,7 @@ export type node = { }; }; -export type node_children = { +export type NodeChildren = { data?: Array<{ /** * The unique identifier of the child node. Must not match the node ID specified in the request path. @@ -1088,7 +1088,7 @@ export type node_children = { }>; }; -export type node_parent = { +export type NodeParent = { data?: { /** * The unique identifier of the new parent node. Must not match the node ID specified in the request path. @@ -1101,7 +1101,7 @@ export type node_parent = { }; }; -export type node_products = { +export type NodeProducts = { data?: Array<{ /** * The unique identifier of the product to be attached to the node. @@ -1117,7 +1117,7 @@ export type node_products = { /** * A custom relationship slug. */ -export type Parametercustom_relationship_slug = string; +export type ParameterCustomRelationshipSlug = string; /** * @@ -1126,7 +1126,7 @@ export type Parametercustom_relationship_slug = string; * For more information about the attributes and operators that this endpoint supports, see [Export Products](/docs/api/pxm/products/export-products). * */ -export type Parameterfilterexport = string; +export type ParameterFilterexport = string; /** * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering). @@ -1134,12 +1134,12 @@ export type Parameterfilterexport = string; * For more information about the attributes and operators that are supported, see [Get all products](/docs/api/pxm/products/get-all-products). * */ -export type Parameterfilterproduct = string; +export type ParameterFilterproduct = string; /** * A unique identifier for the hierarchy. */ -export type Parameterhierarchy_id = string; +export type ParameterHierarchyId = string; /** * Using the include parameter, you can retrieve top-level resources. @@ -1149,59 +1149,59 @@ export type Parameterhierarchy_id = string; * - Key attribute data, such as SKU or slug. * */ -export type Parameterinclude = string; +export type ParameterInclude = string; /** * A unique identifier for the job. */ -export type Parameterjob_id = string; +export type ParameterJobId = string; /** * A unique identifier for the modifier. */ -export type Parametermodifier_id = string; +export type ParameterModifierId = string; /** * A unique identifier for the node. */ -export type Parameternode_id = string; +export type ParameterNodeId = string; /** * A unique identifier for the option. */ -export type Parameteroption_id = string; +export type ParameterOptionId = string; /** * The number of records per page. The maximum limit is 100. */ -export type Parameterpage_limit = number; +export type ParameterPageLimit = number; /** * The number of records to offset the results by. */ -export type Parameterpage_offset = number; +export type ParameterPageOffset = number; /** * A unique identifier for the product. */ -export type Parameterproduct_id = string; +export type ParameterProductId = string; /** * A unique identifier for the tag. */ -export type Parametertag_id = string; +export type ParameterTagId = string; /** * Set to `true` if you want to use a template slug instead of a template ID when exporting products that have custom data. */ -export type ParameteruseTemplateSlugs = boolean; +export type ParameterUseTemplateSlugs = boolean; /** * A unique identifier for the variation. */ -export type Parametervariation_id = string; +export type ParameterVariationId = string; -export type product_attributes = { +export type ProductAttributes = { /** * The unique attribute associated with the product. This could be an external reference from a separate company system, for example. The maximum length is 2048 characters. */ @@ -1242,10 +1242,10 @@ export type product_attributes = { * You can use product tags to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. A product can have up to 20 tags. A product tag can be up to 255 characters. Product tags must not contain any spaces or commas. See [Product Tags](/docs/api/pxm/products/product-tags). */ tags?: Array<(string)>; - build_rules?: product_build_rules; - locales?: product_locales; - custom_inputs?: product_custom_inputs; - components?: product_bundle_components; + build_rules?: ProductBuildRules; + locales?: ProductLocales; + custom_inputs?: ProductCustomInputs; + components?: ProductBundleComponents; }; /** @@ -1261,7 +1261,7 @@ export type commodity_type = 'physical' | 'digital'; /** * You can build a combination of child products associated with a product, based on build rules that you specify. This is useful, for example, if you have a variation option that you do not sell. This makes managing and building your child products quick and easy. See [Using Build Rules](/docs/api/pxm/products/build-child-products#using-build-rules). */ -export type product_build_rules = { +export type ProductBuildRules = { /** * Specifies the default behaviour, either `include` or `exclude`. */ @@ -1284,7 +1284,7 @@ export type default = 'include' | 'exclude'; /** * With Product Experience Manager, you can create and manage bundles. A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. See [Bundles](/docs/api/pxm/products/products#bundles). */ -export type product_bundle_components = { +export type ProductBundleComponents = { [key: string]: { /** * The component name. The component name is the name that is displayed in your storefront. @@ -1333,7 +1333,7 @@ export type product_bundle_components = { /** * You use the `custom_inputs` attribute to allow your shoppers to add custom text to a product when adding product items to their carts. This is useful, for example, if you have a product like a T-shirt that can be personalized or you sell greetings cards that can be printed with your shoppers personalized messages. See [Personalizing Products](/docs/api/pxm/products/create-product#personalizing-products). */ -export type product_custom_inputs = { +export type ProductCustomInputs = { [key: string]: { /** * A name for the custom text field. @@ -1364,7 +1364,7 @@ export type product_custom_inputs = { }; }; -export type product_files_request = { +export type ProductFilesRequest = { data?: Array<{ /** * A unique identifier for a file generated when a file is created. @@ -1386,7 +1386,7 @@ export type product_files_request = { /** * Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. */ -export type product_locales = { +export type ProductLocales = { [key: string]: { /** * A localized name for the product. @@ -1399,7 +1399,7 @@ export type product_locales = { }; }; -export type product_response = { +export type ProductResponse = { /** * A unique product ID that is generated when you create the product. */ @@ -1460,19 +1460,19 @@ export type product_response = { [key: string]: ((string) | null | number | boolean); }; }; - custom_inputs?: product_custom_inputs; - build_rules?: product_build_rules; - components?: product_bundle_components; + custom_inputs?: ProductCustomInputs; + build_rules?: ProductBuildRules; + components?: ProductBundleComponents; }; meta?: { /** * The date and time a product is created. */ - created_at?: string; + created_at?: Date; /** * The date and time a product is updated. */ - updated_at?: string; + updated_at?: Date; /** * The resource owner, either `organization` or `store`. */ @@ -1564,7 +1564,7 @@ export type product_response = { }; }; -export type product_templates_request = { +export type ProductTemplatesRequest = { data?: Array<{ /** * The unique identifier of a template. @@ -1577,7 +1577,7 @@ export type product_templates_request = { }>; }; -export type product_variations_request = { +export type ProductVariationsRequest = { data?: Array<{ /** * The ID of the product variation. @@ -1593,7 +1593,7 @@ export type product_variations_request = { /** * Relationships allow you to move between requests. Includes links to the child nodes and products associated with a hierarchy or node. */ -export type relationships = { +export type Relationships = { /** * The child nodes related to the resource. */ @@ -1650,7 +1650,7 @@ export type relationships = { }; }; -export type relationships_hierarchy = { +export type RelationshipsHierarchy = { /** * The child nodes related to the hierarchy. */ @@ -1671,7 +1671,7 @@ export type relationships_hierarchy = { }; }; -export type replace_main_image_request = { +export type ReplaceMainImageRequest = { data?: Array<{ /** * The ID of the new image file. @@ -1681,7 +1681,7 @@ export type replace_main_image_request = { }>; }; -export type req_attributes_custom_relationship = { +export type ReqAttributesCustomRelationship = { /** * The name of the custom relationship, such as `Kitchen electrics`. */ @@ -1696,7 +1696,7 @@ export type req_attributes_custom_relationship = { slug?: string; }; -export type req_attributes_hierarchy = { +export type ReqAttributesHierarchy = { /** * The name of the hierarchy, such as `Major Appliances`. */ @@ -1726,19 +1726,19 @@ export type req_attributes_hierarchy = { }; }; -export type single = { - data?: job; +export type Single = { + data?: Job; }; -export type single_custom_relationship = { - data?: custom_relationship; +export type SingleCustomRelationship = { + data?: CustomRelationship; }; -export type single_hierarchy = { - data?: hierarchy; +export type SingleHierarchy = { + data?: Hierarchy; }; -export type single_modifier = { +export type SingleModifier = { data?: { /** * A unique identifier for a modifier that is generated automatically when a modifier is created. @@ -1802,11 +1802,11 @@ export type single_modifier = { }; }; -export type single_node = { - data?: node; +export type SingleNode = { + data?: Node; }; -export type single_option = { +export type SingleOption = { data: { /** * The unique identifier generated when an option is created. @@ -1841,17 +1841,17 @@ export type single_option = { /** * The date and time an option is created. */ - created_at?: string; + created_at?: Date; /** * The date and time an option is updated. */ - updated_at?: string; + updated_at?: Date; }; }; }; -export type single_product_response = { - data?: product_response; +export type SingleProductResponse = { + data?: ProductResponse; /** * Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. */ @@ -1859,15 +1859,15 @@ export type single_product_response = { /** * A list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. */ - component_products?: Array; + component_products?: Array; }; }; -export type single_tag = { - data?: tag; +export type SingleTag = { + data?: Tag; }; -export type single_variation = { +export type SingleVariation = { data: { /** * A unique identifier for a variation. @@ -1907,11 +1907,11 @@ export type single_variation = { /** * The date and time an option is created. */ - created_at?: string; + created_at?: Date; /** * The date and time an option is updated. */ - updated_at?: string; + updated_at?: Date; /** * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. */ @@ -1933,7 +1933,7 @@ export type single_variation = { }; }; -export type tag = { +export type Tag = { /** * A unique identifier generated when a tag is created. */ @@ -1956,11 +1956,11 @@ export type tag = { /** * The date and time a tag is created. */ - created_at?: string; + created_at?: Date; /** * The date and time a tag is updated. */ - updated_at?: string; + updated_at?: Date; /** * The owner of a resource, either `organization` or `store`. */ @@ -1973,7 +1973,7 @@ export type tag = { */ export type type10 = 'tag'; -export type template_response = { +export type TemplateResponse = { data?: Array<{ /** * A unique identifier for a template generated when a template is created. @@ -1986,7 +1986,7 @@ export type template_response = { }>; }; -export type update_custom_relationship = { +export type UpdateCustomRelationship = { data: { /** * The unique identifier of the custom relationship. @@ -1996,11 +1996,11 @@ export type update_custom_relationship = { * This represents the type of resource object being returned. Always `custom-relationship`. */ type: 'custom-relationship'; - attributes: req_attributes_custom_relationship; + attributes: ReqAttributesCustomRelationship; }; }; -export type update_hierarchy = { +export type UpdateHierarchy = { data: { /** * The unique identifier of the hierarchy. Must match the hierarchy ID specified in the request path. @@ -2010,11 +2010,11 @@ export type update_hierarchy = { * This represents the type of resource object being returned. Always `hierarchy`. */ type: 'hierarchy'; - attributes: req_attributes_hierarchy; + attributes: ReqAttributesHierarchy; }; }; -export type update_modifier = { +export type UpdateModifier = { data: { /** * This represents the type of resource object being returned. Always `product-variation-modifier`. @@ -2072,7 +2072,7 @@ export type update_modifier = { }; }; -export type update_node = { +export type UpdateNode = { data?: { /** * The unique identifier of the node. Must match the node ID specified in the request path. @@ -2082,7 +2082,7 @@ export type update_node = { * This represents the type of resource object being returned. Always `node`. */ type: 'node'; - attributes: attributes_nodes; + attributes: AttributesNodes; meta?: { /** * You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. The `sort_order` for each node. This value determines the order of nodes in the response for the `Get a Node’s Children` request. The node with the highest value of sort_order is displayed first. For example, a node with a sort_order value of 3 appears before a node with a sort_order value of 2. @@ -2096,7 +2096,7 @@ export type update_node = { }; }; -export type update_option = { +export type UpdateOption = { data: { /** * This represents the type of resource object being returned. Always `product-variation-option`. @@ -2132,7 +2132,7 @@ export type update_option = { }; }; -export type update_product_request = { +export type UpdateProductRequest = { data: { /** * This represents the type of resource object being returned. Always `product`. @@ -2142,11 +2142,11 @@ export type update_product_request = { * The unique identifier of the product. Must match the product ID specified in the request path. */ id: string; - attributes: product_attributes; + attributes: ProductAttributes; }; }; -export type update_variation = { +export type UpdateVariation = { data: { /** * This represents the type of resource object being returned. Always `product-variation`. @@ -2176,7 +2176,7 @@ export type update_variation = { }; }; -export type variations_response = { +export type VariationsResponse = { data?: Array<{ /** * A unique identifier generated when a variation is created. @@ -2190,14 +2190,14 @@ export type variations_response = { /** * The date and time a resource is created. */ - created_at?: string; + created_at?: Date; }; }>; }; -export type GetAllJobsResponse = (multi); +export type GetAllJobsResponse = (Multi); -export type GetAllJobsError = (error); +export type GetAllJobsError = (Error); export type GetJobData = { path: { @@ -2208,9 +2208,9 @@ export type GetJobData = { }; }; -export type GetJobResponse = (single); +export type GetJobResponse = (Single); -export type GetJobError = (error); +export type GetJobError = (Error); export type CancelJobData = { body?: { @@ -2224,9 +2224,9 @@ export type CancelJobData = { }; }; -export type CancelJobResponse = (single); +export type CancelJobResponse = (Single); -export type CancelJobError = (error); +export type CancelJobError = (Error); export type GetJobErrorsData = { path: { @@ -2237,17 +2237,17 @@ export type GetJobErrorsData = { }; }; -export type GetJobErrorsResponse = (errors); +export type GetJobErrorsResponse = (Errors); -export type GetJobErrorsError = (error); +export type GetJobErrorsError = (Error); export type CreateProductData = { - body: create_product_request; + body: CreateProductRequest; }; -export type CreateProductResponse = (single_product_response); +export type CreateProductResponse = (SingleProductResponse); -export type CreateProductError = (error); +export type CreateProductError = (Error); export type GetAllProductsData = { query?: { @@ -2278,9 +2278,9 @@ export type GetAllProductsData = { }; }; -export type GetAllProductsResponse = (multi_product_response); +export type GetAllProductsResponse = (MultiProductResponse); -export type GetAllProductsError = (error); +export type GetAllProductsError = (Error); export type ImportProductsData = { body?: { @@ -2291,9 +2291,9 @@ export type ImportProductsData = { }; }; -export type ImportProductsResponse = (single); +export type ImportProductsResponse = (Single); -export type ImportProductsError = (error); +export type ImportProductsError = (Error); export type ExportProductsData = { body?: { @@ -2315,9 +2315,9 @@ export type ExportProductsData = { }; }; -export type ExportProductsResponse = (single); +export type ExportProductsResponse = (Single); -export type ExportProductsError = (error); +export type ExportProductsError = (Error); export type GetProductData = { path: { @@ -2339,12 +2339,12 @@ export type GetProductData = { }; }; -export type GetProductResponse = (single_product_response); +export type GetProductResponse = (SingleProductResponse); -export type GetProductError = (error); +export type GetProductError = (Error); export type UpdateProductData = { - body?: update_product_request; + body?: UpdateProductRequest; path: { /** * A unique identifier for the product. @@ -2353,9 +2353,9 @@ export type UpdateProductData = { }; }; -export type UpdateProductResponse = (single_product_response); +export type UpdateProductResponse = (SingleProductResponse); -export type UpdateProductError = (error); +export type UpdateProductError = (Error); export type DeleteProductData = { path: { @@ -2368,7 +2368,7 @@ export type DeleteProductData = { export type DeleteProductResponse = (void); -export type DeleteProductError = (error); +export type DeleteProductError = (Error); export type AttachNodesData = { body: { @@ -2399,7 +2399,7 @@ export type AttachNodesResponse = ({ }; }); -export type AttachNodesError = (error); +export type AttachNodesError = (Error); export type DetachNodesData = { body: { @@ -2430,7 +2430,7 @@ export type DetachNodesResponse = ({ }; }); -export type DetachNodesError = (error); +export type DetachNodesError = (Error); export type GetProductsNodesData = { path: { @@ -2451,9 +2451,9 @@ export type GetProductsNodesData = { }; }; -export type GetProductsNodesResponse = (multi_nodes); +export type GetProductsNodesResponse = (MultiNodes); -export type GetProductsNodesError = (error); +export type GetProductsNodesError = (Error); export type BuildChildProductsData = { body?: { @@ -2469,7 +2469,7 @@ export type BuildChildProductsData = { export type BuildChildProductsResponse = (unknown); -export type BuildChildProductsError = (error); +export type BuildChildProductsError = (Error); export type GetChildProductsData = { path: { @@ -2480,12 +2480,12 @@ export type GetChildProductsData = { }; }; -export type GetChildProductsResponse = (multi_product_response); +export type GetChildProductsResponse = (MultiProductResponse); -export type GetChildProductsError = (error); +export type GetChildProductsError = (Error); export type CreateProductTemplateRelationshipData = { - body?: product_templates_request; + body?: ProductTemplatesRequest; path: { /** * A unique identifier for the product. @@ -2494,9 +2494,9 @@ export type CreateProductTemplateRelationshipData = { }; }; -export type CreateProductTemplateRelationshipResponse = (template_response); +export type CreateProductTemplateRelationshipResponse = (TemplateResponse); -export type CreateProductTemplateRelationshipError = (error); +export type CreateProductTemplateRelationshipError = (Error); export type GetProductTemplateRelationshipsData = { path: { @@ -2507,12 +2507,12 @@ export type GetProductTemplateRelationshipsData = { }; }; -export type GetProductTemplateRelationshipsResponse = (template_response); +export type GetProductTemplateRelationshipsResponse = (TemplateResponse); -export type GetProductTemplateRelationshipsError = (error); +export type GetProductTemplateRelationshipsError = (Error); export type DeleteProductTemplateRelationshipData = { - body?: product_templates_request; + body?: ProductTemplatesRequest; path: { /** * A unique identifier for the product. @@ -2523,7 +2523,7 @@ export type DeleteProductTemplateRelationshipData = { export type DeleteProductTemplateRelationshipResponse = (void); -export type DeleteProductTemplateRelationshipError = (error); +export type DeleteProductTemplateRelationshipError = (Error); export type GetProductComponentProductsRelationshipsData = { path: { @@ -2534,9 +2534,9 @@ export type GetProductComponentProductsRelationshipsData = { }; }; -export type GetProductComponentProductsRelationshipsResponse = (component_products_response); +export type GetProductComponentProductsRelationshipsResponse = (ComponentProductsResponse); -export type GetProductComponentProductsRelationshipsError = (error); +export type GetProductComponentProductsRelationshipsError = (Error); export type GetProductFileRelationshipsData = { path: { @@ -2547,12 +2547,12 @@ export type GetProductFileRelationshipsData = { }; }; -export type GetProductFileRelationshipsResponse = (file_response); +export type GetProductFileRelationshipsResponse = (FileResponse); -export type GetProductFileRelationshipsError = (error); +export type GetProductFileRelationshipsError = (Error); export type CreateProductFileRelationshipsData = { - body?: product_files_request; + body?: ProductFilesRequest; path: { /** * A unique identifier for the product. @@ -2563,10 +2563,10 @@ export type CreateProductFileRelationshipsData = { export type CreateProductFileRelationshipsResponse = (void); -export type CreateProductFileRelationshipsError = (error); +export type CreateProductFileRelationshipsError = (Error); export type UpdateProductFileRelationshipsData = { - body?: product_files_request; + body?: ProductFilesRequest; path: { /** * A unique identifier for the product. @@ -2577,10 +2577,10 @@ export type UpdateProductFileRelationshipsData = { export type UpdateProductFileRelationshipsResponse = (void); -export type UpdateProductFileRelationshipsError = (error); +export type UpdateProductFileRelationshipsError = (Error); export type DeleteProductFileRelationshipsData = { - body?: product_files_request; + body?: ProductFilesRequest; path: { /** * A unique identifier for the product. @@ -2591,10 +2591,10 @@ export type DeleteProductFileRelationshipsData = { export type DeleteProductFileRelationshipsResponse = (void); -export type DeleteProductFileRelationshipsError = (error); +export type DeleteProductFileRelationshipsError = (Error); export type CreateProductVariationRelationshipsData = { - body?: product_variations_request; + body?: ProductVariationsRequest; path: { /** * A unique identifier for the product. @@ -2605,7 +2605,7 @@ export type CreateProductVariationRelationshipsData = { export type CreateProductVariationRelationshipsResponse = (void); -export type CreateProductVariationRelationshipsError = (error); +export type CreateProductVariationRelationshipsError = (Error); export type GetProductVariationRelationshipsData = { path: { @@ -2616,12 +2616,12 @@ export type GetProductVariationRelationshipsData = { }; }; -export type GetProductVariationRelationshipsResponse = (variations_response); +export type GetProductVariationRelationshipsResponse = (VariationsResponse); -export type GetProductVariationRelationshipsError = (error); +export type GetProductVariationRelationshipsError = (Error); export type UpdateProductVariationRelationshipsData = { - body?: product_variations_request; + body?: ProductVariationsRequest; path: { /** * A unique identifier for the product. @@ -2632,10 +2632,10 @@ export type UpdateProductVariationRelationshipsData = { export type UpdateProductVariationRelationshipsResponse = (void); -export type UpdateProductVariationRelationshipsError = (error); +export type UpdateProductVariationRelationshipsError = (Error); export type DeleteProductVariationRelationshipsData = { - body?: product_variations_request; + body?: ProductVariationsRequest; path: { /** * A unique identifier for the product. @@ -2646,10 +2646,10 @@ export type DeleteProductVariationRelationshipsData = { export type DeleteProductVariationRelationshipsResponse = (void); -export type DeleteProductVariationRelationshipsError = (error); +export type DeleteProductVariationRelationshipsError = (Error); export type CreateProductMainImageRelationshipsData = { - body?: main_image_request; + body?: MainImageRequest; path: { /** * A unique identifier for the product. @@ -2660,7 +2660,7 @@ export type CreateProductMainImageRelationshipsData = { export type CreateProductMainImageRelationshipsResponse = (void); -export type CreateProductMainImageRelationshipsError = (error); +export type CreateProductMainImageRelationshipsError = (Error); export type GetProductMainImageRelationshipsData = { path: { @@ -2671,12 +2671,12 @@ export type GetProductMainImageRelationshipsData = { }; }; -export type GetProductMainImageRelationshipsResponse = (main_image_response); +export type GetProductMainImageRelationshipsResponse = (MainImageResponse); -export type GetProductMainImageRelationshipsError = (error); +export type GetProductMainImageRelationshipsError = (Error); export type UpdateProductMainImageRelationshipsData = { - body?: replace_main_image_request; + body?: ReplaceMainImageRequest; path: { /** * A unique identifier for the product. @@ -2687,7 +2687,7 @@ export type UpdateProductMainImageRelationshipsData = { export type UpdateProductMainImageRelationshipsResponse = (void); -export type UpdateProductMainImageRelationshipsError = (error); +export type UpdateProductMainImageRelationshipsError = (Error); export type DeleteProductMainImageRelationshipsData = { path: { @@ -2700,15 +2700,15 @@ export type DeleteProductMainImageRelationshipsData = { export type DeleteProductMainImageRelationshipsResponse = (void); -export type DeleteProductMainImageRelationshipsError = (error); +export type DeleteProductMainImageRelationshipsError = (Error); export type CreateVariationData = { - body: create_variation; + body: CreateVariation; }; -export type CreateVariationResponse = (created_variation); +export type CreateVariationResponse = (CreatedVariation); -export type CreateVariationError = (error); +export type CreateVariationError = (Error); export type GetAllVariationsData = { query?: { @@ -2723,9 +2723,9 @@ export type GetAllVariationsData = { }; }; -export type GetAllVariationsResponse = (multi_variations); +export type GetAllVariationsResponse = (MultiVariations); -export type GetAllVariationsError = (error); +export type GetAllVariationsError = (Error); export type GetVariationData = { path: { @@ -2736,12 +2736,12 @@ export type GetVariationData = { }; }; -export type GetVariationResponse = (single_variation); +export type GetVariationResponse = (SingleVariation); -export type GetVariationError = (error); +export type GetVariationError = (Error); export type UpdateVariationData = { - body?: update_variation; + body?: UpdateVariation; path: { /** * A unique identifier for the variation. @@ -2750,9 +2750,9 @@ export type UpdateVariationData = { }; }; -export type UpdateVariationResponse = (single_variation); +export type UpdateVariationResponse = (SingleVariation); -export type UpdateVariationError = (error); +export type UpdateVariationError = (Error); export type DeleteVariationData = { path: { @@ -2765,10 +2765,10 @@ export type DeleteVariationData = { export type DeleteVariationResponse = (void); -export type DeleteVariationError = (error); +export type DeleteVariationError = (Error); export type CreateVariationOptionData = { - body?: create_option; + body?: CreateOption; path: { /** * A unique identifier for the variation. @@ -2777,9 +2777,9 @@ export type CreateVariationOptionData = { }; }; -export type CreateVariationOptionResponse = (created_option); +export type CreateVariationOptionResponse = (CreatedOption); -export type CreateVariationOptionError = (error); +export type CreateVariationOptionError = (Error); export type GetAllVariationOptionsData = { path: { @@ -2800,9 +2800,9 @@ export type GetAllVariationOptionsData = { }; }; -export type GetAllVariationOptionsResponse = (multi_options); +export type GetAllVariationOptionsResponse = (MultiOptions); -export type GetAllVariationOptionsError = (error); +export type GetAllVariationOptionsError = (Error); export type GetVariationOptionData = { path: { @@ -2817,12 +2817,12 @@ export type GetVariationOptionData = { }; }; -export type GetVariationOptionResponse = (single_option); +export type GetVariationOptionResponse = (SingleOption); -export type GetVariationOptionError = (error); +export type GetVariationOptionError = (Error); export type UpdateVariationOptionData = { - body?: update_option; + body?: UpdateOption; path: { /** * A unique identifier for the option. @@ -2835,9 +2835,9 @@ export type UpdateVariationOptionData = { }; }; -export type UpdateVariationOptionResponse = (single_option); +export type UpdateVariationOptionResponse = (SingleOption); -export type UpdateVariationOptionError = (error); +export type UpdateVariationOptionError = (Error); export type DeleteVariationOptionData = { path: { @@ -2854,10 +2854,10 @@ export type DeleteVariationOptionData = { export type DeleteVariationOptionResponse = (void); -export type DeleteVariationOptionError = (error); +export type DeleteVariationOptionError = (Error); export type CreateModifierData = { - body?: create_modifier; + body?: CreateModifier; path: { /** * A unique identifier for the option. @@ -2870,9 +2870,9 @@ export type CreateModifierData = { }; }; -export type CreateModifierResponse = (created_modifier); +export type CreateModifierResponse = (CreatedModifier); -export type CreateModifierError = (error); +export type CreateModifierError = (Error); export type GetAllModifiersData = { path: { @@ -2897,9 +2897,9 @@ export type GetAllModifiersData = { }; }; -export type GetAllModifiersResponse = (multi_modifiers); +export type GetAllModifiersResponse = (MultiModifiers); -export type GetAllModifiersError = (error); +export type GetAllModifiersError = (Error); export type GetModifierData = { path: { @@ -2918,12 +2918,12 @@ export type GetModifierData = { }; }; -export type GetModifierResponse = (single_modifier); +export type GetModifierResponse = (SingleModifier); -export type GetModifierError = (error); +export type GetModifierError = (Error); export type UpdateModifierData = { - body?: update_modifier; + body?: UpdateModifier; path: { /** * A unique identifier for the modifier. @@ -2940,9 +2940,9 @@ export type UpdateModifierData = { }; }; -export type UpdateModifierResponse = (single_modifier); +export type UpdateModifierResponse = (SingleModifier); -export type UpdateModifierError = (error); +export type UpdateModifierError = (Error); export type DeleteModifierData = { path: { @@ -2963,15 +2963,15 @@ export type DeleteModifierData = { export type DeleteModifierResponse = (void); -export type DeleteModifierError = (error); +export type DeleteModifierError = (Error); export type CreateHierarchyData = { - body: create_hierarchy; + body: CreateHierarchy; }; -export type CreateHierarchyResponse = (single_hierarchy); +export type CreateHierarchyResponse = (SingleHierarchy); -export type CreateHierarchyError = (error); +export type CreateHierarchyError = (Error); export type GetHierarchyData = { query?: { @@ -2986,9 +2986,9 @@ export type GetHierarchyData = { }; }; -export type GetHierarchyResponse = (multi_hierarchy); +export type GetHierarchyResponse = (MultiHierarchy); -export type GetHierarchyError = (error); +export type GetHierarchyError = (Error); export type GetHierarchyChildData = { path: { @@ -2999,12 +2999,12 @@ export type GetHierarchyChildData = { }; }; -export type GetHierarchyChildResponse = (single_hierarchy); +export type GetHierarchyChildResponse = (SingleHierarchy); -export type GetHierarchyChildError = (error); +export type GetHierarchyChildError = (Error); export type UpdateHierarchyData = { - body: update_hierarchy; + body: UpdateHierarchy; path: { /** * A unique identifier for the hierarchy. @@ -3013,9 +3013,9 @@ export type UpdateHierarchyData = { }; }; -export type UpdateHierarchyResponse = (single_hierarchy); +export type UpdateHierarchyResponse = (SingleHierarchy); -export type UpdateHierarchyError = (error); +export type UpdateHierarchyError = (Error); export type DeleteHierarchyData = { path: { @@ -3028,10 +3028,10 @@ export type DeleteHierarchyData = { export type DeleteHierarchyResponse = (void); -export type DeleteHierarchyError = (error); +export type DeleteHierarchyError = (Error); export type CreateNodeData = { - body?: create_node; + body?: CreateNode; path: { /** * A unique identifier for the hierarchy. @@ -3040,9 +3040,9 @@ export type CreateNodeData = { }; }; -export type CreateNodeResponse = (single_node); +export type CreateNodeResponse = (SingleNode); -export type CreateNodeError = (error); +export type CreateNodeError = (Error); export type GetAllNodesInHierarchyData = { path: { @@ -3063,9 +3063,9 @@ export type GetAllNodesInHierarchyData = { }; }; -export type GetAllNodesInHierarchyResponse = (multi_nodes); +export type GetAllNodesInHierarchyResponse = (MultiNodes); -export type GetAllNodesInHierarchyError = (error); +export type GetAllNodesInHierarchyError = (Error); export type GetHierarchyNodeData = { path: { @@ -3080,12 +3080,12 @@ export type GetHierarchyNodeData = { }; }; -export type GetHierarchyNodeResponse = (single_node); +export type GetHierarchyNodeResponse = (SingleNode); -export type GetHierarchyNodeError = (error); +export type GetHierarchyNodeError = (Error); export type UpdateNodeData = { - body?: update_node; + body?: UpdateNode; path: { /** * A unique identifier for the hierarchy. @@ -3098,9 +3098,9 @@ export type UpdateNodeData = { }; }; -export type UpdateNodeResponse = (single_node); +export type UpdateNodeResponse = (SingleNode); -export type UpdateNodeError = (error); +export type UpdateNodeError = (Error); export type DeleteNodeData = { path: { @@ -3117,7 +3117,7 @@ export type DeleteNodeData = { export type DeleteNodeResponse = (void); -export type DeleteNodeError = (error); +export type DeleteNodeError = (Error); export type GetAllChildrenData = { path: { @@ -3138,12 +3138,12 @@ export type GetAllChildrenData = { }; }; -export type GetAllChildrenResponse = (multi_nodes); +export type GetAllChildrenResponse = (MultiNodes); -export type GetAllChildrenError = (error); +export type GetAllChildrenError = (Error); export type CreateNodeChildRelationshipsData = { - body?: node_children; + body?: NodeChildren; path: { /** * A unique identifier for the hierarchy. @@ -3156,9 +3156,9 @@ export type CreateNodeChildRelationshipsData = { }; }; -export type CreateNodeChildRelationshipsResponse = (single_node); +export type CreateNodeChildRelationshipsResponse = (SingleNode); -export type CreateNodeChildRelationshipsError = (error); +export type CreateNodeChildRelationshipsError = (Error); export type GetAllNodeChildrenData = { path: { @@ -3183,12 +3183,12 @@ export type GetAllNodeChildrenData = { }; }; -export type GetAllNodeChildrenResponse = (multi_nodes); +export type GetAllNodeChildrenResponse = (MultiNodes); -export type GetAllNodeChildrenError = (error); +export type GetAllNodeChildrenError = (Error); export type UpdateNodeParentData = { - body?: node_parent; + body?: NodeParent; path: { /** * A unique identifier for the hierarchy. @@ -3203,7 +3203,7 @@ export type UpdateNodeParentData = { export type UpdateNodeParentResponse = (void); -export type UpdateNodeParentError = (error); +export type UpdateNodeParentError = (Error); export type DeleteNodeParentData = { path: { @@ -3220,10 +3220,10 @@ export type DeleteNodeParentData = { export type DeleteNodeParentResponse = (void); -export type DeleteNodeParentError = (error); +export type DeleteNodeParentError = (Error); export type CreateNodeProductRelationshipData = { - body?: node_products; + body?: NodeProducts; path: { /** * A unique identifier for the hierarchy. @@ -3236,12 +3236,12 @@ export type CreateNodeProductRelationshipData = { }; }; -export type CreateNodeProductRelationshipResponse = (single_node); +export type CreateNodeProductRelationshipResponse = (SingleNode); -export type CreateNodeProductRelationshipError = (error); +export type CreateNodeProductRelationshipError = (Error); export type DeleteNodeProductRelationshipsData = { - body?: node_products; + body?: NodeProducts; path: { /** * A unique identifier for the hierarchy. @@ -3254,9 +3254,9 @@ export type DeleteNodeProductRelationshipsData = { }; }; -export type DeleteNodeProductRelationshipsResponse = (single_node); +export type DeleteNodeProductRelationshipsResponse = (SingleNode); -export type DeleteNodeProductRelationshipsError = (error); +export type DeleteNodeProductRelationshipsError = (Error); export type GetNodeProductsData = { path: { @@ -3281,12 +3281,12 @@ export type GetNodeProductsData = { }; }; -export type GetNodeProductsResponse = (multi_product_response); +export type GetNodeProductsResponse = (MultiProductResponse); -export type GetNodeProductsError = (error); +export type GetNodeProductsError = (Error); export type DuplicateHierarchyData = { - body: duplicate_job; + body: DuplicateJob; path: { /** * A unique identifier for the hierarchy. @@ -3295,13 +3295,13 @@ export type DuplicateHierarchyData = { }; }; -export type DuplicateHierarchyResponse = (single); +export type DuplicateHierarchyResponse = (Single); -export type DuplicateHierarchyError = (error); +export type DuplicateHierarchyError = (Error); -export type GetAllProductTagsResponse = (multi_tag); +export type GetAllProductTagsResponse = (MultiTag); -export type GetAllProductTagsError = (error); +export type GetAllProductTagsError = (Error); export type GetProductTagData = { path: { @@ -3312,20 +3312,20 @@ export type GetProductTagData = { }; }; -export type GetProductTagResponse = (single_tag); +export type GetProductTagResponse = (SingleTag); -export type GetProductTagError = (error); +export type GetProductTagError = (Error); export type CreateCustomRelationshipData = { - body: create_custom_relationship; + body: CreateCustomRelationship; }; -export type CreateCustomRelationshipResponse = (single_custom_relationship); +export type CreateCustomRelationshipResponse = (SingleCustomRelationship); -export type CreateCustomRelationshipError = (error); +export type CreateCustomRelationshipError = (Error); export type UpdateCustomRelationshipData = { - body: update_custom_relationship; + body: UpdateCustomRelationship; path: { /** * A custom relationship slug. @@ -3334,6 +3334,463 @@ export type UpdateCustomRelationshipData = { }; }; -export type UpdateCustomRelationshipResponse = (single_custom_relationship); +export type UpdateCustomRelationshipResponse = (SingleCustomRelationship); + +export type UpdateCustomRelationshipError = (Error); + +export type GetAllJobsResponseTransformer = (data: any) => Promise; + +export type MultiModelResponseTransformer = (data: any) => Multi; + +export type JobModelResponseTransformer = (data: any) => Job; + +export const JobModelResponseTransformer: JobModelResponseTransformer = data => { + if (data?.attributes?.started_at) { + data.attributes.started_at = new Date(data.attributes.started_at); + } + if (data?.attributes?.completed_at) { + data.attributes.completed_at = new Date(data.attributes.completed_at); + } + if (data?.attributes?.created_at) { + data.attributes.created_at = new Date(data.attributes.created_at); + } + if (data?.attributes?.updated_at) { + data.attributes.updated_at = new Date(data.attributes.updated_at); + } + return data; +}; + +export const MultiModelResponseTransformer: MultiModelResponseTransformer = data => { + if (Array.isArray(data?.data)) { + data.data.forEach(JobModelResponseTransformer); + } + return data; +}; + +export const GetAllJobsResponseTransformer: GetAllJobsResponseTransformer = async (data) => { + MultiModelResponseTransformer(data); + return data; +}; + +export type GetJobResponseTransformer = (data: any) => Promise; + +export type SingleModelResponseTransformer = (data: any) => Single; + +export const SingleModelResponseTransformer: SingleModelResponseTransformer = data => { + if (data?.data) { + JobModelResponseTransformer(data.data); + } + return data; +}; + +export const GetJobResponseTransformer: GetJobResponseTransformer = async (data) => { + SingleModelResponseTransformer(data); + return data; +}; + +export type CancelJobResponseTransformer = (data: any) => Promise; + +export const CancelJobResponseTransformer: CancelJobResponseTransformer = async (data) => { + SingleModelResponseTransformer(data); + return data; +}; + +export type CreateProductResponseTransformer = (data: any) => Promise; + +export type SingleProductResponseModelResponseTransformer = (data: any) => SingleProductResponse; + +export type ProductResponseModelResponseTransformer = (data: any) => ProductResponse; + +export const ProductResponseModelResponseTransformer: ProductResponseModelResponseTransformer = data => { + if (data?.meta?.created_at) { + data.meta.created_at = new Date(data.meta.created_at); + } + if (data?.meta?.updated_at) { + data.meta.updated_at = new Date(data.meta.updated_at); + } + return data; +}; + +export const SingleProductResponseModelResponseTransformer: SingleProductResponseModelResponseTransformer = data => { + if (data?.data) { + ProductResponseModelResponseTransformer(data.data); + } + if (Array.isArray(data?.included?.component_products)) { + data.included.component_products.forEach(ProductResponseModelResponseTransformer); + } + return data; +}; + +export const CreateProductResponseTransformer: CreateProductResponseTransformer = async (data) => { + SingleProductResponseModelResponseTransformer(data); + return data; +}; + +export type GetAllProductsResponseTransformer = (data: any) => Promise; + +export type MultiProductResponseModelResponseTransformer = (data: any) => MultiProductResponse; + +export const MultiProductResponseModelResponseTransformer: MultiProductResponseModelResponseTransformer = data => { + if (Array.isArray(data?.data)) { + data.data.forEach(ProductResponseModelResponseTransformer); + } + if (Array.isArray(data?.included?.component_products)) { + data.included.component_products.forEach(ProductResponseModelResponseTransformer); + } + return data; +}; + +export const GetAllProductsResponseTransformer: GetAllProductsResponseTransformer = async (data) => { + MultiProductResponseModelResponseTransformer(data); + return data; +}; + +export type ImportProductsResponseTransformer = (data: any) => Promise; + +export const ImportProductsResponseTransformer: ImportProductsResponseTransformer = async (data) => { + SingleModelResponseTransformer(data); + return data; +}; + +export type ExportProductsResponseTransformer = (data: any) => Promise; + +export const ExportProductsResponseTransformer: ExportProductsResponseTransformer = async (data) => { + SingleModelResponseTransformer(data); + return data; +}; + +export type GetProductResponseTransformer = (data: any) => Promise; + +export const GetProductResponseTransformer: GetProductResponseTransformer = async (data) => { + SingleProductResponseModelResponseTransformer(data); + return data; +}; + +export type UpdateProductResponseTransformer = (data: any) => Promise; + +export const UpdateProductResponseTransformer: UpdateProductResponseTransformer = async (data) => { + SingleProductResponseModelResponseTransformer(data); + return data; +}; + +export type GetProductsNodesResponseTransformer = (data: any) => Promise; + +export type MultiNodesModelResponseTransformer = (data: any) => MultiNodes; + +export type NodeModelResponseTransformer = (data: any) => Node; + +export const NodeModelResponseTransformer: NodeModelResponseTransformer = data => { + if (data?.meta?.created_at) { + data.meta.created_at = new Date(data.meta.created_at); + } + if (data?.meta?.updated_at) { + data.meta.updated_at = new Date(data.meta.updated_at); + } + return data; +}; + +export const MultiNodesModelResponseTransformer: MultiNodesModelResponseTransformer = data => { + if (Array.isArray(data?.data)) { + data.data.forEach(NodeModelResponseTransformer); + } + return data; +}; + +export const GetProductsNodesResponseTransformer: GetProductsNodesResponseTransformer = async (data) => { + MultiNodesModelResponseTransformer(data); + return data; +}; + +export type GetChildProductsResponseTransformer = (data: any) => Promise; + +export const GetChildProductsResponseTransformer: GetChildProductsResponseTransformer = async (data) => { + MultiProductResponseModelResponseTransformer(data); + return data; +}; + +export type CreateVariationResponseTransformer = (data: any) => Promise; + +export type CreatedVariationModelResponseTransformer = (data: any) => CreatedVariation; + +export const CreatedVariationModelResponseTransformer: CreatedVariationModelResponseTransformer = data => { + if (data?.data?.meta?.created_at) { + data.data.meta.created_at = new Date(data.data.meta.created_at); + } + if (data?.data?.meta?.updated_at) { + data.data.meta.updated_at = new Date(data.data.meta.updated_at); + } + return data; +}; + +export const CreateVariationResponseTransformer: CreateVariationResponseTransformer = async (data) => { + CreatedVariationModelResponseTransformer(data); + return data; +}; + +export type CreateVariationOptionResponseTransformer = (data: any) => Promise; + +export type CreatedOptionModelResponseTransformer = (data: any) => CreatedOption; + +export const CreatedOptionModelResponseTransformer: CreatedOptionModelResponseTransformer = data => { + if (data?.data?.meta?.created_at) { + data.data.meta.created_at = new Date(data.data.meta.created_at); + } + if (data?.data?.meta?.updated_at) { + data.data.meta.updated_at = new Date(data.data.meta.updated_at); + } + return data; +}; + +export const CreateVariationOptionResponseTransformer: CreateVariationOptionResponseTransformer = async (data) => { + CreatedOptionModelResponseTransformer(data); + return data; +}; + +export type GetVariationOptionResponseTransformer = (data: any) => Promise; + +export type SingleOptionModelResponseTransformer = (data: any) => SingleOption; + +export const SingleOptionModelResponseTransformer: SingleOptionModelResponseTransformer = data => { + if (data?.data?.meta?.created_at) { + data.data.meta.created_at = new Date(data.data.meta.created_at); + } + if (data?.data?.meta?.updated_at) { + data.data.meta.updated_at = new Date(data.data.meta.updated_at); + } + return data; +}; + +export const GetVariationOptionResponseTransformer: GetVariationOptionResponseTransformer = async (data) => { + SingleOptionModelResponseTransformer(data); + return data; +}; + +export type UpdateVariationOptionResponseTransformer = (data: any) => Promise; + +export const UpdateVariationOptionResponseTransformer: UpdateVariationOptionResponseTransformer = async (data) => { + SingleOptionModelResponseTransformer(data); + return data; +}; + +export type CreateHierarchyResponseTransformer = (data: any) => Promise; + +export type SingleHierarchyModelResponseTransformer = (data: any) => SingleHierarchy; + +export type HierarchyModelResponseTransformer = (data: any) => Hierarchy; + +export const HierarchyModelResponseTransformer: HierarchyModelResponseTransformer = data => { + if (data?.meta?.created_at) { + data.meta.created_at = new Date(data.meta.created_at); + } + if (data?.meta?.updated_at) { + data.meta.updated_at = new Date(data.meta.updated_at); + } + return data; +}; + +export const SingleHierarchyModelResponseTransformer: SingleHierarchyModelResponseTransformer = data => { + if (data?.data) { + HierarchyModelResponseTransformer(data.data); + } + return data; +}; + +export const CreateHierarchyResponseTransformer: CreateHierarchyResponseTransformer = async (data) => { + SingleHierarchyModelResponseTransformer(data); + return data; +}; + +export type GetHierarchyResponseTransformer = (data: any) => Promise; + +export type MultiHierarchyModelResponseTransformer = (data: any) => MultiHierarchy; + +export const MultiHierarchyModelResponseTransformer: MultiHierarchyModelResponseTransformer = data => { + if (Array.isArray(data?.data)) { + data.data.forEach(HierarchyModelResponseTransformer); + } + return data; +}; + +export const GetHierarchyResponseTransformer: GetHierarchyResponseTransformer = async (data) => { + MultiHierarchyModelResponseTransformer(data); + return data; +}; + +export type GetHierarchyChildResponseTransformer = (data: any) => Promise; + +export const GetHierarchyChildResponseTransformer: GetHierarchyChildResponseTransformer = async (data) => { + SingleHierarchyModelResponseTransformer(data); + return data; +}; + +export type UpdateHierarchyResponseTransformer = (data: any) => Promise; + +export const UpdateHierarchyResponseTransformer: UpdateHierarchyResponseTransformer = async (data) => { + SingleHierarchyModelResponseTransformer(data); + return data; +}; + +export type CreateNodeResponseTransformer = (data: any) => Promise; + +export type SingleNodeModelResponseTransformer = (data: any) => SingleNode; + +export const SingleNodeModelResponseTransformer: SingleNodeModelResponseTransformer = data => { + if (data?.data) { + NodeModelResponseTransformer(data.data); + } + return data; +}; + +export const CreateNodeResponseTransformer: CreateNodeResponseTransformer = async (data) => { + SingleNodeModelResponseTransformer(data); + return data; +}; + +export type GetAllNodesInHierarchyResponseTransformer = (data: any) => Promise; + +export const GetAllNodesInHierarchyResponseTransformer: GetAllNodesInHierarchyResponseTransformer = async (data) => { + MultiNodesModelResponseTransformer(data); + return data; +}; + +export type GetHierarchyNodeResponseTransformer = (data: any) => Promise; + +export const GetHierarchyNodeResponseTransformer: GetHierarchyNodeResponseTransformer = async (data) => { + SingleNodeModelResponseTransformer(data); + return data; +}; + +export type UpdateNodeResponseTransformer = (data: any) => Promise; + +export const UpdateNodeResponseTransformer: UpdateNodeResponseTransformer = async (data) => { + SingleNodeModelResponseTransformer(data); + return data; +}; + +export type GetAllChildrenResponseTransformer = (data: any) => Promise; + +export const GetAllChildrenResponseTransformer: GetAllChildrenResponseTransformer = async (data) => { + MultiNodesModelResponseTransformer(data); + return data; +}; + +export type CreateNodeChildRelationshipsResponseTransformer = (data: any) => Promise; + +export const CreateNodeChildRelationshipsResponseTransformer: CreateNodeChildRelationshipsResponseTransformer = async (data) => { + SingleNodeModelResponseTransformer(data); + return data; +}; + +export type GetAllNodeChildrenResponseTransformer = (data: any) => Promise; + +export const GetAllNodeChildrenResponseTransformer: GetAllNodeChildrenResponseTransformer = async (data) => { + MultiNodesModelResponseTransformer(data); + return data; +}; + +export type CreateNodeProductRelationshipResponseTransformer = (data: any) => Promise; + +export const CreateNodeProductRelationshipResponseTransformer: CreateNodeProductRelationshipResponseTransformer = async (data) => { + SingleNodeModelResponseTransformer(data); + return data; +}; + +export type DeleteNodeProductRelationshipsResponseTransformer = (data: any) => Promise; + +export const DeleteNodeProductRelationshipsResponseTransformer: DeleteNodeProductRelationshipsResponseTransformer = async (data) => { + SingleNodeModelResponseTransformer(data); + return data; +}; + +export type GetNodeProductsResponseTransformer = (data: any) => Promise; + +export const GetNodeProductsResponseTransformer: GetNodeProductsResponseTransformer = async (data) => { + MultiProductResponseModelResponseTransformer(data); + return data; +}; + +export type DuplicateHierarchyResponseTransformer = (data: any) => Promise; + +export const DuplicateHierarchyResponseTransformer: DuplicateHierarchyResponseTransformer = async (data) => { + SingleModelResponseTransformer(data); + return data; +}; + +export type GetAllProductTagsResponseTransformer = (data: any) => Promise; + +export type MultiTagModelResponseTransformer = (data: any) => MultiTag; + +export type TagModelResponseTransformer = (data: any) => Tag; + +export const TagModelResponseTransformer: TagModelResponseTransformer = data => { + if (data?.meta?.created_at) { + data.meta.created_at = new Date(data.meta.created_at); + } + if (data?.meta?.updated_at) { + data.meta.updated_at = new Date(data.meta.updated_at); + } + return data; +}; + +export const MultiTagModelResponseTransformer: MultiTagModelResponseTransformer = data => { + if (Array.isArray(data?.data)) { + data.data.forEach(TagModelResponseTransformer); + } + return data; +}; + +export const GetAllProductTagsResponseTransformer: GetAllProductTagsResponseTransformer = async (data) => { + MultiTagModelResponseTransformer(data); + return data; +}; + +export type GetProductTagResponseTransformer = (data: any) => Promise; + +export type SingleTagModelResponseTransformer = (data: any) => SingleTag; + +export const SingleTagModelResponseTransformer: SingleTagModelResponseTransformer = data => { + if (data?.data) { + TagModelResponseTransformer(data.data); + } + return data; +}; + +export const GetProductTagResponseTransformer: GetProductTagResponseTransformer = async (data) => { + SingleTagModelResponseTransformer(data); + return data; +}; + +export type CreateCustomRelationshipResponseTransformer = (data: any) => Promise; + +export type SingleCustomRelationshipModelResponseTransformer = (data: any) => SingleCustomRelationship; + +export type CustomRelationshipModelResponseTransformer = (data: any) => CustomRelationship; + +export const CustomRelationshipModelResponseTransformer: CustomRelationshipModelResponseTransformer = data => { + if (data?.meta?.timestamps?.created_at) { + data.meta.timestamps.created_at = new Date(data.meta.timestamps.created_at); + } + if (data?.meta?.timestamps?.updated_at) { + data.meta.timestamps.updated_at = new Date(data.meta.timestamps.updated_at); + } + return data; +}; + +export const SingleCustomRelationshipModelResponseTransformer: SingleCustomRelationshipModelResponseTransformer = data => { + if (data?.data) { + CustomRelationshipModelResponseTransformer(data.data); + } + return data; +}; + +export const CreateCustomRelationshipResponseTransformer: CreateCustomRelationshipResponseTransformer = async (data) => { + SingleCustomRelationshipModelResponseTransformer(data); + return data; +}; + +export type UpdateCustomRelationshipResponseTransformer = (data: any) => Promise; -export type UpdateCustomRelationshipError = (error); \ No newline at end of file +export const UpdateCustomRelationshipResponseTransformer: UpdateCustomRelationshipResponseTransformer = async (data) => { + SingleCustomRelationshipModelResponseTransformer(data); + return data; +}; \ No newline at end of file From cccdcb5637a42e8c1e103236148f51e8ec59d10b Mon Sep 17 00:00:00 2001 From: Robert Field Date: Fri, 10 Jan 2025 16:08:06 +0000 Subject: [PATCH 29/30] feat: use latest parser --- packages/sdks/pim/openapi-ts.config.ts | 4 +- packages/sdks/pim/src/client/index.ts | 2 +- packages/sdks/pim/src/client/sdk.gen.ts | 1369 ++- .../sdks/pim/src/client/transformers.gen.ts | 631 ++ packages/sdks/pim/src/client/types.gen.ts | 8737 ++++++++++------- 5 files changed, 6783 insertions(+), 3960 deletions(-) create mode 100644 packages/sdks/pim/src/client/transformers.gen.ts diff --git a/packages/sdks/pim/openapi-ts.config.ts b/packages/sdks/pim/openapi-ts.config.ts index e53954e7..3270ccf6 100644 --- a/packages/sdks/pim/openapi-ts.config.ts +++ b/packages/sdks/pim/openapi-ts.config.ts @@ -2,13 +2,13 @@ import { defaultPlugins, defineConfig } from "@hey-api/openapi-ts" export default defineConfig({ client: "@hey-api/client-fetch", + experimentalParser: true, input: "../specs/pim.yaml", output: { path: "src/client", format: "prettier" }, plugins: [ ...defaultPlugins, { - style: "PascalCase", - exportInlineEnums: false, + exportInlineEnums: true, name: "@hey-api/typescript", }, { diff --git a/packages/sdks/pim/src/client/index.ts b/packages/sdks/pim/src/client/index.ts index bbc0aa80..44d2c904 100644 --- a/packages/sdks/pim/src/client/index.ts +++ b/packages/sdks/pim/src/client/index.ts @@ -1,3 +1,3 @@ // This file is auto-generated by @hey-api/openapi-ts -export * from "./sdk.gen" export * from "./types.gen" +export * from "./sdk.gen" diff --git a/packages/sdks/pim/src/client/sdk.gen.ts b/packages/sdks/pim/src/client/sdk.gen.ts index 7ccd4b3e..c25fee9c 100644 --- a/packages/sdks/pim/src/client/sdk.gen.ts +++ b/packages/sdks/pim/src/client/sdk.gen.ts @@ -3,218 +3,219 @@ import { createClient, createConfig, - type OptionsLegacyParser, + type Options, formDataBodySerializer, } from "@hey-api/client-fetch" import type { - GetAllJobsError, + GetAllJobsData, GetAllJobsResponse, + GetAllJobsError, GetJobData, - GetJobError, GetJobResponse, + GetJobError, CancelJobData, - CancelJobError, CancelJobResponse, + CancelJobError, GetJobErrorsData, - GetJobErrorsError, GetJobErrorsResponse, - CreateProductData, - CreateProductError, - CreateProductResponse, + GetJobErrorsError, GetAllProductsData, - GetAllProductsError, GetAllProductsResponse, + GetAllProductsError, + CreateProductData, + CreateProductResponse, + CreateProductError, ImportProductsData, - ImportProductsError, ImportProductsResponse, + ImportProductsError, ExportProductsData, - ExportProductsError, ExportProductsResponse, + ExportProductsError, + DeleteProductData, + DeleteProductResponse, + DeleteProductError, GetProductData, - GetProductError, GetProductResponse, + GetProductError, UpdateProductData, - UpdateProductError, UpdateProductResponse, - DeleteProductData, - DeleteProductError, - DeleteProductResponse, + UpdateProductError, AttachNodesData, - AttachNodesError, AttachNodesResponse, + AttachNodesError, DetachNodesData, - DetachNodesError, DetachNodesResponse, + DetachNodesError, GetProductsNodesData, - GetProductsNodesError, GetProductsNodesResponse, + GetProductsNodesError, BuildChildProductsData, BuildChildProductsError, - BuildChildProductsResponse, GetChildProductsData, - GetChildProductsError, GetChildProductsResponse, - CreateProductTemplateRelationshipData, - CreateProductTemplateRelationshipError, - CreateProductTemplateRelationshipResponse, - GetProductTemplateRelationshipsData, - GetProductTemplateRelationshipsError, - GetProductTemplateRelationshipsResponse, + GetChildProductsError, DeleteProductTemplateRelationshipData, - DeleteProductTemplateRelationshipError, DeleteProductTemplateRelationshipResponse, + DeleteProductTemplateRelationshipError, + GetProductTemplateRelationshipsData, + GetProductTemplateRelationshipsResponse, + GetProductTemplateRelationshipsError, + CreateProductTemplateRelationshipData, + CreateProductTemplateRelationshipResponse, + CreateProductTemplateRelationshipError, GetProductComponentProductsRelationshipsData, - GetProductComponentProductsRelationshipsError, GetProductComponentProductsRelationshipsResponse, + GetProductComponentProductsRelationshipsError, + DeleteProductFileRelationshipsData, + DeleteProductFileRelationshipsResponse, + DeleteProductFileRelationshipsError, GetProductFileRelationshipsData, - GetProductFileRelationshipsError, GetProductFileRelationshipsResponse, + GetProductFileRelationshipsError, CreateProductFileRelationshipsData, - CreateProductFileRelationshipsError, CreateProductFileRelationshipsResponse, + CreateProductFileRelationshipsError, UpdateProductFileRelationshipsData, - UpdateProductFileRelationshipsError, UpdateProductFileRelationshipsResponse, - DeleteProductFileRelationshipsData, - DeleteProductFileRelationshipsError, - DeleteProductFileRelationshipsResponse, - CreateProductVariationRelationshipsData, - CreateProductVariationRelationshipsError, - CreateProductVariationRelationshipsResponse, + UpdateProductFileRelationshipsError, + DeleteProductVariationRelationshipsData, + DeleteProductVariationRelationshipsResponse, + DeleteProductVariationRelationshipsError, GetProductVariationRelationshipsData, - GetProductVariationRelationshipsError, GetProductVariationRelationshipsResponse, + GetProductVariationRelationshipsError, + CreateProductVariationRelationshipsData, + CreateProductVariationRelationshipsResponse, + CreateProductVariationRelationshipsError, UpdateProductVariationRelationshipsData, - UpdateProductVariationRelationshipsError, UpdateProductVariationRelationshipsResponse, - DeleteProductVariationRelationshipsData, - DeleteProductVariationRelationshipsError, - DeleteProductVariationRelationshipsResponse, - CreateProductMainImageRelationshipsData, - CreateProductMainImageRelationshipsError, - CreateProductMainImageRelationshipsResponse, + UpdateProductVariationRelationshipsError, + DeleteProductMainImageRelationshipsData, + DeleteProductMainImageRelationshipsResponse, + DeleteProductMainImageRelationshipsError, GetProductMainImageRelationshipsData, - GetProductMainImageRelationshipsError, GetProductMainImageRelationshipsResponse, + GetProductMainImageRelationshipsError, + CreateProductMainImageRelationshipsData, + CreateProductMainImageRelationshipsResponse, + CreateProductMainImageRelationshipsError, UpdateProductMainImageRelationshipsData, - UpdateProductMainImageRelationshipsError, UpdateProductMainImageRelationshipsResponse, - DeleteProductMainImageRelationshipsData, - DeleteProductMainImageRelationshipsError, - DeleteProductMainImageRelationshipsResponse, - CreateVariationData, - CreateVariationError, - CreateVariationResponse, + UpdateProductMainImageRelationshipsError, GetAllVariationsData, - GetAllVariationsError, GetAllVariationsResponse, + GetAllVariationsError, + CreateVariationData, + CreateVariationResponse, + CreateVariationError, + DeleteVariationData, + DeleteVariationResponse, + DeleteVariationError, GetVariationData, - GetVariationError, GetVariationResponse, + GetVariationError, UpdateVariationData, - UpdateVariationError, UpdateVariationResponse, - DeleteVariationData, - DeleteVariationError, - DeleteVariationResponse, - CreateVariationOptionData, - CreateVariationOptionError, - CreateVariationOptionResponse, + UpdateVariationError, GetAllVariationOptionsData, - GetAllVariationOptionsError, GetAllVariationOptionsResponse, + GetAllVariationOptionsError, + CreateVariationOptionData, + CreateVariationOptionResponse, + CreateVariationOptionError, + DeleteVariationOptionData, + DeleteVariationOptionResponse, + DeleteVariationOptionError, GetVariationOptionData, - GetVariationOptionError, GetVariationOptionResponse, + GetVariationOptionError, UpdateVariationOptionData, - UpdateVariationOptionError, UpdateVariationOptionResponse, - DeleteVariationOptionData, - DeleteVariationOptionError, - DeleteVariationOptionResponse, - CreateModifierData, - CreateModifierError, - CreateModifierResponse, + UpdateVariationOptionError, GetAllModifiersData, - GetAllModifiersError, GetAllModifiersResponse, + GetAllModifiersError, + CreateModifierData, + CreateModifierResponse, + CreateModifierError, + DeleteModifierData, + DeleteModifierResponse, + DeleteModifierError, GetModifierData, - GetModifierError, GetModifierResponse, + GetModifierError, UpdateModifierData, - UpdateModifierError, UpdateModifierResponse, - DeleteModifierData, - DeleteModifierError, - DeleteModifierResponse, - CreateHierarchyData, - CreateHierarchyError, - CreateHierarchyResponse, + UpdateModifierError, GetHierarchyData, - GetHierarchyError, GetHierarchyResponse, + GetHierarchyError, + CreateHierarchyData, + CreateHierarchyResponse, + CreateHierarchyError, + DeleteHierarchyData, + DeleteHierarchyResponse, + DeleteHierarchyError, GetHierarchyChildData, - GetHierarchyChildError, GetHierarchyChildResponse, + GetHierarchyChildError, UpdateHierarchyData, - UpdateHierarchyError, UpdateHierarchyResponse, - DeleteHierarchyData, - DeleteHierarchyError, - DeleteHierarchyResponse, - CreateNodeData, - CreateNodeError, - CreateNodeResponse, + UpdateHierarchyError, GetAllNodesInHierarchyData, - GetAllNodesInHierarchyError, GetAllNodesInHierarchyResponse, + GetAllNodesInHierarchyError, + CreateNodeData, + CreateNodeResponse, + CreateNodeError, + DeleteNodeData, + DeleteNodeResponse, + DeleteNodeError, GetHierarchyNodeData, - GetHierarchyNodeError, GetHierarchyNodeResponse, + GetHierarchyNodeError, UpdateNodeData, - UpdateNodeError, UpdateNodeResponse, - DeleteNodeData, - DeleteNodeError, - DeleteNodeResponse, + UpdateNodeError, GetAllChildrenData, - GetAllChildrenError, GetAllChildrenResponse, + GetAllChildrenError, CreateNodeChildRelationshipsData, - CreateNodeChildRelationshipsError, CreateNodeChildRelationshipsResponse, + CreateNodeChildRelationshipsError, GetAllNodeChildrenData, - GetAllNodeChildrenError, GetAllNodeChildrenResponse, - UpdateNodeParentData, - UpdateNodeParentError, - UpdateNodeParentResponse, + GetAllNodeChildrenError, DeleteNodeParentData, - DeleteNodeParentError, DeleteNodeParentResponse, - CreateNodeProductRelationshipData, - CreateNodeProductRelationshipError, - CreateNodeProductRelationshipResponse, + DeleteNodeParentError, + UpdateNodeParentData, + UpdateNodeParentResponse, + UpdateNodeParentError, DeleteNodeProductRelationshipsData, - DeleteNodeProductRelationshipsError, DeleteNodeProductRelationshipsResponse, + DeleteNodeProductRelationshipsError, + CreateNodeProductRelationshipData, + CreateNodeProductRelationshipResponse, + CreateNodeProductRelationshipError, GetNodeProductsData, - GetNodeProductsError, GetNodeProductsResponse, + GetNodeProductsError, DuplicateHierarchyData, - DuplicateHierarchyError, DuplicateHierarchyResponse, - GetAllProductTagsError, + DuplicateHierarchyError, + GetAllProductTagsData, GetAllProductTagsResponse, + GetAllProductTagsError, GetProductTagData, - GetProductTagError, GetProductTagResponse, + GetProductTagError, CreateCustomRelationshipData, - CreateCustomRelationshipError, CreateCustomRelationshipResponse, + CreateCustomRelationshipError, UpdateCustomRelationshipData, - UpdateCustomRelationshipError, UpdateCustomRelationshipResponse, + UpdateCustomRelationshipError, } from "./types.gen" export const client = createClient(createConfig()) @@ -224,7 +225,7 @@ export const client = createClient(createConfig()) * The jobs endpoints displays the status of a number of endpoints that function as jobs, for example, product import and export, price book import, building child products, and duplicating hierarchies. */ export const getAllJobs = ( - options?: OptionsLegacyParser, + options?: Options, ) => { return (options?.client ?? client).get< GetAllJobsResponse, @@ -232,6 +233,12 @@ export const getAllJobs = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/jobs", }) } @@ -240,7 +247,7 @@ export const getAllJobs = ( * Get a Job */ export const getJob = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).get< GetJobResponse, @@ -248,6 +255,12 @@ export const getJob = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/jobs/{jobID}", }) } @@ -260,7 +273,7 @@ export const getJob = ( * */ export const cancelJob = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).post< CancelJobResponse, @@ -268,6 +281,16 @@ export const cancelJob = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/jobs/{jobID}/cancel", }) } @@ -276,7 +299,7 @@ export const cancelJob = ( * Get Job Errors */ export const getJobErrors = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).get< GetJobErrorsResponse, @@ -284,10 +307,54 @@ export const getJobErrors = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/jobs/{jobID}/errors", }) } +/** + * Get all products + * Retrieves a list of all your products in the Product Experience Manager system. + * + * You can also use `include` to retrieve top-level resources, such as files or images, and key attribute data, such as SKU or slug for component products in a product bundle. With this option, you can get more information about the products in a product bundle in your store front, improving the buying experience for your shoppers. + * + * #### Filtering + * + * Many Commerce API endpoints support filtering. The general syntax is described in [**Filtering**](/docs/commerce-cloud/api-overview/filtering). + * + * The following attributes and operators are supported. + * + * | Operator | Attribute | Description | Example | + * | :--- |:------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------| + * | `eq` | `sku`, `slug`,`upc_ean`, `mpn`, `name`, `templates`, `commodity_type`, `owner`, `product_types`, `tags` | Equals. Checks if the values of two operands are equal. If they are, the condition is true. For `product_types`, you can only specify one product type. For example, `filter=eq(product_types,child)` | `filter=eq(name,some-name)` | + * | `like` | `sku`, `slug`,`upc_ean`, `mpn`, `name`, `tags` | Like. Checks if the operand contains the specified string. Wildcards are supported. | `filter=like(name,*some-name*)` | + * | `In` | `id`, `name`, `SKU`, `slug`, `upc_ean`, `mpn`, `product_types`, `tags` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `filter=in(id,some-id)` | + * + */ +export const getAllProducts = ( + options?: Options, +) => { + return (options?.client ?? client).get< + GetAllProductsResponse, + GetAllProductsError, + ThrowOnError + >({ + ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/pcm/products", + }) +} + /** * Create a product or bundle * Creates a product or bundle with the attributes that are defined in the body. @@ -329,7 +396,7 @@ export const getJobErrors = ( * */ export const createProduct = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).post< CreateProductResponse, @@ -337,38 +404,16 @@ export const createProduct = ( ThrowOnError >({ ...options, - url: "/pcm/products", - }) -} - -/** - * Get all products - * Retrieves a list of all your products in the Product Experience Manager system. - * - * You can also use `include` to retrieve top-level resources, such as files or images, and key attribute data, such as SKU or slug for component products in a product bundle. With this option, you can get more information about the products in a product bundle in your store front, improving the buying experience for your shoppers. - * - * #### Filtering - * - * Many Commerce API endpoints support filtering. The general syntax is described in [**Filtering**](/docs/commerce-cloud/api-overview/filtering). - * - * The following attributes and operators are supported. - * - * | Operator | Attribute | Description | Example | - * | :--- |:------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------| - * | `eq` | `sku`, `slug`,`upc_ean`, `mpn`, `name`, `templates`, `commodity_type`, `owner`, `product_types`, `tags` | Equals. Checks if the values of two operands are equal. If they are, the condition is true. For `product_types`, you can only specify one product type. For example, `filter=eq(product_types,child)` | `filter=eq(name,some-name)` | - * | `like` | `sku`, `slug`,`upc_ean`, `mpn`, `name`, `tags` | Like. Checks if the operand contains the specified string. Wildcards are supported. | `filter=like(name,*some-name*)` | - * | `In` | `id`, `name`, `SKU`, `slug`, `upc_ean`, `mpn`, `product_types`, `tags` | Checks if the values are included in the specified string. If they are, the condition is true. For `product_types`, you can specify more than one product type. For example, `filter=in(product_types,child,bundle)`. | `filter=in(id,some-id)` | - * - */ -export const getAllProducts = ( - options?: OptionsLegacyParser, -) => { - return (options?.client ?? client).get< - GetAllProductsResponse, - GetAllProductsError, - ThrowOnError - >({ - ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/products", }) } @@ -399,7 +444,7 @@ export const getAllProducts = ( * */ export const importProducts = ( - options?: OptionsLegacyParser, + options?: Options, ) => { return (options?.client ?? client).post< ImportProductsResponse, @@ -412,6 +457,12 @@ export const importProducts = ( "Content-Type": null, ...options?.headers, }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/products/import", }) } @@ -437,7 +488,7 @@ export const importProducts = ( * */ export const exportProducts = ( - options?: OptionsLegacyParser, + options?: Options, ) => { return (options?.client ?? client).post< ExportProductsResponse, @@ -445,10 +496,46 @@ export const exportProducts = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/products/export", }) } +/** + * Delete a product + * Deletes the specified product. + * + * You cannot delete a product if it is part of a bundle. You must first delete the bundle before you delete the product. + * + */ +export const deleteProduct = ( + options: Options, +) => { + return (options?.client ?? client).delete< + DeleteProductResponse, + DeleteProductError, + ThrowOnError + >({ + ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/pcm/products/{productID}", + }) +} + /** * Get a product * Returns a product by its identifier. @@ -457,7 +544,7 @@ export const exportProducts = ( * */ export const getProduct = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).get< GetProductResponse, @@ -465,6 +552,12 @@ export const getProduct = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/products/{productID}", }) } @@ -474,7 +567,7 @@ export const getProduct = ( * Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the product or bundle is not updated. */ export const updateProduct = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).put< UpdateProductResponse, @@ -482,26 +575,16 @@ export const updateProduct = ( ThrowOnError >({ ...options, - url: "/pcm/products/{productID}", - }) -} - -/** - * Delete a product - * Deletes the specified product. - * - * You cannot delete a product if it is part of a bundle. You must first delete the bundle before you delete the product. - * - */ -export const deleteProduct = ( - options: OptionsLegacyParser, -) => { - return (options?.client ?? client).delete< - DeleteProductResponse, - DeleteProductError, - ThrowOnError - >({ - ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/products/{productID}", }) } @@ -521,7 +604,7 @@ export const deleteProduct = ( * */ export const attachNodes = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).post< AttachNodesResponse, @@ -529,6 +612,16 @@ export const attachNodes = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/products/attach_nodes", }) } @@ -547,7 +640,7 @@ export const attachNodes = ( * */ export const detachNodes = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).post< DetachNodesResponse, @@ -555,6 +648,16 @@ export const detachNodes = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/products/detach_nodes", }) } @@ -564,7 +667,7 @@ export const detachNodes = ( * Returns the nodes associated with the product. Products must be in a `live` status. */ export const getProductsNodes = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).get< GetProductsNodesResponse, @@ -572,6 +675,12 @@ export const getProductsNodes = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/products/{productID}/nodes", }) } @@ -629,14 +738,24 @@ export const getProductsNodes = ( * */ export const buildChildProducts = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).post< - BuildChildProductsResponse, + unknown, BuildChildProductsError, ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/products/{productID}/build", }) } @@ -645,7 +764,7 @@ export const buildChildProducts = ( * Get child products */ export const getChildProducts = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).get< GetChildProductsResponse, @@ -653,28 +772,40 @@ export const getChildProducts = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/products/{productID}/children", }) } /** - * Create a product template relationship - * Retrieves all the templates that are associated with the specified product. + * Delete a product template relationship */ -export const createProductTemplateRelationship = < +export const deleteProductTemplateRelationship = < ThrowOnError extends boolean = false, >( - options: OptionsLegacyParser< - CreateProductTemplateRelationshipData, - ThrowOnError - >, + options: Options, ) => { - return (options?.client ?? client).post< - CreateProductTemplateRelationshipResponse, - CreateProductTemplateRelationshipError, + return (options?.client ?? client).delete< + DeleteProductTemplateRelationshipResponse, + DeleteProductTemplateRelationshipError, ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/products/{productID}/relationships/templates", }) } @@ -685,10 +816,7 @@ export const createProductTemplateRelationship = < export const getProductTemplateRelationships = < ThrowOnError extends boolean = false, >( - options: OptionsLegacyParser< - GetProductTemplateRelationshipsData, - ThrowOnError - >, + options: Options, ) => { return (options?.client ?? client).get< GetProductTemplateRelationshipsResponse, @@ -696,27 +824,41 @@ export const getProductTemplateRelationships = < ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/products/{productID}/relationships/templates", }) } /** - * Delete a product template relationship + * Create a product template relationship + * Retrieves all the templates that are associated with the specified product. */ -export const deleteProductTemplateRelationship = < +export const createProductTemplateRelationship = < ThrowOnError extends boolean = false, >( - options: OptionsLegacyParser< - DeleteProductTemplateRelationshipData, - ThrowOnError - >, + options: Options, ) => { - return (options?.client ?? client).delete< - DeleteProductTemplateRelationshipResponse, - DeleteProductTemplateRelationshipError, + return (options?.client ?? client).post< + CreateProductTemplateRelationshipResponse, + CreateProductTemplateRelationshipError, ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/products/{productID}/relationships/templates", }) } @@ -728,10 +870,7 @@ export const deleteProductTemplateRelationship = < export const getProductComponentProductsRelationships = < ThrowOnError extends boolean = false, >( - options: OptionsLegacyParser< - GetProductComponentProductsRelationshipsData, - ThrowOnError - >, + options: Options, ) => { return (options?.client ?? client).get< GetProductComponentProductsRelationshipsResponse, @@ -739,10 +878,44 @@ export const getProductComponentProductsRelationships = < ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/products/{productID}/relationships/component_products", }) } +/** + * Delete a product file relationships + */ +export const deleteProductFileRelationships = < + ThrowOnError extends boolean = false, +>( + options: Options, +) => { + return (options?.client ?? client).delete< + DeleteProductFileRelationshipsResponse, + DeleteProductFileRelationshipsError, + ThrowOnError + >({ + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/pcm/products/{productID}/relationships/files", + }) +} + /** * Get all product file relationships * Retrieves all files that are associated with the specified product. @@ -750,7 +923,7 @@ export const getProductComponentProductsRelationships = < export const getProductFileRelationships = < ThrowOnError extends boolean = false, >( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).get< GetProductFileRelationshipsResponse, @@ -758,6 +931,12 @@ export const getProductFileRelationships = < ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/products/{productID}/relationships/files", }) } @@ -768,10 +947,7 @@ export const getProductFileRelationships = < export const createProductFileRelationships = < ThrowOnError extends boolean = false, >( - options: OptionsLegacyParser< - CreateProductFileRelationshipsData, - ThrowOnError - >, + options: Options, ) => { return (options?.client ?? client).post< CreateProductFileRelationshipsResponse, @@ -779,6 +955,16 @@ export const createProductFileRelationships = < ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/products/{productID}/relationships/files", }) } @@ -789,10 +975,7 @@ export const createProductFileRelationships = < export const updateProductFileRelationships = < ThrowOnError extends boolean = false, >( - options: OptionsLegacyParser< - UpdateProductFileRelationshipsData, - ThrowOnError - >, + options: Options, ) => { return (options?.client ?? client).put< UpdateProductFileRelationshipsResponse, @@ -800,69 +983,96 @@ export const updateProductFileRelationships = < ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/products/{productID}/relationships/files", }) } /** - * Delete a product file relationships + * Delete a product variation relationships */ -export const deleteProductFileRelationships = < +export const deleteProductVariationRelationships = < ThrowOnError extends boolean = false, >( - options: OptionsLegacyParser< - DeleteProductFileRelationshipsData, - ThrowOnError - >, + options: Options, ) => { return (options?.client ?? client).delete< - DeleteProductFileRelationshipsResponse, - DeleteProductFileRelationshipsError, + DeleteProductVariationRelationshipsResponse, + DeleteProductVariationRelationshipsError, ThrowOnError >({ ...options, - url: "/pcm/products/{productID}/relationships/files", + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/pcm/products/{productID}/relationships/variations", }) } /** - * Create a product variation relationship + * Get all product variation relationships */ -export const createProductVariationRelationships = < +export const getProductVariationRelationships = < ThrowOnError extends boolean = false, >( - options: OptionsLegacyParser< - CreateProductVariationRelationshipsData, - ThrowOnError - >, + options: Options, ) => { - return (options?.client ?? client).post< - CreateProductVariationRelationshipsResponse, - CreateProductVariationRelationshipsError, + return (options?.client ?? client).get< + GetProductVariationRelationshipsResponse, + GetProductVariationRelationshipsError, ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/products/{productID}/relationships/variations", }) } /** - * Get all product variation relationships + * Create a product variation relationship */ -export const getProductVariationRelationships = < +export const createProductVariationRelationships = < ThrowOnError extends boolean = false, >( - options: OptionsLegacyParser< - GetProductVariationRelationshipsData, - ThrowOnError - >, + options: Options, ) => { - return (options?.client ?? client).get< - GetProductVariationRelationshipsResponse, - GetProductVariationRelationshipsError, + return (options?.client ?? client).post< + CreateProductVariationRelationshipsResponse, + CreateProductVariationRelationshipsError, ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/products/{productID}/relationships/variations", }) } @@ -873,10 +1083,7 @@ export const getProductVariationRelationships = < export const updateProductVariationRelationships = < ThrowOnError extends boolean = false, >( - options: OptionsLegacyParser< - UpdateProductVariationRelationshipsData, - ThrowOnError - >, + options: Options, ) => { return (options?.client ?? client).put< UpdateProductVariationRelationshipsResponse, @@ -884,70 +1091,93 @@ export const updateProductVariationRelationships = < ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/products/{productID}/relationships/variations", }) } /** - * Delete a product variation relationships + * Delete Main Image Relationships */ -export const deleteProductVariationRelationships = < +export const deleteProductMainImageRelationships = < ThrowOnError extends boolean = false, >( - options: OptionsLegacyParser< - DeleteProductVariationRelationshipsData, - ThrowOnError - >, + options: Options, ) => { return (options?.client ?? client).delete< - DeleteProductVariationRelationshipsResponse, - DeleteProductVariationRelationshipsError, + DeleteProductMainImageRelationshipsResponse, + DeleteProductMainImageRelationshipsError, ThrowOnError >({ ...options, - url: "/pcm/products/{productID}/relationships/variations", + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/pcm/products/{productID}/relationships/main_image", }) } /** - * Create main image relationships - * Associates a main image with the specified product. + * Get Main Image Relationships */ -export const createProductMainImageRelationships = < +export const getProductMainImageRelationships = < ThrowOnError extends boolean = false, >( - options: OptionsLegacyParser< - CreateProductMainImageRelationshipsData, - ThrowOnError - >, + options: Options, ) => { - return (options?.client ?? client).post< - CreateProductMainImageRelationshipsResponse, - CreateProductMainImageRelationshipsError, + return (options?.client ?? client).get< + GetProductMainImageRelationshipsResponse, + GetProductMainImageRelationshipsError, ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/products/{productID}/relationships/main_image", }) } /** - * Get Main Image Relationships + * Create main image relationships + * Associates a main image with the specified product. */ -export const getProductMainImageRelationships = < +export const createProductMainImageRelationships = < ThrowOnError extends boolean = false, ->( - options: OptionsLegacyParser< - GetProductMainImageRelationshipsData, - ThrowOnError - >, -) => { - return (options?.client ?? client).get< - GetProductMainImageRelationshipsResponse, - GetProductMainImageRelationshipsError, +>( + options: Options, +) => { + return (options?.client ?? client).post< + CreateProductMainImageRelationshipsResponse, + CreateProductMainImageRelationshipsError, ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/products/{productID}/relationships/main_image", }) } @@ -958,10 +1188,7 @@ export const getProductMainImageRelationships = < export const updateProductMainImageRelationships = < ThrowOnError extends boolean = false, >( - options: OptionsLegacyParser< - UpdateProductMainImageRelationshipsData, - ThrowOnError - >, + options: Options, ) => { return (options?.client ?? client).put< UpdateProductMainImageRelationshipsResponse, @@ -969,28 +1196,39 @@ export const updateProductMainImageRelationships = < ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/products/{productID}/relationships/main_image", }) } /** - * Delete Main Image Relationships + * Get all variations */ -export const deleteProductMainImageRelationships = < - ThrowOnError extends boolean = false, ->( - options: OptionsLegacyParser< - DeleteProductMainImageRelationshipsData, - ThrowOnError - >, +export const getAllVariations = ( + options?: Options, ) => { - return (options?.client ?? client).delete< - DeleteProductMainImageRelationshipsResponse, - DeleteProductMainImageRelationshipsError, + return (options?.client ?? client).get< + GetAllVariationsResponse, + GetAllVariationsError, ThrowOnError >({ ...options, - url: "/pcm/products/{productID}/relationships/main_image", + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/pcm/variations", }) } @@ -998,7 +1236,7 @@ export const deleteProductMainImageRelationships = < * Create a variation */ export const createVariation = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).post< CreateVariationResponse, @@ -1006,23 +1244,39 @@ export const createVariation = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/variations", }) } /** - * Get all variations + * Delete a variation and all it's associated options */ -export const getAllVariations = ( - options?: OptionsLegacyParser, +export const deleteVariation = ( + options: Options, ) => { - return (options?.client ?? client).get< - GetAllVariationsResponse, - GetAllVariationsError, + return (options?.client ?? client).delete< + DeleteVariationResponse, + DeleteVariationError, ThrowOnError >({ ...options, - url: "/pcm/variations", + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/pcm/variations/{variationID}", }) } @@ -1030,7 +1284,7 @@ export const getAllVariations = ( * Get a variation */ export const getVariation = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).get< GetVariationResponse, @@ -1038,6 +1292,12 @@ export const getVariation = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/variations/{variationID}", }) } @@ -1047,7 +1307,7 @@ export const getVariation = ( * Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the variation is not updated. */ export const updateVariation = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).put< UpdateVariationResponse, @@ -1055,23 +1315,39 @@ export const updateVariation = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/variations/{variationID}", }) } /** - * Delete a variation and all it's associated options + * Get all variation options */ -export const deleteVariation = ( - options: OptionsLegacyParser, +export const getAllVariationOptions = ( + options: Options, ) => { - return (options?.client ?? client).delete< - DeleteVariationResponse, - DeleteVariationError, + return (options?.client ?? client).get< + GetAllVariationOptionsResponse, + GetAllVariationOptionsError, ThrowOnError >({ ...options, - url: "/pcm/variations/{variationID}", + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/pcm/variations/{variationID}/options", }) } @@ -1079,7 +1355,7 @@ export const deleteVariation = ( * Create a variation option */ export const createVariationOption = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).post< CreateVariationOptionResponse, @@ -1087,23 +1363,39 @@ export const createVariationOption = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/variations/{variationID}/options", }) } /** - * Get all variation options + * Delete a variation option */ -export const getAllVariationOptions = ( - options: OptionsLegacyParser, +export const deleteVariationOption = ( + options: Options, ) => { - return (options?.client ?? client).get< - GetAllVariationOptionsResponse, - GetAllVariationOptionsError, + return (options?.client ?? client).delete< + DeleteVariationOptionResponse, + DeleteVariationOptionError, ThrowOnError >({ ...options, - url: "/pcm/variations/{variationID}/options", + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/pcm/variations/{variationID}/options/{optionID}", }) } @@ -1111,7 +1403,7 @@ export const getAllVariationOptions = ( * Get a variation option */ export const getVariationOption = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).get< GetVariationOptionResponse, @@ -1119,6 +1411,12 @@ export const getVariationOption = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/variations/{variationID}/options/{optionID}", }) } @@ -1127,7 +1425,7 @@ export const getVariationOption = ( * Update a variation option */ export const updateVariationOption = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).put< UpdateVariationOptionResponse, @@ -1135,23 +1433,39 @@ export const updateVariationOption = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/variations/{variationID}/options/{optionID}", }) } /** - * Delete a variation option + * Get all modifiers */ -export const deleteVariationOption = ( - options: OptionsLegacyParser, +export const getAllModifiers = ( + options: Options, ) => { - return (options?.client ?? client).delete< - DeleteVariationOptionResponse, - DeleteVariationOptionError, + return (options?.client ?? client).get< + GetAllModifiersResponse, + GetAllModifiersError, ThrowOnError >({ ...options, - url: "/pcm/variations/{variationID}/options/{optionID}", + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/pcm/variations/{variationID}/options/{optionID}/modifiers", }) } @@ -1159,7 +1473,7 @@ export const deleteVariationOption = ( * Create a modifier */ export const createModifier = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).post< CreateModifierResponse, @@ -1167,23 +1481,40 @@ export const createModifier = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/variations/{variationID}/options/{optionID}/modifiers", }) } /** - * Get all modifiers + * Delete a modifier + * You cannot delete a modifier if it is in use. Deleting a modifier in us returns a `422 Failed Validation` error. */ -export const getAllModifiers = ( - options: OptionsLegacyParser, +export const deleteModifier = ( + options: Options, ) => { - return (options?.client ?? client).get< - GetAllModifiersResponse, - GetAllModifiersError, + return (options?.client ?? client).delete< + DeleteModifierResponse, + DeleteModifierError, ThrowOnError >({ ...options, - url: "/pcm/variations/{variationID}/options/{optionID}/modifiers", + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/pcm/variations/{variationID}/options/{optionID}/modifiers/{modifierID}", }) } @@ -1191,7 +1522,7 @@ export const getAllModifiers = ( * Get a modifier */ export const getModifier = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).get< GetModifierResponse, @@ -1199,6 +1530,12 @@ export const getModifier = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/variations/{variationID}/options/{optionID}/modifiers/{modifierID}", }) } @@ -1208,7 +1545,7 @@ export const getModifier = ( * Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the modifier is not updated. */ export const updateModifier = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).put< UpdateModifierResponse, @@ -1216,24 +1553,40 @@ export const updateModifier = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/variations/{variationID}/options/{optionID}/modifiers/{modifierID}", }) } /** - * Delete a modifier - * You cannot delete a modifier if it is in use. Deleting a modifier in us returns a `422 Failed Validation` error. + * Get all hierarchies + * Get all hierarchies */ -export const deleteModifier = ( - options: OptionsLegacyParser, +export const getHierarchy = ( + options?: Options, ) => { - return (options?.client ?? client).delete< - DeleteModifierResponse, - DeleteModifierError, + return (options?.client ?? client).get< + GetHierarchyResponse, + GetHierarchyError, ThrowOnError >({ ...options, - url: "/pcm/variations/{variationID}/options/{optionID}/modifiers/{modifierID}", + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/pcm/hierarchies", }) } @@ -1242,7 +1595,7 @@ export const deleteModifier = ( * Create a hierarchy */ export const createHierarchy = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).post< CreateHierarchyResponse, @@ -1250,24 +1603,40 @@ export const createHierarchy = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/hierarchies", }) } /** - * Get all hierarchies - * Get all hierarchies + * Delete a hierarchy + * Deletes the specified hierarchy and all its children. */ -export const getHierarchy = ( - options?: OptionsLegacyParser, +export const deleteHierarchy = ( + options: Options, ) => { - return (options?.client ?? client).get< - GetHierarchyResponse, - GetHierarchyError, + return (options?.client ?? client).delete< + DeleteHierarchyResponse, + DeleteHierarchyError, ThrowOnError >({ ...options, - url: "/pcm/hierarchies", + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/pcm/hierarchies/{hierarchyID}", }) } @@ -1276,7 +1645,7 @@ export const getHierarchy = ( * Retrieves the specified hierarchy. */ export const getHierarchyChild = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).get< GetHierarchyChildResponse, @@ -1284,6 +1653,12 @@ export const getHierarchyChild = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/hierarchies/{hierarchyID}", }) } @@ -1293,7 +1668,7 @@ export const getHierarchyChild = ( * Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the hierarchy is not updated. */ export const updateHierarchy = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).put< UpdateHierarchyResponse, @@ -1301,24 +1676,40 @@ export const updateHierarchy = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/hierarchies/{hierarchyID}", }) } /** - * Delete a hierarchy - * Deletes the specified hierarchy and all its children. + * Get all nodes in a hierarchy + * A fully paginated view of all nodes in a hierarchy regardless of depth. */ -export const deleteHierarchy = ( - options: OptionsLegacyParser, +export const getAllNodesInHierarchy = ( + options: Options, ) => { - return (options?.client ?? client).delete< - DeleteHierarchyResponse, - DeleteHierarchyError, + return (options?.client ?? client).get< + GetAllNodesInHierarchyResponse, + GetAllNodesInHierarchyError, ThrowOnError >({ ...options, - url: "/pcm/hierarchies/{hierarchyID}", + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/pcm/hierarchies/{hierarchyID}/nodes", }) } @@ -1365,7 +1756,7 @@ export const deleteHierarchy = ( * */ export const createNode = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).post< CreateNodeResponse, @@ -1373,24 +1764,40 @@ export const createNode = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/hierarchies/{hierarchyID}/nodes", }) } /** - * Get all nodes in a hierarchy - * A fully paginated view of all nodes in a hierarchy regardless of depth. + * Deletes a node + * Deletes a node by the node ID */ -export const getAllNodesInHierarchy = ( - options: OptionsLegacyParser, +export const deleteNode = ( + options: Options, ) => { - return (options?.client ?? client).get< - GetAllNodesInHierarchyResponse, - GetAllNodesInHierarchyError, + return (options?.client ?? client).delete< + DeleteNodeResponse, + DeleteNodeError, ThrowOnError >({ ...options, - url: "/pcm/hierarchies/{hierarchyID}/nodes", + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}", }) } @@ -1399,7 +1806,7 @@ export const getAllNodesInHierarchy = ( * Retrieves a node from a hierarchy. */ export const getHierarchyNode = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).get< GetHierarchyNodeResponse, @@ -1407,6 +1814,12 @@ export const getHierarchyNode = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}", }) } @@ -1452,7 +1865,7 @@ export const getHierarchyNode = ( * */ export const updateNode = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).put< UpdateNodeResponse, @@ -1460,23 +1873,16 @@ export const updateNode = ( ThrowOnError >({ ...options, - url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}", - }) -} - -/** - * Deletes a node - * Deletes a node by the node ID - */ -export const deleteNode = ( - options: OptionsLegacyParser, -) => { - return (options?.client ?? client).delete< - DeleteNodeResponse, - DeleteNodeError, - ThrowOnError - >({ - ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}", }) } @@ -1486,7 +1892,7 @@ export const deleteNode = ( * Get a hierarchy's children */ export const getAllChildren = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).get< GetAllChildrenResponse, @@ -1494,6 +1900,12 @@ export const getAllChildren = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/hierarchies/{hierarchyID}/children", }) } @@ -1526,7 +1938,7 @@ export const getAllChildren = ( export const createNodeChildRelationships = < ThrowOnError extends boolean = false, >( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).post< CreateNodeChildRelationshipsResponse, @@ -1534,6 +1946,16 @@ export const createNodeChildRelationships = < ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/children", }) } @@ -1543,7 +1965,7 @@ export const createNodeChildRelationships = < * Retrieves the child nodes for a specified node. */ export const getAllNodeChildren = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).get< GetAllNodeChildrenResponse, @@ -1551,10 +1973,38 @@ export const getAllNodeChildren = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/children", }) } +/** + * Delete a node's parent + */ +export const deleteNodeParent = ( + options: Options, +) => { + return (options?.client ?? client).delete< + DeleteNodeParentResponse, + DeleteNodeParentError, + ThrowOnError + >({ + ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/parent", + }) +} + /** * Update a node's parent * Changes the parent of the specified node. The new parent node must be located within the same hierarchy as the specified node. @@ -1563,7 +2013,7 @@ export const getAllNodeChildren = ( * */ export const updateNodeParent = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).put< UpdateNodeParentResponse, @@ -1571,23 +2021,45 @@ export const updateNodeParent = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/parent", }) } /** - * Delete a node's parent + * Deletes a node's product relationships */ -export const deleteNodeParent = ( - options: OptionsLegacyParser, +export const deleteNodeProductRelationships = < + ThrowOnError extends boolean = false, +>( + options: Options, ) => { return (options?.client ?? client).delete< - DeleteNodeParentResponse, - DeleteNodeParentError, + DeleteNodeProductRelationshipsResponse, + DeleteNodeProductRelationshipsError, ThrowOnError >({ ...options, - url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/parent", + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], + url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/products", }) } @@ -1598,7 +2070,7 @@ export const deleteNodeParent = ( export const createNodeProductRelationship = < ThrowOnError extends boolean = false, >( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).post< CreateNodeProductRelationshipResponse, @@ -1606,27 +2078,16 @@ export const createNodeProductRelationship = < ThrowOnError >({ ...options, - url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/products", - }) -} - -/** - * Deletes a node's product relationships - */ -export const deleteNodeProductRelationships = < - ThrowOnError extends boolean = false, ->( - options: OptionsLegacyParser< - DeleteNodeProductRelationshipsData, - ThrowOnError - >, -) => { - return (options?.client ?? client).delete< - DeleteNodeProductRelationshipsResponse, - DeleteNodeProductRelationshipsError, - ThrowOnError - >({ - ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/products", }) } @@ -1637,7 +2098,7 @@ export const deleteNodeProductRelationships = < * */ export const getNodeProducts = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).get< GetNodeProductsResponse, @@ -1645,6 +2106,12 @@ export const getNodeProducts = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/products", }) } @@ -1668,7 +2135,7 @@ export const getNodeProducts = ( * */ export const duplicateHierarchy = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).post< DuplicateHierarchyResponse, @@ -1676,6 +2143,16 @@ export const duplicateHierarchy = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/hierarchies/{hierarchyID}/duplicate_job", }) } @@ -1687,7 +2164,7 @@ export const duplicateHierarchy = ( * */ export const getAllProductTags = ( - options?: OptionsLegacyParser, + options?: Options, ) => { return (options?.client ?? client).get< GetAllProductTagsResponse, @@ -1695,6 +2172,12 @@ export const getAllProductTags = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/tags", }) } @@ -1704,7 +2187,7 @@ export const getAllProductTags = ( * Retrieves a product tag for a store. A store can view the tags associated with the organization to which the store belongs. However, an organization can only view the tags associated with the organization. */ export const getProductTag = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).get< GetProductTagResponse, @@ -1712,6 +2195,12 @@ export const getProductTag = ( ThrowOnError >({ ...options, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/tags/{tagID}", }) } @@ -1721,7 +2210,7 @@ export const getProductTag = ( * Create a custom relationship */ export const createCustomRelationship = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).post< CreateCustomRelationshipResponse, @@ -1729,6 +2218,16 @@ export const createCustomRelationship = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/custom_relationships", }) } @@ -1738,7 +2237,7 @@ export const createCustomRelationship = ( * Specify whichever attributes you want to change. The values of the other attributes remain the same. If the attributes section is empty, the custom relationship is not updated. */ export const updateCustomRelationship = ( - options: OptionsLegacyParser, + options: Options, ) => { return (options?.client ?? client).put< UpdateCustomRelationshipResponse, @@ -1746,6 +2245,16 @@ export const updateCustomRelationship = ( ThrowOnError >({ ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + security: [ + { + scheme: "bearer", + type: "http", + }, + ], url: "/pcm/custom_relationships/{customRelationshipSlug}", }) } diff --git a/packages/sdks/pim/src/client/transformers.gen.ts b/packages/sdks/pim/src/client/transformers.gen.ts new file mode 100644 index 00000000..61df24f4 --- /dev/null +++ b/packages/sdks/pim/src/client/transformers.gen.ts @@ -0,0 +1,631 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { + GetAllJobsResponse, + GetJobResponse, + CancelJobResponse, + GetAllProductsResponse, + CreateProductResponse, + ImportProductsResponse, + ExportProductsResponse, + GetProductResponse, + UpdateProductResponse, + GetProductsNodesResponse, + GetChildProductsResponse, + GetProductVariationRelationshipsResponse, + GetAllVariationsResponse, + CreateVariationResponse, + GetVariationResponse, + UpdateVariationResponse, + GetAllVariationOptionsResponse, + CreateVariationOptionResponse, + GetVariationOptionResponse, + UpdateVariationOptionResponse, + GetHierarchyResponse, + CreateHierarchyResponse, + GetHierarchyChildResponse, + UpdateHierarchyResponse, + GetAllNodesInHierarchyResponse, + CreateNodeResponse, + GetHierarchyNodeResponse, + UpdateNodeResponse, + GetAllChildrenResponse, + CreateNodeChildRelationshipsResponse, + GetAllNodeChildrenResponse, + DeleteNodeProductRelationshipsResponse, + CreateNodeProductRelationshipResponse, + GetNodeProductsResponse, + DuplicateHierarchyResponse, + GetAllProductTagsResponse, + GetProductTagResponse, + CreateCustomRelationshipResponse, + UpdateCustomRelationshipResponse, +} from "./types.gen" + +const jobSchemaResponseTransformer = (data: any) => { + if (data.attributes) { + if (data.attributes.started_at) { + data.attributes.started_at = new Date(data.attributes.started_at) + } + if (data.attributes.completed_at) { + data.attributes.completed_at = new Date(data.attributes.completed_at) + } + if (data.attributes.created_at) { + data.attributes.created_at = new Date(data.attributes.created_at) + } + if (data.attributes.updated_at) { + data.attributes.updated_at = new Date(data.attributes.updated_at) + } + return data.attributes + } + return data +} + +const multiSchemaResponseTransformer = (data: any) => { + if (data.data) { + data.data = data.data.map((item: any) => { + return jobSchemaResponseTransformer(item) + }) + } + return data +} + +export const getAllJobsResponseTransformer = async ( + data: any, +): Promise => { + data = multiSchemaResponseTransformer(data) + return data +} + +const singleSchemaResponseTransformer = (data: any) => { + if (data.data) { + data.data = jobSchemaResponseTransformer(data.data) + } + return data +} + +export const getJobResponseTransformer = async ( + data: any, +): Promise => { + data = singleSchemaResponseTransformer(data) + return data +} + +export const cancelJobResponseTransformer = async ( + data: any, +): Promise => { + data = singleSchemaResponseTransformer(data) + return data +} + +const productResponseSchemaResponseTransformer = (data: any) => { + if (data.meta) { + if (data.meta.created_at) { + data.meta.created_at = new Date(data.meta.created_at) + } + if (data.meta.updated_at) { + data.meta.updated_at = new Date(data.meta.updated_at) + } + return data.meta + } + return data +} + +const multiProductResponseSchemaResponseTransformer = (data: any) => { + if (data.data) { + data.data = data.data.map((item: any) => { + return productResponseSchemaResponseTransformer(item) + }) + } + if (data.included) { + if (data.included.component_products) { + data.included.component_products = data.included.component_products.map( + (item: any) => { + return productResponseSchemaResponseTransformer(item) + }, + ) + } + return data.included + } + return data +} + +export const getAllProductsResponseTransformer = async ( + data: any, +): Promise => { + data = multiProductResponseSchemaResponseTransformer(data) + return data +} + +const singleProductResponseSchemaResponseTransformer = (data: any) => { + if (data.data) { + data.data = productResponseSchemaResponseTransformer(data.data) + } + if (data.included) { + if (data.included.component_products) { + data.included.component_products = data.included.component_products.map( + (item: any) => { + return productResponseSchemaResponseTransformer(item) + }, + ) + } + return data.included + } + return data +} + +export const createProductResponseTransformer = async ( + data: any, +): Promise => { + data = singleProductResponseSchemaResponseTransformer(data) + return data +} + +export const importProductsResponseTransformer = async ( + data: any, +): Promise => { + data = singleSchemaResponseTransformer(data) + return data +} + +export const exportProductsResponseTransformer = async ( + data: any, +): Promise => { + data = singleSchemaResponseTransformer(data) + return data +} + +export const getProductResponseTransformer = async ( + data: any, +): Promise => { + data = singleProductResponseSchemaResponseTransformer(data) + return data +} + +export const updateProductResponseTransformer = async ( + data: any, +): Promise => { + data = singleProductResponseSchemaResponseTransformer(data) + return data +} + +const nodeSchemaResponseTransformer = (data: any) => { + if (data.meta) { + if (data.meta.created_at) { + data.meta.created_at = new Date(data.meta.created_at) + } + if (data.meta.updated_at) { + data.meta.updated_at = new Date(data.meta.updated_at) + } + return data.meta + } + return data +} + +const multiNodesSchemaResponseTransformer = (data: any) => { + if (data.data) { + data.data = data.data.map((item: any) => { + return nodeSchemaResponseTransformer(item) + }) + } + return data +} + +export const getProductsNodesResponseTransformer = async ( + data: any, +): Promise => { + data = multiNodesSchemaResponseTransformer(data) + return data +} + +export const getChildProductsResponseTransformer = async ( + data: any, +): Promise => { + data = multiProductResponseSchemaResponseTransformer(data) + return data +} + +const variationsResponseSchemaResponseTransformer = (data: any) => { + if (data.data) { + data.data = data.data.map((item: any) => { + if (item.meta) { + if (item.meta.created_at) { + item.meta.created_at = new Date(item.meta.created_at) + } + return item.meta + } + return item + }) + } + return data +} + +export const getProductVariationRelationshipsResponseTransformer = async ( + data: any, +): Promise => { + data = variationsResponseSchemaResponseTransformer(data) + return data +} + +const multiVariationsSchemaResponseTransformer = (data: any) => { + if (data.data) { + data.data = data.data.map((item: any) => { + if (item.meta) { + if (item.meta.options) { + item.meta.options = item.meta.options.map((item: any) => { + if (item.created_at) { + item.created_at = new Date(item.created_at) + } + if (item.updated_at) { + item.updated_at = new Date(item.updated_at) + } + return item + }) + } + if (item.meta.created_at) { + item.meta.created_at = new Date(item.meta.created_at) + } + if (item.meta.updated_at) { + item.meta.updated_at = new Date(item.meta.updated_at) + } + return item.meta + } + return item + }) + } + return data +} + +export const getAllVariationsResponseTransformer = async ( + data: any, +): Promise => { + data = multiVariationsSchemaResponseTransformer(data) + return data +} + +const createdVariationSchemaResponseTransformer = (data: any) => { + if (data.data.meta.created_at) { + data.data.meta.created_at = new Date(data.data.meta.created_at) + } + if (data.data.meta.updated_at) { + data.data.meta.updated_at = new Date(data.data.meta.updated_at) + } + return data.data.meta + return data.data + return data +} + +export const createVariationResponseTransformer = async ( + data: any, +): Promise => { + data = createdVariationSchemaResponseTransformer(data) + return data +} + +const singleVariationSchemaResponseTransformer = (data: any) => { + if (data.data.meta.options) { + data.data.meta.options = data.data.meta.options.map((item: any) => { + if (item.created_at) { + item.created_at = new Date(item.created_at) + } + if (item.updated_at) { + item.updated_at = new Date(item.updated_at) + } + return item + }) + } + return data.data.meta + return data.data + return data +} + +export const getVariationResponseTransformer = async ( + data: any, +): Promise => { + data = singleVariationSchemaResponseTransformer(data) + return data +} + +export const updateVariationResponseTransformer = async ( + data: any, +): Promise => { + data = singleVariationSchemaResponseTransformer(data) + return data +} + +const multiOptionsSchemaResponseTransformer = (data: any) => { + if (data.data) { + data.data = data.data.map((item: any) => { + if (item.meta) { + if (item.meta.created_at) { + item.meta.created_at = new Date(item.meta.created_at) + } + if (item.meta.updated_at) { + item.meta.updated_at = new Date(item.meta.updated_at) + } + return item.meta + } + return item + }) + } + return data +} + +export const getAllVariationOptionsResponseTransformer = async ( + data: any, +): Promise => { + data = multiOptionsSchemaResponseTransformer(data) + return data +} + +const createdOptionSchemaResponseTransformer = (data: any) => { + if (data.data.meta) { + if (data.data.meta.created_at) { + data.data.meta.created_at = new Date(data.data.meta.created_at) + } + if (data.data.meta.updated_at) { + data.data.meta.updated_at = new Date(data.data.meta.updated_at) + } + return data.data.meta + } + return data.data + return data +} + +export const createVariationOptionResponseTransformer = async ( + data: any, +): Promise => { + data = createdOptionSchemaResponseTransformer(data) + return data +} + +const singleOptionSchemaResponseTransformer = (data: any) => { + if (data.data.meta.created_at) { + data.data.meta.created_at = new Date(data.data.meta.created_at) + } + if (data.data.meta.updated_at) { + data.data.meta.updated_at = new Date(data.data.meta.updated_at) + } + return data.data.meta + return data.data + return data +} + +export const getVariationOptionResponseTransformer = async ( + data: any, +): Promise => { + data = singleOptionSchemaResponseTransformer(data) + return data +} + +export const updateVariationOptionResponseTransformer = async ( + data: any, +): Promise => { + data = singleOptionSchemaResponseTransformer(data) + return data +} + +const hierarchySchemaResponseTransformer = (data: any) => { + if (data.meta) { + if (data.meta.created_at) { + data.meta.created_at = new Date(data.meta.created_at) + } + if (data.meta.updated_at) { + data.meta.updated_at = new Date(data.meta.updated_at) + } + return data.meta + } + return data +} + +const multiHierarchySchemaResponseTransformer = (data: any) => { + if (data.data) { + data.data = data.data.map((item: any) => { + return hierarchySchemaResponseTransformer(item) + }) + } + return data +} + +export const getHierarchyResponseTransformer = async ( + data: any, +): Promise => { + data = multiHierarchySchemaResponseTransformer(data) + return data +} + +const singleHierarchySchemaResponseTransformer = (data: any) => { + if (data.data) { + data.data = hierarchySchemaResponseTransformer(data.data) + } + return data +} + +export const createHierarchyResponseTransformer = async ( + data: any, +): Promise => { + data = singleHierarchySchemaResponseTransformer(data) + return data +} + +export const getHierarchyChildResponseTransformer = async ( + data: any, +): Promise => { + data = singleHierarchySchemaResponseTransformer(data) + return data +} + +export const updateHierarchyResponseTransformer = async ( + data: any, +): Promise => { + data = singleHierarchySchemaResponseTransformer(data) + return data +} + +export const getAllNodesInHierarchyResponseTransformer = async ( + data: any, +): Promise => { + data = multiNodesSchemaResponseTransformer(data) + return data +} + +const singleNodeSchemaResponseTransformer = (data: any) => { + if (data.data) { + data.data = nodeSchemaResponseTransformer(data.data) + } + return data +} + +export const createNodeResponseTransformer = async ( + data: any, +): Promise => { + data = singleNodeSchemaResponseTransformer(data) + return data +} + +export const getHierarchyNodeResponseTransformer = async ( + data: any, +): Promise => { + data = singleNodeSchemaResponseTransformer(data) + return data +} + +export const updateNodeResponseTransformer = async ( + data: any, +): Promise => { + data = singleNodeSchemaResponseTransformer(data) + return data +} + +export const getAllChildrenResponseTransformer = async ( + data: any, +): Promise => { + data = multiNodesSchemaResponseTransformer(data) + return data +} + +export const createNodeChildRelationshipsResponseTransformer = async ( + data: any, +): Promise => { + data = singleNodeSchemaResponseTransformer(data) + return data +} + +export const getAllNodeChildrenResponseTransformer = async ( + data: any, +): Promise => { + data = multiNodesSchemaResponseTransformer(data) + return data +} + +export const deleteNodeProductRelationshipsResponseTransformer = async ( + data: any, +): Promise => { + data = singleNodeSchemaResponseTransformer(data) + return data +} + +export const createNodeProductRelationshipResponseTransformer = async ( + data: any, +): Promise => { + data = singleNodeSchemaResponseTransformer(data) + return data +} + +export const getNodeProductsResponseTransformer = async ( + data: any, +): Promise => { + data = multiProductResponseSchemaResponseTransformer(data) + return data +} + +export const duplicateHierarchyResponseTransformer = async ( + data: any, +): Promise => { + data = singleSchemaResponseTransformer(data) + return data +} + +const tagSchemaResponseTransformer = (data: any) => { + if (data.meta) { + if (data.meta.created_at) { + data.meta.created_at = new Date(data.meta.created_at) + } + if (data.meta.updated_at) { + data.meta.updated_at = new Date(data.meta.updated_at) + } + return data.meta + } + return data +} + +const multiTagSchemaResponseTransformer = (data: any) => { + if (data.data) { + data.data = data.data.map((item: any) => { + return tagSchemaResponseTransformer(item) + }) + } + return data +} + +export const getAllProductTagsResponseTransformer = async ( + data: any, +): Promise => { + data = multiTagSchemaResponseTransformer(data) + return data +} + +const singleTagSchemaResponseTransformer = (data: any) => { + if (data.data) { + data.data = tagSchemaResponseTransformer(data.data) + } + return data +} + +export const getProductTagResponseTransformer = async ( + data: any, +): Promise => { + data = singleTagSchemaResponseTransformer(data) + return data +} + +const customRelationshipSchemaResponseTransformer = (data: any) => { + if (data.meta) { + if (data.meta.timestamps) { + if (data.meta.timestamps.created_at) { + data.meta.timestamps.created_at = new Date( + data.meta.timestamps.created_at, + ) + } + if (data.meta.timestamps.updated_at) { + data.meta.timestamps.updated_at = new Date( + data.meta.timestamps.updated_at, + ) + } + return data.meta.timestamps + } + return data.meta + } + return data +} + +const singleCustomRelationshipSchemaResponseTransformer = (data: any) => { + if (data.data) { + data.data = customRelationshipSchemaResponseTransformer(data.data) + } + return data +} + +export const createCustomRelationshipResponseTransformer = async ( + data: any, +): Promise => { + data = singleCustomRelationshipSchemaResponseTransformer(data) + return data +} + +export const updateCustomRelationshipResponseTransformer = async ( + data: any, +): Promise => { + data = singleCustomRelationshipSchemaResponseTransformer(data) + return data +} diff --git a/packages/sdks/pim/src/client/types.gen.ts b/packages/sdks/pim/src/client/types.gen.ts index eeb943d8..bf77c70e 100644 --- a/packages/sdks/pim/src/client/types.gen.ts +++ b/packages/sdks/pim/src/client/types.gen.ts @@ -1,3796 +1,5479 @@ // This file is auto-generated by @hey-api/openapi-ts -export type Attributes = { - /** - * The name of the node, such as `Ranges` or `Refrigerators`. Names must be unique among sibling nodes in the hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies. - */ - name?: string; +/** + * This represents the type of resource object being returned. Always `pim-job`. + */ +export type Type = "pim-job" + +export type Status = "pending" | "cancelled" | "started" | "success" | "failed" + +export type Job = { + /** + * A unique identifier generated when a job is created. + */ + id?: string + /** + * This represents the type of resource object being returned. Always `pim-job`. + */ + type?: "pim-job" + attributes?: { /** - * A description for a node. + * The date and time a job is started. */ - description?: string; + started_at?: Date | null /** - * A slug for the node. Slugs must be unique among sibling nodes in the hierarchy. Otherwise, a slug can be non-unique within the hierarchy and across multiple hierarchies. + * The date and time a job is completed. */ - slug?: string; + completed_at?: Date | null /** - * You can curate your products in your nodes product lists. Product curation allows you to promote specific products within each node in a hierarchy, enabling you to create unique product collections in your storefront. + * The date and time a job is created. */ - curated_products?: Array<(string)>; + created_at?: Date /** - * Product Experience Manager supports localization of hierarchies and nodes. If you store supports multiple languages, you can localize hierarchy and node names and descriptions. + * The date and time a job is updated. */ - locales?: { - [key: string]: { - /** - * A localized hierarchy or node name. - */ - name?: string; - /** - * A localized hierarchy or node description. - */ - description?: string; - }; - }; -}; - -export type AttributesCustomRelationship = { + updated_at?: Date /** - * The name of the custom relationship, such as `Kitchen electrics`. + * The status of a job. + * + * * `pending` - Commerce has received the request but is currently busy processing other requests. + * * `started` - Commerce has started processing the job. + * * `success` - The job has successfully completed. + * * `failed` - The job has failed. + * */ - name?: string; + type?: + | "child-products" + | "product-import" + | "product-export" + | "hierarchy-duplicate" + | "price-import" + status?: "pending" | "cancelled" | "started" | "success" | "failed" + } + meta?: { /** - * A description of the custom relationship. + * Applies to all job types. A unique request ID is generated when a job is created. */ - description?: string; + x_request_id?: string /** - * A unique slug for the custom relationship. + * Applies to `hierarchy-duplicate` job types. The ID of the original hierarchy that you duplicated. */ - slug?: string; -}; - -export type AttributesHierarchy = { + copied_from?: string /** - * The name of a hierarchy, such as `Major Appliances`. + * Applies to `hierarchy-duplicate` job types. The duplicated hierarchy ID. */ - name?: string; + hierarchy_id?: string /** - * A description for a hierarchy. + * If the job type is `product_export`, a link to the file is created when running a job. */ - description?: string; + file_locations?: Array | null /** - * A unique slug for a hierarchy. + * The entities included in the job. For example, if the job type is `product-export`, the PXM products included in the export. */ - slug?: string; + filter?: string + } +} + +export type Multi = { + /** + * An array of jobs. + */ + data?: Array + meta?: { /** - * Product Experience Manager supports localization of hierarchies and nodes. If you store supports multiple languages, you can localize hierarchy and node names and descriptions. + * Contains the results for the entire collection. */ - locales?: { - [key: string]: { - /** - * A localized hierarchy or node name. - */ - name?: string; - /** - * A localized hierarchy or node description. - */ - description?: string; - }; - }; -}; + results?: { + /** + * Total number of results for the entire collection. + */ + total?: number + } + } +} -export type AttributesNodes = { +export type _Error = { + errors: Array<{ /** - * The name of the node, such as `Ranges` or `Refrigerators`. Names must be unique among sibling nodes in the hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies. + * The HTTP response code of the error. */ - name?: string; + status: string /** - * A description of the node. + * A brief summary of the error. */ - description?: string; + title: string /** - * A slug for the node. Slugs must be unique among sibling nodes in the hierarchy. Otherwise, a slug can be non-unique within the hierarchy and across multiple hierarchies. + * Optional additional detail about the error. */ - slug?: string; + detail?: string /** - * You can curate your products in your nodes product lists. Product curation allows you to promote specific products within each node in a hierarchy, enabling you to create unique product collections in your storefront. See [Curating Products in a node](/docs/api/pxm/products/create-node#curating-products-in-a-node). + * Internal request ID. */ - curated_products?: Array<(string)>; + request_id?: string /** - * Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. + * Additional supporting meta data for the error. */ - locales?: { - [key: string]: { - /** - * A localized name for the node. - */ - name?: string; - /** - * A localized description for the node. - */ - description?: string; - }; - }; -}; + meta?: { + [key: string]: unknown + } + }> +} -export type ComponentProductsResponse = { - data?: Array<{ - /** - * The unique identifier of a product component generated when a product is created. - */ - id?: string; - /** - * This represents the type of resource object being returned. Always `product`. - */ - type?: 'product'; - }>; -}; +export type Single = { + data?: Job +} -export type CreateCustomRelationship = { - data?: { - /** - * This represents the type of resource object being returned. Always `custom-relationship`. - */ - type: 'custom-relationship'; - attributes: ReqAttributesCustomRelationship; - }; -}; +export type Errors = { + /** + * An array of job errors. + */ + data?: Array<{ + /** + * This represents the type of resource object being returned. Always `pim-job-error`. + */ + type?: "pim-job-error" + /** + * A unique identifier for a job error generated when a job error is created. + */ + id?: string + attributes?: { + /** + * A description of an error message. + */ + message?: string + } + }> +} /** - * This represents the type of resource object being returned. Always `custom-relationship`. + * You use the `custom_inputs` attribute to allow your shoppers to add custom text to a product when adding product items to their carts. This is useful, for example, if you have a product like a T-shirt that can be personalized or you sell greetings cards that can be printed with your shoppers personalized messages. See [Personalizing Products](/docs/api/pxm/products/create-product#personalizing-products). */ -export type type = 'custom-relationship'; - -export type CreatedModifier = { - data?: { - /** - * A unique identifier for a modifier that is generated automatically when a modifier is created. - */ - id?: string; - /** - * This represents the type of resource object being returned. Always `product-variation-modifier'. - */ - type?: 'product-variation-modifier'; - attributes?: { - /** - * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. - * - * | Modifier | Data Type | Effect | - * | :--- | :--- | :--- | - * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | - * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | - * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | - * | `description_equals` | `string` | Overrides the description of the child product. | - * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | - * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | - * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | - * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | - * | `price_increment` | `string` | Increases the price of the child product. | - * | `price_decrement` | `string` | Decreases the price of the child product. | - * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | - * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `sku_equals` | `string` | Sets the SKU of the child product. | - * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | - * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | - * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | - * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | - * - */ - type?: 'commodity_type' | 'status' | 'price' | 'name_append' | 'name_prepend' | 'name_equals' | 'sku_append' | 'sku_prepend' | 'sku_equals' | 'sku_builder' | 'slug_append' | 'slug_prepend' | 'slug_equals' | 'slug_builder' | 'description_append' | 'description_prepend' | 'description_equals' | 'custom_inputs_equals' | 'build_rules_equals' | 'locales_equals' | 'upc_ean_equals' | 'mpn_equals' | 'external_ref_equals'; - /** - * Required for non-builder modifiers. The value of the modifier type. - */ - value?: string; - /** - * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. - */ - seek?: string; - /** - * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. - */ - set?: string; - /** - * The name of the modifier. - */ - reference_name?: string; - }; - meta?: { - /** - * The owner of the resource, either `organization` or `store`. - */ - owner?: 'organization' | 'store'; - }; - }; -}; +export type ProductCustomInputs = { + [key: string]: { + /** + * A name for the custom text field. + */ + name?: string + /** + * The validation rules for the custom text. + */ + validation_rules?: Array + /** + * This represents the type of the resource being returned. + */ + type?: string + /** + * The length of the custom input text field. + */ + options?: { + [key: string]: unknown + } + /** + * The number of characters the custom text field can be. You can specify a maximum length up to 255 characters, as the limit is 255 characters. + */ + max_length?: number + /** + * `true` or `false` depending on whether the custom text is required. + */ + required?: boolean + } +} /** - * This represents the type of resource object being returned. Always `product-variation-modifier'. + * Specifies the default behaviour, either `include` or `exclude`. */ -export type type2 = 'product-variation-modifier'; +export type Default = "include" | "exclude" /** - * The owner of the resource, either `organization` or `store`. + * You can build a combination of child products associated with a product, based on build rules that you specify. This is useful, for example, if you have a variation option that you do not sell. This makes managing and building your child products quick and easy. See [Using Build Rules](/docs/api/pxm/products/build-child-products#using-build-rules). */ -export type owner = 'organization' | 'store'; - -export type CreatedOption = { - data: { - /** - * A unique identifier that is generated when an option is created. - */ - id?: string; - /** - * This represents the type of resource object being returned. Always `product-variation-option`. - */ - type: 'product-variation-option'; - attributes: { - /** - * A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. - */ - name?: string; - /** - * A human-recognizable description for the option. - */ - description?: string; - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - */ - sort_order?: number; - }; - meta?: { - /** - * The owner of a resource, either `organization` or `store`. - */ - owner?: 'organization' | 'store'; - /** - * The date and time an option is created. - */ - created_at?: Date; - /** - * The date and time an option is updated. - */ - updated_at?: Date; - }; - }; -}; +export type ProductBuildRules = { + /** + * Specifies the default behaviour, either `include` or `exclude`. + */ + default?: "include" | "exclude" + /** + * An array of option IDs to include when child products are built. Each combination consists of a nested array of option IDs from one or more variations. Combinations of option IDs in the nested arrays must come from different variations. + */ + include?: Array> + /** + * An array of option IDs to exclude when child products are built. Each combination consists of a nested array of option IDs from one or more variations. Combinations of option IDs in the nested arrays must come from different variations. + */ + exclude?: Array> +} /** - * This represents the type of resource object being returned. Always `product-variation-option`. + * With Product Experience Manager, you can create and manage bundles. A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. See [Bundles](/docs/api/pxm/products/products#bundles). */ -export type type3 = 'product-variation-option'; - -export type CreatedVariation = { - data: { - /** - * A unique identifier generated when a variation is created. - */ - id: string; - /** - * This represents the type of resource object being returned. Always `product-variation`. - */ - type: 'product-variation'; - attributes: { - /** - * A human-recognizable identifier for a variation. - */ - name?: string; - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - */ - sort_order?: number; - }; - meta: { - /** - * The owner of the resource, either `organization` or `store`. - */ - owner?: 'organization' | 'store'; - /** - * The date and time a variation is created. - */ - created_at?: Date; - /** - * The date and time a variation is updated. - */ - updated_at?: Date; - }; - }; -}; +export type ProductBundleComponents = { + [key: string]: { + /** + * The component name. The component name is the name that is displayed in your storefront. + */ + name?: string + /** + * The product options included in a component. This can be the ID of another bundle. + */ + options?: Array<{ + /** + * The unique ID of the product you want to add to a component. + */ + id?: string + /** + * This represents the type of object being returned. Always `product`. + */ + type?: string + /** + * The number of this product option that a shopper must purchase. + */ + quantity?: number + /** + * The sort order of the options. The `create a bundle` and `update a bundle` endpoints do not sort the options. You can use the `sort_order` attribute when programming your storefront to display the options in the order that you want. + */ + sort_order?: number + /** + * Whether the product option is a default option in a bundle. Shoppers can select a bundle that specifies a default list of product options. See [Dynamic Bundles](/docs/api/pxm/products/products#dynamic-bundles). + */ + default?: boolean + }> + /** + * The minimum number of product options a shopper can select from this component. + */ + min?: number + /** + * The maximum number of product options a shopper can select from this component. + */ + max?: number + /** + * The sort order of the components. The `create a bundle` and `update a bundle` endpoints do not sort the components. You can use the `sort_order` attribute when programming your storefront to display the components in the order that you want. + */ + sort_order?: number + } +} /** - * This represents the type of resource object being returned. Always `product-variation`. + * The commodity type, either `physical` or `digital`. */ -export type type4 = 'product-variation'; - -export type CreateHierarchy = { - data?: { - /** - * This represents the type of resource object being returned. Always `hierarchy`. - */ - type: 'hierarchy'; - attributes: ReqAttributesHierarchy; - }; -}; +export type CommodityType = "physical" | "digital" /** - * This represents the type of resource object being returned. Always `hierarchy`. + * The resource owner, either `organization` or `store`. */ -export type type5 = 'hierarchy'; +export type Owner = "organization" | "store" -/** - * Use modifiers to change the properties of child products that are inherited from a parent product. With modifiers, you only need to have one parent product with a variation attached to the product. - */ -export type CreateModifier = { - data: { +export type ProductResponse = { + /** + * A unique product ID that is generated when you create the product. + */ + id?: string + /** + * This represents the type of resource object being returned. Always `product`. + */ + type?: "product" + attributes?: { + /** + * A name for the product. + */ + name?: string + /** + * A description for the product. + */ + description?: string + /** + * A label for the product that is used in the URL paths. A slug can contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. By default, the product name is used as the slug. + */ + slug?: string + /** + * The unique stock keeping unit of the product. + */ + sku?: string + /** + * The status for the product, either `draft` or `live`. + */ + status?: "live" | "draft" + /** + * The commodity type, either `physical` or `digital`. + */ + commodity_type?: "physical" | "digital" + /** + * The universal product code or european article number of the product. + */ + upc_ean?: string + /** + * The manufacturer part number of the product. + */ + mpn?: string + /** + * The unique attribute associated with the product. This could be an external reference from a separate company system, for example. The maximum length is 2048 characters. + */ + external_ref?: string + /** + * Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. + */ + locales?: { + [key: string]: unknown + } + /** + * You can use product tags to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. A product can have up to 20 tags. A product tag can be up to 255 characters. Product tags must not contain any spaces or commas. + */ + tags?: Array + extensions?: { + [key: string]: { + [key: string]: string | null | number | boolean + } + } + custom_inputs?: ProductCustomInputs + build_rules?: ProductBuildRules + components?: ProductBundleComponents + } + meta?: { + /** + * The date and time a product is created. + */ + created_at?: Date + /** + * The date and time a product is updated. + */ + updated_at?: Date + /** + * The resource owner, either `organization` or `store`. + */ + owner?: "organization" | "store" + /** + * A product's variations and the options defined for each variation. If you have specified `build_rules`, only the child products included in the `build_rules` are specified. + */ + variations?: Array<{ + /** + * A unique ID generated when a variation is created. + */ + id?: string + /** + * The name of a variation. + */ + name?: string + options?: Array<{ /** - * This represents the type of resource object being returned. Always `product-variation-modifier`. + * A unique ID that is generated an option is created. */ - type: 'product-variation-modifier'; - attributes: { - /** - * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. - * - * | Modifier | Data Type | Effect | - * | :--- | :--- | :--- | - * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | - * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | - * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | - * | `description_equals` | `string` | Overrides the description of the child product. | - * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | - * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | - * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | - * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | - * | `price_increment` | `string` | Increases the price of the child product. | - * | `price_decrement` | `string` | Decreases the price of the child product. | - * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | - * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `sku_equals` | `string` | Sets the SKU of the child product. | - * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | - * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | - * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | - * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | - * - */ - type: 'commodity_type' | 'status' | 'price' | 'name_append' | 'name_prepend' | 'name_equals' | 'sku_append' | 'sku_prepend' | 'sku_equals' | 'sku_builder' | 'slug_append' | 'slug_prepend' | 'slug_equals' | 'slug_builder' | 'description_append' | 'description_prepend' | 'description_equals' | 'custom_inputs_equals' | 'build_rules_equals' | 'locales_equals' | 'upc_ean_equals' | 'mpn_equals' | 'external_ref_equals'; - /** - * Required for non-builder modifiers. The value of the modifier type. - */ - value?: string; - /** - * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. - */ - seek?: string; - /** - * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. - */ - set?: string; - /** - * A name for the modifier. - */ - reference_name?: string; - }; - }; -}; - -export type CreateNode = { - data?: { + id?: string /** - * This represents the type of resource object being returned. Always `node`. + * The name of an option. */ - type: 'node'; - attributes: AttributesNodes; - meta?: { - /** - * You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. The `sort_order` for each node. This value determines the order of nodes in the response for the `Get a Node’s Children` request. The node with the highest value of sort_order is displayed first. For example, a node with a sort_order value of 3 appears before a node with a sort_order value of 2. - * - * - If you don’t provide `sort_order` when creating nodes, all child nodes in the response for `Get a Node’s Children` request are ordered by the `updated_at` time in descending order, with the most recently updated child node first. - * - If you set `sort_order` for only a few child nodes or not all, the child nodes with a `sort_order` value appear first and then other child nodes appear in the order of `updated_at` time. See [Sorting Nodes in a hierarchy](). - * - */ - sort_order?: number; - }; - }; -}; - -/** - * This represents the type of resource object being returned. Always `node`. - */ -export type type6 = 'node'; - -export type CreateOption = { - data: { + name?: string /** - * This represents the type of resource object being returned. Always `product-variation-option`. + * A description of an option. */ - type: 'product-variation-option'; - attributes: { + description?: string + }> + }> + /** + * One of the following product types: + * + * - `standard` - A `standard` product is a standalone product. + * - `parent` - A `parent` product is a product that has child products that have been built using the `Build Child Products` endpoint. + * - `child` - When you configure product variations and variation options for `parent` products, the `child` products derived from the `parent` products are automatically created in Commerce. + * - `bundle` - A `bundle` is a purchasable product, comprising one or more standalone products (in other words, components) to be sold together. + * + */ + product_types?: Array<"parent" | "child" | "bundle" | "standard"> + /** + * The child products defined for a product. The order of the variations in the `variation_matrix` is the order of the variations in the array when the variations were linked to the product. For example, the first variation in the `variation_matrix` corresponds to the first variation in the array, and so on. You can use the `sort_order`attribute to sort the order of your variation and variation options in the `variation_matrix` object. See [Sorting the Order of Variations and Options](/docs/api/pxm/products/variations#sorting-the-order-of-variations-and-options) If no variations are defined for a product, the `variation_matrix` is empty. + */ + variation_matrix?: { + [key: string]: unknown + } + } + /** + * Relationships are established between different product entities. For example, a `bundle` product and a `child` product are related to a `parent` product, as both are associated with it. + */ + relationships?: { + [key: string]: { + data?: + | Array<{ + /** + * A unique identifier for a resource. + */ + id?: string /** - * A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + * This represents the type of resource object being returned. */ - name?: string; + type?: string + }> + | { /** - * By default, variations and variation options are sorted alphabetically. You can use the `sort_order` attribute to sort the order of your variation and variation options in the `variation_matrix`. - * - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. - * - * The variation option with the highest value of `sort_order` is displayed first. For example, a variation option with a `sort_order` value of `3` appears before a variation option with a `sort_order` value of `2`. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, and so on, zero or negative numbers. - * - * You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - * - * You must rebuild your products for the sort order changes to take effect. - * + * A unique identifier for a resource. */ - sort_order?: number; + id?: string /** - * A description of a product variation option. + * This represents the type of resource object being returned. */ - description?: string; - }; - }; -}; + type?: string + } + | null + /** + * Links are used to allow you to move between requests. Single entities use a `self` parameter with a link to that specific resource. Sometimes, there are not enough entities for a project to fill multiple pages. In this situation, we return some defaults. + * + * | Property | Description | + * | :--- | :--- | + * | `current` | Always the current page. | + * | `first` | Always the first page. | + * | `last` | `null` if there is only one page. | + * | `prev` | `null` if the user is on the first page. | + * | `next` | `null` if there is only one page. | + * + */ + links?: { + [key: string]: string + } + } + } +} -export type CreateProductRequest = { - data: { - /** - * This represents the type of resource being returned. Always `product`. - */ - type: 'product'; - attributes: ProductAttributes; - /** - * Relationships are established between different product entities. - */ - relationships?: { - variations?: { - data?: Array<{ - /** - * A unique identifier for a resource. - */ - id?: string; - /** - * This represents the type of resource object being returned. - */ - type?: string; - }>; - }; - }; - }; -}; +export type MultiProductResponse = { + data?: Array + /** + * Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. + */ + included?: { + /** + * Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. + */ + component_products?: Array + } + meta?: { + /** + * Contains the results for the entire collection. + */ + results?: { + /** + * Total number of results for the entire collection. + */ + total?: number + } + } +} /** - * This represents the type of resource being returned. Always `product`. + * Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. */ -export type type7 = 'product'; +export type ProductLocales = { + [key: string]: { + /** + * A localized name for the product. + */ + name: string + /** + * A localized description for the product. + */ + description?: string + } +} -export type CreateVariation = { - data: { - /** - * This represents the type of resource object being returned. Always `product-variation`. - */ - type: 'product-variation'; - attributes: { - /** - * The variation name. - */ - name?: string; - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. - * - * The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. - * - * You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - * - * You must rebuild your products for the sort order changes to take effect. - * - */ - sort_order?: number; - }; - }; -}; +export type ProductAttributes = { + /** + * The unique attribute associated with the product. This could be an external reference from a separate company system, for example. The maximum length is 2048 characters. + */ + external_ref?: string + /** + * The product name to display to customers. + */ + name?: string + /** + * A description for the product. + */ + description?: string + /** + * The unique slug of the product. A slug can contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + */ + slug?: string + /** + * The unique stock keeping unit of the product. + */ + sku?: string + /** + * The status for the product, either `draft` or `live`. Default is `draft`. + */ + status?: "live" | "draft" + /** + * The commodity type, either `physical` or `digital`. + */ + commodity_type?: "physical" | "digital" + /** + * The universal product code or european article number of the product. + */ + upc_ean?: string + /** + * The manufacturer part number of the product. + */ + mpn?: string + /** + * You can use product tags to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. A product can have up to 20 tags. A product tag can be up to 255 characters. Product tags must not contain any spaces or commas. See [Product Tags](/docs/api/pxm/products/product-tags). + */ + tags?: Array + build_rules?: ProductBuildRules + locales?: ProductLocales + custom_inputs?: ProductCustomInputs + components?: ProductBundleComponents +} -export type CustomRelationship = { +export type CreateProductRequest = { + data: { /** - * A unique identifier generated when a custom relationship is created. + * This represents the type of resource being returned. Always `product`. */ - id?: string; + type: "product" + attributes: ProductAttributes /** - * This represents the type of resource object being returned. Always `hierarchy`. + * Relationships are established between different product entities. */ - type?: 'custom-relationship'; - attributes?: AttributesCustomRelationship; - meta?: { - /** - * The owner of the resource. - */ - owner?: string; - timestamps?: { - /** - * The date and time the resource is created. - */ - created_at?: Date; - /** - * The date and time the resource is updated. - */ - updated_at?: Date; - }; - }; -}; + relationships?: { + variations?: { + data?: Array<{ + /** + * A unique identifier for a resource. + */ + id?: string + /** + * This represents the type of resource object being returned. + */ + type?: string + }> + } + } + } +} -export type DuplicateJob = { +export type SingleProductResponse = { + data?: ProductResponse + /** + * Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. + */ + included?: { + /** + * A list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. + */ + component_products?: Array + } +} + +export type UpdateProductRequest = { + data: { + /** + * This represents the type of resource object being returned. Always `product`. + */ + type: "product" + /** + * The unique identifier of the product. Must match the product ID specified in the request path. + */ + id: string + attributes: ProductAttributes + } +} + +export type Attributes = { + /** + * The name of the node, such as `Ranges` or `Refrigerators`. Names must be unique among sibling nodes in the hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies. + */ + name?: string + /** + * A description for a node. + */ + description?: string + /** + * A slug for the node. Slugs must be unique among sibling nodes in the hierarchy. Otherwise, a slug can be non-unique within the hierarchy and across multiple hierarchies. + */ + slug?: string + /** + * You can curate your products in your nodes product lists. Product curation allows you to promote specific products within each node in a hierarchy, enabling you to create unique product collections in your storefront. + */ + curated_products?: Array + /** + * Product Experience Manager supports localization of hierarchies and nodes. If you store supports multiple languages, you can localize hierarchy and node names and descriptions. + */ + locales?: { + [key: string]: { + /** + * A localized hierarchy or node name. + */ + name?: string + /** + * A localized hierarchy or node description. + */ + description?: string + } + } +} + +/** + * Relationships allow you to move between requests. Includes links to the child nodes and products associated with a hierarchy or node. + */ +export type Relationships = { + /** + * The child nodes related to the resource. + */ + children?: { + /** + * An array of child nodes. + */ + data?: Array + /** + * Links allow you to move between requests. + */ + links?: { + /** + * A link to a related resource. + */ + related?: string + } + } + /** + * The parent node related to the resource + */ + parent?: { + /** + * The parent node + */ data?: { - /** - * This represents the type of resource object being returned. Always `hierarchy`. - */ - type?: 'hierarchy'; - attributes?: { - /** - * The name of the duplicate hierarchy. The maximum length is 1000 characters. - */ - name?: string; - /** - * A description of the duplicate hierarchy. - */ - description?: string; - /** - * Specify `true` if you want the product associations in the existing nodes associated in your duplicated hierarchy. If not, specify `false`. - */ - include_products?: boolean; - }; - }; -}; + /** + * This represents the type of resource object being returned. Always `node`. + */ + type: "node" + /** + * The unique identifier of a node. + */ + id: string + } + } + /** + * The products related to the resource. + */ + products?: { + /** + * An array of products. + */ + data?: Array + /** + * Links allow you to move between requests. + */ + links?: { + /** + * A link to a related resource. + */ + related?: string + } + } +} -export type Error = { - errors: Array<{ - /** - * The HTTP response code of the error. - */ - status: string; - /** - * A brief summary of the error. - */ - title: string; - /** - * Optional additional detail about the error. - */ - detail?: string; - /** - * Internal request ID. - */ - request_id?: string; - /** - * Additional supporting meta data for the error. - */ - meta?: { - [key: string]: unknown; - }; - }>; -}; +export type Node = { + /** + * The unique identifier of a node. + */ + id?: string + /** + * This represents the type of resource object being returned. Always `node`. + */ + type?: "node" + attributes?: Attributes + relationships?: Relationships + meta?: { + /** + * The sort order value. The node with the highest value of `sort_order` is displayed first. For example, a node with a `sort_order` value of `3` appears before a node with a `sort_order` value of `2`. See [Sorting Nodes in a hierarchy](/docs/api/pxm/products/create-node#sorting-nodes-in-a-hierarchy). + */ + sort_order?: number + /** + * The date and time a node is created. + */ + created_at?: Date + /** + * The date and time a node was updated. + */ + updated_at?: Date + /** + * The name of the parent of the node if one exists. + */ + parent_name?: string + /** + * The node owner, either `organization` or `store`. + */ + owner?: "store" | "organization" + } +} -export type Errors = { +export type MultiMeta = { + /** + * Contains the results for the entire collection. + */ + results?: { /** - * An array of job errors. + * Total number of results for the entire collection. */ - data?: Array<{ - /** - * This represents the type of resource object being returned. Always `pim-job-error`. - */ - type?: 'pim-job-error'; - /** - * A unique identifier for a job error generated when a job error is created. - */ - id?: string; - attributes?: { - /** - * A description of an error message. - */ - message?: string; - }; - }>; -}; + total?: number + } +} + +/** + * Links are used to allow you to move between requests. + */ +export type MultiLinks = { + /** + * Always the first page. + */ + first?: string + /** + * This is `null` if there is only one page. + */ + last?: string + /** + * This is `null` if there is only one page. + */ + next?: string + /** + * This is `null` if you on the first page. + */ + prev?: string +} + +export type MultiNodes = { + /** + * An array of nodes. + */ + data?: Array + meta?: MultiMeta + links?: MultiLinks +} + +export type TemplateResponse = { + data?: Array<{ + /** + * A unique identifier for a template generated when a template is created. + */ + id?: string + /** + * This represents the type of resource object being returned. Always `template`. + */ + type?: "template" + }> +} + +export type ProductTemplatesRequest = { + data?: Array<{ + /** + * The unique identifier of a template. + */ + id?: string + /** + * This represents the type of resource object being returned. Always `template'. + */ + type?: "template" + }> +} + +export type ComponentProductsResponse = { + data?: Array<{ + /** + * The unique identifier of a product component generated when a product is created. + */ + id?: string + /** + * This represents the type of resource object being returned. Always `product`. + */ + type?: "product" + }> +} export type FileResponse = { - data?: Array<{ - /** - * The unique identifier of the new file. - */ - id?: string; - /** - * This represents the type of resource object being returned. Always `file`. - */ - type?: 'file'; - }>; -}; + data?: Array<{ + /** + * The unique identifier of the new file. + */ + id?: string + /** + * This represents the type of resource object being returned. Always `file`. + */ + type?: "file" + }> +} -export type Hierarchy = { +export type ProductFilesRequest = { + data?: Array<{ /** - * A unique identifier generated when a hierarchy is created. + * A unique identifier for a file generated when a file is created. */ - id?: string; + id?: string /** - * This represents the type of resource object being returned. Always `hierarchy`. + * This represents the type of resource being returned. Always `file`. */ - type?: 'hierarchy'; - attributes?: AttributesHierarchy; - relationships?: RelationshipsHierarchy; + type?: "file" meta?: { - /** - * The date and time a hierarchy is created. - */ - created_at?: Date; - /** - * The date and time a hierarchy is updated. - */ - updated_at?: Date; - /** - * The owner of a resource, either `organization` or `store`. - */ - owner?: 'store' | 'organization'; - }; -}; + /** + * The files associated with a product. + */ + tags?: Array + } + }> +} -export type Job = { +export type VariationsResponse = { + data?: Array<{ + /** + * A unique identifier generated when a variation is created. + */ + id?: string + /** + * This represents the type of resource object being returned. Always `product-variation`. + */ + type?: "product-variation" + meta?: { + /** + * The date and time a resource is created. + */ + created_at?: Date + } + }> +} + +export type ProductVariationsRequest = { + data?: Array<{ + /** + * The ID of the product variation. + */ + id?: string + /** + * This represents the type of resource being returned. Always `product-variation`. + */ + type?: "product-variation" + }> +} + +export type MainImageResponse = { + data?: Array<{ + /** + * A unique identifier for the image file generated automatically when a file is created. + */ + id?: string + /** + * This represents the type of resource object being returned. Always `file`. + */ + type?: string + }> +} + +export type ReplaceMainImageRequest = { + data?: Array<{ + /** + * The ID of the new image file. + */ + id?: string + type?: "file" + }> +} + +export type MainImageRequest = { + data?: { + /** + * The ID of the image file. + */ + id?: string + /** + * This represents the type of resource being returned. Always `file`. + */ + type?: "file" + } +} + +export type MultiVariations = { + data?: Array<{ /** - * A unique identifier generated when a job is created. + * A unique identifier for a variation. */ - id?: string; + id?: string /** - * This represents the type of resource object being returned. Always `pim-job`. + * This represents the type of resource object being returned. Always `product-variation`. */ - type?: 'pim-job'; + type?: "product-variation" attributes?: { + /** + * The name of a variation. + */ + name?: string + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + */ + sort_order?: number + } + meta?: { + options?: Array<{ /** - * The date and time a job is started. + * A unique ID that is generated when an option is created. */ - started_at?: (Date) | null; + id?: string /** - * The date and time a job is completed. + * A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. */ - completed_at?: (Date) | null; + name?: string /** - * The date and time a job is created. + * A human recognizable description of the option. */ - created_at?: Date; + description?: string /** - * The date and time a job is updated. + * The date and time an option is created. */ - updated_at?: Date; + created_at?: Date /** - * The status of a job. - * - * * `pending` - Commerce has received the request but is currently busy processing other requests. - * * `started` - Commerce has started processing the job. - * * `success` - The job has successfully completed. - * * `failed` - The job has failed. - * + * The date and time an option is updated. */ - type?: 'child-products' | 'product-import' | 'product-export' | 'hierarchy-duplicate' | 'price-import'; - status?: 'pending' | 'cancelled' | 'started' | 'success' | 'failed'; - }; - meta?: { + updated_at?: Date /** - * Applies to all job types. A unique request ID is generated when a job is created. + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. */ - x_request_id?: string; + sort_order?: number + }> + /** + * The owner of the resource, either `organization` or `store`. + */ + owner?: "organization" | "store" + /** + * The date and time a variation is created. + */ + created_at?: Date + /** + * The date and time a variation is updated. + */ + updated_at?: Date + } + }> + meta?: { + /** + * Contains the results for the entire collection. + */ + results?: { + /** + * Total number of results for the entire collection. + */ + total?: number + } + } +} + +export type CreateVariation = { + data: { + /** + * This represents the type of resource object being returned. Always `product-variation`. + */ + type: "product-variation" + attributes: { + /** + * The variation name. + */ + name?: string + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. + * + * The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. + * + * You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + * + * You must rebuild your products for the sort order changes to take effect. + * + */ + sort_order?: number + } + } +} + +export type CreatedVariation = { + data: { + /** + * A unique identifier generated when a variation is created. + */ + id: string + /** + * This represents the type of resource object being returned. Always `product-variation`. + */ + type: "product-variation" + attributes: { + /** + * A human-recognizable identifier for a variation. + */ + name?: string + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + */ + sort_order?: number + } + meta: { + /** + * The owner of the resource, either `organization` or `store`. + */ + owner?: "organization" | "store" + /** + * The date and time a variation is created. + */ + created_at?: Date + /** + * The date and time a variation is updated. + */ + updated_at?: Date + } + } +} + +export type SingleVariation = { + data: { + /** + * A unique identifier for a variation. + */ + id: string + /** + * This represents the type of resource object being returned. Always `product-variation`. + */ + type: "product-variation" + attributes: { + /** + * The name for a variation. + */ + name?: string + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + */ + sort_order?: number + } + meta: { + /** + * A variation option represents an option for selection for a single product-variation. For example, if your variation is `color`, you might have three possible options; red, green, and blue. + */ + options?: Array<{ /** - * Applies to `hierarchy-duplicate` job types. The ID of the original hierarchy that you duplicated. + * A unique ID that is generated an option is created. */ - copied_from?: string; + id?: string /** - * Applies to `hierarchy-duplicate` job types. The duplicated hierarchy ID. + * A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. */ - hierarchy_id?: string; + name?: string /** - * If the job type is `product_export`, a link to the file is created when running a job. + * A description for an option. */ - file_locations?: Array<(string)> | null; + description?: string /** - * The entities included in the job. For example, if the job type is `product-export`, the PXM products included in the export. + * The date and time an option is created. */ - filter?: string; - }; -}; - -/** - * This represents the type of resource object being returned. Always `pim-job`. - */ -export type type8 = 'pim-job'; - -export type status = 'pending' | 'cancelled' | 'started' | 'success' | 'failed'; - -export type MainImageRequest = { - data?: { + created_at?: Date /** - * The ID of the image file. + * The date and time an option is updated. */ - id?: string; + updated_at?: Date /** - * This represents the type of resource being returned. Always `file`. + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. */ - type?: 'file'; - }; -}; - -/** - * This represents the type of resource being returned. Always `file`. - */ -export type type9 = 'file'; + sort_order?: number + }> + /** + * The owner of the resource, either `organization` or `store`. + */ + owner?: "organization" | "store" + /** + * The date and time a variation is created. + */ + created_at?: string + /** + * The date and time a variation is updated. + */ + updated_at?: string + } + } +} -export type MainImageResponse = { - data?: Array<{ - /** - * A unique identifier for the image file generated automatically when a file is created. - */ - id?: string; - /** - * This represents the type of resource object being returned. Always `file`. - */ - type?: string; - }>; -}; +export type UpdateVariation = { + data: { + /** + * This represents the type of resource object being returned. Always `product-variation`. + */ + type: "product-variation" + attributes: { + /** + * The variation name. + */ + name?: string + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. + * + * The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. + * + * You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + * + * You must rebuild your products for the sort order changes to take effect. + * + */ + sort_order?: number + } + /** + * The unique identifier of the variation. Must match the variation ID specified in the request path. + */ + id: string + } +} -export type Multi = { +export type MultiOptions = { + data?: Array<{ + /** + * A unique identifier generated when an option is created. + */ + id?: string /** - * An array of jobs. + * This represents the type of resource object being returned. Always `product-variation-option`. */ - data?: Array; + type?: "product-variation-option" + attributes?: { + /** + * A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + */ + name?: string + /** + * A human-recognizable description for the option. + */ + description?: string + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + */ + sort_order?: number + } meta?: { - /** - * Contains the results for the entire collection. - */ - results?: { - /** - * Total number of results for the entire collection. - */ - total?: number; - }; - }; -}; + /** + * The owner of a resource, either `organization` or `store`. + */ + owner?: "organization" | "store" + /** + * The date and time an option is created. + */ + created_at?: Date + /** + * The date and time an option is updated. + */ + updated_at?: Date + } + }> + meta?: { + /** + * Contains the results for the entire collection. + */ + results?: { + /** + * Total number of results for the entire collection. + */ + total?: number + } + } +} -export type MultiHierarchy = { - data?: Array; - links?: MultiLinks; - meta?: MultiMeta; -}; +export type CreateOption = { + data: { + /** + * This represents the type of resource object being returned. Always `product-variation-option`. + */ + type: "product-variation-option" + attributes: { + /** + * A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + */ + name?: string + /** + * By default, variations and variation options are sorted alphabetically. You can use the `sort_order` attribute to sort the order of your variation and variation options in the `variation_matrix`. + * + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. + * + * The variation option with the highest value of `sort_order` is displayed first. For example, a variation option with a `sort_order` value of `3` appears before a variation option with a `sort_order` value of `2`. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, and so on, zero or negative numbers. + * + * You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + * + * You must rebuild your products for the sort order changes to take effect. + * + */ + sort_order?: number + /** + * A description of a product variation option. + */ + description?: string + } + } +} -/** - * Links are used to allow you to move between requests. - */ -export type MultiLinks = { +export type CreatedOption = { + data: { + /** + * A unique identifier that is generated when an option is created. + */ + id?: string /** - * Always the first page. + * This represents the type of resource object being returned. Always `product-variation-option`. */ - first?: string; + type: "product-variation-option" + attributes: { + /** + * A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + */ + name?: string + /** + * A human-recognizable description for the option. + */ + description?: string + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + */ + sort_order?: number + } + meta?: { + /** + * The owner of a resource, either `organization` or `store`. + */ + owner?: "organization" | "store" + /** + * The date and time an option is created. + */ + created_at?: Date + /** + * The date and time an option is updated. + */ + updated_at?: Date + } + } +} + +export type SingleOption = { + data: { /** - * This is `null` if there is only one page. + * The unique identifier generated when an option is created. */ - last?: string; + id: string /** - * This is `null` if there is only one page. + * This represents the type of resource object being returned. Always `product-variation-option`. */ - next?: string; + type: "product-variation-option" /** - * This is `null` if you on the first page. + * A variation option represents an option for selection for a single product-variation. For example, if your variation is `color`, you might have three possible options; red, green, and blue. */ - prev?: string; -}; + attributes: { + /** + * A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + */ + name?: string + /** + * A human-recognizable description for the option. + */ + description?: string + /** + * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + */ + sort_order?: number + } + meta: { + /** + * The owner of a resource, either `organization` or `store`. + */ + owner?: "organization" | "store" + /** + * The date and time an option is created. + */ + created_at?: Date + /** + * The date and time an option is updated. + */ + updated_at?: Date + } + } +} -export type MultiMeta = { +export type UpdateOption = { + data: { /** - * Contains the results for the entire collection. + * This represents the type of resource object being returned. Always `product-variation-option`. */ - results?: { - /** - * Total number of results for the entire collection. - */ - total?: number; - }; -}; + type: "product-variation-option" + attributes: { + /** + * A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. + */ + name?: string + /** + * The description of the option. + */ + description?: string + /** + * By default, variations and variation options are sorted alphabetically. You can use the `sort_order` attribute to sort the order of your variation and variation options in the `variation_matrix`. The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. + * + * The variation option with the highest value of `sort_order` is displayed first. For example, a variation option with a `sort_order` value of `3` appears before a variation option with a `sort_order` value of `2`. + * + * You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, and so on, zero or negative numbers. + * + * You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. + * + * You must rebuild your products for the sort order changes to take effect. + * + */ + sort_order?: number + } + /** + * The unique identifier of the option. Must match the option ID specified in the request path. + */ + id: string + } +} export type MultiModifiers = { - data?: Array<{ - /** - * A unique identifier for a modifier that is generated automatically when a modifier is created. - */ - id?: string; - /** - * This represents the type of resource object being returned. Always `product-variation-modifier'. - */ - type?: 'product-variation-modifier'; - attributes?: { - /** - * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. - * - * | Modifier | Data Type | Effect | - * | :--- | :--- | :--- | - * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | - * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | - * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | - * | `description_equals` | `string` | Overrides the description of the child product. | - * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | - * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | - * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | - * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | - * | `price_increment` | `string` | Increases the price of the child product. | - * | `price_decrement` | `string` | Decreases the price of the child product. | - * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | - * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `sku_equals` | `string` | Sets the SKU of the child product. | - * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | - * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | - * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | - * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | - * - */ - type?: 'commodity_type' | 'status' | 'price' | 'name_append' | 'name_prepend' | 'name_equals' | 'sku_append' | 'sku_prepend' | 'sku_equals' | 'sku_builder' | 'slug_append' | 'slug_prepend' | 'slug_equals' | 'slug_builder' | 'description_append' | 'description_prepend' | 'description_equals' | 'custom_inputs_equals' | 'build_rules_equals' | 'locales_equals' | 'upc_ean_equals' | 'mpn_equals' | 'external_ref_equals'; - /** - * Required for non-builder modifiers. The value of the modifier type. - */ - value?: string; - /** - * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. - */ - seek?: string; - /** - * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. - */ - set?: string; - /** - * The name of the modifier. - */ - reference_name?: string; - }; - meta?: { - /** - * The owner of a resource, either `organization` or `store`. - */ - owner?: 'store' | 'organization'; - }; - }>; - meta?: { - /** - * Contains the results for the entire collection. - */ - results?: { - /** - * Total number of results for the entire collection. - */ - total?: number; - }; - }; -}; - -export type MultiNodes = { - /** - * An array of nodes. - */ - data?: Array; - meta?: MultiMeta; - links?: MultiLinks; -}; - -export type MultiOptions = { - data?: Array<{ - /** - * A unique identifier generated when an option is created. - */ - id?: string; - /** - * This represents the type of resource object being returned. Always `product-variation-option`. - */ - type?: 'product-variation-option'; - attributes?: { - /** - * A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. - */ - name?: string; - /** - * A human-recognizable description for the option. - */ - description?: string; - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - */ - sort_order?: number; - }; - meta?: { - /** - * The owner of a resource, either `organization` or `store`. - */ - owner?: 'organization' | 'store'; - /** - * The date and time an option is created. - */ - created_at?: Date; - /** - * The date and time an option is updated. - */ - updated_at?: Date; - }; - }>; - meta?: { - /** - * Contains the results for the entire collection. - */ - results?: { - /** - * Total number of results for the entire collection. - */ - total?: number; - }; - }; -}; - -export type MultiProductResponse = { - data?: Array; - /** - * Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. - */ - included?: { - /** - * Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. - */ - component_products?: Array; - }; - meta?: { - /** - * Contains the results for the entire collection. - */ - results?: { - /** - * Total number of results for the entire collection. - */ - total?: number; - }; - }; -}; - -export type MultiTag = { - /** - * An array of tags. - */ - data?: Array; - meta?: { - /** - * Contains the results for the entire collection. - */ - results?: { - /** - * Total number of results for the entire collection. - */ - total?: number; - }; - }; -}; - -export type MultiVariations = { - data?: Array<{ - /** - * A unique identifier for a variation. - */ - id?: string; - /** - * This represents the type of resource object being returned. Always `product-variation`. - */ - type?: 'product-variation'; - attributes?: { - /** - * The name of a variation. - */ - name?: string; - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - */ - sort_order?: number; - }; - meta?: { - options?: Array<{ - /** - * A unique ID that is generated when an option is created. - */ - id?: string; - /** - * A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. - */ - name?: string; - /** - * A human recognizable description of the option. - */ - description?: string; - /** - * The date and time an option is created. - */ - created_at?: Date; - /** - * The date and time an option is updated. - */ - updated_at?: Date; - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - */ - sort_order?: number; - }>; - /** - * The owner of the resource, either `organization` or `store`. - */ - owner?: 'organization' | 'store'; - /** - * The date and time a variation is created. - */ - created_at?: Date; - /** - * The date and time a variation is updated. - */ - updated_at?: Date; - }; - }>; - meta?: { - /** - * Contains the results for the entire collection. - */ - results?: { - /** - * Total number of results for the entire collection. - */ - total?: number; - }; - }; -}; - -export type Node = { + data?: Array<{ /** - * The unique identifier of a node. + * A unique identifier for a modifier that is generated automatically when a modifier is created. */ - id?: string; + id?: string /** - * This represents the type of resource object being returned. Always `node`. + * This represents the type of resource object being returned. Always `product-variation-modifier'. */ - type?: 'node'; - attributes?: Attributes; - relationships?: Relationships; + type?: "product-variation-modifier" + attributes?: { + /** + * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + * + * | Modifier | Data Type | Effect | + * | :--- | :--- | :--- | + * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | + * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | + * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | + * | `description_equals` | `string` | Overrides the description of the child product. | + * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | + * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | + * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | + * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | + * | `price_increment` | `string` | Increases the price of the child product. | + * | `price_decrement` | `string` | Decreases the price of the child product. | + * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | + * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `sku_equals` | `string` | Sets the SKU of the child product. | + * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | + * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | + * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | + * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | + * + */ + type?: + | "commodity_type" + | "status" + | "price" + | "name_append" + | "name_prepend" + | "name_equals" + | "sku_append" + | "sku_prepend" + | "sku_equals" + | "sku_builder" + | "slug_append" + | "slug_prepend" + | "slug_equals" + | "slug_builder" + | "description_append" + | "description_prepend" + | "description_equals" + | "custom_inputs_equals" + | "build_rules_equals" + | "locales_equals" + | "upc_ean_equals" + | "mpn_equals" + | "external_ref_equals" + /** + * Required for non-builder modifiers. The value of the modifier type. + */ + value?: string + /** + * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. + */ + seek?: string + /** + * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. + */ + set?: string + /** + * The name of the modifier. + */ + reference_name?: string + } meta?: { - /** - * The sort order value. The node with the highest value of `sort_order` is displayed first. For example, a node with a `sort_order` value of `3` appears before a node with a `sort_order` value of `2`. See [Sorting Nodes in a hierarchy](/docs/api/pxm/products/create-node#sorting-nodes-in-a-hierarchy). - */ - sort_order?: number; - /** - * The date and time a node is created. - */ - created_at?: Date; - /** - * The date and time a node was updated. - */ - updated_at?: Date; - /** - * The name of the parent of the node if one exists. - */ - parent_name?: string; - /** - * The node owner, either `organization` or `store`. - */ - owner?: 'store' | 'organization'; - }; -}; - -export type NodeChildren = { - data?: Array<{ - /** - * The unique identifier of the child node. Must not match the node ID specified in the request path. - */ - id: string; - /** - * This represents the type of resource object being returned. Always `node`. - */ - type: 'node'; - }>; -}; - -export type NodeParent = { - data?: { - /** - * The unique identifier of the new parent node. Must not match the node ID specified in the request path. - */ - id: string; - /** - * This represents the type of resource object being returned. Always `node`. - */ - type: 'node'; - }; -}; - -export type NodeProducts = { - data?: Array<{ - /** - * The unique identifier of the product to be attached to the node. - */ - id: string; - /** - * This represents the type of resource object being returned. Always `product`. - */ - type: 'product'; - }>; -}; - -/** - * A custom relationship slug. - */ -export type ParameterCustomRelationshipSlug = string; - -/** - * - * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering), but you must go to a specific endpoint to understand the attributes and operators an endpoint supports. - * - * For more information about the attributes and operators that this endpoint supports, see [Export Products](/docs/api/pxm/products/export-products). - * - */ -export type ParameterFilterexport = string; - -/** - * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering). - * - * For more information about the attributes and operators that are supported, see [Get all products](/docs/api/pxm/products/get-all-products). - * - */ -export type ParameterFilterproduct = string; - -/** - * A unique identifier for the hierarchy. - */ -export type ParameterHierarchyId = string; - -/** - * Using the include parameter, you can retrieve top-level resources. - * - * - Files or main image. For example, `include=files,main_image`. - * - Component product data. For example, `include=component_products`. - * - Key attribute data, such as SKU or slug. - * - */ -export type ParameterInclude = string; - -/** - * A unique identifier for the job. - */ -export type ParameterJobId = string; - -/** - * A unique identifier for the modifier. - */ -export type ParameterModifierId = string; - -/** - * A unique identifier for the node. - */ -export type ParameterNodeId = string; - -/** - * A unique identifier for the option. - */ -export type ParameterOptionId = string; - -/** - * The number of records per page. The maximum limit is 100. - */ -export type ParameterPageLimit = number; - -/** - * The number of records to offset the results by. - */ -export type ParameterPageOffset = number; - -/** - * A unique identifier for the product. - */ -export type ParameterProductId = string; - -/** - * A unique identifier for the tag. - */ -export type ParameterTagId = string; - -/** - * Set to `true` if you want to use a template slug instead of a template ID when exporting products that have custom data. - */ -export type ParameterUseTemplateSlugs = boolean; - -/** - * A unique identifier for the variation. - */ -export type ParameterVariationId = string; - -export type ProductAttributes = { - /** - * The unique attribute associated with the product. This could be an external reference from a separate company system, for example. The maximum length is 2048 characters. - */ - external_ref?: string; - /** - * The product name to display to customers. - */ - name?: string; - /** - * A description for the product. - */ - description?: string; - /** - * The unique slug of the product. A slug can contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. - */ - slug?: string; - /** - * The unique stock keeping unit of the product. - */ - sku?: string; - /** - * The status for the product, either `draft` or `live`. Default is `draft`. - */ - status?: 'live' | 'draft'; - /** - * The commodity type, either `physical` or `digital`. - */ - commodity_type?: 'physical' | 'digital'; - /** - * The universal product code or european article number of the product. - */ - upc_ean?: string; - /** - * The manufacturer part number of the product. - */ - mpn?: string; - /** - * You can use product tags to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. A product can have up to 20 tags. A product tag can be up to 255 characters. Product tags must not contain any spaces or commas. See [Product Tags](/docs/api/pxm/products/product-tags). - */ - tags?: Array<(string)>; - build_rules?: ProductBuildRules; - locales?: ProductLocales; - custom_inputs?: ProductCustomInputs; - components?: ProductBundleComponents; -}; - -/** - * The status for the product, either `draft` or `live`. Default is `draft`. - */ -export type status2 = 'live' | 'draft'; - -/** - * The commodity type, either `physical` or `digital`. - */ -export type commodity_type = 'physical' | 'digital'; - -/** - * You can build a combination of child products associated with a product, based on build rules that you specify. This is useful, for example, if you have a variation option that you do not sell. This makes managing and building your child products quick and easy. See [Using Build Rules](/docs/api/pxm/products/build-child-products#using-build-rules). - */ -export type ProductBuildRules = { - /** - * Specifies the default behaviour, either `include` or `exclude`. - */ - default?: 'include' | 'exclude'; - /** - * An array of option IDs to include when child products are built. Each combination consists of a nested array of option IDs from one or more variations. Combinations of option IDs in the nested arrays must come from different variations. - */ - include?: Array>; + /** + * The owner of a resource, either `organization` or `store`. + */ + owner?: "store" | "organization" + } + }> + meta?: { /** - * An array of option IDs to exclude when child products are built. Each combination consists of a nested array of option IDs from one or more variations. Combinations of option IDs in the nested arrays must come from different variations. - */ - exclude?: Array>; -}; - -/** - * Specifies the default behaviour, either `include` or `exclude`. - */ -export type default = 'include' | 'exclude'; - -/** - * With Product Experience Manager, you can create and manage bundles. A bundle is a purchasable product, comprising of one or more products that you want to sell together. You can create multiple components within a bundle. Each component must have at least one or more options. Each option is a product and a quantity. See [Bundles](/docs/api/pxm/products/products#bundles). - */ -export type ProductBundleComponents = { - [key: string]: { - /** - * The component name. The component name is the name that is displayed in your storefront. - */ - name?: string; - /** - * The product options included in a component. This can be the ID of another bundle. - */ - options?: Array<{ - /** - * The unique ID of the product you want to add to a component. - */ - id?: string; - /** - * This represents the type of object being returned. Always `product`. - */ - type?: string; - /** - * The number of this product option that a shopper must purchase. - */ - quantity?: number; - /** - * The sort order of the options. The `create a bundle` and `update a bundle` endpoints do not sort the options. You can use the `sort_order` attribute when programming your storefront to display the options in the order that you want. - */ - sort_order?: number; - /** - * Whether the product option is a default option in a bundle. Shoppers can select a bundle that specifies a default list of product options. See [Dynamic Bundles](/docs/api/pxm/products/products#dynamic-bundles). - */ - default?: boolean; - }>; - /** - * The minimum number of product options a shopper can select from this component. - */ - min?: number; - /** - * The maximum number of product options a shopper can select from this component. - */ - max?: number; - /** - * The sort order of the components. The `create a bundle` and `update a bundle` endpoints do not sort the components. You can use the `sort_order` attribute when programming your storefront to display the components in the order that you want. - */ - sort_order?: number; - }; -}; - -/** - * You use the `custom_inputs` attribute to allow your shoppers to add custom text to a product when adding product items to their carts. This is useful, for example, if you have a product like a T-shirt that can be personalized or you sell greetings cards that can be printed with your shoppers personalized messages. See [Personalizing Products](/docs/api/pxm/products/create-product#personalizing-products). - */ -export type ProductCustomInputs = { - [key: string]: { - /** - * A name for the custom text field. - */ - name?: string; - /** - * The validation rules for the custom text. - */ - validation_rules?: unknown[]; - /** - * This represents the type of the resource being returned. - */ - type?: string; - /** - * The length of the custom input text field. - */ - options?: { - [key: string]: unknown; - }; - /** - * The number of characters the custom text field can be. You can specify a maximum length up to 255 characters, as the limit is 255 characters. - */ - max_length?: number; - /** - * `true` or `false` depending on whether the custom text is required. - */ - required?: boolean; - }; -}; - -export type ProductFilesRequest = { - data?: Array<{ - /** - * A unique identifier for a file generated when a file is created. - */ - id?: string; - /** - * This represents the type of resource being returned. Always `file`. - */ - type?: 'file'; - meta?: { - /** - * The files associated with a product. - */ - tags?: Array<(string)>; - }; - }>; -}; - -/** - * Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. - */ -export type ProductLocales = { - [key: string]: { - /** - * A localized name for the product. - */ - name: string; - /** - * A localized description for the product. - */ - description?: string; - }; -}; - -export type ProductResponse = { - /** - * A unique product ID that is generated when you create the product. - */ - id?: string; - /** - * This represents the type of resource object being returned. Always `product`. - */ - type?: 'product'; - attributes?: { - /** - * A name for the product. - */ - name?: string; - /** - * A description for the product. - */ - description?: string; - /** - * A label for the product that is used in the URL paths. A slug can contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. By default, the product name is used as the slug. - */ - slug?: string; - /** - * The unique stock keeping unit of the product. - */ - sku?: string; - /** - * The status for the product, either `draft` or `live`. - */ - status?: 'live' | 'draft'; - /** - * The commodity type, either `physical` or `digital`. - */ - commodity_type?: 'physical' | 'digital'; - /** - * The universal product code or european article number of the product. - */ - upc_ean?: string; - /** - * The manufacturer part number of the product. - */ - mpn?: string; - /** - * The unique attribute associated with the product. This could be an external reference from a separate company system, for example. The maximum length is 2048 characters. - */ - external_ref?: string; - /** - * Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. - */ - locales?: { - [key: string]: unknown; - }; - /** - * You can use product tags to store or assign a key word against a product. The product tag can then be used to describe or label that product. Using product tags means that you can group your products together, for example, by brand, category, subcategory, colors, types, industries, and so on. A product can have up to 20 tags. A product tag can be up to 255 characters. Product tags must not contain any spaces or commas. - */ - tags?: Array<(string)>; - extensions?: { - [key: string]: { - [key: string]: ((string) | null | number | boolean); - }; - }; - custom_inputs?: ProductCustomInputs; - build_rules?: ProductBuildRules; - components?: ProductBundleComponents; - }; - meta?: { - /** - * The date and time a product is created. - */ - created_at?: Date; - /** - * The date and time a product is updated. - */ - updated_at?: Date; - /** - * The resource owner, either `organization` or `store`. - */ - owner?: 'organization' | 'store'; - /** - * A product's variations and the options defined for each variation. If you have specified `build_rules`, only the child products included in the `build_rules` are specified. - */ - variations?: Array<{ - /** - * A unique ID generated when a variation is created. - */ - id?: string; - /** - * The name of a variation. - */ - name?: string; - options?: Array<{ - /** - * A unique ID that is generated an option is created. - */ - id?: string; - /** - * The name of an option. - */ - name?: string; - /** - * A description of an option. - */ - description?: string; - }>; - }>; - /** - * One of the following product types: - * - * - `standard` - A `standard` product is a standalone product. - * - `parent` - A `parent` product is a product that has child products that have been built using the `Build Child Products` endpoint. - * - `child` - When you configure product variations and variation options for `parent` products, the `child` products derived from the `parent` products are automatically created in Commerce. - * - `bundle` - A `bundle` is a purchasable product, comprising one or more standalone products (in other words, components) to be sold together. - * - */ - product_types?: Array<('parent' | 'child' | 'bundle' | 'standard')>; - /** - * The child products defined for a product. The order of the variations in the `variation_matrix` is the order of the variations in the array when the variations were linked to the product. For example, the first variation in the `variation_matrix` corresponds to the first variation in the array, and so on. You can use the `sort_order`attribute to sort the order of your variation and variation options in the `variation_matrix` object. See [Sorting the Order of Variations and Options](/docs/api/pxm/products/variations#sorting-the-order-of-variations-and-options) If no variations are defined for a product, the `variation_matrix` is empty. - */ - variation_matrix?: { - [key: string]: unknown; - }; - }; - /** - * Relationships are established between different product entities. For example, a `bundle` product and a `child` product are related to a `parent` product, as both are associated with it. - */ - relationships?: { - [key: string]: { - data?: (Array<{ - /** - * A unique identifier for a resource. - */ - id?: string; - /** - * This represents the type of resource object being returned. - */ - type?: string; -}> | { - /** - * A unique identifier for a resource. - */ - id?: string; - /** - * This represents the type of resource object being returned. - */ - type?: string; -} | null); - /** - * Links are used to allow you to move between requests. Single entities use a `self` parameter with a link to that specific resource. Sometimes, there are not enough entities for a project to fill multiple pages. In this situation, we return some defaults. - * - * | Property | Description | - * | :--- | :--- | - * | `current` | Always the current page. | - * | `first` | Always the first page. | - * | `last` | `null` if there is only one page. | - * | `prev` | `null` if the user is on the first page. | - * | `next` | `null` if there is only one page. | - * - */ - links?: { - [key: string]: (string); - }; - }; - }; -}; - -export type ProductTemplatesRequest = { - data?: Array<{ - /** - * The unique identifier of a template. - */ - id?: string; - /** - * This represents the type of resource object being returned. Always `template'. - */ - type?: 'template'; - }>; -}; - -export type ProductVariationsRequest = { - data?: Array<{ - /** - * The ID of the product variation. - */ - id?: string; - /** - * This represents the type of resource being returned. Always `product-variation`. - */ - type?: 'product-variation'; - }>; -}; - -/** - * Relationships allow you to move between requests. Includes links to the child nodes and products associated with a hierarchy or node. - */ -export type Relationships = { - /** - * The child nodes related to the resource. - */ - children?: { - /** - * An array of child nodes. - */ - data?: unknown[]; - /** - * Links allow you to move between requests. - */ - links?: { - /** - * A link to a related resource. - */ - related?: string; - }; - }; - /** - * The parent node related to the resource - */ - parent?: { - /** - * The parent node - */ - data?: { - /** - * This represents the type of resource object being returned. Always `node`. - */ - type: 'node'; - /** - * The unique identifier of a node. - */ - id: string; - }; - }; - /** - * The products related to the resource. - */ - products?: { - /** - * An array of products. - */ - data?: unknown[]; - /** - * Links allow you to move between requests. - */ - links?: { - /** - * A link to a related resource. - */ - related?: string; - }; - }; -}; - -export type RelationshipsHierarchy = { - /** - * The child nodes related to the hierarchy. - */ - children?: { - /** - * An array of child nodes. - */ - data?: unknown[]; - /** - * Links allow you to move between requests. - */ - links?: { - /** - * A link to a related resource. - */ - related?: string; - }; - }; -}; - -export type ReplaceMainImageRequest = { - data?: Array<{ - /** - * The ID of the new image file. - */ - id?: string; - type?: 'file'; - }>; -}; - -export type ReqAttributesCustomRelationship = { - /** - * The name of the custom relationship, such as `Kitchen electrics`. - */ - name?: string; - /** - * A description of the custom relationship. - */ - description?: string; - /** - * A unique slug for the custom relationship. Must match the slug specified in the request path. - */ - slug?: string; -}; - -export type ReqAttributesHierarchy = { - /** - * The name of the hierarchy, such as `Major Appliances`. - */ - name?: string; - /** - * A description of the hierarchy. - */ - description?: string; - /** - * A unique slug for the hierarchy. - */ - slug?: string; - /** - * Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. - */ - locales?: { - [key: string]: { - /** - * A localized name for the hierarchy. - */ - name?: string; - /** - * A localized description for the hierarchy. - */ - description?: string; - }; - }; -}; - -export type Single = { - data?: Job; -}; - -export type SingleCustomRelationship = { - data?: CustomRelationship; -}; - -export type SingleHierarchy = { - data?: Hierarchy; -}; - -export type SingleModifier = { - data?: { - /** - * A unique identifier for a modifier that is generated automatically when a modifier is created. - */ - id?: string; - /** - * This represents the type of resource object being returned. Always `product-variation-modifier'. - */ - type?: 'product-variation-modifier'; - attributes?: { - /** - * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. - * - * | Modifier | Data Type | Effect | - * | :--- | :--- | :--- | - * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | - * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | - * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | - * | `description_equals` | `string` | Overrides the description of the child product. | - * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | - * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | - * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | - * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | - * | `price_increment` | `string` | Increases the price of the child product. | - * | `price_decrement` | `string` | Decreases the price of the child product. | - * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | - * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `sku_equals` | `string` | Sets the SKU of the child product. | - * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | - * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | - * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | - * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | - * - */ - type?: 'commodity_type' | 'status' | 'price' | 'name_append' | 'name_prepend' | 'name_equals' | 'sku_append' | 'sku_prepend' | 'sku_equals' | 'sku_builder' | 'slug_append' | 'slug_prepend' | 'slug_equals' | 'slug_builder' | 'description_append' | 'description_prepend' | 'description_equals' | 'custom_inputs_equals' | 'build_rules_equals' | 'locales_equals' | 'upc_ean_equals' | 'mpn_equals' | 'external_ref_equals'; - /** - * Required for non-builder modifiers. The value of the modifier type. - */ - value?: string; - /** - * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. - */ - seek?: string; - /** - * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. - */ - set?: string; - /** - * The name of the modifier. - */ - reference_name?: string; - }; - /** - * The owner of the resource, either `organization` or `store`. - */ - meta?: { - owner?: 'organization' | 'store'; - }; - }; -}; - -export type SingleNode = { - data?: Node; -}; - -export type SingleOption = { - data: { - /** - * The unique identifier generated when an option is created. - */ - id: string; - /** - * This represents the type of resource object being returned. Always `product-variation-option`. - */ - type: 'product-variation-option'; - /** - * A variation option represents an option for selection for a single product-variation. For example, if your variation is `color`, you might have three possible options; red, green, and blue. - */ - attributes: { - /** - * A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. - */ - name?: string; - /** - * A human-recognizable description for the option. - */ - description?: string; - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - */ - sort_order?: number; - }; - meta: { - /** - * The owner of a resource, either `organization` or `store`. - */ - owner?: 'organization' | 'store'; - /** - * The date and time an option is created. - */ - created_at?: Date; - /** - * The date and time an option is updated. - */ - updated_at?: Date; - }; - }; -}; - -export type SingleProductResponse = { - data?: ProductResponse; - /** - * Returns a list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. - */ - included?: { - /** - * A list of component products in a product bundle. If a bundle has no component products (in other words, is not a product bundle), an empty array is returned. - */ - component_products?: Array; - }; -}; - -export type SingleTag = { - data?: Tag; -}; - -export type SingleVariation = { - data: { - /** - * A unique identifier for a variation. - */ - id: string; - /** - * This represents the type of resource object being returned. Always `product-variation`. - */ - type: 'product-variation'; - attributes: { - /** - * The name for a variation. - */ - name?: string; - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - */ - sort_order?: number; - }; - meta: { - /** - * A variation option represents an option for selection for a single product-variation. For example, if your variation is `color`, you might have three possible options; red, green, and blue. - */ - options?: Array<{ - /** - * A unique ID that is generated an option is created. - */ - id?: string; - /** - * A human-recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. - */ - name?: string; - /** - * A description for an option. - */ - description?: string; - /** - * The date and time an option is created. - */ - created_at?: Date; - /** - * The date and time an option is updated. - */ - updated_at?: Date; - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - */ - sort_order?: number; - }>; - /** - * The owner of the resource, either `organization` or `store`. - */ - owner?: 'organization' | 'store'; - /** - * The date and time a variation is created. - */ - created_at?: string; - /** - * The date and time a variation is updated. - */ - updated_at?: string; - }; - }; -}; - -export type Tag = { - /** - * A unique identifier generated when a tag is created. - */ - id?: string; - /** - * This represents the type of resource object being returned. Always `tag`. - */ - type?: 'tag'; - attributes?: { - /** - * The text value of the tag. - */ - value?: string; - }; - meta?: { - /** - * A unique request ID is generated when a tag is created. - */ - x_request_id?: string; - /** - * The date and time a tag is created. - */ - created_at?: Date; - /** - * The date and time a tag is updated. - */ - updated_at?: Date; - /** - * The owner of a resource, either `organization` or `store`. - */ - owner?: 'store' | 'organization'; - }; -}; - -/** - * This represents the type of resource object being returned. Always `tag`. - */ -export type type10 = 'tag'; - -export type TemplateResponse = { - data?: Array<{ - /** - * A unique identifier for a template generated when a template is created. - */ - id?: string; - /** - * This represents the type of resource object being returned. Always `template`. - */ - type?: 'template'; - }>; -}; - -export type UpdateCustomRelationship = { - data: { - /** - * The unique identifier of the custom relationship. - */ - id: string; - /** - * This represents the type of resource object being returned. Always `custom-relationship`. - */ - type: 'custom-relationship'; - attributes: ReqAttributesCustomRelationship; - }; -}; - -export type UpdateHierarchy = { - data: { - /** - * The unique identifier of the hierarchy. Must match the hierarchy ID specified in the request path. - */ - id: string; - /** - * This represents the type of resource object being returned. Always `hierarchy`. - */ - type: 'hierarchy'; - attributes: ReqAttributesHierarchy; - }; -}; - -export type UpdateModifier = { - data: { - /** - * This represents the type of resource object being returned. Always `product-variation-modifier`. - */ - type: 'product-variation-modifier'; - attributes: { - /** - * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. - * - * | Modifier | Data Type | Effect | - * | :--- | :--- | :--- | - * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | - * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | - * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | - * | `description_equals` | `string` | Overrides the description of the child product. | - * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | - * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | - * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | - * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | - * | `price_increment` | `string` | Increases the price of the child product. | - * | `price_decrement` | `string` | Decreases the price of the child product. | - * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | - * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | - * | `sku_equals` | `string` | Sets the SKU of the child product. | - * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | - * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | - * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | - * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | - * - */ - type: 'commodity_type' | 'status' | 'price' | 'name_append' | 'name_prepend' | 'name_equals' | 'sku_append' | 'sku_prepend' | 'sku_equals' | 'sku_builder' | 'slug_append' | 'slug_prepend' | 'slug_equals' | 'slug_builder' | 'description_append' | 'description_prepend' | 'description_equals' | 'custom_inputs_equals' | 'build_rules_equals' | 'locales_equals' | 'upc_ean_equals' | 'mpn_equals' | 'external_ref_equals'; - /** - * Required for non-builder modifiers. The value of the modifier type. - */ - value?: string; - /** - * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. - */ - seek?: string; - /** - * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. - */ - set?: string; - /** - * The name of the modifier. - */ - reference_name?: string; - }; - /** - * The unique identifier of the modifier. Must match the modifier ID specified in the request path. - */ - id: string; - }; -}; - -export type UpdateNode = { - data?: { - /** - * The unique identifier of the node. Must match the node ID specified in the request path. - */ - id: string; - /** - * This represents the type of resource object being returned. Always `node`. - */ - type: 'node'; - attributes: AttributesNodes; - meta?: { - /** - * You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. The `sort_order` for each node. This value determines the order of nodes in the response for the `Get a Node’s Children` request. The node with the highest value of sort_order is displayed first. For example, a node with a sort_order value of 3 appears before a node with a sort_order value of 2. - * - * - If you don’t provide `sort_order` when creating nodes, all child nodes in the response for `Get a Node’s Children` request are ordered by the `updated_at` time in descending order, with the most recently updated child node first. - * - If you set `sort_order` for only a few child nodes or not all, the child nodes with a `sort_order` value appear first and then other child nodes appear in the order of `updated_at` time. - * - */ - sort_order?: number; - }; - }; -}; - -export type UpdateOption = { - data: { - /** - * This represents the type of resource object being returned. Always `product-variation-option`. - */ - type: 'product-variation-option'; - attributes: { - /** - * A human recognizable identifier for the option, also used in the SLUG for child products. Option names can only contain A to Z, a to z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. - */ - name?: string; - /** - * The description of the option. - */ - description?: string; - /** - * By default, variations and variation options are sorted alphabetically. You can use the `sort_order` attribute to sort the order of your variation and variation options in the `variation_matrix`. The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. - * - * The variation option with the highest value of `sort_order` is displayed first. For example, a variation option with a `sort_order` value of `3` appears before a variation option with a `sort_order` value of `2`. - * - * You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, and so on, zero or negative numbers. - * - * You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - * - * You must rebuild your products for the sort order changes to take effect. - * - */ - sort_order?: number; - }; - /** - * The unique identifier of the option. Must match the option ID specified in the request path. - */ - id: string; - }; -}; - -export type UpdateProductRequest = { - data: { - /** - * This represents the type of resource object being returned. Always `product`. - */ - type: 'product'; - /** - * The unique identifier of the product. Must match the product ID specified in the request path. - */ - id: string; - attributes: ProductAttributes; - }; -}; - -export type UpdateVariation = { - data: { - /** - * This represents the type of resource object being returned. Always `product-variation`. - */ - type: 'product-variation'; - attributes: { - /** - * The variation name. - */ - name?: string; - /** - * The sort order value is visible when you add the variations and variation options to your catalogs. You can then use the `sort_order` value to program your storefront to display the variation options in the order that you want. - * - * The variation with the highest value of `sort_order` is displayed first. For example, a variation with a `sort_order` value of 3 appears before a variation with a `sort_order` value of 2. - * - * You can specify any numbers that you want. You can use 1, 2, 3, or 100, 90, 80, including, zero or negative numbers. You can set `sort_order` to either `null` or omit it entirely from the request if you wish to remove an existing `sort_order` attribute. - * - * You must rebuild your products for the sort order changes to take effect. - * - */ - sort_order?: number; - }; - /** - * The unique identifier of the variation. Must match the variation ID specified in the request path. - */ - id: string; - }; -}; - -export type VariationsResponse = { - data?: Array<{ - /** - * A unique identifier generated when a variation is created. - */ - id?: string; - /** - * This represents the type of resource object being returned. Always `product-variation`. - */ - type?: 'product-variation'; - meta?: { - /** - * The date and time a resource is created. - */ - created_at?: Date; - }; - }>; -}; - -export type GetAllJobsResponse = (Multi); - -export type GetAllJobsError = (Error); - -export type GetJobData = { - path: { - /** - * A unique identifier for the job. - */ - jobID: string; - }; -}; - -export type GetJobResponse = (Single); - -export type GetJobError = (Error); - -export type CancelJobData = { - body?: { - [key: string]: unknown; - }; - path: { - /** - * A unique identifier for the job. - */ - jobID: string; - }; -}; - -export type CancelJobResponse = (Single); - -export type CancelJobError = (Error); - -export type GetJobErrorsData = { - path: { - /** - * A unique identifier for the job. - */ - jobID: string; - }; -}; - -export type GetJobErrorsResponse = (Errors); - -export type GetJobErrorsError = (Error); - -export type CreateProductData = { - body: CreateProductRequest; -}; - -export type CreateProductResponse = (SingleProductResponse); - -export type CreateProductError = (Error); - -export type GetAllProductsData = { - query?: { - /** - * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering). - * - * For more information about the attributes and operators that are supported, see [Get all products](/docs/api/pxm/products/get-all-products). - * - */ - filter?: string; - /** - * Using the include parameter, you can retrieve top-level resources. - * - * - Files or main image. For example, `include=files,main_image`. - * - Component product data. For example, `include=component_products`. - * - Key attribute data, such as SKU or slug. - * - */ - include?: string; - /** - * The number of records per page. The maximum limit is 100. - */ - 'page[limit]'?: number; - /** - * The number of records to offset the results by. - */ - 'page[offset]'?: number; - }; -}; - -export type GetAllProductsResponse = (MultiProductResponse); - -export type GetAllProductsError = (Error); - -export type ImportProductsData = { - body?: { - /** - * The file you want to upload. Ensure that the file format is Comma Separated Values (CSV). - */ - file?: (Blob | File); - }; -}; - -export type ImportProductsResponse = (Single); - -export type ImportProductsError = (Error); - -export type ExportProductsData = { - body?: { - [key: string]: unknown; - }; - query?: { - /** - * - * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering), but you must go to a specific endpoint to understand the attributes and operators an endpoint supports. - * - * For more information about the attributes and operators that this endpoint supports, see [Export Products](/docs/api/pxm/products/export-products). - * - */ - filter?: string; - /** - * Set to `true` if you want to use a template slug instead of a template ID when exporting products that have custom data. - */ - useTemplateSlugs?: boolean; - }; -}; - -export type ExportProductsResponse = (Single); - -export type ExportProductsError = (Error); - -export type GetProductData = { - path: { - /** - * A unique identifier for the product. - */ - productID: string; - }; - query?: { - /** - * Using the include parameter, you can retrieve top-level resources. - * - * - Files or main image. For example, `include=files,main_image`. - * - Component product data. For example, `include=component_products`. - * - Key attribute data, such as SKU or slug. - * - */ - include?: string; - }; -}; - -export type GetProductResponse = (SingleProductResponse); - -export type GetProductError = (Error); - -export type UpdateProductData = { - body?: UpdateProductRequest; - path: { - /** - * A unique identifier for the product. - */ - productID: string; - }; -}; - -export type UpdateProductResponse = (SingleProductResponse); - -export type UpdateProductError = (Error); - -export type DeleteProductData = { - path: { - /** - * A unique identifier for the product. - */ - productID: string; - }; -}; - -export type DeleteProductResponse = (void); - -export type DeleteProductError = (Error); - -export type AttachNodesData = { - body: { - data: { - /** - * Filters applied to search for appropriate products to attach to a node. See [Attach multiple nodes](/docs/api/pxm/products/attach-nodes). - * - */ - filter: string; - /** - * A list of node unique identifiers that you want to assign to the products. - */ - node_ids: Array<(string)>; - }; - }; -}; - -export type AttachNodesResponse = ({ - meta?: { - /** - * Number of nodes assigned to the products. - */ - nodes_attached?: number; - /** - * A list of node unique identifiers that could not be identified. - */ - nodes_not_found?: Array<(string)>; - }; -}); - -export type AttachNodesError = (Error); - -export type DetachNodesData = { - body: { - data: { - /** - * You can apply filters to search for the appropriate products to detach. See [Detach multiple nodes](/docs/api/pxm/products/detach-nodes). - * - */ - filter: string; - /** - * A list of node unique identifiers that you want to assign to the products. - */ - node_ids: Array<(string)>; - }; - }; -}; - -export type DetachNodesResponse = ({ - meta?: { - /** - * Number of nodes dissociated from the products. - */ - nodes_detached?: number; - /** - * A list of node unique identifiers that could not be identified. - */ - nodes_not_found?: Array<(string)>; - }; -}); - -export type DetachNodesError = (Error); - -export type GetProductsNodesData = { - path: { - /** - * A unique identifier for the product. - */ - productID: string; - }; - query?: { - /** - * The number of records per page. The maximum limit is 100. - */ - 'page[limit]'?: number; - /** - * The number of records to offset the results by. - */ - 'page[offset]'?: number; - }; -}; - -export type GetProductsNodesResponse = (MultiNodes); - -export type GetProductsNodesError = (Error); - -export type BuildChildProductsData = { - body?: { - [key: string]: unknown; - }; - path: { - /** - * A unique identifier for the product. - */ - productID: string; - }; -}; - -export type BuildChildProductsResponse = (unknown); - -export type BuildChildProductsError = (Error); - -export type GetChildProductsData = { - path: { - /** - * A unique identifier for the product. - */ - productID: string; - }; -}; - -export type GetChildProductsResponse = (MultiProductResponse); - -export type GetChildProductsError = (Error); - -export type CreateProductTemplateRelationshipData = { - body?: ProductTemplatesRequest; - path: { - /** - * A unique identifier for the product. - */ - productID: string; - }; -}; - -export type CreateProductTemplateRelationshipResponse = (TemplateResponse); - -export type CreateProductTemplateRelationshipError = (Error); - -export type GetProductTemplateRelationshipsData = { - path: { - /** - * A unique identifier for the product. - */ - productID: string; - }; -}; - -export type GetProductTemplateRelationshipsResponse = (TemplateResponse); - -export type GetProductTemplateRelationshipsError = (Error); - -export type DeleteProductTemplateRelationshipData = { - body?: ProductTemplatesRequest; - path: { - /** - * A unique identifier for the product. - */ - productID: string; - }; -}; - -export type DeleteProductTemplateRelationshipResponse = (void); - -export type DeleteProductTemplateRelationshipError = (Error); - -export type GetProductComponentProductsRelationshipsData = { - path: { - /** - * A unique identifier for the product. - */ - productID: string; - }; -}; - -export type GetProductComponentProductsRelationshipsResponse = (ComponentProductsResponse); - -export type GetProductComponentProductsRelationshipsError = (Error); - -export type GetProductFileRelationshipsData = { - path: { - /** - * A unique identifier for the product. - */ - productID: string; - }; -}; - -export type GetProductFileRelationshipsResponse = (FileResponse); - -export type GetProductFileRelationshipsError = (Error); - -export type CreateProductFileRelationshipsData = { - body?: ProductFilesRequest; - path: { - /** - * A unique identifier for the product. - */ - productID: string; - }; -}; - -export type CreateProductFileRelationshipsResponse = (void); - -export type CreateProductFileRelationshipsError = (Error); - -export type UpdateProductFileRelationshipsData = { - body?: ProductFilesRequest; - path: { - /** - * A unique identifier for the product. - */ - productID: string; - }; -}; - -export type UpdateProductFileRelationshipsResponse = (void); - -export type UpdateProductFileRelationshipsError = (Error); - -export type DeleteProductFileRelationshipsData = { - body?: ProductFilesRequest; - path: { - /** - * A unique identifier for the product. - */ - productID: string; - }; -}; - -export type DeleteProductFileRelationshipsResponse = (void); - -export type DeleteProductFileRelationshipsError = (Error); - -export type CreateProductVariationRelationshipsData = { - body?: ProductVariationsRequest; - path: { - /** - * A unique identifier for the product. - */ - productID: string; - }; -}; - -export type CreateProductVariationRelationshipsResponse = (void); - -export type CreateProductVariationRelationshipsError = (Error); - -export type GetProductVariationRelationshipsData = { - path: { - /** - * A unique identifier for the product. - */ - productID: string; - }; -}; - -export type GetProductVariationRelationshipsResponse = (VariationsResponse); - -export type GetProductVariationRelationshipsError = (Error); - -export type UpdateProductVariationRelationshipsData = { - body?: ProductVariationsRequest; - path: { - /** - * A unique identifier for the product. - */ - productID: string; - }; -}; - -export type UpdateProductVariationRelationshipsResponse = (void); - -export type UpdateProductVariationRelationshipsError = (Error); - -export type DeleteProductVariationRelationshipsData = { - body?: ProductVariationsRequest; - path: { - /** - * A unique identifier for the product. - */ - productID: string; - }; -}; - -export type DeleteProductVariationRelationshipsResponse = (void); - -export type DeleteProductVariationRelationshipsError = (Error); - -export type CreateProductMainImageRelationshipsData = { - body?: MainImageRequest; - path: { - /** - * A unique identifier for the product. - */ - productID: string; - }; -}; - -export type CreateProductMainImageRelationshipsResponse = (void); - -export type CreateProductMainImageRelationshipsError = (Error); - -export type GetProductMainImageRelationshipsData = { - path: { - /** - * A unique identifier for the product. - */ - productID: string; - }; -}; - -export type GetProductMainImageRelationshipsResponse = (MainImageResponse); - -export type GetProductMainImageRelationshipsError = (Error); - -export type UpdateProductMainImageRelationshipsData = { - body?: ReplaceMainImageRequest; - path: { - /** - * A unique identifier for the product. - */ - productID: string; - }; -}; - -export type UpdateProductMainImageRelationshipsResponse = (void); - -export type UpdateProductMainImageRelationshipsError = (Error); - -export type DeleteProductMainImageRelationshipsData = { - path: { - /** - * A unique identifier for the product. - */ - productID: string; - }; -}; - -export type DeleteProductMainImageRelationshipsResponse = (void); - -export type DeleteProductMainImageRelationshipsError = (Error); - -export type CreateVariationData = { - body: CreateVariation; -}; - -export type CreateVariationResponse = (CreatedVariation); - -export type CreateVariationError = (Error); - -export type GetAllVariationsData = { - query?: { - /** - * The number of records per page. The maximum limit is 100. - */ - 'page[limit]'?: number; - /** - * The number of records to offset the results by. - */ - 'page[offset]'?: number; - }; -}; - -export type GetAllVariationsResponse = (MultiVariations); - -export type GetAllVariationsError = (Error); - -export type GetVariationData = { - path: { - /** - * A unique identifier for the variation. - */ - variationID: string; - }; -}; - -export type GetVariationResponse = (SingleVariation); - -export type GetVariationError = (Error); - -export type UpdateVariationData = { - body?: UpdateVariation; - path: { - /** - * A unique identifier for the variation. - */ - variationID: string; - }; -}; - -export type UpdateVariationResponse = (SingleVariation); - -export type UpdateVariationError = (Error); - -export type DeleteVariationData = { - path: { - /** - * A unique identifier for the variation. - */ - variationID: string; - }; -}; - -export type DeleteVariationResponse = (void); - -export type DeleteVariationError = (Error); - -export type CreateVariationOptionData = { - body?: CreateOption; - path: { - /** - * A unique identifier for the variation. - */ - variationID: string; - }; -}; - -export type CreateVariationOptionResponse = (CreatedOption); - -export type CreateVariationOptionError = (Error); - -export type GetAllVariationOptionsData = { - path: { - /** - * A unique identifier for the variation. - */ - variationID: string; - }; - query?: { - /** - * The number of records per page. The maximum limit is 100. - */ - 'page[limit]'?: number; - /** - * The number of records to offset the results by. - */ - 'page[offset]'?: number; - }; -}; - -export type GetAllVariationOptionsResponse = (MultiOptions); - -export type GetAllVariationOptionsError = (Error); - -export type GetVariationOptionData = { - path: { - /** - * A unique identifier for the option. - */ - optionID: string; - /** - * A unique identifier for the variation. - */ - variationID: string; - }; -}; - -export type GetVariationOptionResponse = (SingleOption); - -export type GetVariationOptionError = (Error); - -export type UpdateVariationOptionData = { - body?: UpdateOption; - path: { - /** - * A unique identifier for the option. - */ - optionID: string; - /** - * A unique identifier for the variation. - */ - variationID: string; - }; -}; - -export type UpdateVariationOptionResponse = (SingleOption); - -export type UpdateVariationOptionError = (Error); - -export type DeleteVariationOptionData = { - path: { - /** - * A unique identifier for the option. - */ - optionID: string; - /** - * A unique identifier for the variation. - */ - variationID: string; - }; -}; - -export type DeleteVariationOptionResponse = (void); - -export type DeleteVariationOptionError = (Error); - -export type CreateModifierData = { - body?: CreateModifier; - path: { - /** - * A unique identifier for the option. - */ - optionID: string; - /** - * A unique identifier for the variation. - */ - variationID: string; - }; -}; - -export type CreateModifierResponse = (CreatedModifier); - -export type CreateModifierError = (Error); - -export type GetAllModifiersData = { - path: { - /** - * A unique identifier for the option. - */ - optionID: string; - /** - * A unique identifier for the variation. - */ - variationID: string; - }; - query?: { - /** - * The number of records per page. The maximum limit is 100. - */ - 'page[limit]'?: number; - /** - * The number of records to offset the results by. - */ - 'page[offset]'?: number; - }; -}; - -export type GetAllModifiersResponse = (MultiModifiers); - -export type GetAllModifiersError = (Error); - -export type GetModifierData = { - path: { - /** - * A unique identifier for the modifier. - */ - modifierID: string; - /** - * A unique identifier for the option. - */ - optionID: string; - /** - * A unique identifier for the variation. - */ - variationID: string; - }; -}; - -export type GetModifierResponse = (SingleModifier); - -export type GetModifierError = (Error); - -export type UpdateModifierData = { - body?: UpdateModifier; - path: { - /** - * A unique identifier for the modifier. - */ - modifierID: string; - /** - * A unique identifier for the option. - */ - optionID: string; - /** - * A unique identifier for the variation. - */ - variationID: string; - }; -}; - -export type UpdateModifierResponse = (SingleModifier); - -export type UpdateModifierError = (Error); - -export type DeleteModifierData = { - path: { - /** - * A unique identifier for the modifier. - */ - modifierID: string; - /** - * A unique identifier for the option. - */ - optionID: string; - /** - * A unique identifier for the variation. - */ - variationID: string; - }; -}; - -export type DeleteModifierResponse = (void); - -export type DeleteModifierError = (Error); - -export type CreateHierarchyData = { - body: CreateHierarchy; -}; - -export type CreateHierarchyResponse = (SingleHierarchy); - -export type CreateHierarchyError = (Error); - -export type GetHierarchyData = { - query?: { - /** - * The number of records per page. The maximum limit is 100. - */ - 'page[limit]'?: number; - /** - * The number of records to offset the results by. - */ - 'page[offset]'?: number; - }; -}; - -export type GetHierarchyResponse = (MultiHierarchy); - -export type GetHierarchyError = (Error); - -export type GetHierarchyChildData = { - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string; - }; -}; - -export type GetHierarchyChildResponse = (SingleHierarchy); - -export type GetHierarchyChildError = (Error); - -export type UpdateHierarchyData = { - body: UpdateHierarchy; - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string; - }; -}; - -export type UpdateHierarchyResponse = (SingleHierarchy); - -export type UpdateHierarchyError = (Error); - -export type DeleteHierarchyData = { - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string; - }; -}; - -export type DeleteHierarchyResponse = (void); - -export type DeleteHierarchyError = (Error); - -export type CreateNodeData = { - body?: CreateNode; - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string; - }; -}; - -export type CreateNodeResponse = (SingleNode); - -export type CreateNodeError = (Error); - -export type GetAllNodesInHierarchyData = { - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string; - }; - query?: { - /** - * The number of records per page. The maximum limit is 100. - */ - 'page[limit]'?: number; - /** - * The number of records to offset the results by. - */ - 'page[offset]'?: number; - }; -}; - -export type GetAllNodesInHierarchyResponse = (MultiNodes); - -export type GetAllNodesInHierarchyError = (Error); - -export type GetHierarchyNodeData = { - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string; - /** - * A unique identifier for the node. - */ - nodeID: string; - }; -}; - -export type GetHierarchyNodeResponse = (SingleNode); - -export type GetHierarchyNodeError = (Error); - -export type UpdateNodeData = { - body?: UpdateNode; - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string; - /** - * A unique identifier for the node. - */ - nodeID: string; - }; -}; - -export type UpdateNodeResponse = (SingleNode); - -export type UpdateNodeError = (Error); - -export type DeleteNodeData = { - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string; - /** - * A unique identifier for the node. - */ - nodeID: string; - }; -}; - -export type DeleteNodeResponse = (void); - -export type DeleteNodeError = (Error); - -export type GetAllChildrenData = { - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string; - }; - query?: { - /** - * The number of records per page. The maximum limit is 100. - */ - 'page[limit]'?: number; - /** - * The number of records to offset the results by. - */ - 'page[offset]'?: number; - }; -}; - -export type GetAllChildrenResponse = (MultiNodes); - -export type GetAllChildrenError = (Error); - -export type CreateNodeChildRelationshipsData = { - body?: NodeChildren; - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string; - /** - * A unique identifier for the node. - */ - nodeID: string; - }; -}; - -export type CreateNodeChildRelationshipsResponse = (SingleNode); - -export type CreateNodeChildRelationshipsError = (Error); - -export type GetAllNodeChildrenData = { - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string; - /** - * A unique identifier for the node. - */ - nodeID: string; - }; - query?: { - /** - * The number of records per page. The maximum limit is 100. - */ - 'page[limit]'?: number; - /** - * The number of records to offset the results by. - */ - 'page[offset]'?: number; - }; -}; - -export type GetAllNodeChildrenResponse = (MultiNodes); - -export type GetAllNodeChildrenError = (Error); - -export type UpdateNodeParentData = { - body?: NodeParent; - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string; - /** - * A unique identifier for the node. - */ - nodeID: string; - }; -}; - -export type UpdateNodeParentResponse = (void); - -export type UpdateNodeParentError = (Error); - -export type DeleteNodeParentData = { - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string; - /** - * A unique identifier for the node. - */ - nodeID: string; - }; -}; - -export type DeleteNodeParentResponse = (void); - -export type DeleteNodeParentError = (Error); - -export type CreateNodeProductRelationshipData = { - body?: NodeProducts; - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string; - /** - * A unique identifier for the node. - */ - nodeID: string; - }; -}; - -export type CreateNodeProductRelationshipResponse = (SingleNode); - -export type CreateNodeProductRelationshipError = (Error); - -export type DeleteNodeProductRelationshipsData = { - body?: NodeProducts; - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string; - /** - * A unique identifier for the node. - */ - nodeID: string; - }; -}; - -export type DeleteNodeProductRelationshipsResponse = (SingleNode); - -export type DeleteNodeProductRelationshipsError = (Error); - -export type GetNodeProductsData = { - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string; - /** - * A unique identifier for the node. - */ - nodeID: string; - }; - query?: { - /** - * The number of records per page. The maximum limit is 100. - */ - 'page[limit]'?: number; - /** - * The number of records to offset the results by. - */ - 'page[offset]'?: number; - }; -}; - -export type GetNodeProductsResponse = (MultiProductResponse); - -export type GetNodeProductsError = (Error); - -export type DuplicateHierarchyData = { - body: DuplicateJob; - path: { - /** - * A unique identifier for the hierarchy. - */ - hierarchyID: string; - }; -}; - -export type DuplicateHierarchyResponse = (Single); - -export type DuplicateHierarchyError = (Error); - -export type GetAllProductTagsResponse = (MultiTag); - -export type GetAllProductTagsError = (Error); + * Contains the results for the entire collection. + */ + results?: { + /** + * Total number of results for the entire collection. + */ + total?: number + } + } +} -export type GetProductTagData = { - path: { - /** - * A unique identifier for the tag. - */ - tagID: string; - }; -}; +/** + * Use modifiers to change the properties of child products that are inherited from a parent product. With modifiers, you only need to have one parent product with a variation attached to the product. + */ +export type CreateModifier = { + data: { + /** + * This represents the type of resource object being returned. Always `product-variation-modifier`. + */ + type: "product-variation-modifier" + attributes: { + /** + * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + * + * | Modifier | Data Type | Effect | + * | :--- | :--- | :--- | + * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | + * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | + * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | + * | `description_equals` | `string` | Overrides the description of the child product. | + * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | + * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | + * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | + * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | + * | `price_increment` | `string` | Increases the price of the child product. | + * | `price_decrement` | `string` | Decreases the price of the child product. | + * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | + * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `sku_equals` | `string` | Sets the SKU of the child product. | + * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | + * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | + * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | + * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | + * + */ + type: + | "commodity_type" + | "status" + | "price" + | "name_append" + | "name_prepend" + | "name_equals" + | "sku_append" + | "sku_prepend" + | "sku_equals" + | "sku_builder" + | "slug_append" + | "slug_prepend" + | "slug_equals" + | "slug_builder" + | "description_append" + | "description_prepend" + | "description_equals" + | "custom_inputs_equals" + | "build_rules_equals" + | "locales_equals" + | "upc_ean_equals" + | "mpn_equals" + | "external_ref_equals" + /** + * Required for non-builder modifiers. The value of the modifier type. + */ + value?: string + /** + * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. + */ + seek?: string + /** + * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. + */ + set?: string + /** + * A name for the modifier. + */ + reference_name?: string + } + } +} -export type GetProductTagResponse = (SingleTag); +export type CreatedModifier = { + data?: { + /** + * A unique identifier for a modifier that is generated automatically when a modifier is created. + */ + id?: string + /** + * This represents the type of resource object being returned. Always `product-variation-modifier'. + */ + type?: "product-variation-modifier" + attributes?: { + /** + * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + * + * | Modifier | Data Type | Effect | + * | :--- | :--- | :--- | + * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | + * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | + * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | + * | `description_equals` | `string` | Overrides the description of the child product. | + * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | + * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | + * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | + * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | + * | `price_increment` | `string` | Increases the price of the child product. | + * | `price_decrement` | `string` | Decreases the price of the child product. | + * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | + * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `sku_equals` | `string` | Sets the SKU of the child product. | + * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | + * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | + * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | + * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | + * + */ + type?: + | "commodity_type" + | "status" + | "price" + | "name_append" + | "name_prepend" + | "name_equals" + | "sku_append" + | "sku_prepend" + | "sku_equals" + | "sku_builder" + | "slug_append" + | "slug_prepend" + | "slug_equals" + | "slug_builder" + | "description_append" + | "description_prepend" + | "description_equals" + | "custom_inputs_equals" + | "build_rules_equals" + | "locales_equals" + | "upc_ean_equals" + | "mpn_equals" + | "external_ref_equals" + /** + * Required for non-builder modifiers. The value of the modifier type. + */ + value?: string + /** + * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. + */ + seek?: string + /** + * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. + */ + set?: string + /** + * The name of the modifier. + */ + reference_name?: string + } + meta?: { + /** + * The owner of the resource, either `organization` or `store`. + */ + owner?: "organization" | "store" + } + } +} -export type GetProductTagError = (Error); +export type SingleModifier = { + data?: { + /** + * A unique identifier for a modifier that is generated automatically when a modifier is created. + */ + id?: string + /** + * This represents the type of resource object being returned. Always `product-variation-modifier'. + */ + type?: "product-variation-modifier" + attributes?: { + /** + * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + * + * | Modifier | Data Type | Effect | + * | :--- | :--- | :--- | + * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | + * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | + * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | + * | `description_equals` | `string` | Overrides the description of the child product. | + * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | + * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | + * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | + * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | + * | `price_increment` | `string` | Increases the price of the child product. | + * | `price_decrement` | `string` | Decreases the price of the child product. | + * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | + * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `sku_equals` | `string` | Sets the SKU of the child product. | + * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | + * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | + * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | + * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | + * + */ + type?: + | "commodity_type" + | "status" + | "price" + | "name_append" + | "name_prepend" + | "name_equals" + | "sku_append" + | "sku_prepend" + | "sku_equals" + | "sku_builder" + | "slug_append" + | "slug_prepend" + | "slug_equals" + | "slug_builder" + | "description_append" + | "description_prepend" + | "description_equals" + | "custom_inputs_equals" + | "build_rules_equals" + | "locales_equals" + | "upc_ean_equals" + | "mpn_equals" + | "external_ref_equals" + /** + * Required for non-builder modifiers. The value of the modifier type. + */ + value?: string + /** + * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. + */ + seek?: string + /** + * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. + */ + set?: string + /** + * The name of the modifier. + */ + reference_name?: string + } + /** + * The owner of the resource, either `organization` or `store`. + */ + meta?: { + owner?: "organization" | "store" + } + } +} -export type CreateCustomRelationshipData = { - body: CreateCustomRelationship; -}; +export type UpdateModifier = { + data: { + /** + * This represents the type of resource object being returned. Always `product-variation-modifier`. + */ + type: "product-variation-modifier" + attributes: { + /** + * You can specify different modifiers for different options in a variation. When you build child products using options in variations, the properties of a child products depends on the modifier set for the options that are applied to the child product. The table below describes the different types of modifiers. + * + * | Modifier | Data Type | Effect | + * | :--- | :--- | :--- | + * | `name_equals` | `string` | Overrides the name of the child product with the name specified by the modifier. | + * | `name_append` | `string` | Appends the string specified in the modifier to the name of the child product. | + * | `name_prepend` | `string` | Prepends the string specified in the modifier to the name of the child product. | + * | `description_equals` | `string` | Overrides the description of the child product. | + * | `description_append` | `string` | Appends the string specified in the modifier to the description of the child product. | + * | `description_prepend` | `string` | Prepends the string specified in the modifier to the product description of the child product. | + * | `commodity_type` | `string` | Sets the commodity type of the child product, such as `physical` or `digital`. | + * | `price` | `string` | Allows application of price modifiers (`price_increment`, `price_decrement`, and `price_equals`) to the child products. | + * | `price_increment` | `string` | Increases the price of the child product. | + * | `price_decrement` | `string` | Decreases the price of the child product. | + * | `price_equals` | `string` | Sets the price of a child product to the amount you specify. | + * | `slug_append` | `string` | Appends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_prepend` | `string` | Prepends the string specified in the modifier to the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `slug_builder` | `string`| Sets a part of the slug of the child product. Can only contain A-Z, a-z, 0 to 9, hyphen, underscore, and period. Spaces or other special characters like ^, [], *, and $ are not allowed. However, for the `slug-builder` modifier, you can use `{}` in the `seek` field, for example, `"seek": :{COLOR}"`. | + * | `sku_equals` | `string` | Sets the SKU of the child product. | + * | `sku_append` | `string` | Appends the string specified in the modifier to the SKU of the child product. | + * | `sku_prepend` | `string` | Prepends the string specified in the modifier to the SKU of the child product. | + * | `sku_builder` | `string` | Sets a part of the SKU of the child product. | + * | `status` | `string` | Sets the status of the child product, such as `draft` or `live`. | + * + */ + type: + | "commodity_type" + | "status" + | "price" + | "name_append" + | "name_prepend" + | "name_equals" + | "sku_append" + | "sku_prepend" + | "sku_equals" + | "sku_builder" + | "slug_append" + | "slug_prepend" + | "slug_equals" + | "slug_builder" + | "description_append" + | "description_prepend" + | "description_equals" + | "custom_inputs_equals" + | "build_rules_equals" + | "locales_equals" + | "upc_ean_equals" + | "mpn_equals" + | "external_ref_equals" + /** + * Required for non-builder modifiers. The value of the modifier type. + */ + value?: string + /** + * Required for builder modifiers. The sub-string to find and replace enclosed in curly brackets for `slug_builder` and `sku_builder`. + */ + seek?: string + /** + * Required for builder modifiers. The value to replace matches the `seek` string for `slug_builder` and `sku_builder`. + */ + set?: string + /** + * The name of the modifier. + */ + reference_name?: string + } + /** + * The unique identifier of the modifier. Must match the modifier ID specified in the request path. + */ + id: string + } +} -export type CreateCustomRelationshipResponse = (SingleCustomRelationship); +export type AttributesHierarchy = { + /** + * The name of a hierarchy, such as `Major Appliances`. + */ + name?: string + /** + * A description for a hierarchy. + */ + description?: string + /** + * A unique slug for a hierarchy. + */ + slug?: string + /** + * Product Experience Manager supports localization of hierarchies and nodes. If you store supports multiple languages, you can localize hierarchy and node names and descriptions. + */ + locales?: { + [key: string]: { + /** + * A localized hierarchy or node name. + */ + name?: string + /** + * A localized hierarchy or node description. + */ + description?: string + } + } +} -export type CreateCustomRelationshipError = (Error); +export type RelationshipsHierarchy = { + /** + * The child nodes related to the hierarchy. + */ + children?: { + /** + * An array of child nodes. + */ + data?: Array + /** + * Links allow you to move between requests. + */ + links?: { + /** + * A link to a related resource. + */ + related?: string + } + } +} -export type UpdateCustomRelationshipData = { - body: UpdateCustomRelationship; - path: { - /** - * A custom relationship slug. - */ - customRelationshipSlug: string; - }; -}; +export type Hierarchy = { + /** + * A unique identifier generated when a hierarchy is created. + */ + id?: string + /** + * This represents the type of resource object being returned. Always `hierarchy`. + */ + type?: "hierarchy" + attributes?: AttributesHierarchy + relationships?: RelationshipsHierarchy + meta?: { + /** + * The date and time a hierarchy is created. + */ + created_at?: Date + /** + * The date and time a hierarchy is updated. + */ + updated_at?: Date + /** + * The owner of a resource, either `organization` or `store`. + */ + owner?: "store" | "organization" + } +} -export type UpdateCustomRelationshipResponse = (SingleCustomRelationship); +export type MultiHierarchy = { + data?: Array + links?: MultiLinks + meta?: MultiMeta +} -export type UpdateCustomRelationshipError = (Error); +export type ReqAttributesHierarchy = { + /** + * The name of the hierarchy, such as `Major Appliances`. + */ + name?: string + /** + * A description of the hierarchy. + */ + description?: string + /** + * A unique slug for the hierarchy. + */ + slug?: string + /** + * Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. + */ + locales?: { + [key: string]: { + /** + * A localized name for the hierarchy. + */ + name?: string + /** + * A localized description for the hierarchy. + */ + description?: string + } + } +} -export type GetAllJobsResponseTransformer = (data: any) => Promise; +export type CreateHierarchy = { + data?: { + /** + * This represents the type of resource object being returned. Always `hierarchy`. + */ + type: "hierarchy" + attributes: ReqAttributesHierarchy + } +} -export type MultiModelResponseTransformer = (data: any) => Multi; +export type SingleHierarchy = { + data?: Hierarchy +} -export type JobModelResponseTransformer = (data: any) => Job; +export type UpdateHierarchy = { + data: { + /** + * The unique identifier of the hierarchy. Must match the hierarchy ID specified in the request path. + */ + id: string + /** + * This represents the type of resource object being returned. Always `hierarchy`. + */ + type: "hierarchy" + attributes: ReqAttributesHierarchy + } +} -export const JobModelResponseTransformer: JobModelResponseTransformer = data => { - if (data?.attributes?.started_at) { - data.attributes.started_at = new Date(data.attributes.started_at); - } - if (data?.attributes?.completed_at) { - data.attributes.completed_at = new Date(data.attributes.completed_at); - } - if (data?.attributes?.created_at) { - data.attributes.created_at = new Date(data.attributes.created_at); +export type AttributesNodes = { + /** + * The name of the node, such as `Ranges` or `Refrigerators`. Names must be unique among sibling nodes in the hierarchy. Otherwise, a name can be non-unique within the hierarchy and across multiple hierarchies. + */ + name?: string + /** + * A description of the node. + */ + description?: string + /** + * A slug for the node. Slugs must be unique among sibling nodes in the hierarchy. Otherwise, a slug can be non-unique within the hierarchy and across multiple hierarchies. + */ + slug?: string + /** + * You can curate your products in your nodes product lists. Product curation allows you to promote specific products within each node in a hierarchy, enabling you to create unique product collections in your storefront. See [Curating Products in a node](/docs/api/pxm/products/create-node#curating-products-in-a-node). + */ + curated_products?: Array + /** + * Product Experience Manager supports localization of products and hierarchies. If your store supports multiple languages, you can localize product names and descriptions. You can have as many locales as you want. + */ + locales?: { + [key: string]: { + /** + * A localized name for the node. + */ + name?: string + /** + * A localized description for the node. + */ + description?: string } - if (data?.attributes?.updated_at) { - data.attributes.updated_at = new Date(data.attributes.updated_at); + } +} + +export type CreateNode = { + data?: { + /** + * This represents the type of resource object being returned. Always `node`. + */ + type: "node" + attributes: AttributesNodes + meta?: { + /** + * You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. The `sort_order` for each node. This value determines the order of nodes in the response for the `Get a Node’s Children` request. The node with the highest value of sort_order is displayed first. For example, a node with a sort_order value of 3 appears before a node with a sort_order value of 2. + * + * - If you don’t provide `sort_order` when creating nodes, all child nodes in the response for `Get a Node’s Children` request are ordered by the `updated_at` time in descending order, with the most recently updated child node first. + * - If you set `sort_order` for only a few child nodes or not all, the child nodes with a `sort_order` value appear first and then other child nodes appear in the order of `updated_at` time. See [Sorting Nodes in a hierarchy](). + * + */ + sort_order?: number } - return data; -}; + } +} -export const MultiModelResponseTransformer: MultiModelResponseTransformer = data => { - if (Array.isArray(data?.data)) { - data.data.forEach(JobModelResponseTransformer); +export type SingleNode = { + data?: Node +} + +export type UpdateNode = { + data?: { + /** + * The unique identifier of the node. Must match the node ID specified in the request path. + */ + id: string + /** + * This represents the type of resource object being returned. Always `node`. + */ + type: "node" + attributes: AttributesNodes + meta?: { + /** + * You can sort the order of your nodes, regardless of where the nodes are in the hierarchy. The `sort_order` for each node. This value determines the order of nodes in the response for the `Get a Node’s Children` request. The node with the highest value of sort_order is displayed first. For example, a node with a sort_order value of 3 appears before a node with a sort_order value of 2. + * + * - If you don’t provide `sort_order` when creating nodes, all child nodes in the response for `Get a Node’s Children` request are ordered by the `updated_at` time in descending order, with the most recently updated child node first. + * - If you set `sort_order` for only a few child nodes or not all, the child nodes with a `sort_order` value appear first and then other child nodes appear in the order of `updated_at` time. + * + */ + sort_order?: number } - return data; -}; + } +} -export const GetAllJobsResponseTransformer: GetAllJobsResponseTransformer = async (data) => { - MultiModelResponseTransformer(data); - return data; -}; +export type NodeChildren = { + data?: Array<{ + /** + * The unique identifier of the child node. Must not match the node ID specified in the request path. + */ + id: string + /** + * This represents the type of resource object being returned. Always `node`. + */ + type: "node" + }> +} -export type GetJobResponseTransformer = (data: any) => Promise; +export type NodeParent = { + data?: { + /** + * The unique identifier of the new parent node. Must not match the node ID specified in the request path. + */ + id: string + /** + * This represents the type of resource object being returned. Always `node`. + */ + type: "node" + } +} -export type SingleModelResponseTransformer = (data: any) => Single; +export type NodeProducts = { + data?: Array<{ + /** + * The unique identifier of the product to be attached to the node. + */ + id: string + /** + * This represents the type of resource object being returned. Always `product`. + */ + type: "product" + }> +} -export const SingleModelResponseTransformer: SingleModelResponseTransformer = data => { - if (data?.data) { - JobModelResponseTransformer(data.data); +export type DuplicateJob = { + data?: { + /** + * This represents the type of resource object being returned. Always `hierarchy`. + */ + type?: "hierarchy" + attributes?: { + /** + * The name of the duplicate hierarchy. The maximum length is 1000 characters. + */ + name?: string + /** + * A description of the duplicate hierarchy. + */ + description?: string + /** + * Specify `true` if you want the product associations in the existing nodes associated in your duplicated hierarchy. If not, specify `false`. + */ + include_products?: boolean } - return data; -}; + } +} -export const GetJobResponseTransformer: GetJobResponseTransformer = async (data) => { - SingleModelResponseTransformer(data); - return data; -}; - -export type CancelJobResponseTransformer = (data: any) => Promise; +export type Tag = { + /** + * A unique identifier generated when a tag is created. + */ + id?: string + /** + * This represents the type of resource object being returned. Always `tag`. + */ + type?: "tag" + attributes?: { + /** + * The text value of the tag. + */ + value?: string + } + meta?: { + /** + * A unique request ID is generated when a tag is created. + */ + x_request_id?: string + /** + * The date and time a tag is created. + */ + created_at?: Date + /** + * The date and time a tag is updated. + */ + updated_at?: Date + /** + * The owner of a resource, either `organization` or `store`. + */ + owner?: "store" | "organization" + } +} -export const CancelJobResponseTransformer: CancelJobResponseTransformer = async (data) => { - SingleModelResponseTransformer(data); - return data; -}; +export type MultiTag = { + /** + * An array of tags. + */ + data?: Array + meta?: { + /** + * Contains the results for the entire collection. + */ + results?: { + /** + * Total number of results for the entire collection. + */ + total?: number + } + } +} -export type CreateProductResponseTransformer = (data: any) => Promise; +export type SingleTag = { + data?: Tag +} -export type SingleProductResponseModelResponseTransformer = (data: any) => SingleProductResponse; +export type ReqAttributesCustomRelationship = { + /** + * The name of the custom relationship, such as `Kitchen electrics`. + */ + name?: string + /** + * A description of the custom relationship. + */ + description?: string + /** + * A unique slug for the custom relationship. Must match the slug specified in the request path. + */ + slug?: string +} -export type ProductResponseModelResponseTransformer = (data: any) => ProductResponse; +export type CreateCustomRelationship = { + data?: { + /** + * This represents the type of resource object being returned. Always `custom-relationship`. + */ + type: "custom-relationship" + attributes: ReqAttributesCustomRelationship + } +} -export const ProductResponseModelResponseTransformer: ProductResponseModelResponseTransformer = data => { - if (data?.meta?.created_at) { - data.meta.created_at = new Date(data.meta.created_at); - } - if (data?.meta?.updated_at) { - data.meta.updated_at = new Date(data.meta.updated_at); - } - return data; -}; +export type AttributesCustomRelationship = { + /** + * The name of the custom relationship, such as `Kitchen electrics`. + */ + name?: string + /** + * A description of the custom relationship. + */ + description?: string + /** + * A unique slug for the custom relationship. + */ + slug?: string +} -export const SingleProductResponseModelResponseTransformer: SingleProductResponseModelResponseTransformer = data => { - if (data?.data) { - ProductResponseModelResponseTransformer(data.data); - } - if (Array.isArray(data?.included?.component_products)) { - data.included.component_products.forEach(ProductResponseModelResponseTransformer); +export type CustomRelationship = { + /** + * A unique identifier generated when a custom relationship is created. + */ + id?: string + /** + * This represents the type of resource object being returned. Always `hierarchy`. + */ + type?: "custom-relationship" + attributes?: AttributesCustomRelationship + meta?: { + /** + * The owner of the resource. + */ + owner?: string + timestamps?: { + /** + * The date and time the resource is created. + */ + created_at?: Date + /** + * The date and time the resource is updated. + */ + updated_at?: Date } - return data; -}; + } +} -export const CreateProductResponseTransformer: CreateProductResponseTransformer = async (data) => { - SingleProductResponseModelResponseTransformer(data); - return data; -}; +export type SingleCustomRelationship = { + data?: CustomRelationship +} -export type GetAllProductsResponseTransformer = (data: any) => Promise; +export type UpdateCustomRelationship = { + data: { + /** + * The unique identifier of the custom relationship. + */ + id: string + /** + * This represents the type of resource object being returned. Always `custom-relationship`. + */ + type: "custom-relationship" + attributes: ReqAttributesCustomRelationship + } +} -export type MultiProductResponseModelResponseTransformer = (data: any) => MultiProductResponse; +/** + * A unique identifier for the job. + */ +export type JobId = string -export const MultiProductResponseModelResponseTransformer: MultiProductResponseModelResponseTransformer = data => { - if (Array.isArray(data?.data)) { - data.data.forEach(ProductResponseModelResponseTransformer); - } - if (Array.isArray(data?.included?.component_products)) { - data.included.component_products.forEach(ProductResponseModelResponseTransformer); - } - return data; -}; +/** + * The number of records to offset the results by. + */ +export type PageOffset = BigInt -export const GetAllProductsResponseTransformer: GetAllProductsResponseTransformer = async (data) => { - MultiProductResponseModelResponseTransformer(data); - return data; -}; +/** + * The number of records per page. The maximum limit is 100. + */ +export type PageLimit = BigInt -export type ImportProductsResponseTransformer = (data: any) => Promise; +/** + * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering). + * + * For more information about the attributes and operators that are supported, see [Get all products](/docs/api/pxm/products/get-all-products). + * + */ +export type Filterproduct = string -export const ImportProductsResponseTransformer: ImportProductsResponseTransformer = async (data) => { - SingleModelResponseTransformer(data); - return data; -}; +/** + * Using the include parameter, you can retrieve top-level resources. + * + * - Files or main image. For example, `include=files,main_image`. + * - Component product data. For example, `include=component_products`. + * - Key attribute data, such as SKU or slug. + * + */ +export type Include = string -export type ExportProductsResponseTransformer = (data: any) => Promise; +/** + * Set to `true` if you want to use a template slug instead of a template ID when exporting products that have custom data. + */ +export type UseTemplateSlugs = boolean -export const ExportProductsResponseTransformer: ExportProductsResponseTransformer = async (data) => { - SingleModelResponseTransformer(data); - return data; -}; +/** + * + * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering), but you must go to a specific endpoint to understand the attributes and operators an endpoint supports. + * + * For more information about the attributes and operators that this endpoint supports, see [Export Products](/docs/api/pxm/products/export-products). + * + */ +export type Filterexport = string -export type GetProductResponseTransformer = (data: any) => Promise; +/** + * A unique identifier for the product. + */ +export type ProductId = string -export const GetProductResponseTransformer: GetProductResponseTransformer = async (data) => { - SingleProductResponseModelResponseTransformer(data); - return data; -}; +/** + * A unique identifier for the variation. + */ +export type VariationId = string -export type UpdateProductResponseTransformer = (data: any) => Promise; +/** + * A unique identifier for the option. + */ +export type OptionId = string -export const UpdateProductResponseTransformer: UpdateProductResponseTransformer = async (data) => { - SingleProductResponseModelResponseTransformer(data); - return data; -}; +/** + * A unique identifier for the modifier. + */ +export type ModifierId = string -export type GetProductsNodesResponseTransformer = (data: any) => Promise; +/** + * A unique identifier for the hierarchy. + */ +export type HierarchyId = string -export type MultiNodesModelResponseTransformer = (data: any) => MultiNodes; +/** + * A unique identifier for the node. + */ +export type NodeId = string -export type NodeModelResponseTransformer = (data: any) => Node; +/** + * A unique identifier for the tag. + */ +export type TagId = string -export const NodeModelResponseTransformer: NodeModelResponseTransformer = data => { - if (data?.meta?.created_at) { - data.meta.created_at = new Date(data.meta.created_at); - } - if (data?.meta?.updated_at) { - data.meta.updated_at = new Date(data.meta.updated_at); - } - return data; -}; +/** + * A custom relationship slug. + */ +export type CustomRelationshipSlug = string + +export type GetAllJobsData = { + body?: never + path?: never + query?: never + url: "/pcm/jobs" +} + +export type GetAllJobsErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type GetAllJobsError = GetAllJobsErrors[keyof GetAllJobsErrors] + +export type GetAllJobsResponses = { + /** + * Returns all the jobs. + */ + 200: Multi +} + +export type GetAllJobsResponse = GetAllJobsResponses[keyof GetAllJobsResponses] -export const MultiNodesModelResponseTransformer: MultiNodesModelResponseTransformer = data => { - if (Array.isArray(data?.data)) { - data.data.forEach(NodeModelResponseTransformer); - } - return data; -}; +export type GetJobData = { + body?: never + path: { + /** + * A unique identifier for the job. + */ + jobID: string + } + query?: never + url: "/pcm/jobs/{jobID}" +} + +export type GetJobErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type GetJobError = GetJobErrors[keyof GetJobErrors] + +export type GetJobResponses = { + /** + * Returns a job with the following attributes. + */ + 200: Single +} + +export type GetJobResponse = GetJobResponses[keyof GetJobResponses] -export const GetProductsNodesResponseTransformer: GetProductsNodesResponseTransformer = async (data) => { - MultiNodesModelResponseTransformer(data); - return data; -}; +export type CancelJobData = { + body?: { + [key: string]: unknown + } + path: { + /** + * A unique identifier for the job. + */ + jobID: string + } + query?: never + url: "/pcm/jobs/{jobID}/cancel" +} + +export type CancelJobErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type CancelJobError = CancelJobErrors[keyof CancelJobErrors] + +export type CancelJobResponses = { + /** + * Successfully cancelled job + */ + 200: Single +} + +export type CancelJobResponse = CancelJobResponses[keyof CancelJobResponses] -export type GetChildProductsResponseTransformer = (data: any) => Promise; +export type GetJobErrorsData = { + body?: never + path: { + /** + * A unique identifier for the job. + */ + jobID: string + } + query?: never + url: "/pcm/jobs/{jobID}/errors" +} + +export type GetJobErrorsErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type GetJobErrorsError = GetJobErrorsErrors[keyof GetJobErrorsErrors] + +export type GetJobErrorsResponses = { + /** + * Successful + */ + 200: Errors +} + +export type GetJobErrorsResponse = + GetJobErrorsResponses[keyof GetJobErrorsResponses] -export const GetChildProductsResponseTransformer: GetChildProductsResponseTransformer = async (data) => { - MultiProductResponseModelResponseTransformer(data); - return data; -}; +export type GetAllProductsData = { + body?: never + path?: never + query?: { + /** + * The number of records to offset the results by. + */ + "page[offset]"?: BigInt + /** + * The number of records per page. The maximum limit is 100. + */ + "page[limit]"?: BigInt + /** + * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering). + * + * For more information about the attributes and operators that are supported, see [Get all products](/docs/api/pxm/products/get-all-products). + * + */ + filter?: string + /** + * Using the include parameter, you can retrieve top-level resources. + * + * - Files or main image. For example, `include=files,main_image`. + * - Component product data. For example, `include=component_products`. + * - Key attribute data, such as SKU or slug. + * + */ + include?: string + } + url: "/pcm/products" +} + +export type GetAllProductsErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type GetAllProductsError = + GetAllProductsErrors[keyof GetAllProductsErrors] + +export type GetAllProductsResponses = { + /** + * Returns a list of all products. + */ + 200: MultiProductResponse +} + +export type GetAllProductsResponse = + GetAllProductsResponses[keyof GetAllProductsResponses] -export type CreateVariationResponseTransformer = (data: any) => Promise; +export type CreateProductData = { + body: CreateProductRequest + path?: never + query?: never + url: "/pcm/products" +} + +export type CreateProductErrors = { + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type CreateProductError = CreateProductErrors[keyof CreateProductErrors] + +export type CreateProductResponses = { + /** + * Creates a product with the following attributes. + */ + 201: SingleProductResponse +} + +export type CreateProductResponse = + CreateProductResponses[keyof CreateProductResponses] -export type CreatedVariationModelResponseTransformer = (data: any) => CreatedVariation; +export type ImportProductsData = { + body?: { + /** + * The file you want to upload. Ensure that the file format is Comma Separated Values (CSV). + */ + file?: Blob | File + } + path?: never + query?: never + url: "/pcm/products/import" +} + +export type ImportProductsErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type ImportProductsError = + ImportProductsErrors[keyof ImportProductsErrors] + +export type ImportProductsResponses = { + /** + * Import started + */ + 201: Single +} + +export type ImportProductsResponse = + ImportProductsResponses[keyof ImportProductsResponses] -export const CreatedVariationModelResponseTransformer: CreatedVariationModelResponseTransformer = data => { - if (data?.data?.meta?.created_at) { - data.data.meta.created_at = new Date(data.data.meta.created_at); - } - if (data?.data?.meta?.updated_at) { - data.data.meta.updated_at = new Date(data.data.meta.updated_at); - } - return data; -}; +export type ExportProductsData = { + body?: { + [key: string]: unknown + } + path?: never + query?: { + /** + * Set to `true` if you want to use a template slug instead of a template ID when exporting products that have custom data. + */ + useTemplateSlugs?: boolean + /** + * + * Many Commerce API endpoints support filtering. The general syntax is described [**here**](/docs/commerce-cloud/api-overview/filtering), but you must go to a specific endpoint to understand the attributes and operators an endpoint supports. + * + * For more information about the attributes and operators that this endpoint supports, see [Export Products](/docs/api/pxm/products/export-products). + * + */ + filter?: string + } + url: "/pcm/products/export" +} + +export type ExportProductsErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type ExportProductsError = + ExportProductsErrors[keyof ExportProductsErrors] + +export type ExportProductsResponses = { + /** + * Export started + */ + 201: Single +} + +export type ExportProductsResponse = + ExportProductsResponses[keyof ExportProductsResponses] -export const CreateVariationResponseTransformer: CreateVariationResponseTransformer = async (data) => { - CreatedVariationModelResponseTransformer(data); - return data; -}; +export type DeleteProductData = { + body?: never + path: { + /** + * A unique identifier for the product. + */ + productID: string + } + query?: never + url: "/pcm/products/{productID}" +} + +export type DeleteProductErrors = { + /** + * Forbidden + */ + 403: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type DeleteProductError = DeleteProductErrors[keyof DeleteProductErrors] + +export type DeleteProductResponses = { + /** + * Deletes the specified product. + */ + 204: void +} + +export type DeleteProductResponse = + DeleteProductResponses[keyof DeleteProductResponses] -export type CreateVariationOptionResponseTransformer = (data: any) => Promise; +export type GetProductData = { + body?: never + path: { + /** + * A unique identifier for the product. + */ + productID: string + } + query?: { + /** + * Using the include parameter, you can retrieve top-level resources. + * + * - Files or main image. For example, `include=files,main_image`. + * - Component product data. For example, `include=component_products`. + * - Key attribute data, such as SKU or slug. + * + */ + include?: string + } + url: "/pcm/products/{productID}" +} + +export type GetProductErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type GetProductError = GetProductErrors[keyof GetProductErrors] + +export type GetProductResponses = { + /** + * Returns a product by its identifier. + */ + 200: SingleProductResponse +} + +export type GetProductResponse = GetProductResponses[keyof GetProductResponses] -export type CreatedOptionModelResponseTransformer = (data: any) => CreatedOption; +export type UpdateProductData = { + body?: UpdateProductRequest + path: { + /** + * A unique identifier for the product. + */ + productID: string + } + query?: never + url: "/pcm/products/{productID}" +} + +export type UpdateProductErrors = { + /** + * Forbidden + */ + 403: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Write conflict detected + */ + 409: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type UpdateProductError = UpdateProductErrors[keyof UpdateProductErrors] + +export type UpdateProductResponses = { + /** + * Updates a product with the following attributes. + */ + 200: SingleProductResponse +} + +export type UpdateProductResponse = + UpdateProductResponses[keyof UpdateProductResponses] -export const CreatedOptionModelResponseTransformer: CreatedOptionModelResponseTransformer = data => { - if (data?.data?.meta?.created_at) { - data.data.meta.created_at = new Date(data.data.meta.created_at); +export type AttachNodesData = { + body: { + data: { + /** + * Filters applied to search for appropriate products to attach to a node. See [Attach multiple nodes](/docs/api/pxm/products/attach-nodes). + * + */ + filter: string + /** + * A list of node unique identifiers that you want to assign to the products. + */ + node_ids: Array } - if (data?.data?.meta?.updated_at) { - data.data.meta.updated_at = new Date(data.data.meta.updated_at); + } + path?: never + query?: never + url: "/pcm/products/attach_nodes" +} + +export type AttachNodesErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type AttachNodesError = AttachNodesErrors[keyof AttachNodesErrors] + +export type AttachNodesResponses = { + /** + * This request assigns the products that you have selected to multiple hierarchies and their children nodes and returns the following. + */ + 200: { + meta?: { + /** + * Number of nodes assigned to the products. + */ + nodes_attached?: number + /** + * A list of node unique identifiers that could not be identified. + */ + nodes_not_found?: Array } - return data; -}; - -export const CreateVariationOptionResponseTransformer: CreateVariationOptionResponseTransformer = async (data) => { - CreatedOptionModelResponseTransformer(data); - return data; -}; + } +} -export type GetVariationOptionResponseTransformer = (data: any) => Promise; +export type AttachNodesResponse = + AttachNodesResponses[keyof AttachNodesResponses] -export type SingleOptionModelResponseTransformer = (data: any) => SingleOption; - -export const SingleOptionModelResponseTransformer: SingleOptionModelResponseTransformer = data => { - if (data?.data?.meta?.created_at) { - data.data.meta.created_at = new Date(data.data.meta.created_at); +export type DetachNodesData = { + body: { + data: { + /** + * You can apply filters to search for the appropriate products to detach. See [Detach multiple nodes](/docs/api/pxm/products/detach-nodes). + * + */ + filter: string + /** + * A list of node unique identifiers that you want to assign to the products. + */ + node_ids: Array } - if (data?.data?.meta?.updated_at) { - data.data.meta.updated_at = new Date(data.data.meta.updated_at); + } + path?: never + query?: never + url: "/pcm/products/detach_nodes" +} + +export type DetachNodesErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type DetachNodesError = DetachNodesErrors[keyof DetachNodesErrors] + +export type DetachNodesResponses = { + /** + * The request dissociates the products that you have selected from multiple hierarchies and their children and returns the following. + */ + 200: { + meta?: { + /** + * Number of nodes dissociated from the products. + */ + nodes_detached?: number + /** + * A list of node unique identifiers that could not be identified. + */ + nodes_not_found?: Array } - return data; -}; - -export const GetVariationOptionResponseTransformer: GetVariationOptionResponseTransformer = async (data) => { - SingleOptionModelResponseTransformer(data); - return data; -}; - -export type UpdateVariationOptionResponseTransformer = (data: any) => Promise; + } +} -export const UpdateVariationOptionResponseTransformer: UpdateVariationOptionResponseTransformer = async (data) => { - SingleOptionModelResponseTransformer(data); - return data; -}; +export type DetachNodesResponse = + DetachNodesResponses[keyof DetachNodesResponses] -export type CreateHierarchyResponseTransformer = (data: any) => Promise; +export type GetProductsNodesData = { + body?: never + path: { + /** + * A unique identifier for the product. + */ + productID: string + } + query?: { + /** + * The number of records to offset the results by. + */ + "page[offset]"?: BigInt + /** + * The number of records per page. The maximum limit is 100. + */ + "page[limit]"?: BigInt + } + url: "/pcm/products/{productID}/nodes" +} + +export type GetProductsNodesErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type GetProductsNodesError = + GetProductsNodesErrors[keyof GetProductsNodesErrors] + +export type GetProductsNodesResponses = { + /** + * Successfully returns the product's nodes. + */ + 200: MultiNodes +} + +export type GetProductsNodesResponse = + GetProductsNodesResponses[keyof GetProductsNodesResponses] -export type SingleHierarchyModelResponseTransformer = (data: any) => SingleHierarchy; +export type BuildChildProductsData = { + body?: { + [key: string]: unknown + } + path: { + /** + * A unique identifier for the product. + */ + productID: string + } + query?: never + url: "/pcm/products/{productID}/build" +} + +export type BuildChildProductsErrors = { + /** + * Forbidden + */ + 403: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type BuildChildProductsError = + BuildChildProductsErrors[keyof BuildChildProductsErrors] + +export type BuildChildProductsResponses = { + /** + * Successfully started building child products + */ + 201: unknown +} -export type HierarchyModelResponseTransformer = (data: any) => Hierarchy; +export type GetChildProductsData = { + body?: never + path: { + /** + * A unique identifier for the product. + */ + productID: string + } + query?: never + url: "/pcm/products/{productID}/children" +} + +export type GetChildProductsErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type GetChildProductsError = + GetChildProductsErrors[keyof GetChildProductsErrors] + +export type GetChildProductsResponses = { + /** + * Returns a list of child products for the specified parent product ID. + */ + 200: MultiProductResponse +} + +export type GetChildProductsResponse = + GetChildProductsResponses[keyof GetChildProductsResponses] -export const HierarchyModelResponseTransformer: HierarchyModelResponseTransformer = data => { - if (data?.meta?.created_at) { - data.meta.created_at = new Date(data.meta.created_at); - } - if (data?.meta?.updated_at) { - data.meta.updated_at = new Date(data.meta.updated_at); - } - return data; -}; +export type DeleteProductTemplateRelationshipData = { + body?: ProductTemplatesRequest + path: { + /** + * A unique identifier for the product. + */ + productID: string + } + query?: never + url: "/pcm/products/{productID}/relationships/templates" +} + +export type DeleteProductTemplateRelationshipErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Forbidden + */ + 403: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Write conflict detected + */ + 409: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type DeleteProductTemplateRelationshipError = + DeleteProductTemplateRelationshipErrors[keyof DeleteProductTemplateRelationshipErrors] + +export type DeleteProductTemplateRelationshipResponses = { + /** + * No Content + */ + 204: void +} + +export type DeleteProductTemplateRelationshipResponse = + DeleteProductTemplateRelationshipResponses[keyof DeleteProductTemplateRelationshipResponses] -export const SingleHierarchyModelResponseTransformer: SingleHierarchyModelResponseTransformer = data => { - if (data?.data) { - HierarchyModelResponseTransformer(data.data); - } - return data; -}; +export type GetProductTemplateRelationshipsData = { + body?: never + path: { + /** + * A unique identifier for the product. + */ + productID: string + } + query?: never + url: "/pcm/products/{productID}/relationships/templates" +} + +export type GetProductTemplateRelationshipsErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Forbidden + */ + 403: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Write conflict detected + */ + 409: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type GetProductTemplateRelationshipsError = + GetProductTemplateRelationshipsErrors[keyof GetProductTemplateRelationshipsErrors] + +export type GetProductTemplateRelationshipsResponses = { + /** + * Returns all product template relationships + */ + 200: TemplateResponse +} + +export type GetProductTemplateRelationshipsResponse = + GetProductTemplateRelationshipsResponses[keyof GetProductTemplateRelationshipsResponses] -export const CreateHierarchyResponseTransformer: CreateHierarchyResponseTransformer = async (data) => { - SingleHierarchyModelResponseTransformer(data); - return data; -}; +export type CreateProductTemplateRelationshipData = { + body?: ProductTemplatesRequest + path: { + /** + * A unique identifier for the product. + */ + productID: string + } + query?: never + url: "/pcm/products/{productID}/relationships/templates" +} + +export type CreateProductTemplateRelationshipErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Forbidden + */ + 403: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Write conflict detected + */ + 409: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type CreateProductTemplateRelationshipError = + CreateProductTemplateRelationshipErrors[keyof CreateProductTemplateRelationshipErrors] + +export type CreateProductTemplateRelationshipResponses = { + /** + * Returns a created product template relationship. + */ + 201: TemplateResponse +} + +export type CreateProductTemplateRelationshipResponse = + CreateProductTemplateRelationshipResponses[keyof CreateProductTemplateRelationshipResponses] -export type GetHierarchyResponseTransformer = (data: any) => Promise; +export type GetProductComponentProductsRelationshipsData = { + body?: never + path: { + /** + * A unique identifier for the product. + */ + productID: string + } + query?: never + url: "/pcm/products/{productID}/relationships/component_products" +} + +export type GetProductComponentProductsRelationshipsErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Forbidden + */ + 403: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Write conflict detected + */ + 409: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type GetProductComponentProductsRelationshipsError = + GetProductComponentProductsRelationshipsErrors[keyof GetProductComponentProductsRelationshipsErrors] + +export type GetProductComponentProductsRelationshipsResponses = { + /** + * Returns all Component Products relationships + */ + 200: ComponentProductsResponse +} + +export type GetProductComponentProductsRelationshipsResponse = + GetProductComponentProductsRelationshipsResponses[keyof GetProductComponentProductsRelationshipsResponses] -export type MultiHierarchyModelResponseTransformer = (data: any) => MultiHierarchy; +export type DeleteProductFileRelationshipsData = { + body?: ProductFilesRequest + path: { + /** + * A unique identifier for the product. + */ + productID: string + } + query?: never + url: "/pcm/products/{productID}/relationships/files" +} + +export type DeleteProductFileRelationshipsErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Forbidden + */ + 403: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Write conflict detected + */ + 409: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type DeleteProductFileRelationshipsError = + DeleteProductFileRelationshipsErrors[keyof DeleteProductFileRelationshipsErrors] + +export type DeleteProductFileRelationshipsResponses = { + /** + * No Content + */ + 204: void +} + +export type DeleteProductFileRelationshipsResponse = + DeleteProductFileRelationshipsResponses[keyof DeleteProductFileRelationshipsResponses] -export const MultiHierarchyModelResponseTransformer: MultiHierarchyModelResponseTransformer = data => { - if (Array.isArray(data?.data)) { - data.data.forEach(HierarchyModelResponseTransformer); - } - return data; -}; +export type GetProductFileRelationshipsData = { + body?: never + path: { + /** + * A unique identifier for the product. + */ + productID: string + } + query?: never + url: "/pcm/products/{productID}/relationships/files" +} + +export type GetProductFileRelationshipsErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Forbidden + */ + 403: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Write conflict detected + */ + 409: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type GetProductFileRelationshipsError = + GetProductFileRelationshipsErrors[keyof GetProductFileRelationshipsErrors] + +export type GetProductFileRelationshipsResponses = { + /** + * Returns all product file relationships. + */ + 200: FileResponse +} + +export type GetProductFileRelationshipsResponse = + GetProductFileRelationshipsResponses[keyof GetProductFileRelationshipsResponses] -export const GetHierarchyResponseTransformer: GetHierarchyResponseTransformer = async (data) => { - MultiHierarchyModelResponseTransformer(data); - return data; -}; +export type CreateProductFileRelationshipsData = { + body?: ProductFilesRequest + path: { + /** + * A unique identifier for the product. + */ + productID: string + } + query?: never + url: "/pcm/products/{productID}/relationships/files" +} + +export type CreateProductFileRelationshipsErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Forbidden + */ + 403: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Write conflict detected + */ + 409: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type CreateProductFileRelationshipsError = + CreateProductFileRelationshipsErrors[keyof CreateProductFileRelationshipsErrors] + +export type CreateProductFileRelationshipsResponses = { + /** + * No Content + */ + 204: void +} + +export type CreateProductFileRelationshipsResponse = + CreateProductFileRelationshipsResponses[keyof CreateProductFileRelationshipsResponses] -export type GetHierarchyChildResponseTransformer = (data: any) => Promise; +export type UpdateProductFileRelationshipsData = { + body?: ProductFilesRequest + path: { + /** + * A unique identifier for the product. + */ + productID: string + } + query?: never + url: "/pcm/products/{productID}/relationships/files" +} + +export type UpdateProductFileRelationshipsErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Forbidden + */ + 403: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Write conflict detected + */ + 409: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type UpdateProductFileRelationshipsError = + UpdateProductFileRelationshipsErrors[keyof UpdateProductFileRelationshipsErrors] + +export type UpdateProductFileRelationshipsResponses = { + /** + * No Content + */ + 204: void +} + +export type UpdateProductFileRelationshipsResponse = + UpdateProductFileRelationshipsResponses[keyof UpdateProductFileRelationshipsResponses] -export const GetHierarchyChildResponseTransformer: GetHierarchyChildResponseTransformer = async (data) => { - SingleHierarchyModelResponseTransformer(data); - return data; -}; +export type DeleteProductVariationRelationshipsData = { + body?: ProductVariationsRequest + path: { + /** + * A unique identifier for the product. + */ + productID: string + } + query?: never + url: "/pcm/products/{productID}/relationships/variations" +} + +export type DeleteProductVariationRelationshipsErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Forbidden + */ + 403: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Write conflict detected + */ + 409: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type DeleteProductVariationRelationshipsError = + DeleteProductVariationRelationshipsErrors[keyof DeleteProductVariationRelationshipsErrors] + +export type DeleteProductVariationRelationshipsResponses = { + /** + * No Content + */ + 204: void +} + +export type DeleteProductVariationRelationshipsResponse = + DeleteProductVariationRelationshipsResponses[keyof DeleteProductVariationRelationshipsResponses] -export type UpdateHierarchyResponseTransformer = (data: any) => Promise; +export type GetProductVariationRelationshipsData = { + body?: never + path: { + /** + * A unique identifier for the product. + */ + productID: string + } + query?: never + url: "/pcm/products/{productID}/relationships/variations" +} + +export type GetProductVariationRelationshipsErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Forbidden + */ + 403: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Write conflict detected + */ + 409: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type GetProductVariationRelationshipsError = + GetProductVariationRelationshipsErrors[keyof GetProductVariationRelationshipsErrors] + +export type GetProductVariationRelationshipsResponses = { + /** + * Returns all product variation relationships + */ + 200: VariationsResponse +} + +export type GetProductVariationRelationshipsResponse = + GetProductVariationRelationshipsResponses[keyof GetProductVariationRelationshipsResponses] -export const UpdateHierarchyResponseTransformer: UpdateHierarchyResponseTransformer = async (data) => { - SingleHierarchyModelResponseTransformer(data); - return data; -}; +export type CreateProductVariationRelationshipsData = { + body?: ProductVariationsRequest + path: { + /** + * A unique identifier for the product. + */ + productID: string + } + query?: never + url: "/pcm/products/{productID}/relationships/variations" +} + +export type CreateProductVariationRelationshipsErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Forbidden + */ + 403: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Write conflict detected + */ + 409: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type CreateProductVariationRelationshipsError = + CreateProductVariationRelationshipsErrors[keyof CreateProductVariationRelationshipsErrors] + +export type CreateProductVariationRelationshipsResponses = { + /** + * No Content + */ + 204: void +} + +export type CreateProductVariationRelationshipsResponse = + CreateProductVariationRelationshipsResponses[keyof CreateProductVariationRelationshipsResponses] -export type CreateNodeResponseTransformer = (data: any) => Promise; +export type UpdateProductVariationRelationshipsData = { + body?: ProductVariationsRequest + path: { + /** + * A unique identifier for the product. + */ + productID: string + } + query?: never + url: "/pcm/products/{productID}/relationships/variations" +} + +export type UpdateProductVariationRelationshipsErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Forbidden + */ + 403: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Write conflict detected + */ + 409: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type UpdateProductVariationRelationshipsError = + UpdateProductVariationRelationshipsErrors[keyof UpdateProductVariationRelationshipsErrors] + +export type UpdateProductVariationRelationshipsResponses = { + /** + * No Content + */ + 204: void +} + +export type UpdateProductVariationRelationshipsResponse = + UpdateProductVariationRelationshipsResponses[keyof UpdateProductVariationRelationshipsResponses] -export type SingleNodeModelResponseTransformer = (data: any) => SingleNode; +export type DeleteProductMainImageRelationshipsData = { + body?: never + path: { + /** + * A unique identifier for the product. + */ + productID: string + } + query?: never + url: "/pcm/products/{productID}/relationships/main_image" +} + +export type DeleteProductMainImageRelationshipsErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Forbidden + */ + 403: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Write conflict detected + */ + 409: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type DeleteProductMainImageRelationshipsError = + DeleteProductMainImageRelationshipsErrors[keyof DeleteProductMainImageRelationshipsErrors] + +export type DeleteProductMainImageRelationshipsResponses = { + /** + * No Content + */ + 204: void +} + +export type DeleteProductMainImageRelationshipsResponse = + DeleteProductMainImageRelationshipsResponses[keyof DeleteProductMainImageRelationshipsResponses] -export const SingleNodeModelResponseTransformer: SingleNodeModelResponseTransformer = data => { - if (data?.data) { - NodeModelResponseTransformer(data.data); - } - return data; -}; +export type GetProductMainImageRelationshipsData = { + body?: never + path: { + /** + * A unique identifier for the product. + */ + productID: string + } + query?: never + url: "/pcm/products/{productID}/relationships/main_image" +} + +export type GetProductMainImageRelationshipsErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Forbidden + */ + 403: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Write conflict detected + */ + 409: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type GetProductMainImageRelationshipsError = + GetProductMainImageRelationshipsErrors[keyof GetProductMainImageRelationshipsErrors] + +export type GetProductMainImageRelationshipsResponses = { + /** + * Returns all product variation relationships + */ + 200: MainImageResponse +} + +export type GetProductMainImageRelationshipsResponse = + GetProductMainImageRelationshipsResponses[keyof GetProductMainImageRelationshipsResponses] -export const CreateNodeResponseTransformer: CreateNodeResponseTransformer = async (data) => { - SingleNodeModelResponseTransformer(data); - return data; -}; +export type CreateProductMainImageRelationshipsData = { + body?: MainImageRequest + path: { + /** + * A unique identifier for the product. + */ + productID: string + } + query?: never + url: "/pcm/products/{productID}/relationships/main_image" +} + +export type CreateProductMainImageRelationshipsErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Forbidden + */ + 403: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Write conflict detected + */ + 409: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type CreateProductMainImageRelationshipsError = + CreateProductMainImageRelationshipsErrors[keyof CreateProductMainImageRelationshipsErrors] + +export type CreateProductMainImageRelationshipsResponses = { + /** + * No Content + */ + 204: void +} + +export type CreateProductMainImageRelationshipsResponse = + CreateProductMainImageRelationshipsResponses[keyof CreateProductMainImageRelationshipsResponses] -export type GetAllNodesInHierarchyResponseTransformer = (data: any) => Promise; +export type UpdateProductMainImageRelationshipsData = { + body?: ReplaceMainImageRequest + path: { + /** + * A unique identifier for the product. + */ + productID: string + } + query?: never + url: "/pcm/products/{productID}/relationships/main_image" +} + +export type UpdateProductMainImageRelationshipsErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Forbidden + */ + 403: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Write conflict detected + */ + 409: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type UpdateProductMainImageRelationshipsError = + UpdateProductMainImageRelationshipsErrors[keyof UpdateProductMainImageRelationshipsErrors] + +export type UpdateProductMainImageRelationshipsResponses = { + /** + * No Content + */ + 204: void +} + +export type UpdateProductMainImageRelationshipsResponse = + UpdateProductMainImageRelationshipsResponses[keyof UpdateProductMainImageRelationshipsResponses] -export const GetAllNodesInHierarchyResponseTransformer: GetAllNodesInHierarchyResponseTransformer = async (data) => { - MultiNodesModelResponseTransformer(data); - return data; -}; +export type GetAllVariationsData = { + body?: never + path?: never + query?: { + /** + * The number of records to offset the results by. + */ + "page[offset]"?: BigInt + /** + * The number of records per page. The maximum limit is 100. + */ + "page[limit]"?: BigInt + } + url: "/pcm/variations" +} + +export type GetAllVariationsErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type GetAllVariationsError = + GetAllVariationsErrors[keyof GetAllVariationsErrors] + +export type GetAllVariationsResponses = { + /** + * Returns all variations. + */ + 200: MultiVariations +} + +export type GetAllVariationsResponse = + GetAllVariationsResponses[keyof GetAllVariationsResponses] -export type GetHierarchyNodeResponseTransformer = (data: any) => Promise; +export type CreateVariationData = { + body: CreateVariation + path?: never + query?: never + url: "/pcm/variations" +} + +export type CreateVariationErrors = { + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type CreateVariationError = + CreateVariationErrors[keyof CreateVariationErrors] + +export type CreateVariationResponses = { + /** + * Returns a created variation with the following attributes. + */ + 201: CreatedVariation +} + +export type CreateVariationResponse = + CreateVariationResponses[keyof CreateVariationResponses] -export const GetHierarchyNodeResponseTransformer: GetHierarchyNodeResponseTransformer = async (data) => { - SingleNodeModelResponseTransformer(data); - return data; -}; +export type DeleteVariationData = { + body?: never + path: { + /** + * A unique identifier for the variation. + */ + variationID: string + } + query?: never + url: "/pcm/variations/{variationID}" +} + +export type DeleteVariationErrors = { + /** + * Forbidden + */ + 403: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type DeleteVariationError = + DeleteVariationErrors[keyof DeleteVariationErrors] + +export type DeleteVariationResponses = { + /** + * No Content + */ + 204: void +} + +export type DeleteVariationResponse = + DeleteVariationResponses[keyof DeleteVariationResponses] -export type UpdateNodeResponseTransformer = (data: any) => Promise; +export type GetVariationData = { + body?: never + path: { + /** + * A unique identifier for the variation. + */ + variationID: string + } + query?: never + url: "/pcm/variations/{variationID}" +} + +export type GetVariationErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type GetVariationError = GetVariationErrors[keyof GetVariationErrors] + +export type GetVariationResponses = { + /** + * Returns the specified variation. + */ + 200: SingleVariation +} + +export type GetVariationResponse = + GetVariationResponses[keyof GetVariationResponses] -export const UpdateNodeResponseTransformer: UpdateNodeResponseTransformer = async (data) => { - SingleNodeModelResponseTransformer(data); - return data; -}; +export type UpdateVariationData = { + body?: UpdateVariation + path: { + /** + * A unique identifier for the variation. + */ + variationID: string + } + query?: never + url: "/pcm/variations/{variationID}" +} + +export type UpdateVariationErrors = { + /** + * Forbidden + */ + 403: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Write conflict detected + */ + 409: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type UpdateVariationError = + UpdateVariationErrors[keyof UpdateVariationErrors] + +export type UpdateVariationResponses = { + /** + * Returns an updated variation with the following attributes. + */ + 200: SingleVariation +} + +export type UpdateVariationResponse = + UpdateVariationResponses[keyof UpdateVariationResponses] -export type GetAllChildrenResponseTransformer = (data: any) => Promise; +export type GetAllVariationOptionsData = { + body?: never + path: { + /** + * A unique identifier for the variation. + */ + variationID: string + } + query?: { + /** + * The number of records to offset the results by. + */ + "page[offset]"?: BigInt + /** + * The number of records per page. The maximum limit is 100. + */ + "page[limit]"?: BigInt + } + url: "/pcm/variations/{variationID}/options" +} + +export type GetAllVariationOptionsErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type GetAllVariationOptionsError = + GetAllVariationOptionsErrors[keyof GetAllVariationOptionsErrors] + +export type GetAllVariationOptionsResponses = { + /** + * Successfully returns all variation options + */ + 200: MultiOptions +} + +export type GetAllVariationOptionsResponse = + GetAllVariationOptionsResponses[keyof GetAllVariationOptionsResponses] -export const GetAllChildrenResponseTransformer: GetAllChildrenResponseTransformer = async (data) => { - MultiNodesModelResponseTransformer(data); - return data; -}; +export type CreateVariationOptionData = { + body?: CreateOption + path: { + /** + * A unique identifier for the variation. + */ + variationID: string + } + query?: never + url: "/pcm/variations/{variationID}/options" +} + +export type CreateVariationOptionErrors = { + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type CreateVariationOptionError = + CreateVariationOptionErrors[keyof CreateVariationOptionErrors] + +export type CreateVariationOptionResponses = { + /** + * Successfully returns the created variation option + */ + 201: CreatedOption +} + +export type CreateVariationOptionResponse = + CreateVariationOptionResponses[keyof CreateVariationOptionResponses] -export type CreateNodeChildRelationshipsResponseTransformer = (data: any) => Promise; +export type DeleteVariationOptionData = { + body?: never + path: { + /** + * A unique identifier for the variation. + */ + variationID: string + /** + * A unique identifier for the option. + */ + optionID: string + } + query?: never + url: "/pcm/variations/{variationID}/options/{optionID}" +} + +export type DeleteVariationOptionErrors = { + /** + * Forbidden + */ + 403: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type DeleteVariationOptionError = + DeleteVariationOptionErrors[keyof DeleteVariationOptionErrors] + +export type DeleteVariationOptionResponses = { + /** + * No Content + */ + 204: void +} + +export type DeleteVariationOptionResponse = + DeleteVariationOptionResponses[keyof DeleteVariationOptionResponses] -export const CreateNodeChildRelationshipsResponseTransformer: CreateNodeChildRelationshipsResponseTransformer = async (data) => { - SingleNodeModelResponseTransformer(data); - return data; -}; +export type GetVariationOptionData = { + body?: never + path: { + /** + * A unique identifier for the variation. + */ + variationID: string + /** + * A unique identifier for the option. + */ + optionID: string + } + query?: never + url: "/pcm/variations/{variationID}/options/{optionID}" +} + +export type GetVariationOptionErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type GetVariationOptionError = + GetVariationOptionErrors[keyof GetVariationOptionErrors] + +export type GetVariationOptionResponses = { + /** + * Successfully returns the variation option + */ + 200: SingleOption +} + +export type GetVariationOptionResponse = + GetVariationOptionResponses[keyof GetVariationOptionResponses] -export type GetAllNodeChildrenResponseTransformer = (data: any) => Promise; +export type UpdateVariationOptionData = { + body?: UpdateOption + path: { + /** + * A unique identifier for the variation. + */ + variationID: string + /** + * A unique identifier for the option. + */ + optionID: string + } + query?: never + url: "/pcm/variations/{variationID}/options/{optionID}" +} + +export type UpdateVariationOptionErrors = { + /** + * Forbidden + */ + 403: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Write conflict detected + */ + 409: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type UpdateVariationOptionError = + UpdateVariationOptionErrors[keyof UpdateVariationOptionErrors] + +export type UpdateVariationOptionResponses = { + /** + * Successfully returns the updated variation option + */ + 200: SingleOption +} + +export type UpdateVariationOptionResponse = + UpdateVariationOptionResponses[keyof UpdateVariationOptionResponses] -export const GetAllNodeChildrenResponseTransformer: GetAllNodeChildrenResponseTransformer = async (data) => { - MultiNodesModelResponseTransformer(data); - return data; -}; +export type GetAllModifiersData = { + body?: never + path: { + /** + * A unique identifier for the variation. + */ + variationID: string + /** + * A unique identifier for the option. + */ + optionID: string + } + query?: { + /** + * The number of records to offset the results by. + */ + "page[offset]"?: BigInt + /** + * The number of records per page. The maximum limit is 100. + */ + "page[limit]"?: BigInt + } + url: "/pcm/variations/{variationID}/options/{optionID}/modifiers" +} + +export type GetAllModifiersErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type GetAllModifiersError = + GetAllModifiersErrors[keyof GetAllModifiersErrors] + +export type GetAllModifiersResponses = { + /** + * Successfully returns all variation modifiers + */ + 200: MultiModifiers +} + +export type GetAllModifiersResponse = + GetAllModifiersResponses[keyof GetAllModifiersResponses] -export type CreateNodeProductRelationshipResponseTransformer = (data: any) => Promise; +export type CreateModifierData = { + body?: CreateModifier + path: { + /** + * A unique identifier for the variation. + */ + variationID: string + /** + * A unique identifier for the option. + */ + optionID: string + } + query?: never + url: "/pcm/variations/{variationID}/options/{optionID}/modifiers" +} + +export type CreateModifierErrors = { + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type CreateModifierError = + CreateModifierErrors[keyof CreateModifierErrors] + +export type CreateModifierResponses = { + /** + * Successfully returns the created modifier + */ + 201: CreatedModifier +} + +export type CreateModifierResponse = + CreateModifierResponses[keyof CreateModifierResponses] -export const CreateNodeProductRelationshipResponseTransformer: CreateNodeProductRelationshipResponseTransformer = async (data) => { - SingleNodeModelResponseTransformer(data); - return data; -}; +export type DeleteModifierData = { + body?: never + path: { + /** + * A unique identifier for the variation. + */ + variationID: string + /** + * A unique identifier for the option. + */ + optionID: string + /** + * A unique identifier for the modifier. + */ + modifierID: string + } + query?: never + url: "/pcm/variations/{variationID}/options/{optionID}/modifiers/{modifierID}" +} + +export type DeleteModifierErrors = { + /** + * Forbidden + */ + 403: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type DeleteModifierError = + DeleteModifierErrors[keyof DeleteModifierErrors] + +export type DeleteModifierResponses = { + /** + * No Content + */ + 204: void +} + +export type DeleteModifierResponse = + DeleteModifierResponses[keyof DeleteModifierResponses] -export type DeleteNodeProductRelationshipsResponseTransformer = (data: any) => Promise; +export type GetModifierData = { + body?: never + path: { + /** + * A unique identifier for the variation. + */ + variationID: string + /** + * A unique identifier for the option. + */ + optionID: string + /** + * A unique identifier for the modifier. + */ + modifierID: string + } + query?: never + url: "/pcm/variations/{variationID}/options/{optionID}/modifiers/{modifierID}" +} + +export type GetModifierErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type GetModifierError = GetModifierErrors[keyof GetModifierErrors] + +export type GetModifierResponses = { + /** + * Returns the specified modifier. + */ + 200: SingleModifier +} + +export type GetModifierResponse = + GetModifierResponses[keyof GetModifierResponses] -export const DeleteNodeProductRelationshipsResponseTransformer: DeleteNodeProductRelationshipsResponseTransformer = async (data) => { - SingleNodeModelResponseTransformer(data); - return data; -}; +export type UpdateModifierData = { + body?: UpdateModifier + path: { + /** + * A unique identifier for the variation. + */ + variationID: string + /** + * A unique identifier for the option. + */ + optionID: string + /** + * A unique identifier for the modifier. + */ + modifierID: string + } + query?: never + url: "/pcm/variations/{variationID}/options/{optionID}/modifiers/{modifierID}" +} + +export type UpdateModifierErrors = { + /** + * Forbidden + */ + 403: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Write conflict detected + */ + 409: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type UpdateModifierError = + UpdateModifierErrors[keyof UpdateModifierErrors] + +export type UpdateModifierResponses = { + /** + * Successfully returns the updated modifier + */ + 200: SingleModifier +} + +export type UpdateModifierResponse = + UpdateModifierResponses[keyof UpdateModifierResponses] -export type GetNodeProductsResponseTransformer = (data: any) => Promise; +export type GetHierarchyData = { + body?: never + path?: never + query?: { + /** + * The number of records to offset the results by. + */ + "page[offset]"?: BigInt + /** + * The number of records per page. The maximum limit is 100. + */ + "page[limit]"?: BigInt + } + url: "/pcm/hierarchies" +} + +export type GetHierarchyErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type GetHierarchyError = GetHierarchyErrors[keyof GetHierarchyErrors] + +export type GetHierarchyResponses = { + /** + * Returns a list of all hierarchies. + */ + 200: MultiHierarchy +} + +export type GetHierarchyResponse = + GetHierarchyResponses[keyof GetHierarchyResponses] -export const GetNodeProductsResponseTransformer: GetNodeProductsResponseTransformer = async (data) => { - MultiProductResponseModelResponseTransformer(data); - return data; -}; +export type CreateHierarchyData = { + body: CreateHierarchy + path?: never + query?: never + url: "/pcm/hierarchies" +} + +export type CreateHierarchyErrors = { + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type CreateHierarchyError = + CreateHierarchyErrors[keyof CreateHierarchyErrors] + +export type CreateHierarchyResponses = { + /** + * Returns a created hierarchy with the following attributes. + */ + 201: SingleHierarchy +} + +export type CreateHierarchyResponse = + CreateHierarchyResponses[keyof CreateHierarchyResponses] -export type DuplicateHierarchyResponseTransformer = (data: any) => Promise; +export type DeleteHierarchyData = { + body?: never + path: { + /** + * A unique identifier for the hierarchy. + */ + hierarchyID: string + } + query?: never + url: "/pcm/hierarchies/{hierarchyID}" +} + +export type DeleteHierarchyErrors = { + /** + * Forbidden + */ + 403: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type DeleteHierarchyError = + DeleteHierarchyErrors[keyof DeleteHierarchyErrors] + +export type DeleteHierarchyResponses = { + /** + * No Content + */ + 204: void +} + +export type DeleteHierarchyResponse = + DeleteHierarchyResponses[keyof DeleteHierarchyResponses] -export const DuplicateHierarchyResponseTransformer: DuplicateHierarchyResponseTransformer = async (data) => { - SingleModelResponseTransformer(data); - return data; -}; +export type GetHierarchyChildData = { + body?: never + path: { + /** + * A unique identifier for the hierarchy. + */ + hierarchyID: string + } + query?: never + url: "/pcm/hierarchies/{hierarchyID}" +} + +export type GetHierarchyChildErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type GetHierarchyChildError = + GetHierarchyChildErrors[keyof GetHierarchyChildErrors] + +export type GetHierarchyChildResponses = { + /** + * Returns a hierarchy with the following attributes. + */ + 200: SingleHierarchy +} + +export type GetHierarchyChildResponse = + GetHierarchyChildResponses[keyof GetHierarchyChildResponses] -export type GetAllProductTagsResponseTransformer = (data: any) => Promise; +export type UpdateHierarchyData = { + body: UpdateHierarchy + path: { + /** + * A unique identifier for the hierarchy. + */ + hierarchyID: string + } + query?: never + url: "/pcm/hierarchies/{hierarchyID}" +} + +export type UpdateHierarchyErrors = { + /** + * Forbidden + */ + 403: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type UpdateHierarchyError = + UpdateHierarchyErrors[keyof UpdateHierarchyErrors] + +export type UpdateHierarchyResponses = { + /** + * Successfully returns the updated hierarchy + */ + 200: SingleHierarchy +} + +export type UpdateHierarchyResponse = + UpdateHierarchyResponses[keyof UpdateHierarchyResponses] -export type MultiTagModelResponseTransformer = (data: any) => MultiTag; +export type GetAllNodesInHierarchyData = { + body?: never + path: { + /** + * A unique identifier for the hierarchy. + */ + hierarchyID: string + } + query?: { + /** + * The number of records to offset the results by. + */ + "page[offset]"?: BigInt + /** + * The number of records per page. The maximum limit is 100. + */ + "page[limit]"?: BigInt + } + url: "/pcm/hierarchies/{hierarchyID}/nodes" +} + +export type GetAllNodesInHierarchyErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type GetAllNodesInHierarchyError = + GetAllNodesInHierarchyErrors[keyof GetAllNodesInHierarchyErrors] + +export type GetAllNodesInHierarchyResponses = { + /** + * Successfully returns the node's children + */ + 200: MultiNodes +} + +export type GetAllNodesInHierarchyResponse = + GetAllNodesInHierarchyResponses[keyof GetAllNodesInHierarchyResponses] -export type TagModelResponseTransformer = (data: any) => Tag; +export type CreateNodeData = { + body?: CreateNode + path: { + /** + * A unique identifier for the hierarchy. + */ + hierarchyID: string + } + query?: never + url: "/pcm/hierarchies/{hierarchyID}/nodes" +} + +export type CreateNodeErrors = { + /** + * Forbidden + */ + 403: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type CreateNodeError = CreateNodeErrors[keyof CreateNodeErrors] + +export type CreateNodeResponses = { + /** + * Successfully returns the created node + */ + 201: SingleNode +} + +export type CreateNodeResponse = CreateNodeResponses[keyof CreateNodeResponses] -export const TagModelResponseTransformer: TagModelResponseTransformer = data => { - if (data?.meta?.created_at) { - data.meta.created_at = new Date(data.meta.created_at); - } - if (data?.meta?.updated_at) { - data.meta.updated_at = new Date(data.meta.updated_at); - } - return data; -}; +export type DeleteNodeData = { + body?: never + path: { + /** + * A unique identifier for the hierarchy. + */ + hierarchyID: string + /** + * A unique identifier for the node. + */ + nodeID: string + } + query?: never + url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}" +} + +export type DeleteNodeErrors = { + /** + * Forbidden + */ + 403: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type DeleteNodeError = DeleteNodeErrors[keyof DeleteNodeErrors] + +export type DeleteNodeResponses = { + /** + * No Content + */ + 204: void +} + +export type DeleteNodeResponse = DeleteNodeResponses[keyof DeleteNodeResponses] -export const MultiTagModelResponseTransformer: MultiTagModelResponseTransformer = data => { - if (Array.isArray(data?.data)) { - data.data.forEach(TagModelResponseTransformer); - } - return data; -}; +export type GetHierarchyNodeData = { + body?: never + path: { + /** + * A unique identifier for the hierarchy. + */ + hierarchyID: string + /** + * A unique identifier for the node. + */ + nodeID: string + } + query?: never + url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}" +} + +export type GetHierarchyNodeErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type GetHierarchyNodeError = + GetHierarchyNodeErrors[keyof GetHierarchyNodeErrors] + +export type GetHierarchyNodeResponses = { + /** + * Returns a node with the following attributes. + */ + 200: SingleNode +} + +export type GetHierarchyNodeResponse = + GetHierarchyNodeResponses[keyof GetHierarchyNodeResponses] -export const GetAllProductTagsResponseTransformer: GetAllProductTagsResponseTransformer = async (data) => { - MultiTagModelResponseTransformer(data); - return data; -}; +export type UpdateNodeData = { + body?: UpdateNode + path: { + /** + * A unique identifier for the hierarchy. + */ + hierarchyID: string + /** + * A unique identifier for the node. + */ + nodeID: string + } + query?: never + url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}" +} + +export type UpdateNodeErrors = { + /** + * Forbidden + */ + 403: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type UpdateNodeError = UpdateNodeErrors[keyof UpdateNodeErrors] + +export type UpdateNodeResponses = { + /** + * Successfully returns the updated node + */ + 200: SingleNode +} + +export type UpdateNodeResponse = UpdateNodeResponses[keyof UpdateNodeResponses] -export type GetProductTagResponseTransformer = (data: any) => Promise; +export type GetAllChildrenData = { + body?: never + path: { + /** + * A unique identifier for the hierarchy. + */ + hierarchyID: string + } + query?: { + /** + * The number of records to offset the results by. + */ + "page[offset]"?: BigInt + /** + * The number of records per page. The maximum limit is 100. + */ + "page[limit]"?: BigInt + } + url: "/pcm/hierarchies/{hierarchyID}/children" +} + +export type GetAllChildrenErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type GetAllChildrenError = + GetAllChildrenErrors[keyof GetAllChildrenErrors] + +export type GetAllChildrenResponses = { + /** + * Returns the hierarchy's children. + */ + 200: MultiNodes +} + +export type GetAllChildrenResponse = + GetAllChildrenResponses[keyof GetAllChildrenResponses] -export type SingleTagModelResponseTransformer = (data: any) => SingleTag; +export type CreateNodeChildRelationshipsData = { + body?: NodeChildren + path: { + /** + * A unique identifier for the hierarchy. + */ + hierarchyID: string + /** + * A unique identifier for the node. + */ + nodeID: string + } + query?: never + url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/children" +} + +export type CreateNodeChildRelationshipsErrors = { + /** + * Forbidden + */ + 403: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type CreateNodeChildRelationshipsError = + CreateNodeChildRelationshipsErrors[keyof CreateNodeChildRelationshipsErrors] + +export type CreateNodeChildRelationshipsResponses = { + /** + * Successfully returns the node's children + */ + 200: SingleNode +} + +export type CreateNodeChildRelationshipsResponse = + CreateNodeChildRelationshipsResponses[keyof CreateNodeChildRelationshipsResponses] -export const SingleTagModelResponseTransformer: SingleTagModelResponseTransformer = data => { - if (data?.data) { - TagModelResponseTransformer(data.data); - } - return data; -}; +export type GetAllNodeChildrenData = { + body?: never + path: { + /** + * A unique identifier for the hierarchy. + */ + hierarchyID: string + /** + * A unique identifier for the node. + */ + nodeID: string + } + query?: { + /** + * The number of records to offset the results by. + */ + "page[offset]"?: BigInt + /** + * The number of records per page. The maximum limit is 100. + */ + "page[limit]"?: BigInt + } + url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/children" +} + +export type GetAllNodeChildrenErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type GetAllNodeChildrenError = + GetAllNodeChildrenErrors[keyof GetAllNodeChildrenErrors] + +export type GetAllNodeChildrenResponses = { + /** + * Successfully returns the node's children + */ + 200: MultiNodes +} + +export type GetAllNodeChildrenResponse = + GetAllNodeChildrenResponses[keyof GetAllNodeChildrenResponses] -export const GetProductTagResponseTransformer: GetProductTagResponseTransformer = async (data) => { - SingleTagModelResponseTransformer(data); - return data; -}; +export type DeleteNodeParentData = { + body?: never + path: { + /** + * A unique identifier for the hierarchy. + */ + hierarchyID: string + /** + * A unique identifier for the node. + */ + nodeID: string + } + query?: never + url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/parent" +} + +export type DeleteNodeParentErrors = { + /** + * Forbidden + */ + 403: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type DeleteNodeParentError = + DeleteNodeParentErrors[keyof DeleteNodeParentErrors] + +export type DeleteNodeParentResponses = { + /** + * No Content + */ + 204: void +} + +export type DeleteNodeParentResponse = + DeleteNodeParentResponses[keyof DeleteNodeParentResponses] -export type CreateCustomRelationshipResponseTransformer = (data: any) => Promise; +export type UpdateNodeParentData = { + body?: NodeParent + path: { + /** + * A unique identifier for the hierarchy. + */ + hierarchyID: string + /** + * A unique identifier for the node. + */ + nodeID: string + } + query?: never + url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/parent" +} + +export type UpdateNodeParentErrors = { + /** + * Forbidden + */ + 403: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type UpdateNodeParentError = + UpdateNodeParentErrors[keyof UpdateNodeParentErrors] + +export type UpdateNodeParentResponses = { + /** + * No Content + */ + 204: void +} + +export type UpdateNodeParentResponse = + UpdateNodeParentResponses[keyof UpdateNodeParentResponses] -export type SingleCustomRelationshipModelResponseTransformer = (data: any) => SingleCustomRelationship; +export type DeleteNodeProductRelationshipsData = { + body?: NodeProducts + path: { + /** + * A unique identifier for the hierarchy. + */ + hierarchyID: string + /** + * A unique identifier for the node. + */ + nodeID: string + } + query?: never + url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/products" +} + +export type DeleteNodeProductRelationshipsErrors = { + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type DeleteNodeProductRelationshipsError = + DeleteNodeProductRelationshipsErrors[keyof DeleteNodeProductRelationshipsErrors] + +export type DeleteNodeProductRelationshipsResponses = { + /** + * Successfully returns the updated node + */ + 200: SingleNode +} + +export type DeleteNodeProductRelationshipsResponse = + DeleteNodeProductRelationshipsResponses[keyof DeleteNodeProductRelationshipsResponses] -export type CustomRelationshipModelResponseTransformer = (data: any) => CustomRelationship; +export type CreateNodeProductRelationshipData = { + body?: NodeProducts + path: { + /** + * A unique identifier for the hierarchy. + */ + hierarchyID: string + /** + * A unique identifier for the node. + */ + nodeID: string + } + query?: never + url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/relationships/products" +} + +export type CreateNodeProductRelationshipErrors = { + /** + * Forbidden + */ + 403: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type CreateNodeProductRelationshipError = + CreateNodeProductRelationshipErrors[keyof CreateNodeProductRelationshipErrors] + +export type CreateNodeProductRelationshipResponses = { + /** + * Successfully returns the updated node + */ + 201: SingleNode +} + +export type CreateNodeProductRelationshipResponse = + CreateNodeProductRelationshipResponses[keyof CreateNodeProductRelationshipResponses] -export const CustomRelationshipModelResponseTransformer: CustomRelationshipModelResponseTransformer = data => { - if (data?.meta?.timestamps?.created_at) { - data.meta.timestamps.created_at = new Date(data.meta.timestamps.created_at); - } - if (data?.meta?.timestamps?.updated_at) { - data.meta.timestamps.updated_at = new Date(data.meta.timestamps.updated_at); - } - return data; -}; +export type GetNodeProductsData = { + body?: never + path: { + /** + * A unique identifier for the hierarchy. + */ + hierarchyID: string + /** + * A unique identifier for the node. + */ + nodeID: string + } + query?: { + /** + * The number of records to offset the results by. + */ + "page[offset]"?: BigInt + /** + * The number of records per page. The maximum limit is 100. + */ + "page[limit]"?: BigInt + } + url: "/pcm/hierarchies/{hierarchyID}/nodes/{nodeID}/products" +} + +export type GetNodeProductsErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type GetNodeProductsError = + GetNodeProductsErrors[keyof GetNodeProductsErrors] + +export type GetNodeProductsResponses = { + /** + * Successfully returns the node's products + */ + 200: MultiProductResponse +} + +export type GetNodeProductsResponse = + GetNodeProductsResponses[keyof GetNodeProductsResponses] -export const SingleCustomRelationshipModelResponseTransformer: SingleCustomRelationshipModelResponseTransformer = data => { - if (data?.data) { - CustomRelationshipModelResponseTransformer(data.data); - } - return data; -}; +export type DuplicateHierarchyData = { + body: DuplicateJob + path: { + /** + * A unique identifier for the hierarchy. + */ + hierarchyID: string + } + query?: never + url: "/pcm/hierarchies/{hierarchyID}/duplicate_job" +} + +export type DuplicateHierarchyErrors = { + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type DuplicateHierarchyError = + DuplicateHierarchyErrors[keyof DuplicateHierarchyErrors] + +export type DuplicateHierarchyResponses = { + /** + * Successfully returns the duplicate hierarchy job ID + */ + 201: Single +} + +export type DuplicateHierarchyResponse = + DuplicateHierarchyResponses[keyof DuplicateHierarchyResponses] + +export type GetAllProductTagsData = { + body?: never + path?: never + query?: never + url: "/pcm/tags" +} + +export type GetAllProductTagsErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type GetAllProductTagsError = + GetAllProductTagsErrors[keyof GetAllProductTagsErrors] + +export type GetAllProductTagsResponses = { + /** + * Returns all the product tags. + */ + 200: MultiTag +} + +export type GetAllProductTagsResponse = + GetAllProductTagsResponses[keyof GetAllProductTagsResponses] -export const CreateCustomRelationshipResponseTransformer: CreateCustomRelationshipResponseTransformer = async (data) => { - SingleCustomRelationshipModelResponseTransformer(data); - return data; -}; +export type GetProductTagData = { + body?: never + path: { + /** + * A unique identifier for the tag. + */ + tagID: string + } + query?: never + url: "/pcm/tags/{tagID}" +} + +export type GetProductTagErrors = { + /** + * Bad request. The request failed validation. + */ + 400: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type GetProductTagError = GetProductTagErrors[keyof GetProductTagErrors] + +export type GetProductTagResponses = { + /** + * Returns a product tag with the following attributes. + */ + 200: SingleTag +} + +export type GetProductTagResponse = + GetProductTagResponses[keyof GetProductTagResponses] -export type UpdateCustomRelationshipResponseTransformer = (data: any) => Promise; +export type CreateCustomRelationshipData = { + body: CreateCustomRelationship + path?: never + query?: never + url: "/pcm/custom_relationships" +} + +export type CreateCustomRelationshipErrors = { + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type CreateCustomRelationshipError = + CreateCustomRelationshipErrors[keyof CreateCustomRelationshipErrors] + +export type CreateCustomRelationshipResponses = { + /** + * Returns a created custom relationship with the following attributes. + */ + 201: SingleCustomRelationship +} + +export type CreateCustomRelationshipResponse = + CreateCustomRelationshipResponses[keyof CreateCustomRelationshipResponses] -export const UpdateCustomRelationshipResponseTransformer: UpdateCustomRelationshipResponseTransformer = async (data) => { - SingleCustomRelationshipModelResponseTransformer(data); - return data; -}; \ No newline at end of file +export type UpdateCustomRelationshipData = { + body: UpdateCustomRelationship + path: { + /** + * A custom relationship slug. + */ + customRelationshipSlug: string + } + query?: never + url: "/pcm/custom_relationships/{customRelationshipSlug}" +} + +export type UpdateCustomRelationshipErrors = { + /** + * Forbidden + */ + 403: _Error + /** + * Bad Request. Not Found. + */ + 404: _Error + /** + * Bad request. The request failed validation. + */ + 422: _Error + /** + * Internal server error. There was a system failure in the platform. + */ + 500: _Error +} + +export type UpdateCustomRelationshipError = + UpdateCustomRelationshipErrors[keyof UpdateCustomRelationshipErrors] + +export type UpdateCustomRelationshipResponses = { + /** + * Successfully returns the updated custom relationship + */ + 200: SingleCustomRelationship +} + +export type UpdateCustomRelationshipResponse = + UpdateCustomRelationshipResponses[keyof UpdateCustomRelationshipResponses] From d05645b8107dc9a8bcf8f4e7be8a147a6411aa3a Mon Sep 17 00:00:00 2001 From: Robert Field Date: Fri, 10 Jan 2025 17:45:44 +0000 Subject: [PATCH 30/30] chore: add explainer for status of sdks --- packages/sdks/README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 packages/sdks/README.md diff --git a/packages/sdks/README.md b/packages/sdks/README.md new file mode 100644 index 00000000..f12c0b64 --- /dev/null +++ b/packages/sdks/README.md @@ -0,0 +1,31 @@ +# Elastic Path SDKs (Next Generation) + +> ⚠️ **Work in Progress**: These TypeScript SDKs are currently under active development and represent the next generation of Elastic Path's client libraries. They are not yet ready for production use. + +## Overview + +This package contains the next version of Elastic Path's TypeScript SDKs, built from the ground up to provide: + +- Improved type safety and TypeScript support +- Better performance and smaller bundle sizes +- Consistent API across different platforms +- Enhanced developer experience + +## Status + +These SDKs are currently in development and should be considered alpha quality. We recommend using our current stable SDKs for production applications: + +- [JavaScript SDK](https://www.npmjs.com/package/@elasticpath/js-sdk) + +## Future Updates + +We'll update this README with more information as development progresses. Stay tuned for: + +- Installation instructions +- Usage examples +- API documentation +- Migration guides from existing SDKs + +## Questions? + +If you have any questions about these upcoming SDKs, please reach out to our support team or open an issue in this repository.