diff --git a/gen/openapi.json b/gen/openapi.json index 0d2860b6..3876b53d 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.1", + "version": "5.4.2", "contact": { "name": "API Support", "url": "https://commercelayer.io", @@ -16517,6 +16517,33 @@ } } }, + "/order_subscriptions/{orderSubscriptionId}/tags": { + "get": { + "operationId": "GET/orderSubscriptionId/tags", + "summary": "Retrieve the tags associated to the order subscription", + "description": "Retrieve the tags associated to the order subscription", + "tags": [ + "has_many", + "tags" + ], + "parameters": [ + { + "name": "orderSubscriptionId", + "in": "path", + "schema": { + "type": "string" + }, + "required": true, + "description": "The resource's id" + } + ], + "responses": { + "200": { + "description": "The tags associated to the order subscription" + } + } + } + }, "/order_subscriptions/{orderSubscriptionId}/versions": { "get": { "operationId": "GET/orderSubscriptionId/versions", @@ -73426,6 +73453,28 @@ } } }, + "tags": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "tags" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } + }, "versions": { "type": "object", "properties": { @@ -73581,6 +73630,31 @@ } } } + }, + "tags": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "tags" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } } }, "required": [ @@ -73729,6 +73803,31 @@ } } } + }, + "tags": { + "required": [ + "data" + ], + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The resource's type", + "enum": [ + "tags" + ] + }, + "id": { + "type": "string", + "description": "The resource's id", + "example": "XGZwpOSrWL" + } + } + } + } } } } @@ -74109,6 +74208,40 @@ } } }, + "tags": { + "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": [ + "tags" + ] + }, + "id": { + "type": "string", + "description": "The resource ID" + } + } + } + } + }, "versions": { "type": "object", "properties": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0dc0642d..f8961caf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1712,8 +1712,8 @@ packages: eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} - electron-to-chromium@1.4.798: - resolution: {integrity: sha512-by9J2CiM9KPGj9qfp5U4FcPSbXJG7FNzqnYaY4WLzX+v2PHieVGmnsA4dxfpGE3QEC7JofpPZmn7Vn1B9NR2+Q==} + electron-to-chromium@1.4.799: + resolution: {integrity: sha512-3D3DwWkRTzrdEpntY0hMLYwj7SeBk1138CkPE8sBDSj3WzrzOiG2rHm3luw8jucpf+WiyLBCZyU9lMHyQI9M9Q==} emittery@0.13.1: resolution: {integrity: sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==} @@ -2024,8 +2024,8 @@ packages: for-each@0.3.3: resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} - foreground-child@3.1.1: - resolution: {integrity: sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==} + foreground-child@3.2.0: + resolution: {integrity: sha512-CrWQNaEl1/6WeZoarcM9LHupTo3RpZO2Pdk1vktwzPiQTsJnAKJmm3TACKeG5UZbWDfaH2AbvYxzP96y0MT7fA==} engines: {node: '>=14'} form-data@4.0.0: @@ -5461,7 +5461,7 @@ snapshots: browserslist@4.23.1: dependencies: caniuse-lite: 1.0.30001632 - electron-to-chromium: 1.4.798 + electron-to-chromium: 1.4.799 node-releases: 2.0.14 update-browserslist-db: 1.0.16(browserslist@4.23.1) @@ -5727,7 +5727,7 @@ snapshots: eastasianwidth@0.2.0: {} - electron-to-chromium@1.4.798: {} + electron-to-chromium@1.4.799: {} emittery@0.13.1: {} @@ -6161,7 +6161,7 @@ snapshots: dependencies: is-callable: 1.2.7 - foreground-child@3.1.1: + foreground-child@3.2.0: dependencies: cross-spawn: 7.0.3 signal-exit: 4.1.0 @@ -6255,7 +6255,7 @@ snapshots: glob@10.4.1: dependencies: - foreground-child: 3.1.1 + foreground-child: 3.2.0 jackspeak: 3.4.0 minimatch: 9.0.4 minipass: 7.1.2 diff --git a/specs/resources/order_subscriptions.spec.ts b/specs/resources/order_subscriptions.spec.ts index 729bea6c..8f9437ca 100644 --- a/specs/resources/order_subscriptions.spec.ts +++ b/specs/resources/order_subscriptions.spec.ts @@ -28,6 +28,7 @@ describe('OrderSubscriptions resource', () => { frequency: randomValue('string', 'frequency'), market: cl.markets.relationship(TestData.id), source_order: cl.orders.relationship(TestData.id), + tags: [ cl.tags.relationship(TestData.id) ], } const attributes = { ...createAttributes, reference: TestData.reference } @@ -405,6 +406,27 @@ describe('OrderSubscriptions resource', () => { /* relationship.events stop */ + /* relationship.tags start */ + it(resourceType + '.tags', async () => { + + const id = TestData.id + const params = { fields: { tags: CommonData.paramsFields } } + + const intId = cl.addRequestInterceptor((config) => { + expect(config.method).toBe('get') + checkCommon(config, resourceType, id, currentAccessToken, 'tags') + checkCommonParams(config, params) + return interceptRequest() + }) + + await cl[resourceType].tags(id, params, CommonData.options) + .catch(handleError) + .finally(() => cl.removeInterceptor('request', intId)) + + }) + /* relationship.tags stop */ + + /* relationship.versions start */ it(resourceType + '.versions', async () => { diff --git a/src/api.ts b/src/api.ts index 461782fd..7afbedcb 100644 --- a/src/api.ts +++ b/src/api.ts @@ -779,6 +779,7 @@ export type TaggableResourceType = | 'gift_cards' | 'line_item_options' | 'line_items' +| 'order_subscriptions' | 'orders' | 'percentage_discount_promotions' | 'promotions' diff --git a/src/commercelayer.ts b/src/commercelayer.ts index aac8860d..4abe3530 100644 --- a/src/commercelayer.ts +++ b/src/commercelayer.ts @@ -10,7 +10,7 @@ const debug = Debug('commercelayer') // Autogenerated schema version number, do not remove this line -const OPEN_API_SCHEMA_VERSION = '5.4.1' +const OPEN_API_SCHEMA_VERSION = '5.4.2' export { OPEN_API_SCHEMA_VERSION } diff --git a/src/resources/order_subscriptions.ts b/src/resources/order_subscriptions.ts index 92458ad3..aba77bba 100644 --- a/src/resources/order_subscriptions.ts +++ b/src/resources/order_subscriptions.ts @@ -11,6 +11,7 @@ import type { OrderSubscriptionItem } from './order_subscription_items' import type { OrderFactory } from './order_factories' import type { RecurringOrderCopy } from './recurring_order_copies' import type { Event } from './events' +import type { Tag, TagType } from './tags' import type { Version } from './versions' @@ -18,6 +19,7 @@ type OrderSubscriptionType = 'order_subscriptions' type OrderSubscriptionRel = ResourceRel & { type: OrderSubscriptionType } type MarketRel = ResourceRel & { type: MarketType } type OrderRel = ResourceRel & { type: OrderType } +type TagRel = ResourceRel & { type: TagType } type CustomerPaymentSourceRel = ResourceRel & { type: CustomerPaymentSourceType } @@ -50,6 +52,7 @@ interface OrderSubscription extends Resource { recurring_order_copies?: RecurringOrderCopy[] | null orders?: Order[] | null events?: Event[] | null + tags?: Tag[] | null versions?: Version[] | null } @@ -66,6 +69,7 @@ interface OrderSubscriptionCreate extends ResourceCreate { market?: MarketRel | null source_order: OrderRel + tags?: TagRel[] | null } @@ -84,6 +88,7 @@ interface OrderSubscriptionUpdate extends ResourceUpdate { _convert?: boolean | null customer_payment_source?: CustomerPaymentSourceRel | null + tags?: TagRel[] | null } @@ -154,6 +159,11 @@ class OrderSubscriptions extends ApiResource { return this.resources.fetch({ type: 'events' }, `order_subscriptions/${_orderSubscriptionId}/events`, params, options) as unknown as ListResponse } + async tags(orderSubscriptionId: string | OrderSubscription, params?: QueryParamsList, options?: ResourcesConfig): Promise> { + const _orderSubscriptionId = (orderSubscriptionId as OrderSubscription).id || orderSubscriptionId as string + return this.resources.fetch({ type: 'tags' }, `order_subscriptions/${_orderSubscriptionId}/tags`, params, options) as unknown as ListResponse + } + async versions(orderSubscriptionId: string | OrderSubscription, params?: QueryParamsList, options?: ResourcesConfig): Promise> { const _orderSubscriptionId = (orderSubscriptionId as OrderSubscription).id || orderSubscriptionId as string return this.resources.fetch({ type: 'versions' }, `order_subscriptions/${_orderSubscriptionId}/versions`, params, options) as unknown as ListResponse