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/gen/resources.json b/gen/resources.json index 3af6dcea..848207ae 100644 --- a/gen/resources.json +++ b/gen/resources.json @@ -19464,6 +19464,20 @@ "parent_resource": "Api::OrderSubscriptionResource", "class_name": "Event" }, + "tags": { + "type": "has_many", + "desc": "The associated tags.", + "creatable": true, + "fetchable": true, + "updatable": true, + "filterable": true, + "sortable": false, + "conditions": { + "include": "Taggable" + }, + "parent_resource": "Api::OrderSubscriptionResource", + "class_name": "Tag" + }, "versions": { "type": "has_many", "desc": "The associated changes.", @@ -19504,6 +19518,7 @@ "customer_id", "customer_payment_source_id", "events_id", + "tags_id", "ids", "starts_at_from", "starts_at_to", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e3447580..f388ede5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1781,8 +1781,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==} @@ -2083,8 +2083,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'} from2@2.3.0: @@ -5615,7 +5615,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) @@ -5888,7 +5888,7 @@ snapshots: eastasianwidth@0.2.0: {} - electron-to-chromium@1.4.798: {} + electron-to-chromium@1.4.799: {} emittery@0.13.1: {} @@ -6321,7 +6321,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 @@ -6409,7 +6409,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 2f7b5a52..1ecb6e1d 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 } @@ -412,6 +413,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((request) => { + expect(request.options.method).toBe('GET') + checkCommon(request, resourceType, id, currentAccessToken, 'tags') + checkCommonParams(request, params) + return interceptRequest() + }) + + await cl[resourceType].tags(id, params, CommonData.options) + .catch(handleError) + .finally(() => cl.removeInterceptor('request')) + + }) + /* relationship.tags stop */ + + /* relationship.versions start */ it(resourceType + '.versions', async () => { diff --git a/src/api.ts b/src/api.ts index 806ac5c5..b6e5949f 100644 --- a/src/api.ts +++ b/src/api.ts @@ -780,6 +780,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 ee4def2a..af9865d8 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 d7316175..92e42c6d 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 } @@ -110,6 +112,7 @@ interface OrderSubscription extends Resource { recurring_order_copies?: RecurringOrderCopy[] | null orders?: Order[] | null events?: Event[] | null + tags?: Tag[] | null versions?: Version[] | null } @@ -150,6 +153,7 @@ interface OrderSubscriptionCreate extends ResourceCreate { market?: MarketRel | null source_order: OrderRel + tags?: TagRel[] | null } @@ -208,6 +212,7 @@ interface OrderSubscriptionUpdate extends ResourceUpdate { _convert?: boolean | null customer_payment_source?: CustomerPaymentSourceRel | null + tags?: TagRel[] | null } @@ -278,6 +283,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