Skip to content

Commit

Permalink
Updated api-reference from documentation release (#1840)
Browse files Browse the repository at this point in the history
Co-authored-by: Auto Mation <[email protected]>
Co-authored-by: Timon Rey Turak <[email protected]>
  • Loading branch information
3 people authored Oct 4, 2023
1 parent 3f558ea commit 2a6133c
Show file tree
Hide file tree
Showing 23 changed files with 396 additions and 12 deletions.
4 changes: 3 additions & 1 deletion api-specs/api/api.raml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#%RAML 1.0
---
title: commercetools Composable Commerce
title: commercetools Composable Commerce API
(products):
- Composable Commerce
baseUri: https://api.{region}.commercetools.com
(sdkBaseUri): https://api.europe-west1.gcp.commercetools.com
baseUriParameters:
Expand Down
169 changes: 169 additions & 0 deletions api-specs/api/examples/approval-flows.example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
{
"limit": 20,
"offset": 0,
"count": 1,
"total": 1,
"results": [
{
"id": "0bd46ab0-ab12-4191-be2a-749e4f0453ef",
"version": 2,
"createdAt": "2023-06-12T14:43:46.096Z",
"lastModifiedAt": "2023-06-12T14:43:46.202Z",
"lastModifiedBy": {
"clientId": "EH-PdRPKst38wygJuKChVlBS",
"isPlatformClient": false
},
"createdBy": {
"clientId": "EH-PdRPKst38wygJuKChVlBS",
"isPlatformClient": false
},
"order": {
"typeId": "order",
"id": "f6c6cd95-0a09-4dd6-9253-1cd27c70b184"
},
"businessUnit": {
"typeId": "business-unit",
"key": "bu-key"
},
"rules": [
{
"id": "ff806a85-1457-4cef-929a-79aefe85f02d",
"version": 1,
"lastMessageSequenceNumber": 1,
"createdAt": "2023-06-12T14:43:45.732Z",
"lastModifiedAt": "2023-06-12T14:43:45.732Z",
"lastModifiedBy": {
"clientId": "EH-PdRPKst38wygJuKChVlBS",
"isPlatformClient": false
},
"createdBy": {
"clientId": "EH-PdRPKst38wygJuKChVlBS",
"isPlatformClient": false
},
"key": "ar-key",
"name": "name",
"description": "description",
"status": "Active",
"predicate": "customer.email = \"[email protected]\"",
"approvers": {
"tiers": [
{
"and": [
{
"or": [
{
"associateRole": {
"typeId": "associate-role",
"key": "approver0"
}
}
]
},
{
"or": [
{
"associateRole": {
"typeId": "associate-role",
"key": "approver1"
}
}
]
}
]
},
{
"and": [
{
"or": [
{
"associateRole": {
"typeId": "associate-role",
"key": "approver2"
}
}
]
}
]
}
]
},
"requesters": [
{
"associateRole": {
"typeId": "associate-role",
"key": "requester"
}
}
],
"businessUnit": {
"typeId": "business-unit",
"key": "bu-key"
}
}
],
"status": "Pending",
"approvals": [
{
"approver": {
"customer": {
"typeId": "customer",
"id": "9c95aece-ccfa-4cc2-98c5-6b7a5e474361"
},
"associateRoleAssignments": [
{
"associateRole": {
"typeId": "associate-role",
"key": "approver0"
},
"inheritance": "Disabled"
}
]
},
"approvedAt": "2023-04-06T17:41:28.123Z"
}
],
"eligibleApprovers": [
{
"associateRole": {
"typeId": "associate-role",
"key": "approver0"
}
},
{
"associateRole": {
"typeId": "associate-role",
"key": "approver1"
}
},
{
"associateRole": {
"typeId": "associate-role",
"key": "approver2"
}
}
],
"pendingApprovers": [
{
"associateRole": {
"typeId": "associate-role",
"key": "approver1"
}
},
{
"associateRole": {
"typeId": "associate-role",
"key": "approver2"
}
}
],
"currentTierPendingApprovers": [
{
"associateRole": {
"typeId": "associate-role",
"key": "approver1"
}
}
]
}
]
}
61 changes: 61 additions & 0 deletions api-specs/api/examples/approval-rules.example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"limit": 20,
"offset": 0,
"count": 1,
"total": 1,
"results": [
{
"id": "aba82d3f-ee7d-4a86-a4ca-adf0b2d711d0",
"version": 1,
"createdAt": "2023-02-20T16:15:51.043Z",
"lastModifiedAt": "2023-02-20T16:15:51.043Z",
"lastModifiedBy": {
"clientId": "U3r9iqphXgPkoWTrIsTiKAl1",
"isPlatformClient": false
},
"createdBy": {
"clientId": "U3r9iqphXgPkoWTrIsTiKAl1",
"isPlatformClient": false
},
"name": "my approval rule",
"status": "Inactive",
"predicate": "totalPrice.centAmount >= 100000",
"approvers": {
"tiers": [
{
"and": [
{
"or": [
{
"associateRole": {
"typeId": "associate-role",
"key": "project-team-lead"
}
},
{
"associateRole": {
"typeId": "associate-role",
"key": "project-team-lead-substitute"
}
}
]
}
]
}
]
},
"requesters": [
{
"associateRole": {
"typeId": "associate-role",
"key": "project-manager"
}
}
],
"businessUnit": {
"typeId": "business-unit",
"key": "commercetools"
}
}
]
}
16 changes: 16 additions & 0 deletions api-specs/api/resources/as-associate.raml
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,18 @@ type: base
type:
baseDomain:
resourceType: ApprovalRule
resourceQueryType: ApprovalRulePagedQueryResponse
resourceDraft: ApprovalRuleDraft
(createable): ApprovalRuleDraft
(updateable): ApprovalRule
description: 'An Approval Rule describes the conditions determining whether an Order that matches the predicate needs approval by an approver before it can be ordered by an requester within a Business Unit.'
get:
securedBy: [oauth_2_0: { scopes: ['view_approval_rules:{projectKey}'] }]
responses:
200:
body:
application/json:
example: !include ../examples/approval-rules.example.json
post:
securedBy:
[oauth_2_0: { scopes: ['manage_approval_rules:{projectKey}'] }]
Expand Down Expand Up @@ -166,11 +174,19 @@ type: base
type:
baseDomain:
resourceType: ApprovalFlow
resourceQueryType: ApprovalFlowPagedQueryResponse
resourceDraft: ApprovalFlowDraft
(updateable): ApprovalFlow
description: |
Approval Flows connect Orders that require approval with the Approval Rules that initiate the approval requirement.
They represent the approval process by including information about approvals, rejections, and all involved parties.
get:
securedBy: [oauth_2_0: { scopes: ['view_approval_flows:{projectKey}'] }]
responses:
200:
body:
application/json:
example: !include ../examples/approval-flows.example.json
/{ID}:
(methodName): withId
type:
Expand Down
6 changes: 6 additions & 0 deletions api-specs/api/types/annotations.raml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ sdkBaseUri:
allowedTargets:
- API
type: string
products:
allowedTargets:
- API
type: array
items:
type: string
docsBaseUri:
allowedTargets:
- API
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#%RAML 1.0 DataType
(package): ApprovalFlow
displayName: ApprovalFlowPagedQueryResponse
type: object
description: |
[PagedQueryResult](/../api/general-concepts#pagedqueryresult) with results containing an array of [ApprovalFlow](ctp:api:type:ApprovalFlow).
properties:
limit:
type: number
format: int64
description: |
Number of [results requested](/../api/general-concepts#limit).
offset:
type: number
format: int64
description: |
Number of [elements skipped](/../api/general-concepts#offset).
count:
type: number
format: int64
description: |
Actual number of results returned.
total?:
type: number
format: int64
description: |
Total number of results matching the query.
This number is an estimation that is not [strongly consistent](/../api/general-concepts#strong-consistency).
This field is returned by default.
For improved performance, calculating this field can be deactivated by using the query parameter `withTotal=false`.
When the results are filtered with a [Query Predicate](/../api/predicates/query), `total` is subject to a [limit](/../api/limits#queries).
results:
type: ApprovalFlow[]
description: |
Approval Flows matching the query.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#%RAML 1.0 DataType
(package): ApprovalRule
displayName: ApprovalRulePagedQueryResponse
type: object
description: |
[PagedQueryResult](/../api/general-concepts#pagedqueryresult) with results containing an array of [ApprovalRule](ctp:api:type:ApprovalRule).
properties:
limit:
type: number
format: int64
description: |
Number of [results requested](/../api/general-concepts#limit).
offset:
type: number
format: int64
description: |
Number of [elements skipped](/../api/general-concepts#offset).
count:
type: number
format: int64
description: |
Actual number of results returned.
total?:
type: number
format: int64
description: |
Total number of results matching the query.
This number is an estimation that is not [strongly consistent](/../api/general-concepts#strong-consistency).
This field is returned by default.
For improved performance, calculating this field can be deactivated by using the query parameter `withTotal=false`.
When the results are filtered with a [Query Predicate](/../api/predicates/query), `total` is subject to a [limit](/../api/limits#queries).
results:
type: ApprovalRule[]
description: |
Approval Rules matching the query.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#%RAML 1.0 DataType
(package): CartDiscount
(beta): true
type: CartDiscountTarget
displayName: CartDiscountTotalPriceTarget
discriminatorValue: totalPrice
description: |
Discount is applied to the total price of the [Cart](ctp:api:type:Cart).
Loading

0 comments on commit 2a6133c

Please sign in to comment.