Skip to content

Commit

Permalink
build(codegen): updating SDK (#883)
Browse files Browse the repository at this point in the history
Co-authored-by: ct-sdks[bot] <153784748+ct-sdks[bot]@users.noreply.github.com>
  • Loading branch information
ct-sdks[bot] authored Dec 16, 2024
1 parent 90ece88 commit 67ef618
Show file tree
Hide file tree
Showing 7 changed files with 237 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/changes_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
<details>
<summary>Added Resource(s)</summary>

- 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`
Expand Down Expand Up @@ -231,6 +232,10 @@
<summary>Added Method(s)</summary>

- 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()`
Expand Down
5 changes: 5 additions & 0 deletions changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
<details>
<summary>Added Resource(s)</summary>

- 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`
Expand Down Expand Up @@ -227,6 +228,10 @@
<summary>Added Method(s)</summary>

- 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()`
Expand Down
Original file line number Diff line number Diff line change
@@ -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<Channel> {
return new ApiRequest<Channel>(
{
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<void> {
return new ApiRequest<void>(
{
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<Channel> {
return new ApiRequest<Channel>(
{
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<Channel> {
return new ApiRequest<Channel>(
{
baseUri: this.args.baseUri,
method: 'DELETE',
uriTemplate: '/{projectKey}/channels/key={key}',
pathVariables: this.args.pathArgs,
headers: {
...methodArgs?.headers,
},
queryParams: methodArgs?.queryArgs,
},
this.args.executeRequest
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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?: {
Expand Down
1 change: 1 addition & 0 deletions packages/platform-sdk/src/generated/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
@@ -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()
)
})
})
})
1 change: 1 addition & 0 deletions references.txt
Original file line number Diff line number Diff line change
Expand Up @@ -349,3 +349,4 @@ df53588d26d7953dfdf44166866ca03045f0a70b
6b69c5425fe16564147deb9b1d6a9a1078dc5330
99e7aa1c7e3ba67a59b6df3efbaf4e320611c549
269027575a6fd5a2a29387930064a06f22f09bbf
9c2f053d7f45e95984760f59a344e9630d90d843

0 comments on commit 67ef618

Please sign in to comment.