From 1f84cd8de692ea17f6ee157bc6d725d5bb39b495 Mon Sep 17 00:00:00 2001 From: Pierluigi Viti Date: Tue, 11 Jun 2024 12:44:09 +0200 Subject: [PATCH] feat: update resources to schema v5.4.1 --- gen/openapi.json | 477 ++---------------- .../resources/order_validation_rules.spec.ts | 141 ------ src/api.ts | 3 - src/commercelayer.ts | 4 +- src/model.ts | 1 - src/resources/adyen_gateways.ts | 3 + src/resources/attachments.ts | 8 +- src/resources/customers.ts | 3 + src/resources/order_validation_rules.ts | 70 --- 9 files changed, 63 insertions(+), 647 deletions(-) delete mode 100644 specs/resources/order_validation_rules.spec.ts delete mode 100644 src/resources/order_validation_rules.ts diff --git a/gen/openapi.json b/gen/openapi.json index d86a292e..0d2860b6 100644 --- a/gen/openapi.json +++ b/gen/openapi.json @@ -2,7 +2,7 @@ "openapi": "3.1.0", "info": { "title": "Commerce Layer API", - "version": "5.4.0", + "version": "5.4.1", "contact": { "name": "API Support", "url": "https://commercelayer.io", @@ -16544,142 +16544,6 @@ } } }, - "/order_validation_rules": { - "get": { - "operationId": "GET/order_validation_rules", - "summary": "List all order validation rules", - "description": "List all order validation rules", - "tags": [ - "order_validation_rules" - ], - "responses": { - "200": { - "description": "A list of order validation rule objects", - "content": { - "application/vnd.api+json": { - "schema": { - "$ref": "#/components/schemas/orderValidationRuleResponseList" - } - } - } - } - } - } - }, - "/order_validation_rules/{orderValidationRuleId}": { - "get": { - "operationId": "GET/order_validation_rules/orderValidationRuleId", - "summary": "Retrieve an order validation rule", - "description": "Retrieve an order validation rule", - "tags": [ - "order_validation_rules" - ], - "parameters": [ - { - "name": "orderValidationRuleId", - "in": "path", - "schema": { - "type": "string" - }, - "required": true, - "description": "The resource's id" - } - ], - "responses": { - "200": { - "description": "The order validation rule object", - "content": { - "application/vnd.api+json": { - "schema": { - "$ref": "#/components/schemas/orderValidationRuleResponse" - } - } - } - } - } - } - }, - "/order_validation_rules/{orderValidationRuleId}/market": { - "get": { - "operationId": "GET/orderValidationRuleId/market", - "summary": "Retrieve the market associated to the order validation rule", - "description": "Retrieve the market associated to the order validation rule", - "tags": [ - "has_one", - "markets" - ], - "parameters": [ - { - "name": "orderValidationRuleId", - "in": "path", - "schema": { - "type": "string" - }, - "required": true, - "description": "The resource's id" - } - ], - "responses": { - "200": { - "description": "The market associated to the order validation rule" - } - } - } - }, - "/order_validation_rules/{orderValidationRuleId}/attachments": { - "get": { - "operationId": "GET/orderValidationRuleId/attachments", - "summary": "Retrieve the attachments associated to the order validation rule", - "description": "Retrieve the attachments associated to the order validation rule", - "tags": [ - "has_many", - "attachments" - ], - "parameters": [ - { - "name": "orderValidationRuleId", - "in": "path", - "schema": { - "type": "string" - }, - "required": true, - "description": "The resource's id" - } - ], - "responses": { - "200": { - "description": "The attachments associated to the order validation rule" - } - } - } - }, - "/order_validation_rules/{orderValidationRuleId}/versions": { - "get": { - "operationId": "GET/orderValidationRuleId/versions", - "summary": "Retrieve the versions associated to the order validation rule", - "description": "Retrieve the versions associated to the order validation rule", - "tags": [ - "has_many", - "versions" - ], - "parameters": [ - { - "name": "orderValidationRuleId", - "in": "path", - "schema": { - "type": "string" - }, - "required": true, - "description": "The resource's id" - } - ], - "responses": { - "200": { - "description": "The versions associated to the order validation rule" - } - } - } - }, "/orders": { "get": { "operationId": "GET/orders", @@ -32441,6 +32305,12 @@ "example": true, "nullable": true }, + "native_customer_payment_sources": { + "type": "boolean", + "description": "Indicates if the gateway will use the native customer payment sources.", + "example": true, + "nullable": true + }, "webhook_endpoint_secret": { "type": "string", "description": "The gateway webhook endpoint secret, generated by Adyen customer area.", @@ -32605,6 +32475,11 @@ "description": "Indicates if the gateway will leverage on the Adyen notification webhooks.", "example": true }, + "native_customer_payment_sources": { + "type": "boolean", + "description": "Indicates if the gateway will use the native customer payment sources.", + "example": true + }, "webhook_endpoint_secret": { "type": "string", "description": "The gateway webhook endpoint secret, generated by Adyen customer area.", @@ -32739,6 +32614,12 @@ "example": true, "nullable": false }, + "native_customer_payment_sources": { + "type": "boolean", + "description": "Indicates if the gateway will use the native customer payment sources.", + "example": true, + "nullable": false + }, "webhook_endpoint_secret": { "type": "string", "description": "The gateway webhook endpoint secret, generated by Adyen customer area.", @@ -33715,6 +33596,7 @@ "skus", "stock_items", "stock_locations", + "stock_transfers", "tax_calculators", "tax_categories" ] @@ -33812,6 +33694,9 @@ { "$ref": "#/components/schemas/stockLocation" }, + { + "$ref": "#/components/schemas/stockTransfer" + }, { "$ref": "#/components/schemas/taxCalculator" }, @@ -33930,6 +33815,7 @@ "skus", "stock_items", "stock_locations", + "stock_transfers", "tax_calculators", "tax_categories" ] @@ -34027,6 +33913,9 @@ { "$ref": "#/components/schemas/stockLocation" }, + { + "$ref": "#/components/schemas/stockTransfer" + }, { "$ref": "#/components/schemas/taxCalculator" }, @@ -34157,6 +34046,7 @@ "skus", "stock_items", "stock_locations", + "stock_transfers", "tax_calculators", "tax_categories" ] @@ -34254,6 +34144,9 @@ { "$ref": "#/components/schemas/stockLocation" }, + { + "$ref": "#/components/schemas/stockTransfer" + }, { "$ref": "#/components/schemas/taxCalculator" }, @@ -48358,6 +48251,12 @@ "example": 6, "nullable": true }, + "shopper_reference": { + "type": "string", + "description": "A reference to uniquely identify the shopper during payment sessions.", + "example": "xxx-yyy-zzz", + "nullable": true + }, "created_at": { "type": "string", "description": "Time at which the resource was created.", @@ -48676,6 +48575,11 @@ "description": "The customer's password. Initiate a customer password reset flow if you need to change it.", "example": "secret" }, + "shopper_reference": { + "type": "string", + "description": "A reference to uniquely identify the shopper during payment sessions.", + "example": "xxx-yyy-zzz" + }, "reference": { "type": "string", "description": "A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.", @@ -48797,6 +48701,12 @@ "description": "The customer's password. Initiate a customer password reset flow if you need to change it.", "example": "secret" }, + "shopper_reference": { + "type": "string", + "description": "A reference to uniquely identify the shopper during payment sessions.", + "example": "xxx-yyy-zzz", + "nullable": true + }, "reference": { "type": "string", "description": "A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.", @@ -65020,7 +64930,7 @@ "properties": { "session_id": { "type": "string", - "description": "The identifier of the payment session, useful to updated it.", + "description": "The identifier of the payment session.", "example": "xxxx-yyyy-zzzz", "nullable": true }, @@ -74250,287 +74160,6 @@ } } }, - "orderValidationRule": { - "type": "object", - "properties": { - "data": { - "type": "object", - "required": [ - "type", - "attributes" - ], - "properties": { - "type": { - "type": "string", - "description": "The resource's type", - "enum": [ - "order_validation_rules" - ] - }, - "attributes": { - "type": "object", - "properties": { - "created_at": { - "type": "string", - "description": "Time at which the resource was created.", - "example": "2018-01-01T12:00:00.000Z", - "nullable": false - }, - "updated_at": { - "type": "string", - "description": "Time at which the resource was last updated.", - "example": "2018-01-01T12:00:00.000Z", - "nullable": false - }, - "reference": { - "type": "string", - "description": "A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.", - "example": "ANY-EXTERNAL-REFEFERNCE", - "nullable": true - }, - "reference_origin": { - "type": "string", - "description": "Any identifier of the third party system that defines the reference code", - "example": "ANY-EXTERNAL-REFEFERNCE-ORIGIN", - "nullable": true - }, - "metadata": { - "type": "object", - "description": "Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.", - "example": { - "foo": "bar" - }, - "nullable": true - } - } - }, - "relationships": { - "type": "object", - "properties": { - "market": { - "type": "object", - "properties": { - "data": { - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "The resource's type", - "enum": [ - "markets" - ] - }, - "id": { - "type": "string", - "description": "The resource's id", - "example": "XGZwpOSrWL" - } - } - } - } - }, - "attachments": { - "type": "object", - "properties": { - "data": { - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "The resource's type", - "enum": [ - "attachments" - ] - }, - "id": { - "type": "string", - "description": "The resource's id", - "example": "XGZwpOSrWL" - } - } - } - } - }, - "versions": { - "type": "object", - "properties": { - "data": { - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "The resource's type", - "enum": [ - "versions" - ] - }, - "id": { - "type": "string", - "description": "The resource's id", - "example": "XGZwpOSrWL" - } - } - } - } - } - } - } - } - } - } - }, - "orderValidationRuleResponse": { - "type": "object", - "properties": { - "data": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "The resource's id", - "example": "XGZwpOSrWL" - }, - "type": { - "type": "string", - "description": "The resource's type", - "enum": [ - "order_validation_rules" - ] - }, - "links": { - "type": "object", - "properties": { - "self": { - "type": "string", - "description": "URL" - } - } - }, - "attributes": { - "$ref": "#/components/schemas/orderValidationRule/properties/data/properties/attributes" - }, - "relationships": { - "type": "object", - "properties": { - "market": { - "type": "object", - "properties": { - "links": { - "type": "object", - "properties": { - "self": { - "type": "string", - "description": "URL" - }, - "related": { - "type": "string", - "description": "URL" - } - } - }, - "data": { - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "The resource's type", - "enum": [ - "market" - ] - }, - "id": { - "type": "string", - "description": "The resource ID" - } - } - } - } - }, - "attachments": { - "type": "object", - "properties": { - "links": { - "type": "object", - "properties": { - "self": { - "type": "string", - "description": "URL" - }, - "related": { - "type": "string", - "description": "URL" - } - } - }, - "data": { - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "The resource's type", - "enum": [ - "attachments" - ] - }, - "id": { - "type": "string", - "description": "The resource ID" - } - } - } - } - }, - "versions": { - "type": "object", - "properties": { - "links": { - "type": "object", - "properties": { - "self": { - "type": "string", - "description": "URL" - }, - "related": { - "type": "string", - "description": "URL" - } - } - }, - "data": { - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "The resource's type", - "enum": [ - "versions" - ] - }, - "id": { - "type": "string", - "description": "The resource ID" - } - } - } - } - } - } - } - } - } - } - }, - "orderValidationRuleResponseList": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/orderValidationRuleResponse/properties/data" - } - } - } - }, "order": { "type": "object", "properties": { @@ -106233,7 +105862,7 @@ }, "return_url": { "type": "string", - "description": "The URL where the payer is redirected after they authenticate the payment.", + "description": "The URL to return to when a redirect payment is completed.", "example": "https://yourdomain.com/thankyou", "nullable": true }, @@ -106404,7 +106033,7 @@ }, "return_url": { "type": "string", - "description": "The URL where the payer is redirected after they authenticate the payment.", + "description": "The URL to return to when a redirect payment is completed.", "example": "https://yourdomain.com/thankyou" }, "receipt_email": { @@ -106508,7 +106137,7 @@ }, "return_url": { "type": "string", - "description": "The URL where the payer is redirected after they authenticate the payment.", + "description": "The URL to return to when a redirect payment is completed.", "example": "https://yourdomain.com/thankyou", "nullable": true }, @@ -111678,10 +111307,6 @@ "name": "order_subscriptions", "description": "resource type" }, - { - "name": "order_validation_rules", - "description": "resource type" - }, { "name": "orders", "description": "resource type" diff --git a/specs/resources/order_validation_rules.spec.ts b/specs/resources/order_validation_rules.spec.ts deleted file mode 100644 index b1f8929c..00000000 --- a/specs/resources/order_validation_rules.spec.ts +++ /dev/null @@ -1,141 +0,0 @@ -/** - * ©2024 Commerce Layer Inc. - * Source code generated automatically by SDK codegen - **/ - -import { CommerceLayerClient } from '../../src' -import { isEqual } from 'lodash' -// eslint-disable-next-line @typescript-eslint/no-unused-vars -import { getClient, TestData, CommonData, handleError, interceptRequest, checkCommon, checkCommonData, checkCommonParamsList, checkCommonParams, currentAccessToken, randomValue } from '../../test/common' - - - -let cl: CommerceLayerClient - - -beforeAll(async () => { cl = await getClient() }) - - -describe('OrderValidationRules resource', () => { - - const resourceType = 'order_validation_rules' - - - /* spec.retrieve.start */ - it(resourceType + '.retrieve', async () => { - - const id = TestData.id - const params = { fields: { order_validation_rules: CommonData.paramsFields } } - - const intId = cl.addRequestInterceptor((config) => { - expect(config.method).toBe('get') - checkCommon(config, resourceType, id, currentAccessToken) - checkCommonParams(config, params) - return interceptRequest() - }) - - await cl[resourceType].retrieve(id, params, CommonData.options) - .catch(handleError) - .finally(() => cl.removeInterceptor('request', intId)) - - }) - /* spec.retrieve.stop */ - - - /* spec.list.start */ - it(resourceType + '.list', async () => { - - const params = CommonData.paramsList - - const intId = cl.addRequestInterceptor((config) => { - expect(config.method).toBe('get') - checkCommon(config, resourceType) - checkCommonParamsList(config, params) - return interceptRequest() - }) - - await cl[resourceType].list(params, CommonData.options) - .catch(handleError) - .finally(() => cl.removeInterceptor('request', intId)) - - }) - /* spec.list.stop */ - - - /* spec.type.start */ - it(resourceType + '.type', async () => { - - const resource = { id: TestData.id, type: resourceType } - expect(cl[resourceType].isOrderValidationRule(resource)).toBeTruthy() - - const relId = cl[resourceType].relationship(TestData.id) - expect(isEqual(relId, { id: TestData.id, type: resourceType})) - - const relResId = cl[resourceType].relationship({ id: TestData.id, type: resourceType }) - expect(isEqual(relResId, { id: TestData.id, type: resourceType})) - - const type = cl[resourceType].type() - expect(type).toBe(resourceType) - - }) - /* spec.type.stop */ - - - - it(resourceType + '.market', async () => { - - const id = TestData.id - const params = { fields: { markets: CommonData.paramsFields } } - - const intId = cl.addRequestInterceptor((config) => { - expect(config.method).toBe('get') - checkCommon(config, resourceType, id, currentAccessToken, 'market') - checkCommonParams(config, params) - return interceptRequest() - }) - - await cl[resourceType].market(id, params, CommonData.options) - .catch(handleError) - .finally(() => cl.removeInterceptor('request', intId)) - - }) - - - it(resourceType + '.attachments', async () => { - - const id = TestData.id - const params = { fields: { attachments: CommonData.paramsFields } } - - const intId = cl.addRequestInterceptor((config) => { - expect(config.method).toBe('get') - checkCommon(config, resourceType, id, currentAccessToken, 'attachments') - checkCommonParams(config, params) - return interceptRequest() - }) - - await cl[resourceType].attachments(id, params, CommonData.options) - .catch(handleError) - .finally(() => cl.removeInterceptor('request', intId)) - - }) - - - it(resourceType + '.versions', async () => { - - const id = TestData.id - const params = { fields: { versions: CommonData.paramsFields } } - - const intId = cl.addRequestInterceptor((config) => { - expect(config.method).toBe('get') - checkCommon(config, resourceType, id, currentAccessToken, 'versions') - checkCommonParams(config, params) - return interceptRequest() - }) - - await cl[resourceType].versions(id, params, CommonData.options) - .catch(handleError) - .finally(() => cl.removeInterceptor('request', intId)) - - }) - -}) diff --git a/src/api.ts b/src/api.ts index c8630cd7..b3bf32cb 100644 --- a/src/api.ts +++ b/src/api.ts @@ -70,7 +70,6 @@ export { default as OrderCopies } from './resources/order_copies' export { default as OrderFactories } from './resources/order_factories' export { default as OrderSubscriptionItems } from './resources/order_subscription_items' export { default as OrderSubscriptions } from './resources/order_subscriptions' -export { default as OrderValidationRules } from './resources/order_validation_rules' export { default as Orders } from './resources/orders' export { default as Organizations } from './resources/organization' export { default as Packages } from './resources/packages' @@ -198,7 +197,6 @@ export type ResourceTypeLock = | 'order_factories' | 'order_subscription_items' | 'order_subscriptions' -| 'order_validation_rules' | 'orders' | 'organization' | 'packages' @@ -326,7 +324,6 @@ export const resourceList = [ 'order_factories', 'order_subscription_items', 'order_subscriptions', - 'order_validation_rules', 'orders', 'organization', 'packages', diff --git a/src/commercelayer.ts b/src/commercelayer.ts index a50ca47a..1654896d 100644 --- a/src/commercelayer.ts +++ b/src/commercelayer.ts @@ -9,7 +9,7 @@ import Debug from './debug' const debug = Debug('commercelayer') // Autogenerated schema version number, do not remove this line -const OPEN_API_SCHEMA_VERSION = '5.4.0' +const OPEN_API_SCHEMA_VERSION = '5.4.1' export { OPEN_API_SCHEMA_VERSION } @@ -96,7 +96,6 @@ class CommerceLayerClient { order_factories: api.OrderFactories order_subscription_items: api.OrderSubscriptionItems order_subscriptions: api.OrderSubscriptions - order_validation_rules: api.OrderValidationRules orders: api.Orders organization: api.Organizations packages: api.Packages @@ -231,7 +230,6 @@ class CommerceLayerClient { this.order_factories = new api.OrderFactories(this.#adapter) this.order_subscription_items = new api.OrderSubscriptionItems(this.#adapter) this.order_subscriptions = new api.OrderSubscriptions(this.#adapter) - this.order_validation_rules = new api.OrderValidationRules(this.#adapter) this.orders = new api.Orders(this.#adapter) this.organization = new api.Organizations(this.#adapter) this.packages = new api.Packages(this.#adapter) diff --git a/src/model.ts b/src/model.ts index 992e115e..ebddea5f 100644 --- a/src/model.ts +++ b/src/model.ts @@ -70,7 +70,6 @@ export type { OrderCopy, OrderCopyCreate, OrderCopyUpdate } from './resources/or export type { OrderFactory } from './resources/order_factories' export type { OrderSubscriptionItem, OrderSubscriptionItemCreate, OrderSubscriptionItemUpdate } from './resources/order_subscription_items' export type { OrderSubscription, OrderSubscriptionCreate, OrderSubscriptionUpdate } from './resources/order_subscriptions' -export type { OrderValidationRule } from './resources/order_validation_rules' export type { Order, OrderCreate, OrderUpdate } from './resources/orders' export type { Organization } from './resources/organization' export type { Package, PackageCreate, PackageUpdate } from './resources/packages' diff --git a/src/resources/adyen_gateways.ts b/src/resources/adyen_gateways.ts index 58a0162a..9712b83f 100644 --- a/src/resources/adyen_gateways.ts +++ b/src/resources/adyen_gateways.ts @@ -15,6 +15,7 @@ interface AdyenGateway extends Resource { name?: string live_url_prefix?: string async_api?: boolean + native_customer_payment_sources?: boolean webhook_endpoint_secret?: string webhook_endpoint_url?: string @@ -34,6 +35,7 @@ interface AdyenGatewayCreate extends ResourceCreate { live_url_prefix: string api_version?: number async_api?: boolean + native_customer_payment_sources?: boolean webhook_endpoint_secret?: string adyen_payments?: AdyenPaymentRel[] @@ -50,6 +52,7 @@ interface AdyenGatewayUpdate extends ResourceUpdate { live_url_prefix?: string api_version?: number async_api?: boolean + native_customer_payment_sources?: boolean webhook_endpoint_secret?: string adyen_payments?: AdyenPaymentRel[] diff --git a/src/resources/attachments.ts b/src/resources/attachments.ts index f3426ed8..4679c035 100644 --- a/src/resources/attachments.ts +++ b/src/resources/attachments.ts @@ -29,6 +29,7 @@ import type { SkuOption } from './sku_options' import type { Sku } from './skus' import type { StockItem } from './stock_items' import type { StockLocation } from './stock_locations' +import type { StockTransfer } from './stock_transfers' import type { TaxCalculator } from './tax_calculators' import type { TaxCategory } from './tax_categories' @@ -62,6 +63,7 @@ type SkuOptionRel = ResourceRel & { type: 'sku_options' } type SkuRel = ResourceRel & { type: 'skus' } type StockItemRel = ResourceRel & { type: 'stock_items' } type StockLocationRel = ResourceRel & { type: 'stock_locations' } +type StockTransferRel = ResourceRel & { type: 'stock_transfers' } type TaxCalculatorRel = ResourceRel & { type: 'tax_calculators' } type TaxCategoryRel = ResourceRel & { type: 'tax_categories' } @@ -72,7 +74,7 @@ interface Attachment extends Resource { description?: string url?: string - attachable?: Bundle | CarrierAccount | CustomerGroup | Customer | DeliveryLeadTime | Geocoder | GiftCardRecipient | GiftCard | InventoryModel | Market | Merchant | BillingInfoValidationRule | Order | Package | Parcel | PaymentMethod | PriceList | Price | Promotion | Return | Shipment | ShippingCategory | ShippingMethod | ShippingZone | SkuOption | Sku | StockItem | StockLocation | TaxCalculator | TaxCategory + attachable?: Bundle | CarrierAccount | CustomerGroup | Customer | DeliveryLeadTime | Geocoder | GiftCardRecipient | GiftCard | InventoryModel | Market | Merchant | BillingInfoValidationRule | Order | Package | Parcel | PaymentMethod | PriceList | Price | Promotion | Return | Shipment | ShippingCategory | ShippingMethod | ShippingZone | SkuOption | Sku | StockItem | StockLocation | StockTransfer | TaxCalculator | TaxCategory } @@ -83,7 +85,7 @@ interface AttachmentCreate extends ResourceCreate { description?: string url?: string - attachable: BundleRel | CarrierAccountRel | CustomerGroupRel | CustomerRel | DeliveryLeadTimeRel | GeocoderRel | GiftCardRecipientRel | GiftCardRel | InventoryModelRel | MarketRel | MerchantRel | BillingInfoValidationRuleRel | OrderRel | PackageRel | ParcelRel | PaymentMethodRel | PriceListRel | PriceRel | PromotionRel | ReturnRel | ShipmentRel | ShippingCategoryRel | ShippingMethodRel | ShippingZoneRel | SkuOptionRel | SkuRel | StockItemRel | StockLocationRel | TaxCalculatorRel | TaxCategoryRel + attachable: BundleRel | CarrierAccountRel | CustomerGroupRel | CustomerRel | DeliveryLeadTimeRel | GeocoderRel | GiftCardRecipientRel | GiftCardRel | InventoryModelRel | MarketRel | MerchantRel | BillingInfoValidationRuleRel | OrderRel | PackageRel | ParcelRel | PaymentMethodRel | PriceListRel | PriceRel | PromotionRel | ReturnRel | ShipmentRel | ShippingCategoryRel | ShippingMethodRel | ShippingZoneRel | SkuOptionRel | SkuRel | StockItemRel | StockLocationRel | StockTransferRel | TaxCalculatorRel | TaxCategoryRel } @@ -94,7 +96,7 @@ interface AttachmentUpdate extends ResourceUpdate { description?: string url?: string - attachable?: BundleRel | CarrierAccountRel | CustomerGroupRel | CustomerRel | DeliveryLeadTimeRel | GeocoderRel | GiftCardRecipientRel | GiftCardRel | InventoryModelRel | MarketRel | MerchantRel | BillingInfoValidationRuleRel | OrderRel | PackageRel | ParcelRel | PaymentMethodRel | PriceListRel | PriceRel | PromotionRel | ReturnRel | ShipmentRel | ShippingCategoryRel | ShippingMethodRel | ShippingZoneRel | SkuOptionRel | SkuRel | StockItemRel | StockLocationRel | TaxCalculatorRel | TaxCategoryRel + attachable?: BundleRel | CarrierAccountRel | CustomerGroupRel | CustomerRel | DeliveryLeadTimeRel | GeocoderRel | GiftCardRecipientRel | GiftCardRel | InventoryModelRel | MarketRel | MerchantRel | BillingInfoValidationRuleRel | OrderRel | PackageRel | ParcelRel | PaymentMethodRel | PriceListRel | PriceRel | PromotionRel | ReturnRel | ShipmentRel | ShippingCategoryRel | ShippingMethodRel | ShippingZoneRel | SkuOptionRel | SkuRel | StockItemRel | StockLocationRel | StockTransferRel | TaxCalculatorRel | TaxCategoryRel } diff --git a/src/resources/customers.ts b/src/resources/customers.ts index 438a0173..32d19c90 100644 --- a/src/resources/customers.ts +++ b/src/resources/customers.ts @@ -25,6 +25,7 @@ interface Customer extends Resource { status?: string has_password?: boolean total_orders_count?: number + shopper_reference?: string customer_group?: CustomerGroup customer_addresses?: CustomerAddress[] @@ -45,6 +46,7 @@ interface CustomerCreate extends ResourceCreate { email: string password?: string + shopper_reference?: string customer_group?: CustomerGroupRel tags?: TagRel[] @@ -56,6 +58,7 @@ interface CustomerUpdate extends ResourceUpdate { email?: string password?: string + shopper_reference?: string customer_group?: CustomerGroupRel tags?: TagRel[] diff --git a/src/resources/order_validation_rules.ts b/src/resources/order_validation_rules.ts deleted file mode 100644 index 2907222b..00000000 --- a/src/resources/order_validation_rules.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { ApiResource, Resource, ResourcesConfig, ResourceId, ResourceRel, ListResponse } from '../resource' -import type { QueryParamsList, QueryParamsRetrieve } from '../query' - -import type { Market } from './markets' -import type { Attachment } from './attachments' -import type { Version } from './versions' - - -type OrderValidationRuleRel = ResourceRel & { type: typeof OrderValidationRules.TYPE } - - -interface OrderValidationRule extends Resource { - - market?: Market - attachments?: Attachment[] - versions?: Version[] - -} - - -class OrderValidationRules extends ApiResource { - - static readonly TYPE: 'order_validation_rules' = 'order_validation_rules' as const - // static readonly PATH = 'order_validation_rules' - - async list(params?: QueryParamsList, options?: ResourcesConfig): Promise> { - return this.resources.list({ type: OrderValidationRules.TYPE }, params, options) - } - - async retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise { - return this.resources.retrieve({ type: OrderValidationRules.TYPE, id }, params, options) - } - - async market(orderValidationRuleId: string | OrderValidationRule, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise { - const _orderValidationRuleId = (orderValidationRuleId as OrderValidationRule).id || orderValidationRuleId as string - return this.resources.fetch({ type: 'markets' }, `order_validation_rules/${_orderValidationRuleId}/market`, params, options) as unknown as Market - } - - async attachments(orderValidationRuleId: string | OrderValidationRule, params?: QueryParamsList, options?: ResourcesConfig): Promise> { - const _orderValidationRuleId = (orderValidationRuleId as OrderValidationRule).id || orderValidationRuleId as string - return this.resources.fetch({ type: 'attachments' }, `order_validation_rules/${_orderValidationRuleId}/attachments`, params, options) as unknown as ListResponse - } - - async versions(orderValidationRuleId: string | OrderValidationRule, params?: QueryParamsList, options?: ResourcesConfig): Promise> { - const _orderValidationRuleId = (orderValidationRuleId as OrderValidationRule).id || orderValidationRuleId as string - return this.resources.fetch({ type: 'versions' }, `order_validation_rules/${_orderValidationRuleId}/versions`, params, options) as unknown as ListResponse - } - - - // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any - isOrderValidationRule(resource: any): resource is OrderValidationRule { - return resource.type && (resource.type === OrderValidationRules.TYPE) - } - - - relationship(id: string | ResourceId | null): OrderValidationRuleRel { - return ((id === null) || (typeof id === 'string')) ? { id, type: OrderValidationRules.TYPE } : { id: id.id, type: OrderValidationRules.TYPE } - } - - - type(): string { - return OrderValidationRules.TYPE - } - -} - - -export default OrderValidationRules - -export { OrderValidationRule }