-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: ct-sdks[bot] <153784748+ct-sdks[bot]@users.noreply.github.com>
- Loading branch information
1 parent
90ece88
commit 67ef618
Showing
7 changed files
with
237 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
120 changes: 120 additions & 0 deletions
120
...m-sdk/src/generated/client/channels/by-project-key-channels-key-by-key-request-builder.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
...test/generated/client/channels/by-project-key-channels-key-by-key-request-builder.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters