From 7ef7094a1397cab1f8ee665fbc546fd38e4bdeec Mon Sep 17 00:00:00 2001 From: Robert Field Date: Mon, 26 Aug 2024 18:44:53 +0100 Subject: [PATCH] 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"