diff --git a/.changeset/changes_api.md b/.changeset/changes_api.md index 8b6748a5c..d698633d5 100644 --- a/.changeset/changes_api.md +++ b/.changeset/changes_api.md @@ -95,6 +95,7 @@
Added Resource(s) +- added resource `/{projectKey}/channels/key={key}` - added resource `/{projectKey}/customers/search` - added resource `/{projectKey}/customers/search/indexing-status` - added resource `/{projectKey}/in-store/key={storeKey}/quote-requests` @@ -231,6 +232,10 @@ Added Method(s) - added method `apiRoot.withProjectKey().productTailoring().head()` +- added method `apiRoot.withProjectKey().channels().withKey().get()` +- added method `apiRoot.withProjectKey().channels().withKey().head()` +- added method `apiRoot.withProjectKey().channels().withKey().post()` +- added method `apiRoot.withProjectKey().channels().withKey().delete()` - added method `apiRoot.withProjectKey().customers().search().post()` - added method `apiRoot.withProjectKey().customers().search().head()` - added method `apiRoot.withProjectKey().customers().searchIndexingStatus().get()` diff --git a/changes.md b/changes.md index 1a7e3c50f..75a63ac80 100644 --- a/changes.md +++ b/changes.md @@ -91,6 +91,7 @@
Added Resource(s) +- added resource `/{projectKey}/channels/key={key}` - added resource `/{projectKey}/customers/search` - added resource `/{projectKey}/customers/search/indexing-status` - added resource `/{projectKey}/in-store/key={storeKey}/quote-requests` @@ -227,6 +228,10 @@ Added Method(s) - added method `apiRoot.withProjectKey().productTailoring().head()` +- added method `apiRoot.withProjectKey().channels().withKey().get()` +- added method `apiRoot.withProjectKey().channels().withKey().head()` +- added method `apiRoot.withProjectKey().channels().withKey().post()` +- added method `apiRoot.withProjectKey().channels().withKey().delete()` - added method `apiRoot.withProjectKey().customers().search().post()` - added method `apiRoot.withProjectKey().customers().search().head()` - added method `apiRoot.withProjectKey().customers().searchIndexingStatus().get()` diff --git a/packages/platform-sdk/src/generated/client/channels/by-project-key-channels-key-by-key-request-builder.ts b/packages/platform-sdk/src/generated/client/channels/by-project-key-channels-key-by-key-request-builder.ts new file mode 100644 index 000000000..6d9c9fca2 --- /dev/null +++ b/packages/platform-sdk/src/generated/client/channels/by-project-key-channels-key-by-key-request-builder.ts @@ -0,0 +1,120 @@ +/** + * 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/. + */ +import { Channel, ChannelUpdate } from '../../models/channel' +import { executeRequest, QueryParam } from '../../shared/utils/common-types' +import { ApiRequest } from '../../shared/utils/requests-utils' +/** + **/ +export class ByProjectKeyChannelsKeyByKeyRequestBuilder { + constructor( + protected readonly args: { + pathArgs: { + projectKey: string + key: string + } + executeRequest: executeRequest + baseUri?: string + } + ) {} + public get(methodArgs?: { + queryArgs?: { + expand?: string | string[] + [key: string]: QueryParam + } + headers?: { + [key: string]: string | string[] + } + }): ApiRequest { + return new ApiRequest( + { + baseUri: this.args.baseUri, + method: 'GET', + uriTemplate: '/{projectKey}/channels/key={key}', + pathVariables: this.args.pathArgs, + headers: { + ...methodArgs?.headers, + }, + queryParams: methodArgs?.queryArgs, + }, + this.args.executeRequest + ) + } + /** + * Checks if a Channel exists for a given `key`. Returns a `200 OK` status if the Channel exists or a `404 Not Found` otherwise. + */ + public head(methodArgs?: { + headers?: { + [key: string]: string | string[] + } + }): ApiRequest { + return new ApiRequest( + { + baseUri: this.args.baseUri, + method: 'HEAD', + uriTemplate: '/{projectKey}/channels/key={key}', + pathVariables: this.args.pathArgs, + headers: { + ...methodArgs?.headers, + }, + }, + this.args.executeRequest + ) + } + public post(methodArgs: { + queryArgs?: { + expand?: string | string[] + [key: string]: QueryParam + } + body: ChannelUpdate + headers?: { + [key: string]: string | string[] + } + }): ApiRequest { + return new ApiRequest( + { + baseUri: this.args.baseUri, + method: 'POST', + uriTemplate: '/{projectKey}/channels/key={key}', + pathVariables: this.args.pathArgs, + headers: { + 'Content-Type': 'application/json', + ...methodArgs?.headers, + }, + queryParams: methodArgs?.queryArgs, + body: methodArgs?.body, + }, + this.args.executeRequest + ) + } + /** + * Returns a [ReferenceExists](ctp:api:type:ReferenceExistsError) error if other resources reference the Channel to be deleted. + * + */ + public delete(methodArgs: { + queryArgs: { + version: number + expand?: string | string[] + [key: string]: QueryParam + } + headers?: { + [key: string]: string | string[] + } + }): ApiRequest { + return new ApiRequest( + { + baseUri: this.args.baseUri, + method: 'DELETE', + uriTemplate: '/{projectKey}/channels/key={key}', + pathVariables: this.args.pathArgs, + headers: { + ...methodArgs?.headers, + }, + queryParams: methodArgs?.queryArgs, + }, + this.args.executeRequest + ) + } +} diff --git a/packages/platform-sdk/src/generated/client/channels/by-project-key-channels-request-builder.ts b/packages/platform-sdk/src/generated/client/channels/by-project-key-channels-request-builder.ts index 219ee909e..bd21a6d53 100644 --- a/packages/platform-sdk/src/generated/client/channels/by-project-key-channels-request-builder.ts +++ b/packages/platform-sdk/src/generated/client/channels/by-project-key-channels-request-builder.ts @@ -11,6 +11,7 @@ import { import { executeRequest, QueryParam } from '../../shared/utils/common-types' import { ApiRequest } from '../../shared/utils/requests-utils' import { ByProjectKeyChannelsByIDRequestBuilder } from './by-project-key-channels-by-id-request-builder' +import { ByProjectKeyChannelsKeyByKeyRequestBuilder } from './by-project-key-channels-key-by-key-request-builder' /** **/ export class ByProjectKeyChannelsRequestBuilder { @@ -35,6 +36,18 @@ export class ByProjectKeyChannelsRequestBuilder { baseUri: this.args.baseUri, }) } + public withKey(childPathArgs: { + key: string + }): ByProjectKeyChannelsKeyByKeyRequestBuilder { + return new ByProjectKeyChannelsKeyByKeyRequestBuilder({ + pathArgs: { + ...this.args.pathArgs, + ...childPathArgs, + }, + executeRequest: this.args.executeRequest, + baseUri: this.args.baseUri, + }) + } public get(methodArgs?: { queryArgs?: { diff --git a/packages/platform-sdk/src/generated/index.ts b/packages/platform-sdk/src/generated/index.ts index 3845be94e..f77c62227 100644 --- a/packages/platform-sdk/src/generated/index.ts +++ b/packages/platform-sdk/src/generated/index.ts @@ -60,6 +60,7 @@ export * from './client/categories/by-project-key-categories-by-id-request-build export * from './client/categories/by-project-key-categories-key-by-key-request-builder' export * from './client/categories/by-project-key-categories-request-builder' export * from './client/channels/by-project-key-channels-by-id-request-builder' +export * from './client/channels/by-project-key-channels-key-by-key-request-builder' export * from './client/channels/by-project-key-channels-request-builder' export * from './client/confirm/by-project-key-customers-email-confirm-request-builder' export * from './client/confirm/by-project-key-in-store-key-by-store-key-customers-email-confirm-request-builder' diff --git a/packages/platform-sdk/test/generated/client/channels/by-project-key-channels-key-by-key-request-builder.test.ts b/packages/platform-sdk/test/generated/client/channels/by-project-key-channels-key-by-key-request-builder.test.ts new file mode 100644 index 000000000..d0852acd5 --- /dev/null +++ b/packages/platform-sdk/test/generated/client/channels/by-project-key-channels-key-by-key-request-builder.test.ts @@ -0,0 +1,92 @@ +/** + * 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/. + */ + +import { RequestWithMethod } from '../../../request-with-method' +import { ApiRoot } from '../../../../src' + +const apiRoot: ApiRoot = new ApiRoot({ executeRequest: null }) + +export function getRequestsWithMethodParameters(): RequestWithMethod[] { + return [ + { + method: 'get', + uri: '/test_projectKey/channels/key=test_key?expand=expand', + request: apiRoot + .withProjectKey({ projectKey: 'test_projectKey' }) + .channels() + .withKey({ key: 'test_key' }) + .get({ queryArgs: { expand: 'expand' } }), + }, + { + method: 'get', + uri: '/test_projectKey/channels/key=test_key', + request: apiRoot + .withProjectKey({ projectKey: 'test_projectKey' }) + .channels() + .withKey({ key: 'test_key' }) + .get(), + }, + { + method: 'head', + uri: '/test_projectKey/channels/key=test_key', + request: apiRoot + .withProjectKey({ projectKey: 'test_projectKey' }) + .channels() + .withKey({ key: 'test_key' }) + .head(), + }, + { + method: 'post', + uri: '/test_projectKey/channels/key=test_key?expand=expand', + request: apiRoot + .withProjectKey({ projectKey: 'test_projectKey' }) + .channels() + .withKey({ key: 'test_key' }) + .post({ body: null, headers: null, queryArgs: { expand: 'expand' } }), + }, + { + method: 'post', + uri: '/test_projectKey/channels/key=test_key', + request: apiRoot + .withProjectKey({ projectKey: 'test_projectKey' }) + .channels() + .withKey({ key: 'test_key' }) + .post({ body: null, headers: null }), + }, + { + method: 'delete', + uri: '/test_projectKey/channels/key=test_key?version=2', + request: apiRoot + .withProjectKey({ projectKey: 'test_projectKey' }) + .channels() + .withKey({ key: 'test_key' }) + .delete({ queryArgs: { version: 2 } }), + }, + { + method: 'delete', + uri: '/test_projectKey/channels/key=test_key?expand=expand&version=2', + request: apiRoot + .withProjectKey({ projectKey: 'test_projectKey' }) + .channels() + .withKey({ key: 'test_key' }) + .delete({ queryArgs: { expand: 'expand', version: 2 } }), + }, + ] +} + +describe('Testing ByProjectKeyChannelsKeyByKeyRequestBuilder Requests', () => { + const requestsToTest = getRequestsWithMethodParameters() + requestsToTest.forEach((rm) => { + test(`Testing => request method: ${rm.method} and url: ${rm.uri}`, async () => { + expect(rm.method.toLowerCase()).toBe( + rm.request.clientRequest().method.toLowerCase() + ) + expect(rm.uri.toLowerCase()).toBe( + rm.request.clientRequest().uri.toLowerCase() + ) + }) + }) +}) diff --git a/references.txt b/references.txt index 1377aa320..764d024ea 100644 --- a/references.txt +++ b/references.txt @@ -349,3 +349,4 @@ df53588d26d7953dfdf44166866ca03045f0a70b 6b69c5425fe16564147deb9b1d6a9a1078dc5330 99e7aa1c7e3ba67a59b6df3efbaf4e320611c549 269027575a6fd5a2a29387930064a06f22f09bbf +9c2f053d7f45e95984760f59a344e9630d90d843