Skip to content

Commit

Permalink
build(codegen): updating SDK (#780)
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 Aug 9, 2024
1 parent 38c7035 commit d32ac42
Show file tree
Hide file tree
Showing 18 changed files with 98 additions and 99 deletions.
2 changes: 2 additions & 0 deletions .changeset/changes_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@
<details>
<summary>Removed Method(s)</summary>

- :warning: removed method `apiRoot.withProjectKey().me().businessUnits().withId().delete()`
- :warning: removed method `apiRoot.withProjectKey().me().businessUnits().withKey().delete()`
- :warning: removed method `apiRoot.withProjectKey().me().carts().withKey().get()`
- :warning: removed method `apiRoot.withProjectKey().me().carts().withKey().head()`
- :warning: removed method `apiRoot.withProjectKey().me().carts().withKey().post()`
Expand Down
2 changes: 2 additions & 0 deletions changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@
<details>
<summary>Removed Method(s)</summary>

- :warning: removed method `apiRoot.withProjectKey().me().businessUnits().withId().delete()`
- :warning: removed method `apiRoot.withProjectKey().me().businessUnits().withKey().delete()`
- :warning: removed method `apiRoot.withProjectKey().me().carts().withKey().get()`
- :warning: removed method `apiRoot.withProjectKey().me().carts().withKey().head()`
- :warning: removed method `apiRoot.withProjectKey().me().carts().withKey().post()`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ export class ByProjectKeyMeBusinessUnitsByIDRequestBuilder {
baseUri?: string
}
) {}
/**
* Returns a Business Unit for a given `id`. Returns a `200 OK` status if the Business Unit exists and the Customer has access to it, or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
*
*/
public get(methodArgs?: {
queryArgs?: {
expand?: string | string[]
Expand All @@ -44,7 +48,7 @@ export class ByProjectKeyMeBusinessUnitsByIDRequestBuilder {
)
}
/**
* Checks if a BusinessUnit exists for a given `id`. Returns a `200 OK` status if the BusinessUnit exists or a `404 Not Found` otherwise.
* Checks if a BusinessUnit exists for a given `id`. Returns a `200 OK` status if the BusinessUnit exists and the Customer has access to it, or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
*/
public head(methodArgs?: {
headers?: {
Expand All @@ -64,6 +68,10 @@ export class ByProjectKeyMeBusinessUnitsByIDRequestBuilder {
this.args.executeRequest
)
}
/**
* Updates a Business Unit for a given `id`. Returns a `200 OK` status if the Business Unit exists and the Customer has access to it, or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
*
*/
public post(methodArgs: {
queryArgs?: {
expand?: string | string[]
Expand All @@ -90,28 +98,4 @@ export class ByProjectKeyMeBusinessUnitsByIDRequestBuilder {
this.args.executeRequest
)
}
public delete(methodArgs: {
queryArgs: {
version: number
expand?: string | string[]
[key: string]: QueryParam
}
headers?: {
[key: string]: string | string[]
}
}): ApiRequest<BusinessUnit> {
return new ApiRequest<BusinessUnit>(
{
baseUri: this.args.baseUri,
method: 'DELETE',
uriTemplate: '/{projectKey}/me/business-units/{ID}',
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 @@ -20,6 +20,9 @@ export class ByProjectKeyMeBusinessUnitsKeyByKeyRequestBuilder {
baseUri?: string
}
) {}
/**
* Returns a Business Unit for a given `key`. Returns a `200 OK` status if the Business Unit exists and the Customer has access to it, or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
*/
public get(methodArgs?: {
queryArgs?: {
expand?: string | string[]
Expand All @@ -44,7 +47,7 @@ export class ByProjectKeyMeBusinessUnitsKeyByKeyRequestBuilder {
)
}
/**
* Checks if a BusinessUnit exists for a given `key`. Returns a `200 OK` status if the BusinessUnit exists or a `404 Not Found` otherwise.
* Checks if a BusinessUnit exists for a given `key`. Returns a `200 OK` status if the Business Unit exists and the Customer has access to it, or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
*/
public head(methodArgs?: {
headers?: {
Expand All @@ -64,6 +67,9 @@ export class ByProjectKeyMeBusinessUnitsKeyByKeyRequestBuilder {
this.args.executeRequest
)
}
/**
* Updates a Business Unit for a given `key`. Returns a `200 OK` status if the Business Unit exists and the Customer has access to it, or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
*/
public post(methodArgs: {
queryArgs?: {
expand?: string | string[]
Expand All @@ -90,28 +96,4 @@ export class ByProjectKeyMeBusinessUnitsKeyByKeyRequestBuilder {
this.args.executeRequest
)
}
public delete(methodArgs: {
queryArgs: {
version: number
expand?: string | string[]
[key: string]: QueryParam
}
headers?: {
[key: string]: string | string[]
}
}): ApiRequest<BusinessUnit> {
return new ApiRequest<BusinessUnit>(
{
baseUri: this.args.baseUri,
method: 'DELETE',
uriTemplate: '/{projectKey}/me/business-units/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 @@ -49,6 +49,10 @@ export class ByProjectKeyMeBusinessUnitsRequestBuilder {
})
}

/**
* Returns all of the authenticated Customer’s Business Units in a Project. Returns a `200 OK` status if successful, or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
*
*/
public get(methodArgs?: {
queryArgs?: {
expand?: string | string[]
Expand Down Expand Up @@ -78,7 +82,8 @@ export class ByProjectKeyMeBusinessUnitsRequestBuilder {
)
}
/**
* Checks if a BusinessUnit exists for a given Query Predicate. Returns a `200 OK` status if any BusinessUnits match the Query Predicate or a `404 Not Found` otherwise.
* Checks if a BusinessUnit exists for a given Query Predicate. Returns a `200 OK` status if any BusinessUnits match the Query Predicate and the Customer has access to them, or a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error otherwise.
*
*/
public head(methodArgs?: {
queryArgs?: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ export class ByProjectKeyInStoreKeyByStoreKeyMeEmailConfirmRequestBuilder {
}
) {}
/**
* This is the last step in the [email verification process of a Customer](/../api/projects/customers#email-verification-of-customer-in-store).
* This is the last step in the [email verification process of a Customer](/../api/projects/customers#email-verification-of-customer-in-store). Returns a `200 OK` status if successful.
*
* A [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error is returned in the following scenarios:
*
* - If no Customer exists with the `id` specified in the [customer:{id}](/scopes#customer_idid) scope.
* - If the Customer exists but is associated with a different Store than what is specified in the `manage_my_profile:{projectKey}:{storeKey}` scope.
*
*/
public post(methodArgs: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ export class ByProjectKeyInStoreKeyByStoreKeyMeLoginRequestBuilder {
}
) {}
/**
*
* Retrieves the authenticated Customer (that matches the given email/password pair) if they are part of a specific [Store](ctp:api:type:Store).
*
* If used with an optional [access token for an anonymous session](ctp:api:type:AnonymousSession), all Orders and Carts that belong to the `anonymousId` are assigned to the newly logged-in Customer.
*
* - If the Customer does not have a Cart, the most recently modified anonymous cart becomes the Customer's Cart.
* - If the Customer already has a Cart, the most recently modified anonymous cart is handled according to [AnonymousCartSignInMode](ctp:api:type:AnonymousCartSignInMode).
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class ByProjectKeyMeLoginRequestBuilder {
/**
* Retrieves the authenticated customer (that matches the given email/password pair).
*
* If used with [an access token for an anonymous session](ctp:api:type:AnonymousSession), all Orders and Carts that belong to the `anonymousId` are assigned to the newly logged-in Customer.
* If used with an optional [access token for an anonymous session](ctp:api:type:AnonymousSession), all Orders and Carts that belong to the `anonymousId` are assigned to the newly logged-in Customer.
*
* - If the Customer does not have a Cart yet, the most recently modified anonymous cart becomes the Customer's Cart.
* - If the Customer already has a Cart, the most recently modified anonymous cart is handled in accordance with [AnonymousCartSignInMode](ctp:api:type:AnonymousCartSignInMode).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,16 @@ export class ByProjectKeyInStoreKeyByStoreKeyMeRequestBuilder {
})
}

/**
* Returns a Customer for a given Query Predicate in a [Store](ctp:api:type:Store). Returns a `200 OK` status if successful.
*
* A [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error is returned in the following scenarios:
*
* - If no Customer exists in the Store for the given Query Predicate.
* - If a Customer exists in the Store for the given Query Predicate, but does not have an `id` value that matches the [customer:{id}](/scopes#customer_idid) scope.
* - If a Customer exists for the given Query Predicate but is associated with a different Store than what is specified in the `manage_my_profile:{projectKey}:{storeKey}` scope.
*
*/
public get(methodArgs?: {
queryArgs?: {
sort?: string | string[]
Expand Down Expand Up @@ -139,6 +149,15 @@ export class ByProjectKeyInStoreKeyByStoreKeyMeRequestBuilder {
this.args.executeRequest
)
}
/**
* Updates the Customer in a [Store](ctp:api:type:Store). Returns a `200 OK` status if successful.
*
* A [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error is returned in the following scenarios:
*
* - If no Customer exists with the `id` specified in the [customer:{id}](/scopes#customer_idid) scope.
* - If the Customer exists but is associated with a different Store than what is specified in the `manage_my_profile:{projectKey}:{storeKey}` scope.
*
*/
public post(methodArgs: {
body: MyCustomerUpdate
headers?: {
Expand All @@ -160,6 +179,15 @@ export class ByProjectKeyInStoreKeyByStoreKeyMeRequestBuilder {
this.args.executeRequest
)
}
/**
* Deletes the Customer in a [Store](ctp:api:type:Store). Returns a `200 OK` status if successful.
*
* A [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error is returned in the following scenarios:
*
* - If no Customer exists with the `id` specified in the [customer:{id}](/scopes#customer_idid) scope.
* - If the Customer exists but is associated with a different Store than what is specified in the `manage_my_profile:{projectKey}:{storeKey}` scope.
*
*/
public delete(methodArgs: {
queryArgs: {
version: number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,15 @@ export class ByProjectKeyMeRequestBuilder {
})
}

/**
* Returns a Customer for a given Query Predicate. Returns a `200 OK` status if successful.
*
* A [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error is returned in the following scenarios:
*
* - If no Customer exists for the given Query Predicate.
* - If a Customer exists for the given Query Predicate, but does not have an `id` value that matches the [customer:{id}](/scopes#customer_idid) scope.
*
*/
public get(methodArgs?: {
queryArgs?: {
sort?: string | string[]
Expand Down Expand Up @@ -189,6 +198,10 @@ export class ByProjectKeyMeRequestBuilder {
this.args.executeRequest
)
}
/**
* Updates the Customer specified in the [customer:{id}](/scopes#customer_idid) scope. Returns a `200 OK` status if successful.
*
*/
public post(methodArgs: {
body: MyCustomerUpdate
headers?: {
Expand All @@ -210,6 +223,9 @@ export class ByProjectKeyMeRequestBuilder {
this.args.executeRequest
)
}
/**
* Deletes the Customer specified in the [customer:{id}](/scopes#customer_idid) scope. Returns a `200 OK` status if successful.
*/
public delete(methodArgs: {
queryArgs: {
version: number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ export class ByProjectKeyInStoreKeyByStoreKeyMePasswordRequestBuilder {
}

/**
* Changing the password of the Customer produces the [CustomerPasswordUpdated](ctp:api:type:CustomerPasswordUpdatedMessage) Message with `reset=false`.
* Changing the password of the Customer produces the [CustomerPasswordUpdated](ctp:api:type:CustomerPasswordUpdatedMessage) Message with `reset=false`. Returns a `200 OK` status if successful.
*
* A [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error is returned in the following scenarios:
*
* - If no Customer exists with the `id` specified in the [customer:{id}](/scopes#customer_idid) scope.
* - If the Customer exists but is associated with a different Store than what is specified in the `manage_my_profile:{projectKey}:{storeKey}` scope.
*
*/
public post(methodArgs: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ export class ByProjectKeyInStoreKeyByStoreKeyMePasswordResetRequestBuilder {
/**
* This is the last step in the [password reset process of the authenticated Customer](/../api/projects/customers#password-reset-of-customer-in-store).
*
* Resetting a password produces the of the Customer [CustomerPasswordUpdated](ctp:api:type:CustomerPasswordUpdatedMessage) Message with `reset=true`.
* Resetting a password produces the Customer [CustomerPasswordUpdated](ctp:api:type:CustomerPasswordUpdatedMessage) Message with `reset=true`.
*
* A [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error is returned in the following scenarios:
*
* - If no Customer exists with the `id` specified in the [customer:{id}](/scopes#customer_idid) scope.
* - If the Customer exists but is associated with a different Store than what is specified in the `manage_my_profile:{projectKey}:{storeKey}` scope.
*
*/
public post(methodArgs: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ export class ByProjectKeyInStoreKeyByStoreKeyMeSignupRequestBuilder {
}
) {}
/**
*
* If used with an optional [access token for an anonymous session](ctp:api:type:AnonymousSession), all Orders and Carts that belong to the `anonymousId` are assigned to the newly created Customer.
*
* If omitted in the request body, the [Customer](ctp:api:type:Customer) `stores` field is set to the [Store](ctp:api:type:Store) specified in the path parameter.
*
* A Cart returned in the [CustomerSignInResult](ctp:api:type:CustomerSignInResult) has any invalid Line Items removed and is [updated](/api/carts-orders-overview#cart-updates) with the latest prices, taxes, and discounts. During these updates, the following errors can be returned: [MatchingPriceNotFound](ctp:api:type:MatchingPriceNotFoundError) and [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class ByProjectKeyMeSignupRequestBuilder {
}
) {}
/**
* If used with an [access token for an anonymous session](ctp:api:type:AnonymousSession), all Orders and Carts that belong to the `anonymousId` are assigned to the newly created Customer.
* If used with an optional [access token for an anonymous session](ctp:api:type:AnonymousSession), all Orders and Carts that belong to the `anonymousId` are assigned to the newly created Customer.
*
* Creating a Customer produces the [CustomerCreated](ctp:api:type:CustomerCreatedMessage) Message.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,26 +61,6 @@ export function getRequestsWithMethodParameters(): RequestWithMethod[] {
.withId({ ID: 'test_ID' })
.post({ body: null, headers: null }),
},
{
method: 'delete',
uri: '/test_projectKey/me/business-units/test_ID?version=2',
request: apiRoot
.withProjectKey({ projectKey: 'test_projectKey' })
.me()
.businessUnits()
.withId({ ID: 'test_ID' })
.delete({ queryArgs: { version: 2 } }),
},
{
method: 'delete',
uri: '/test_projectKey/me/business-units/test_ID?expand=expand&version=2',
request: apiRoot
.withProjectKey({ projectKey: 'test_projectKey' })
.me()
.businessUnits()
.withId({ ID: 'test_ID' })
.delete({ queryArgs: { expand: 'expand', version: 2 } }),
},
]
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,26 +61,6 @@ export function getRequestsWithMethodParameters(): RequestWithMethod[] {
.withKey({ key: 'test_key' })
.post({ body: null, headers: null }),
},
{
method: 'delete',
uri: '/test_projectKey/me/business-units/key=test_key?version=2',
request: apiRoot
.withProjectKey({ projectKey: 'test_projectKey' })
.me()
.businessUnits()
.withKey({ key: 'test_key' })
.delete({ queryArgs: { version: 2 } }),
},
{
method: 'delete',
uri: '/test_projectKey/me/business-units/key=test_key?expand=expand&version=2',
request: apiRoot
.withProjectKey({ projectKey: 'test_projectKey' })
.me()
.businessUnits()
.withKey({ key: 'test_key' })
.delete({ queryArgs: { expand: 'expand', version: 2 } }),
},
]
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import fetch from 'node-fetch'
import { Mutex } from 'async-mutex'
import fetch from 'node-fetch'
import {
AuthMiddlewareOptions,
Middleware,
MiddlewareRequest,
MiddlewareResponse,
Next,
RequestState,
RequestStateStore,
Task,
TokenCache,
TokenStore,
Expand Down
1 change: 1 addition & 0 deletions references.txt
Original file line number Diff line number Diff line change
Expand Up @@ -302,3 +302,4 @@ d3777f87ffd605785d0af34c175a0d61176413ca
bbcf212f1c06136cd406dd802b8a208daaa1e732
dd82e076236554dd808fb9309d53cb2a207cb296
aa1065bc2b62370c10a6fd7f49098bd9ec71c3ad
6fbc0468427de97a13a8ae23c0d0c157b52b2f45

0 comments on commit d32ac42

Please sign in to comment.