Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update generated SDKs #883

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading