UNPKG

@commercetools/platform-sdk

Version:

TypeScript definitions and SDK for commercetools Composable Commerce

1,346 lines (1,316 loc) 884 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; } function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } /** * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. * Please don't change this file manually but run `rmf-codegen generate <raml_file_path> -o <output_path> -t typescript_client` to update it. * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. */ function isDefined(value) { return typeof value !== 'undefined' && value !== null; } function stringify(object) { const params = new URLSearchParams(object); for (const [key, value] of Object.entries(object)) { if (Array.isArray(value)) { params.delete(key); value.filter(Boolean).forEach(v => params.append(key, v)); } } return params.toString(); } function cleanObject(obj) { return Object.keys(obj).reduce((result, key) => { const value = obj[key]; if (Array.isArray(value)) { const values = value.filter(isDefined); if (!values.length) { return result; } return { ...result, [key]: values }; } if (isDefined(value)) { return { ...result, [key]: value }; } return result; }, {}); } function formatQueryString(variableMap) { const map = cleanObject(variableMap); const result = stringify(map); if (result === '') { return ''; } return `?${result}`; } function buildRelativeUri(commonRequest) { const pathMap = commonRequest.pathVariables; var uri = commonRequest.uriTemplate; for (const param in pathMap) { const value = encodeURIComponent(`${pathMap[param]}`); uri = uri.replace(`{${param}}`, `${value}`); } const resQuery = formatQueryString(commonRequest.queryParams || {}); return `${uri}${resQuery}`; } class ApiRequest { constructor(request, requestExecutor) { this.requestExecutor = requestExecutor; _defineProperty(this, "request", void 0); this.request = { ...request, uri: buildRelativeUri(request) }; } clientRequest() { return this.request; } execute() { return this.requestExecutor(this.request); } } /** * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. */ /** **/ class ByProjectKeyInStoreKeyByStoreKeyMeActiveCartRequestBuilder { constructor(args) { this.args = args; } /** * Retrieves the Customer's most recently modified [active Cart](ctp:api:type:CartState) in a Store. Returns a `200` status if successful. * * Carts with `Merchant` or `Quote` [CartOrigin](ctp:api:type:CartOrigin) are ignored. * * A [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error is returned in the following scenarios: * * - If no active Cart exists. * - If an active Cart exists but does not have a `store` specified, or the `store` field references a different Store. * - If an active Cart exists but does not have a `customerId` that matches the [customer:{id}](/scopes#composable-commerce-oauth) scope, or `anonymousId` that matches the [anonymous_id:{id}](/scopes#composable-commerce-oauth) scope. * */ get(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'GET', uriTemplate: '/{projectKey}/in-store/key={storeKey}/me/active-cart', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs }, this.args.executeRequest); } /** * Checks if an active Cart exists in a Store. Returns `200 OK` status if successful. * * A [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error is returned in the following scenarios: * * - If no active Cart exists in a Store. * - If an active Cart exists but does not have a `store` specified, or the `store` field references a different Store. * - If an active Cart exists but does not contain a `customerId` that matches the [customer:{id}](/scopes#composable-commerce-oauth) scope, or `anonymousId` that matches the [anonymous_id:{id}](/scopes#composable-commerce-oauth) scope. * */ head(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'HEAD', uriTemplate: '/{projectKey}/in-store/key={storeKey}/me/active-cart', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers } }, this.args.executeRequest); } } /** * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. */ /** **/ class ByProjectKeyMeActiveCartRequestBuilder { constructor(args) { this.args = args; } /** * Retrieves the Customer's most recently modified [active Cart](ctp:api:type:CartState). Returns a `200` status if successful. * * Carts with `Merchant` or `Quote` [CartOrigin](ctp:api:type:CartOrigin) are ignored. * * A [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error is returned in the following scenarios: * * - If no active Cart exists. * - If an active Cart exists but does not have a `customerId` that matches the [customer:{id}](/scopes#composable-commerce-oauth) scope, or `anonymousId` that matches the [anonymous_id:{id}](/scopes#composable-commerce-oauth) scope. * */ get(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'GET', uriTemplate: '/{projectKey}/me/active-cart', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs }, this.args.executeRequest); } /** * Checks if an active Cart exists. Returns a `200` status if successful. * * A [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error is returned in the following scenarios: * * - If no active Cart exists. * - If an active Cart exists but does not have a `customerId` that matches the [customer:{id}](/scopes#composable-commerce-oauth) scope, or an `anonymousId` that matches the [anonymous_id:{id}](/scopes#composable-commerce-oauth) scope. * */ head(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'HEAD', uriTemplate: '/{projectKey}/me/active-cart', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers } }, this.args.executeRequest); } } /** * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. */ /** **/ class ByProjectKeyApiClientsByIDRequestBuilder { constructor(args) { this.args = args; } get(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'GET', uriTemplate: '/{projectKey}/api-clients/{ID}', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers } }, this.args.executeRequest); } /** * Checks if an API Client exists with the provided `id`. Returns a `200` status if the API Client exists, or a `404` status otherwise. */ head(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'HEAD', uriTemplate: '/{projectKey}/api-clients/{ID}', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers } }, this.args.executeRequest); } delete(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'DELETE', uriTemplate: '/{projectKey}/api-clients/{ID}', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers } }, this.args.executeRequest); } } /** * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. */ /** **/ class ByProjectKeyApiClientsRequestBuilder { constructor(args) { this.args = args; } withId(childPathArgs) { return new ByProjectKeyApiClientsByIDRequestBuilder({ pathArgs: { ...this.args.pathArgs, ...childPathArgs }, executeRequest: this.args.executeRequest, baseUri: this.args.baseUri }); } get(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'GET', uriTemplate: '/{projectKey}/api-clients', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs }, this.args.executeRequest); } /** * Checks if an API Client exists for the provided query predicate. Returns a `200` status if any API Clients match the query predicate, or a `404` status otherwise. */ head(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'HEAD', uriTemplate: '/{projectKey}/api-clients', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs }, this.args.executeRequest); } post(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'POST', uriTemplate: '/{projectKey}/api-clients', pathVariables: this.args.pathArgs, headers: { 'Content-Type': 'application/json', ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs, body: methodArgs?.body }, this.args.executeRequest); } } /** * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. */ /** **/ class ByProjectKeyAsAssociateByAssociateIdBusinessUnitsByIDRequestBuilder { constructor(args) { this.args = args; } get(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'GET', uriTemplate: '/{projectKey}/as-associate/{associateId}/business-units/{ID}', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs }, this.args.executeRequest); } /** * Checks if a BusinessUnit exists with the provided `id`. Returns a `200` status if the BusinessUnit exists, or a `404` status otherwise. */ head(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'HEAD', uriTemplate: '/{projectKey}/as-associate/{associateId}/business-units/{ID}', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers } }, this.args.executeRequest); } post(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'POST', uriTemplate: '/{projectKey}/as-associate/{associateId}/business-units/{ID}', pathVariables: this.args.pathArgs, headers: { 'Content-Type': 'application/json', ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs, body: methodArgs?.body }, this.args.executeRequest); } } /** * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. */ /** **/ class ByProjectKeyAsAssociateByAssociateIdBusinessUnitsKeyByKeyRequestBuilder { constructor(args) { this.args = args; } get(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'GET', uriTemplate: '/{projectKey}/as-associate/{associateId}/business-units/key={key}', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs }, this.args.executeRequest); } /** * Checks if a BusinessUnit exists with the provided `key`. Returns a `200` status if the BusinessUnit exists, or a `404` status otherwise. */ head(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'HEAD', uriTemplate: '/{projectKey}/as-associate/{associateId}/business-units/key={key}', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers } }, this.args.executeRequest); } post(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'POST', uriTemplate: '/{projectKey}/as-associate/{associateId}/business-units/key={key}', pathVariables: this.args.pathArgs, headers: { 'Content-Type': 'application/json', ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs, body: methodArgs?.body }, this.args.executeRequest); } } /** * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. */ /** **/ class ByProjectKeyAsAssociateByAssociateIdBusinessUnitsRequestBuilder { constructor(args) { this.args = args; } withKey(childPathArgs) { return new ByProjectKeyAsAssociateByAssociateIdBusinessUnitsKeyByKeyRequestBuilder({ pathArgs: { ...this.args.pathArgs, ...childPathArgs }, executeRequest: this.args.executeRequest, baseUri: this.args.baseUri }); } withId(childPathArgs) { return new ByProjectKeyAsAssociateByAssociateIdBusinessUnitsByIDRequestBuilder({ pathArgs: { ...this.args.pathArgs, ...childPathArgs }, executeRequest: this.args.executeRequest, baseUri: this.args.baseUri }); } get(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'GET', uriTemplate: '/{projectKey}/as-associate/{associateId}/business-units', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs }, this.args.executeRequest); } /** * Checks if one or more BusinessUnits exist for the provided query predicate. Returns a `200` status if any BusinessUnits match the query predicate, or a `404` status otherwise. */ head(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'HEAD', uriTemplate: '/{projectKey}/as-associate/{associateId}/business-units', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs }, this.args.executeRequest); } post(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'POST', uriTemplate: '/{projectKey}/as-associate/{associateId}/business-units', pathVariables: this.args.pathArgs, headers: { 'Content-Type': 'application/json', ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs, body: methodArgs?.body }, this.args.executeRequest); } } /** * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. */ /** **/ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyApprovalFlowsByIDRequestBuilder { constructor(args) { this.args = args; } get(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'GET', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/approval-flows/{ID}', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs }, this.args.executeRequest); } post(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'POST', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/approval-flows/{ID}', pathVariables: this.args.pathArgs, headers: { 'Content-Type': 'application/json', ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs, body: methodArgs?.body }, this.args.executeRequest); } } /** * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. */ /** **/ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyApprovalFlowsRequestBuilder { constructor(args) { this.args = args; } withId(childPathArgs) { return new ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyApprovalFlowsByIDRequestBuilder({ pathArgs: { ...this.args.pathArgs, ...childPathArgs }, executeRequest: this.args.executeRequest, baseUri: this.args.baseUri }); } get(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'GET', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/approval-flows', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs }, this.args.executeRequest); } } /** * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. */ /** **/ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyApprovalRulesByIDRequestBuilder { constructor(args) { this.args = args; } get(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'GET', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/approval-rules/{ID}', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs }, this.args.executeRequest); } post(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'POST', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/approval-rules/{ID}', pathVariables: this.args.pathArgs, headers: { 'Content-Type': 'application/json', ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs, body: methodArgs?.body }, this.args.executeRequest); } } /** * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. */ /** **/ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyApprovalRulesKeyByKeyRequestBuilder { constructor(args) { this.args = args; } get(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'GET', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/approval-rules/key={key}', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs }, this.args.executeRequest); } post(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'POST', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/approval-rules/key={key}', pathVariables: this.args.pathArgs, headers: { 'Content-Type': 'application/json', ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs, body: methodArgs?.body }, this.args.executeRequest); } } /** * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. */ /** **/ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyApprovalRulesRequestBuilder { constructor(args) { this.args = args; } withId(childPathArgs) { return new ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyApprovalRulesByIDRequestBuilder({ pathArgs: { ...this.args.pathArgs, ...childPathArgs }, executeRequest: this.args.executeRequest, baseUri: this.args.baseUri }); } withKey(childPathArgs) { return new ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyApprovalRulesKeyByKeyRequestBuilder({ pathArgs: { ...this.args.pathArgs, ...childPathArgs }, executeRequest: this.args.executeRequest, baseUri: this.args.baseUri }); } get(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'GET', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/approval-rules', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs }, this.args.executeRequest); } post(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'POST', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/approval-rules', pathVariables: this.args.pathArgs, headers: { 'Content-Type': 'application/json', ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs, body: methodArgs?.body }, this.args.executeRequest); } } /** * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. */ /** **/ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicateRequestBuilder { constructor(args) { this.args = args; } /** * Creates a new Cart by replicating an existing Cart or Order. Can be useful in cases where a customer wants to cancel a recent order to make some changes or reorder a previous order. * * The replicated Cart preserves Customer information, Line Items and Custom Line Items, Custom Fields, Discount Codes, and other settings of the Cart or Order. If the Line Items become invalid, for example, due to removed Products or Prices, they are removed from the new Cart. If the Customer switches to another Customer Group, the new Cart is updated with the new value. It has up-to-date Tax Rates, Prices, and Line Item product data and is in `Active` [CartState](ctp:api:type:CartState). * * The new Cart does not contain Payments or Deliveries. The [State](ctp:api:type:ItemState) of Line Items and Custom Line Items is reset to `initial`. * * If the Cart exists in the [Project](ctp:api:type:Project) but does not reference the requested [BusinessUnit](ctp:api:type:BusinessUnit), this method returns an [InvalidOperation](ctp:api:type:InvalidOperationError) error. * * Specific Error Codes: * * - [MatchingPriceNotFound](ctp:api:type:MatchingPriceNotFoundError) * - [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError) * */ post(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'POST', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts/replicate', pathVariables: this.args.pathArgs, headers: { 'Content-Type': 'application/json', ...methodArgs?.headers }, body: methodArgs?.body }, this.args.executeRequest); } } /** * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. */ /** **/ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsByIDRequestBuilder { constructor(args) { this.args = args; } /** * If the Cart exists in the [Project](ctp:api:type:Project) but does not reference the requested [BusinessUnit](ctp:api:type:BusinessUnit), this method returns an [InvalidOperation](ctp:api:type:InvalidOperationError) error. * */ get(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'GET', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts/{ID}', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs }, this.args.executeRequest); } /** * Checks if a Cart exists with the provided `id`. Returns a `200` status if the Cart exists, or a `404` status otherwise. */ head(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'HEAD', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts/{ID}', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers } }, this.args.executeRequest); } /** * If the Cart exists in the [Project](ctp:api:type:Project) but does not reference the requested [BusinessUnit](ctp:api:type:BusinessUnit), this method returns an [InvalidOperation](ctp:api:type:InvalidOperationError) error. * */ post(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'POST', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts/{ID}', pathVariables: this.args.pathArgs, headers: { 'Content-Type': 'application/json', ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs, body: methodArgs?.body }, this.args.executeRequest); } /** * If the Cart exists in the [Project](ctp:api:type:Project) but does not reference the requested [BusinessUnit](ctp:api:type:BusinessUnit), this method returns an [InvalidOperation](ctp:api:type:InvalidOperationError) error. */ delete(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'DELETE', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts/{ID}', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs }, this.args.executeRequest); } } /** * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. */ /** **/ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsKeyByKeyRequestBuilder { constructor(args) { this.args = args; } /** * If the Cart exists in the [Project](ctp:api:type:Project) but does not reference the requested [BusinessUnit](ctp:api:type:BusinessUnit), this method returns an [InvalidOperation](ctp:api:type:InvalidOperationError) error. * */ get(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'GET', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts/key={key}', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs }, this.args.executeRequest); } /** * Checks if a Cart exists with the provided `key`. Returns a `200` status if the Cart exists, or a `404` status otherwise. */ head(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'HEAD', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts/key={key}', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers } }, this.args.executeRequest); } /** * If the Cart exists in the [Project](ctp:api:type:Project) but does not reference the requested [BusinessUnit](ctp:api:type:BusinessUnit), this method returns an [InvalidOperation](ctp:api:type:InvalidOperationError) error. * */ post(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'POST', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts/key={key}', pathVariables: this.args.pathArgs, headers: { 'Content-Type': 'application/json', ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs, body: methodArgs?.body }, this.args.executeRequest); } /** * If the Cart exists in the [Project](ctp:api:type:Project) but does not reference the requested [BusinessUnit](ctp:api:type:BusinessUnit), this method returns an [InvalidOperation](ctp:api:type:InvalidOperationError) error. */ delete(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'DELETE', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts/key={key}', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs }, this.args.executeRequest); } } /** * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. */ /** **/ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsRequestBuilder { constructor(args) { this.args = args; } withKey(childPathArgs) { return new ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsKeyByKeyRequestBuilder({ pathArgs: { ...this.args.pathArgs, ...childPathArgs }, executeRequest: this.args.executeRequest, baseUri: this.args.baseUri }); } withId(childPathArgs) { return new ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsByIDRequestBuilder({ pathArgs: { ...this.args.pathArgs, ...childPathArgs }, executeRequest: this.args.executeRequest, baseUri: this.args.baseUri }); } replicate() { return new ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicateRequestBuilder({ pathArgs: { ...this.args.pathArgs }, executeRequest: this.args.executeRequest, baseUri: this.args.baseUri }); } get(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'GET', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs }, this.args.executeRequest); } /** * Checks if one or more Carts exist for the provided query predicate. Returns a `200` status if any Carts match the query predicate, or a `404` status otherwise. */ head(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'HEAD', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs }, this.args.executeRequest); } /** * Creates a Cart in the [BusinessUnit](ctp:api:type:BusinessUnit) referenced by `businessUnitKey`. As such, the `businessUnit` field on [CartDraft](ctp:api:type:CartDraft) is ignored for this request. * Creating a Cart can fail with an [InvalidOperation](ctp:api:type:InvalidOperationError) if the referenced [ShippingMethod](ctp:api:type:ShippingMethod) in the [CartDraft](ctp:api:type:CartDraft) has a predicate that does not match the Cart. * * Specific Error Codes: * * - [DiscountCodeNonApplicable](ctp:api:type:DiscountCodeNonApplicableError) * - [InvalidItemShippingDetails](ctp:api:type:InvalidItemShippingDetailsError) * - [MatchingPriceNotFound](ctp:api:type:MatchingPriceNotFoundError) * - [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError) * */ post(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'POST', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts', pathVariables: this.args.pathArgs, headers: { 'Content-Type': 'application/json', ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs, body: methodArgs?.body }, this.args.executeRequest); } } /** * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. */ /** **/ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyOrdersQuotesRequestBuilder { constructor(args) { this.args = args; } /** * * Creates an Order from a [Quote](ctp:api:type:Quote) in a [BusinessUnit](ctp:api:type:BusinessUnit). * * The Quote must reference the same Business Unit as the `businessUnitKey` path parameter, must have the `Pending` [state](ctp:api:type:QuoteState), and must be valid (not past the `validTo` date). If these criteria are not met, an [InvalidOperation](ctp:api:type:InvalidOperationError) error is returned. * * Specific Error Codes: * * - [InvalidItemShippingDetails](ctp:api:type:InvalidItemShippingDetailsError) * - [OutOfStock](ctp:api:type:OutOfStockError) * */ post(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'POST', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders/quotes', pathVariables: this.args.pathArgs, headers: { 'Content-Type': 'application/json', ...methodArgs?.headers }, body: methodArgs?.body }, this.args.executeRequest); } } /** * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. */ /** **/ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyOrdersByIDRequestBuilder { constructor(args) { this.args = args; } /** * Retrieves an Order with the provided `id` in a [BusinessUnit](ctp:api:type:BusinessUnit). * If the Order exists in the [Project](ctp:api:type:Project) but does not reference the requested Business Unit, this method returns an [InvalidOperation](ctp:api:type:InvalidOperationError) error. * */ get(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'GET', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders/{ID}', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs }, this.args.executeRequest); } /** * Checks if an Order exists with the provided `id` in a [BusinessUnit](ctp:api:type:BusinessUnit). Returns a `200` status if the Order exists, or a `404` status otherwise. */ head(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'HEAD', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders/{ID}', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers } }, this.args.executeRequest); } /** * Updates an Order in a [BusinessUnit](ctp:api:type:BusinessUnit) using one or more [update actions](/../api/projects/orders#update-actions). * If the Order exists in the [Project](ctp:api:type:Project) but does not reference the requested Business Unit, this method returns an [InvalidOperation](ctp:api:type:InvalidOperationError) error. * */ post(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'POST', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders/{ID}', pathVariables: this.args.pathArgs, headers: { 'Content-Type': 'application/json', ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs, body: methodArgs?.body }, this.args.executeRequest); } } /** * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. */ /** **/ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyOrdersOrderNumberByOrderNumberRequestBuilder { constructor(args) { this.args = args; } /** * Retrieves an Order with the provided `orderNumber` in a [BusinessUnit](ctp:api:type:BusinessUnit). * If the Order exists in the [Project](ctp:api:type:Project) but does not reference the requested [BusinessUnit](ctp:api:type:BusinessUnit), this method returns an [InvalidOperation](ctp:api:type:InvalidOperationError) error. * */ get(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'GET', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders/order-number={orderNumber}', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs }, this.args.executeRequest); } /** * Checks if an Order exists with the provided `orderNumber` in a [BusinessUnit](ctp:api:type:BusinessUnit). Returns a `200` status if the Order exists, or a `404` status otherwise. */ head(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'HEAD', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders/order-number={orderNumber}', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers } }, this.args.executeRequest); } /** * Updates an Order in a [BusinessUnit](ctp:api:type:BusinessUnit) using one or more [update actions](/../api/projects/orders#update-actions). * If the Order exists in the [Project](ctp:api:type:Project) but does not reference the requested Business Unit, this method returns an [InvalidOperation](ctp:api:type:InvalidOperationError) error. * */ post(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'POST', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders/order-number={orderNumber}', pathVariables: this.args.pathArgs, headers: { 'Content-Type': 'application/json', ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs, body: methodArgs?.body }, this.args.executeRequest); } } /** * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. */ /** **/ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyOrdersRequestBuilder { constructor(args) { this.args = args; } orderQuote() { return new ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyOrdersQuotesRequestBuilder({ pathArgs: { ...this.args.pathArgs }, executeRequest: this.args.executeRequest, baseUri: this.args.baseUri }); } withOrderNumber(childPathArgs) { return new ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyOrdersOrderNumberByOrderNumberRequestBuilder({ pathArgs: { ...this.args.pathArgs, ...childPathArgs }, executeRequest: this.args.executeRequest, baseUri: this.args.baseUri }); } withId(childPathArgs) { return new ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyOrdersByIDRequestBuilder({ pathArgs: { ...this.args.pathArgs, ...childPathArgs }, executeRequest: this.args.executeRequest, baseUri: this.args.baseUri }); } /** * Retrieves Orders in a [BusinessUnit](ctp:api:type:BusinessUnit). */ get(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'GET', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs }, this.args.executeRequest); } /** * Checks if one or more Orders exist with provided query predicate in a [BusinessUnit](ctp:api:type:BusinessUnit). Returns a `200` status if any Orders match the query predicate, or a `404` status otherwise. */ head(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'HEAD', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs }, this.args.executeRequest); } /** * Creates an Order from a [Cart](ctp:api:type:Cart) in a [BusinessUnit](ctp:api:type:BusinessUnit). * * The Cart must have a shipping address and an active Shipping Method set. * * If the Cart does not reference the same BusinessUnit as the `businessUnitKey` path parameter, an [InvalidOperation](ctp:api:type:InvalidOperationError) is returned. * * Specific Error Codes: * * - [DiscountCodeNonApplicable](ctp:api:type:DiscountCodeNonApplicableError) * - [InvalidItemShippingDetails](ctp:api:type:InvalidItemShippingDetailsError) * - [OutOfStock](ctp:api:type:OutOfStockError) * - [PriceChanged](ctp:api:type:PriceChangedError) * - [ShippingMethodDoesNotMatchCart](ctp:api:type:ShippingMethodDoesNotMatchCartError) * - [MatchingPriceNotFound](ctp:api:type:MatchingPriceNotFoundError) * - [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError) * */ post(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'POST', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders', pathVariables: this.args.pathArgs, headers: { 'Content-Type': 'application/json', ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs, body: methodArgs?.body }, this.args.executeRequest); } } /** * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. * For more information about the commercetools platform APIs, visit https://docs.commercetools.com/. */ /** **/ class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyQuoteRequestsByIDRequestBuilder { constructor(args) { this.args = args; } /** * If the QuoteRequest exists in the [Project](ctp:api:type:Project) but does not reference the requested [BusinessUnit](ctp:api:type:BusinessUnit), this method returns an [InvalidOperation](ctp:api:type:InvalidOperationError) error. * */ get(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'GET', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/quote-requests/{ID}', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs }, this.args.executeRequest); } /** * Checks if a QuoteRequest exists with the provided `id`. Returns a `200` status if the QuoteRequest exists, or a `404` status otherwise. */ head(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'HEAD', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/quote-requests/{ID}', pathVariables: this.args.pathArgs, headers: { ...methodArgs?.headers } }, this.args.executeRequest); } /** * If the QuoteRequest exists in the [Project](ctp:api:type:Project) but does not reference the requested [BusinessUnit](ctp:api:type:BusinessUnit), this method returns an [InvalidOperation](ctp:api:type:InvalidOperationError) error. * */ post(methodArgs) { return new ApiRequest({ baseUri: this.args.baseUri, method: 'POST', uriTemplate: '/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/quote-requests/{ID}', pathVariables: this.args.pathArgs, headers: { 'Content-Type': 'application/json', ...methodArgs?.headers }, queryParams: methodArgs?.queryArgs, body: methodArgs?.body }, this.args.executeRequest); } } /** * Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT. * Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it. * For more information about the commercetool