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 Jan 11, 2024
1 parent 00498ad commit d54ef63
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"action": "setCustomField",
"name": "ExampleStringTypeField",
"value": "TextString"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"action": "setCustomType",
"type": {
"id": "{{type-id}}",
"typeId": "type"
},
"fields": {
"exampleStringTypeField": "TextString"
}
}
4 changes: 4 additions & 0 deletions api-specs/api/types/approval-flow/ApprovalFlow.raml
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,7 @@ properties:
type: RuleApprover[]
description: |
Associate Roles required for approval based on the approver hierarchy tiers defined in `rules` only for the currently active tier(s).
custom?:
type: CustomFields
description: |
Custom Fields on the Approval Flow.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#%RAML 1.0 DataType
(package): ApprovalFlow
(docs-uri): https://docs.commercetools.com/api/projects/approvalflows#set-custom-field
type: ApprovalFlowUpdateAction
displayName: ApprovalFlowSetCustomFieldAction
discriminatorValue: setCustomField
example: !include ../../examples/ApprovalFlow/ApprovalFlowSetCustomFieldAction.json
properties:
name:
type: string
description: |
Name of the [Custom Field](ctp:api:type:CustomFields).
value?:
type: CustomFieldValue
description: |
If `value` is absent or `null`, this field will be removed if it exists.
Removing a field that does not exist returns an [InvalidOperation](ctp:api:type:InvalidOperationError) error.
If `value` is provided, it is set for the field defined by `name`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#%RAML 1.0 DataType
(package): ApprovalFlow
(docs-uri): https://docs.commercetools.com/api/projects/approvalflows#set-custom-type
type: ApprovalFlowUpdateAction
displayName: ApprovalFlowSetCustomTypeAction
discriminatorValue: setCustomType
example: !include ../../examples/ApprovalFlow/ApprovalFlowSetCustomTypeAction.json
properties:
type?:
type: TypeResourceIdentifier
description: |
Defines the [Type](ctp:api:type:Type) that extends the ApprovalFlow with [Custom Fields](ctp:api:type:CustomFields).
If absent, any existing Type and Custom Fields are removed from the ApprovalFlow.
fields?:
type: FieldContainer
description: |
Sets the [Custom Fields](ctp:api:type:CustomFields) fields for the ApprovalFlow.
3 changes: 3 additions & 0 deletions api-specs/api/types/type/CustomFieldReferenceValue.raml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ type: string
description: |
Defines which resource type a [CustomFieldReferenceType](ctp:api:type:CustomFieldReferenceType) can reference.
enum:
- approval-flow
- associate-role
- business-unit
- cart
Expand All @@ -20,6 +21,8 @@ enum:
- shipping-method
- zone
(enumDescriptions):
approval-flow: |
[ApprovalFlow](ctp:api:type:ApprovalFlow)
associate-role: |
[AssociateRole](ctp:api:type:AssociateRole)
business-unit: |
Expand Down
3 changes: 3 additions & 0 deletions api-specs/api/types/type/ResourceTypeId.raml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ description: |
enum:
- address
- asset
- approval-flow
- associate-role
- business-unit
- cart-discount
Expand Down Expand Up @@ -41,6 +42,8 @@ enum:
[Address](ctp:api:type:Address) on [BusinessUnit](ctp:api:type:BusinessUnit), [Cart](ctp:api:type:Cart), [Order](ctp:api:type:Order), [OrderEdit](ctp:api:type:OrderEdit), [Customer](ctp:api:type:Customer), and [Channel](ctp:api:type:Channel)
asset: |
[Asset](ctp:api:type:Asset) on [Category](ctp:api:type:Category) and [ProductVariant](ctp:api:type:ProductVariant)
approval-flow: |
[ApprovalFlow](ctp:api:type:ApprovalFlow)
associate-role: |
[AssociateRole](ctp:api:type:AssociateRole)
business-unit: |
Expand Down
2 changes: 2 additions & 0 deletions api-specs/api/types/types.raml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ ApprovalFlowApproveAction: !include approval-flow/ApprovalFlowApproveAction.raml
ApprovalFlowPagedQueryResponse: !include approval-flow/ApprovalFlowPagedQueryResponse.raml
ApprovalFlowRejectAction: !include approval-flow/ApprovalFlowRejectAction.raml
ApprovalFlowRejection: !include approval-flow/ApprovalFlowRejection.raml
ApprovalFlowSetCustomFieldAction: !include approval-flow/ApprovalFlowSetCustomFieldAction.raml
ApprovalFlowSetCustomTypeAction: !include approval-flow/ApprovalFlowSetCustomTypeAction.raml
ApprovalFlowStatus: !include approval-flow/ApprovalFlowStatus.raml
ApprovalFlowUpdate: !include approval-flow/ApprovalFlowUpdate.raml
ApprovalFlowUpdateAction: !include approval-flow/ApprovalFlowUpdateAction.raml
Expand Down
16 changes: 16 additions & 0 deletions api-specs/graphql/schema.sdl
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,7 @@ type ApprovalFlow implements Versioned {
eligibleApprovers: [RuleApprover!]!
pendingApprovers: [RuleApprover!]!
currentTierPendingApprovers: [RuleApprover!]!
custom: CustomFieldsType
id: String!
version: Long!
createdAt: DateTime!
Expand Down Expand Up @@ -727,6 +728,8 @@ type ApprovalFlowRejection {
input ApprovalFlowUpdateAction {
approve: ApproveApprovalFlow
reject: RejectApprovalFlow
setCustomField: SetApprovalFlowCustomField
setCustomType: SetApprovalFlowCustomType
}

type ApprovalRule implements Versioned {
Expand Down Expand Up @@ -1796,6 +1799,7 @@ type CartDiscountTotalPriceTarget implements CartDiscountTarget {
input CartDiscountTotalPriceTargetInput {
dummy: String
}

input CartDiscountUpdateAction {
setStores: SetCartDiscountStores
addStore: AddCartDiscountStore
Expand Down Expand Up @@ -9764,6 +9768,18 @@ type SelectionOfProductQueryResult {
"A set."
scalar Set

input SetApprovalFlowCustomField {
name: String!
value: String
}

input SetApprovalFlowCustomType {
fields: [CustomFieldInput!]
type: ResourceIdentifierInput
typeKey: String
typeId: String
}

input SetApprovalRuleApprovers {
approvers: ApproverHierarchyDraft!
}
Expand Down

0 comments on commit d54ef63

Please sign in to comment.