From d54ef63fe5ba7eac24c714f805b0a0dbe4315fb7 Mon Sep 17 00:00:00 2001 From: "ct-sdks[bot]" <153784748+ct-sdks[bot]@users.noreply.github.com> Date: Thu, 11 Jan 2024 09:54:49 +0000 Subject: [PATCH] Updated API from documentation release --- .../ApprovalFlowSetCustomFieldAction.json | 5 +++++ .../ApprovalFlowSetCustomTypeAction.json | 10 ++++++++++ .../api/types/approval-flow/ApprovalFlow.raml | 4 ++++ .../ApprovalFlowSetCustomFieldAction.raml | 18 ++++++++++++++++++ .../ApprovalFlowSetCustomTypeAction.raml | 17 +++++++++++++++++ .../types/type/CustomFieldReferenceValue.raml | 3 +++ api-specs/api/types/type/ResourceTypeId.raml | 3 +++ api-specs/api/types/types.raml | 2 ++ api-specs/graphql/schema.sdl | 16 ++++++++++++++++ 9 files changed, 78 insertions(+) create mode 100644 api-specs/api/examples/ApprovalFlow/ApprovalFlowSetCustomFieldAction.json create mode 100644 api-specs/api/examples/ApprovalFlow/ApprovalFlowSetCustomTypeAction.json create mode 100644 api-specs/api/types/approval-flow/ApprovalFlowSetCustomFieldAction.raml create mode 100644 api-specs/api/types/approval-flow/ApprovalFlowSetCustomTypeAction.raml diff --git a/api-specs/api/examples/ApprovalFlow/ApprovalFlowSetCustomFieldAction.json b/api-specs/api/examples/ApprovalFlow/ApprovalFlowSetCustomFieldAction.json new file mode 100644 index 000000000..600781b63 --- /dev/null +++ b/api-specs/api/examples/ApprovalFlow/ApprovalFlowSetCustomFieldAction.json @@ -0,0 +1,5 @@ +{ + "action": "setCustomField", + "name": "ExampleStringTypeField", + "value": "TextString" +} diff --git a/api-specs/api/examples/ApprovalFlow/ApprovalFlowSetCustomTypeAction.json b/api-specs/api/examples/ApprovalFlow/ApprovalFlowSetCustomTypeAction.json new file mode 100644 index 000000000..f91f59d9e --- /dev/null +++ b/api-specs/api/examples/ApprovalFlow/ApprovalFlowSetCustomTypeAction.json @@ -0,0 +1,10 @@ +{ + "action": "setCustomType", + "type": { + "id": "{{type-id}}", + "typeId": "type" + }, + "fields": { + "exampleStringTypeField": "TextString" + } +} diff --git a/api-specs/api/types/approval-flow/ApprovalFlow.raml b/api-specs/api/types/approval-flow/ApprovalFlow.raml index 19371466d..5b52db7dd 100644 --- a/api-specs/api/types/approval-flow/ApprovalFlow.raml +++ b/api-specs/api/types/approval-flow/ApprovalFlow.raml @@ -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. diff --git a/api-specs/api/types/approval-flow/ApprovalFlowSetCustomFieldAction.raml b/api-specs/api/types/approval-flow/ApprovalFlowSetCustomFieldAction.raml new file mode 100644 index 000000000..9315a57db --- /dev/null +++ b/api-specs/api/types/approval-flow/ApprovalFlowSetCustomFieldAction.raml @@ -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`. diff --git a/api-specs/api/types/approval-flow/ApprovalFlowSetCustomTypeAction.raml b/api-specs/api/types/approval-flow/ApprovalFlowSetCustomTypeAction.raml new file mode 100644 index 000000000..aae675d48 --- /dev/null +++ b/api-specs/api/types/approval-flow/ApprovalFlowSetCustomTypeAction.raml @@ -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. diff --git a/api-specs/api/types/type/CustomFieldReferenceValue.raml b/api-specs/api/types/type/CustomFieldReferenceValue.raml index a356fb0e3..8d90356e2 100644 --- a/api-specs/api/types/type/CustomFieldReferenceValue.raml +++ b/api-specs/api/types/type/CustomFieldReferenceValue.raml @@ -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 @@ -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: | diff --git a/api-specs/api/types/type/ResourceTypeId.raml b/api-specs/api/types/type/ResourceTypeId.raml index 93b992dcd..788e7a154 100644 --- a/api-specs/api/types/type/ResourceTypeId.raml +++ b/api-specs/api/types/type/ResourceTypeId.raml @@ -7,6 +7,7 @@ description: | enum: - address - asset + - approval-flow - associate-role - business-unit - cart-discount @@ -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: | diff --git a/api-specs/api/types/types.raml b/api-specs/api/types/types.raml index ed50bcb85..96cf96fad 100644 --- a/api-specs/api/types/types.raml +++ b/api-specs/api/types/types.raml @@ -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 diff --git a/api-specs/graphql/schema.sdl b/api-specs/graphql/schema.sdl index 80a6b368a..9328aa80a 100644 --- a/api-specs/graphql/schema.sdl +++ b/api-specs/graphql/schema.sdl @@ -668,6 +668,7 @@ type ApprovalFlow implements Versioned { eligibleApprovers: [RuleApprover!]! pendingApprovers: [RuleApprover!]! currentTierPendingApprovers: [RuleApprover!]! + custom: CustomFieldsType id: String! version: Long! createdAt: DateTime! @@ -727,6 +728,8 @@ type ApprovalFlowRejection { input ApprovalFlowUpdateAction { approve: ApproveApprovalFlow reject: RejectApprovalFlow + setCustomField: SetApprovalFlowCustomField + setCustomType: SetApprovalFlowCustomType } type ApprovalRule implements Versioned { @@ -1796,6 +1799,7 @@ type CartDiscountTotalPriceTarget implements CartDiscountTarget { input CartDiscountTotalPriceTargetInput { dummy: String } + input CartDiscountUpdateAction { setStores: SetCartDiscountStores addStore: AddCartDiscountStore @@ -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! }