Skip to content

Commit

Permalink
Updated API from documentation release
Browse files Browse the repository at this point in the history
  • Loading branch information
ct-sdks[bot] committed Mar 25, 2024
1 parent 672766b commit d6c4e8c
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 2 deletions.
5 changes: 4 additions & 1 deletion api-specs/api/resources/customers.raml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ post:
description: |
If the `anonymousCart` field is set on the [CustomerDraft](ctp:api:type:CustomerDraft), then the newly created Customer will be assigned to that [Cart](ctp:api:type:Cart).
Similarly, if the `anonymousId` field is set, the Customer will be set on all [Carts](ctp:api:type:Cart), [Orders](ctp:api:type:Order), [ShoppingLists](ctp:api:type:ShoppingList) and [Payments](ctp:api:type:Payment) with the same `anonymousId`.
Creating a Customer produces the [CustomerCreated](ctp:api:type:CustomerCreatedMessage) Message.
Creating a Customer produces the [CustomerCreated](ctp:api:type:CustomerCreatedMessage) Message. Simultaneously creating two Customers with the same email address can return a [LockedField](ctp:api:type:LockedFieldError) error.
body:
application/json:
example: !include ../examples/customer-create.example.json
Expand Down Expand Up @@ -170,6 +171,7 @@ post:
description: Checks if a Customer exists for a given `key`. Returns a `200 OK` status if the Customer exists or a `404 Not Found` otherwise.
post:
securedBy: [oauth_2_0: { scopes: ['manage_customers:{projectKey}'] }]
description: Simultaneously updating two Customers with the same email address can return a [LockedField](ctp:api:type:LockedFieldError) error.
body:
application/json:
example: !include ../examples/customer-update.example.json
Expand Down Expand Up @@ -208,6 +210,7 @@ post:
description: Checks if a Customer exists for a given `id`. Returns a `200 OK` status if the Customer exists or a `404 Not Found` otherwise.
post:
securedBy: [oauth_2_0: { scopes: ['manage_customers:{projectKey}'] }]
description: Simultaneously updating two Customers with the same email address can return a [LockedField](ctp:api:type:LockedFieldError) error.
body:
application/json:
example: !include ../examples/customer-update.example.json
Expand Down
7 changes: 6 additions & 1 deletion api-specs/api/resources/in-store.raml
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,8 @@ uriParameters:
If the `anonymousCart` field is set on the [CustomerDraft](ctp:api:type:CustomerDraft), then the newly created Customer will be assigned to that [Cart](ctp:api:type:Cart).
Similarly, if the `anonymousId` field is set, the Customer will be set on all [Carts](ctp:api:type:Cart), [Orders](ctp:api:type:Order), [ShoppingLists](ctp:api:type:ShoppingList) and [Payments](ctp:api:type:Payment) with the same `anonymousId`.
If a Cart with a `store` field specified, the `store` field must reference the same [Store](ctp:api:type:Store) specified in the `{storeKey}` path parameter.
Creating a Customer produces the [CustomerCreated](ctp:api:type:CustomerCreatedMessage) Message.
Creating a Customer produces the [CustomerCreated](ctp:api:type:CustomerCreatedMessage) Message. Simultaneously creating two Customers with the same email address can return a [LockedField](ctp:api:type:LockedFieldError) error.
body:
application/json:
example: !include ../examples/customer-create.example.json
Expand Down Expand Up @@ -1651,6 +1652,8 @@ uriParameters:
displayName: Update customer by key in store
description: |
If the Customer exists in the Project but the `stores` field references a different Store, this method returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error.
Simultaneously updating two Customers with the same email address can return a [LockedField](ctp:api:type:LockedFieldError) error.
securedBy:
- oauth_2_0:
scopes:
Expand Down Expand Up @@ -1714,6 +1717,8 @@ uriParameters:
displayName: Update customer by id in store
description: |
If the Customer exists in the Project but the `stores` field references a different [Store](ctp:api:type:Store), this method returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error.
Simultaneously updating two Customers with the same email address can return a [LockedField](ctp:api:type:LockedFieldError) error.
securedBy:
- oauth_2_0:
scopes:
Expand Down
20 changes: 20 additions & 0 deletions api-specs/api/types/error/LockedFieldError.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#%RAML 1.0 DataType
(package): Error
type: ErrorObject
displayName: LockedFieldError
discriminatorValue: LockedField
description: |
Returned when two [Customers](ctp:api:type:Customer) are simultaneously created or updated with the same email address.
To confirm if the operation was successful, repeat the request.
properties:
field:
type: string
description: |
Field that is currently locked.
code:
type: string
message:
type: string
description: |
`"'$field' is locked by another request. Please try again later."`
16 changes: 16 additions & 0 deletions api-specs/api/types/error/graphql/GraphQLLockedFieldError.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#%RAML 1.0 DataType
(package): Error
type: GraphQLErrorObject
displayName: GraphQLLockedFieldError
discriminatorValue: LockedField
description: |
Returned when two [Customers](ctp:api:type:Customer) are simultaneously created or updated with the same email address.
To confirm if the operation was successful, repeat the request.
properties:
field:
type: string
description: |
Field that is currently locked.
code:
type: string
2 changes: 2 additions & 0 deletions api-specs/api/types/types.raml
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ InvalidOperationError: !include error/InvalidOperationError.raml
InvalidSubjectError: !include error/InvalidSubjectError.raml
InvalidTokenError: !include error/InvalidTokenError.raml
LanguageUsedInStoresError: !include error/LanguageUsedInStoresError.raml
LockedFieldError: !include error/LockedFieldError.raml
MatchingPriceNotFoundError: !include error/MatchingPriceNotFoundError.raml
MaxCartDiscountsReachedError: !include error/MaxCartDiscountsReachedError.raml
MaxResourceLimitExceededError: !include error/MaxResourceLimitExceededError.raml
Expand Down Expand Up @@ -604,6 +605,7 @@ GraphQLInvalidOperationError: !include error/graphql/GraphQLInvalidOperationErro
GraphQLInvalidSubjectError: !include error/graphql/GraphQLInvalidSubjectError.raml
GraphQLInvalidTokenError: !include error/graphql/GraphQLInvalidTokenError.raml
GraphQLLanguageUsedInStoresError: !include error/graphql/GraphQLLanguageUsedInStoresError.raml
GraphQLLockedFieldError: !include error/graphql/GraphQLLockedFieldError.raml
GraphQLMatchingPriceNotFoundError: !include error/graphql/GraphQLMatchingPriceNotFoundError.raml
GraphQLMaxCartDiscountsReachedError: !include error/graphql/GraphQLMaxCartDiscountsReachedError.raml
GraphQLMaxResourceLimitExceededError: !include error/graphql/GraphQLMaxResourceLimitExceededError.raml
Expand Down

0 comments on commit d6c4e8c

Please sign in to comment.