Skip to content

Commit 8ec7476

Browse files
authored
build(codegen): updating SDK (#1107)
Co-authored-by: ct-sdks[bot] <153784748+ct-sdks[bot]@users.noreply.github.com>
1 parent 8f48a1e commit 8ec7476

19 files changed

+1569
-11
lines changed

.changeset/changes_api.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,39 @@
44

55
**Api changes**
66

7+
<details>
8+
<summary>Added Type(s)</summary>
9+
10+
- added type `CartDiscountSetDiscountGroupAction`
11+
- added type `DiscountGroup`
12+
- added type `DiscountGroupDraft`
13+
- added type `DiscountGroupPagedQueryResponse`
14+
- added type `DiscountGroupReference`
15+
- added type `DiscountGroupResourceIdentifier`
16+
- added type `DiscountGroupUpdate`
17+
- added type `DiscountGroupUpdateAction`
18+
- added type `DiscountGroupSetDescriptionAction`
19+
- added type `DiscountGroupSetKeyAction`
20+
- added type `DiscountGroupSetNameAction`
21+
- added type `DiscountGroupSetSortOrderAction`
22+
- added type `DiscountGroupCreatedMessage`
23+
- added type `DiscountGroupDeletedMessage`
24+
- added type `DiscountGroupKeySetMessage`
25+
- added type `DiscountGroupSortOrderSetMessage`
26+
- added type `DiscountGroupCreatedMessagePayload`
27+
- added type `DiscountGroupDeletedMessagePayload`
28+
- added type `DiscountGroupKeySetMessagePayload`
29+
- added type `DiscountGroupSortOrderSetMessagePayload`
30+
</details>
31+
32+
<details>
33+
<summary>Added Resource(s)</summary>
34+
35+
- added resource `/{projectKey}/discount-groups`
36+
- added resource `/{projectKey}/discount-groups/key={key}`
37+
- added resource `/{projectKey}/discount-groups/{ID}`
38+
</details>
39+
740
<details>
841
<summary>Removed Property(s)</summary>
942

@@ -17,9 +50,40 @@
1750
- :warning: changed property `filter` of type `SearchSorting` from type `SearchQueryExpression` to `SearchQuery`
1851
</details>
1952

53+
<details>
54+
<summary>Required Property(s)</summary>
55+
56+
- changed property `sortOrder` of type `CartDiscountDraft` to be optional
57+
</details>
58+
2059
<details>
2160
<summary>Added Property(s)</summary>
2261

62+
- added property `discountGroup` to type `CartDiscount`
63+
- added property `discountGroup` to type `CartDiscountDraft`
2364
- added property `/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/` to type `CategoryOrderHints`
2465
- added property `/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/` to type `ProductVariantChannelAvailabilityMap`
2566
</details>
67+
68+
<details>
69+
<summary>Added Method(s)</summary>
70+
71+
- added method `apiRoot.withProjectKey().discountGroups().get()`
72+
- added method `apiRoot.withProjectKey().discountGroups().head()`
73+
- added method `apiRoot.withProjectKey().discountGroups().post()`
74+
- added method `apiRoot.withProjectKey().discountGroups().withKey().get()`
75+
- added method `apiRoot.withProjectKey().discountGroups().withKey().head()`
76+
- added method `apiRoot.withProjectKey().discountGroups().withKey().post()`
77+
- added method `apiRoot.withProjectKey().discountGroups().withKey().delete()`
78+
- added method `apiRoot.withProjectKey().discountGroups().withId().get()`
79+
- added method `apiRoot.withProjectKey().discountGroups().withId().head()`
80+
- added method `apiRoot.withProjectKey().discountGroups().withId().post()`
81+
- added method `apiRoot.withProjectKey().discountGroups().withId().delete()`
82+
</details>
83+
84+
<details>
85+
<summary>Added Enum(s)</summary>
86+
87+
- added enum `ApplicationStoppedByGroupBestDeal` to type `DiscountCodeState`
88+
- added enum `discount-group` to type `ReferenceTypeId`
89+
</details>

.changeset/changes_history.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
'@commercetools/history-sdk': minor
3+
---
4+
5+
**History changes**
6+
7+
<details>
8+
<summary>Added Enum(s)</summary>
9+
10+
- added enum `ApplicationStoppedByGroupBestDeal` to type `DiscountCodeState`
11+
</details>

changes.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,38 @@
11
**Api changes**
22

3+
<details>
4+
<summary>Added Type(s)</summary>
5+
6+
- added type `CartDiscountSetDiscountGroupAction`
7+
- added type `DiscountGroup`
8+
- added type `DiscountGroupDraft`
9+
- added type `DiscountGroupPagedQueryResponse`
10+
- added type `DiscountGroupReference`
11+
- added type `DiscountGroupResourceIdentifier`
12+
- added type `DiscountGroupUpdate`
13+
- added type `DiscountGroupUpdateAction`
14+
- added type `DiscountGroupSetDescriptionAction`
15+
- added type `DiscountGroupSetKeyAction`
16+
- added type `DiscountGroupSetNameAction`
17+
- added type `DiscountGroupSetSortOrderAction`
18+
- added type `DiscountGroupCreatedMessage`
19+
- added type `DiscountGroupDeletedMessage`
20+
- added type `DiscountGroupKeySetMessage`
21+
- added type `DiscountGroupSortOrderSetMessage`
22+
- added type `DiscountGroupCreatedMessagePayload`
23+
- added type `DiscountGroupDeletedMessagePayload`
24+
- added type `DiscountGroupKeySetMessagePayload`
25+
- added type `DiscountGroupSortOrderSetMessagePayload`
26+
</details>
27+
28+
<details>
29+
<summary>Added Resource(s)</summary>
30+
31+
- added resource `/{projectKey}/discount-groups`
32+
- added resource `/{projectKey}/discount-groups/key={key}`
33+
- added resource `/{projectKey}/discount-groups/{ID}`
34+
</details>
35+
336
<details>
437
<summary>Removed Property(s)</summary>
538

@@ -13,9 +46,48 @@
1346
- :warning: changed property `filter` of type `SearchSorting` from type `SearchQueryExpression` to `SearchQuery`
1447
</details>
1548

49+
<details>
50+
<summary>Required Property(s)</summary>
51+
52+
- changed property `sortOrder` of type `CartDiscountDraft` to be optional
53+
</details>
54+
1655
<details>
1756
<summary>Added Property(s)</summary>
1857

58+
- added property `discountGroup` to type `CartDiscount`
59+
- added property `discountGroup` to type `CartDiscountDraft`
1960
- added property `/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/` to type `CategoryOrderHints`
2061
- added property `/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/` to type `ProductVariantChannelAvailabilityMap`
2162
</details>
63+
64+
<details>
65+
<summary>Added Method(s)</summary>
66+
67+
- added method `apiRoot.withProjectKey().discountGroups().get()`
68+
- added method `apiRoot.withProjectKey().discountGroups().head()`
69+
- added method `apiRoot.withProjectKey().discountGroups().post()`
70+
- added method `apiRoot.withProjectKey().discountGroups().withKey().get()`
71+
- added method `apiRoot.withProjectKey().discountGroups().withKey().head()`
72+
- added method `apiRoot.withProjectKey().discountGroups().withKey().post()`
73+
- added method `apiRoot.withProjectKey().discountGroups().withKey().delete()`
74+
- added method `apiRoot.withProjectKey().discountGroups().withId().get()`
75+
- added method `apiRoot.withProjectKey().discountGroups().withId().head()`
76+
- added method `apiRoot.withProjectKey().discountGroups().withId().post()`
77+
- added method `apiRoot.withProjectKey().discountGroups().withId().delete()`
78+
</details>
79+
80+
<details>
81+
<summary>Added Enum(s)</summary>
82+
83+
- added enum `ApplicationStoppedByGroupBestDeal` to type `DiscountCodeState`
84+
- added enum `discount-group` to type `ReferenceTypeId`
85+
</details>
86+
87+
**History changes**
88+
89+
<details>
90+
<summary>Added Enum(s)</summary>
91+
92+
- added enum `ApplicationStoppedByGroupBestDeal` to type `DiscountCodeState`
93+
</details>

packages/history-sdk/src/generated/models/common.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ export interface DiscountCodeInfo {
437437
readonly state: DiscountCodeState
438438
}
439439
export enum DiscountCodeStateValues {
440+
ApplicationStoppedByGroupBestDeal = 'ApplicationStoppedByGroupBestDeal',
440441
ApplicationStoppedByPreviousDiscount = 'ApplicationStoppedByPreviousDiscount',
441442
DoesNotMatchCart = 'DoesNotMatchCart',
442443
MatchesCart = 'MatchesCart',
@@ -446,6 +447,7 @@ export enum DiscountCodeStateValues {
446447
}
447448

448449
export type DiscountCodeState =
450+
| 'ApplicationStoppedByGroupBestDeal'
449451
| 'ApplicationStoppedByPreviousDiscount'
450452
| 'DoesNotMatchCart'
451453
| 'MatchesCart'

packages/platform-sdk/src/generated/client/by-project-key-request-builder.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { ByProjectKeyCustomObjectsRequestBuilder } from './custom-objects/by-pro
1919
import { ByProjectKeyCustomerGroupsRequestBuilder } from './customer-groups/by-project-key-customer-groups-request-builder'
2020
import { ByProjectKeyCustomersRequestBuilder } from './customers/by-project-key-customers-request-builder'
2121
import { ByProjectKeyDiscountCodesRequestBuilder } from './discount-codes/by-project-key-discount-codes-request-builder'
22+
import { ByProjectKeyDiscountGroupsRequestBuilder } from './discount-groups/by-project-key-discount-groups-request-builder'
2223
import { ByProjectKeyExtensionsRequestBuilder } from './extensions/by-project-key-extensions-request-builder'
2324
import { ByProjectKeyGraphqlRequestBuilder } from './graphql/by-project-key-graphql-request-builder'
2425
import { ByProjectKeyInBusinessUnitKeyByBusinessUnitKeyRequestBuilder } from './in-business-unit/by-project-key-in-business-unit-key-by-business-unit-key-request-builder'
@@ -191,6 +192,18 @@ export class ByProjectKeyRequestBuilder {
191192
baseUri: this.args.baseUri,
192193
})
193194
}
195+
/**
196+
* Discount groups are used to group the discounts that are applied to a cart or an order.
197+
*/
198+
public discountGroups(): ByProjectKeyDiscountGroupsRequestBuilder {
199+
return new ByProjectKeyDiscountGroupsRequestBuilder({
200+
pathArgs: {
201+
...this.args.pathArgs,
202+
},
203+
executeRequest: this.args.executeRequest,
204+
baseUri: this.args.baseUri,
205+
})
206+
}
194207
/**
195208
* commercetools Composable Commerce provides a GraphQL API
196209
*/
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
/**
2+
* Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT.
3+
* Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it.
4+
* For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
5+
*/
6+
import { DiscountGroup, DiscountGroupUpdate } from '../../models/discount-group'
7+
import { executeRequest, QueryParam } from '../../shared/utils/common-types'
8+
import { ApiRequest } from '../../shared/utils/requests-utils'
9+
/**
10+
**/
11+
export class ByProjectKeyDiscountGroupsByIDRequestBuilder {
12+
constructor(
13+
protected readonly args: {
14+
pathArgs: {
15+
projectKey: string
16+
ID: string
17+
}
18+
executeRequest: executeRequest
19+
baseUri?: string
20+
}
21+
) {}
22+
/**
23+
* Retrieves a DiscountGroup with the provided `id`.
24+
*
25+
*/
26+
public get(methodArgs?: {
27+
queryArgs?: {
28+
expand?: string | string[]
29+
[key: string]: QueryParam
30+
}
31+
headers?: {
32+
[key: string]: string | string[]
33+
}
34+
}): ApiRequest<DiscountGroup> {
35+
return new ApiRequest<DiscountGroup>(
36+
{
37+
baseUri: this.args.baseUri,
38+
method: 'GET',
39+
uriTemplate: '/{projectKey}/discount-groups/{ID}',
40+
pathVariables: this.args.pathArgs,
41+
headers: {
42+
...methodArgs?.headers,
43+
},
44+
queryParams: methodArgs?.queryArgs,
45+
},
46+
this.args.executeRequest
47+
)
48+
}
49+
/**
50+
* Checks if a DiscountGroup exists with the provided `id`.
51+
* Returns a `200 OK` status if a DiscountGroup exists; otherwise, returns a [Not Found](/../api/errors#404-not-found).
52+
*
53+
*/
54+
public head(methodArgs?: {
55+
headers?: {
56+
[key: string]: string | string[]
57+
}
58+
}): ApiRequest<void> {
59+
return new ApiRequest<void>(
60+
{
61+
baseUri: this.args.baseUri,
62+
method: 'HEAD',
63+
uriTemplate: '/{projectKey}/discount-groups/{ID}',
64+
pathVariables: this.args.pathArgs,
65+
headers: {
66+
...methodArgs?.headers,
67+
},
68+
},
69+
this.args.executeRequest
70+
)
71+
}
72+
/**
73+
* Updates a DiscountGroup in the Project using one or more [update actions](/../api/projects/discount-groups#update-actions).
74+
*
75+
*/
76+
public post(methodArgs: {
77+
queryArgs?: {
78+
expand?: string | string[]
79+
[key: string]: QueryParam
80+
}
81+
body: DiscountGroupUpdate
82+
headers?: {
83+
[key: string]: string | string[]
84+
}
85+
}): ApiRequest<DiscountGroup> {
86+
return new ApiRequest<DiscountGroup>(
87+
{
88+
baseUri: this.args.baseUri,
89+
method: 'POST',
90+
uriTemplate: '/{projectKey}/discount-groups/{ID}',
91+
pathVariables: this.args.pathArgs,
92+
headers: {
93+
'Content-Type': 'application/json',
94+
...methodArgs?.headers,
95+
},
96+
queryParams: methodArgs?.queryArgs,
97+
body: methodArgs?.body,
98+
},
99+
this.args.executeRequest
100+
)
101+
}
102+
/**
103+
* Deletes a DiscountGroup in the Project.
104+
* This request generates the [DiscountGroupDeleted](ctp:api:type:DiscountGroupDeletedMessage) Message.
105+
*
106+
* If the DiscountGroup is referenced by a CartDiscount, a [ReferenceExists](ctp:api:type:ReferenceExistsError) error is returned.
107+
*
108+
*/
109+
public delete(methodArgs: {
110+
queryArgs: {
111+
version: number
112+
expand?: string | string[]
113+
[key: string]: QueryParam
114+
}
115+
headers?: {
116+
[key: string]: string | string[]
117+
}
118+
}): ApiRequest<DiscountGroup> {
119+
return new ApiRequest<DiscountGroup>(
120+
{
121+
baseUri: this.args.baseUri,
122+
method: 'DELETE',
123+
uriTemplate: '/{projectKey}/discount-groups/{ID}',
124+
pathVariables: this.args.pathArgs,
125+
headers: {
126+
...methodArgs?.headers,
127+
},
128+
queryParams: methodArgs?.queryArgs,
129+
},
130+
this.args.executeRequest
131+
)
132+
}
133+
}

0 commit comments

Comments
 (0)