From 75a08d66deeb431f27f367c7f89b09755d4b9677 Mon Sep 17 00:00:00 2001 From: jkaliszuk Date: Fri, 17 Nov 2023 14:40:48 +0100 Subject: [PATCH 1/9] Category and ValidationRulesAssignmentsList in Campaign. --- reference/OpenAPI.json | 87 ++++++++---------------------------------- 1 file changed, 15 insertions(+), 72 deletions(-) diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index 75e2d399d..e7c437a8f 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -3841,7 +3841,7 @@ "type": "array", "description": "Contains details about the category.", "items": { - "$ref": "#/components/schemas/20_obj_category_object" + "$ref": "#/components/schemas/Category" } }, "type": { @@ -7368,7 +7368,7 @@ {} ] }, - "2_obj_campaign_object": { + "Campaign": { "type": "object", "title": "Campaign Object", "description": "This is an object representing a campaign.", @@ -7517,7 +7517,8 @@ "DONE", "IN_PROGRESS", "FAILED", - "DRAFT" + "DRAFT", + "MODIFYING" ] }, "protected": { @@ -7530,7 +7531,7 @@ "example": "cat_0b688929a2476386a7" }, "categories": { - "$ref": "#/components/schemas/20_obj_category_object" + "$ref": "#/components/schemas/Category" }, "object": { "type": "string", @@ -7605,17 +7606,8 @@ "promotion": { "$ref": "#/components/schemas/3_res_list_promotion_tiers_from_campaign" }, - "loyalty_tiers_expiration": { - "type": "object", - "description": "Defines the expiration mechanism for loyalty tiers.", - "anyOf": [ - { - "$ref": "#/components/schemas/2_loyalty_tiers_expiration_balance" - }, - { - "$ref": "#/components/schemas/2_loyalty_tiers_expiration_points_in_period" - } - ] + "validation_rules_assignments": { + "$ref": "#/components/schemas/ValidationRulesAssignmentsList" } } }, @@ -8957,7 +8949,7 @@ "example": "cat_0b688929a2476386a7" }, "categories": { - "$ref": "#/components/schemas/20_obj_category_object" + "$ref": "#/components/schemas/Category" }, "object": { "type": "string", @@ -13389,7 +13381,7 @@ "description": "A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" }, "categories": { - "$ref": "#/components/schemas/20_obj_category_object" + "$ref": "#/components/schemas/Category" }, "object": { "type": "string", @@ -13425,7 +13417,7 @@ "example": "cat_0c9da30e7116ba6bba" }, "categories": { - "$ref": "#/components/schemas/20_obj_category_object", + "$ref": "#/components/schemas/Category", "description": "Details about the category assigned to the promotion tier." } } @@ -13577,7 +13569,7 @@ "description": "A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" }, "categories": { - "$ref": "#/components/schemas/20_obj_category_object" + "$ref": "#/components/schemas/Category" }, "object": { "type": "string", @@ -20838,7 +20830,7 @@ "example": "cat_0b688929a2476386a7" }, "categories": { - "$ref": "#/components/schemas/20_obj_category_object" + "$ref": "#/components/schemas/Category" }, "loyalty_tiers_expiration": { "type": "object", @@ -21002,7 +20994,7 @@ "type": "array", "description": "Contains details about the category.", "items": { - "$ref": "#/components/schemas/20_obj_category_object" + "$ref": "#/components/schemas/Category" } }, "loyalty_tiers_expiration": { @@ -21130,7 +21122,7 @@ "type": "array", "description": "Contains details about the category.", "items": { - "$ref": "#/components/schemas/20_obj_category_object" + "$ref": "#/components/schemas/Category" } }, "type": { @@ -21495,7 +21487,7 @@ "type": "array", "description": "Contains details about the category.", "items": { - "$ref": "#/components/schemas/20_obj_category_object" + "$ref": "#/components/schemas/Category" } }, "type": { @@ -31911,55 +31903,6 @@ } } }, - "20_obj_category_object": { - "type": "object", - "title": "Category Object", - "description": "This is an object representing a category.", - "x-tags": [ - "CATEGORIES API" - ], - "properties": { - "id": { - "type": "string", - "description": "Unique category ID assigned by Voucherify." - }, - "name": { - "type": "string", - "description": "Category name." - }, - "hierarchy": { - "type": "integer", - "description": "Category hierarchy." - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the category was created in ISO 8601 format.", - "example": "2022-07-14T10:45:13.156Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "example": "2022-08-16T10:52:08.094Z", - "description": "Timestamp representing the date and time when the category was updated in ISO 8601 format.", - "format": "date-time" - }, - "object": { - "type": "string", - "default": "category", - "description": "The type of object represented by the JSON. This object stores information about the category." - } - }, - "examples": [ - { - "id": "cat_0b60cfe7d0d7ddbb55", - "name": "Update", - "hierarchy": 1, - "created_at": "2022-07-14T10:45:13.156Z", - "updated_at": "2022-08-16T11:03:54.727Z", - "object": "category" - } - ] - }, "21_obj_metadata_schema_object": { "type": "object", "title": "Metadata Schema Object", From b1c1ec4da5fa6d659300c618b01085dc0dd214c0 Mon Sep 17 00:00:00 2001 From: jkaliszuk Date: Mon, 20 Nov 2023 13:44:24 +0100 Subject: [PATCH 2/9] Added campaign voucher. --- README.md | 2 +- .../CAMPAIGNS-API-Campaign-Object.md | 192 +++++-------- .../LOYALTIES-API-Loyalty-Campaign-Object.md | 7 +- .../LOYALTIES-API-Loyalty-Card-Object.md | 7 +- reference/OpenAPI.json | 253 ++++++++++++++++-- scripts/md-tables.ts | 2 +- 6 files changed, 303 insertions(+), 160 deletions(-) diff --git a/README.md b/README.md index 8d21448f4..67bdd8400 100644 --- a/README.md +++ b/README.md @@ -13,4 +13,4 @@ Please refer to the following guides: - [Guides](https://docs.voucherify.io/docs) - [Recipes](https://docs.voucherify.io/recipes) - [API Reference](https://docs.voucherify.io/reference/introduction-1) -- [Support Documentation](https://support.voucherify.io/) \ No newline at end of file +- [Support Documentation](https://support.voucherify.io/) diff --git a/docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md b/docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md index a8a07728c..bf75fdb8f 100644 --- a/docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md +++ b/docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md @@ -16,7 +16,7 @@ order: 1 | description
`string` |

An optional field to keep any extra textual information about the campaign such as a campaign description and details.

| | campaign_type
`string` |

Type of campaign.

Available values: `LOYALTY_PROGRAM`, `GIFT_VOUCHERS`, `DISCOUNT_COUPONS`, `PROMOTION`, `REFERRAL_PROGRAM`, `LUCKY_DRAW` | | type
`string` |

Defines whether the campaign can be updated with new vouchers after campaign creation.

Available values: `AUTO_UPDATE`, `STATIC` | -| voucher | Any of: [Discount Voucher](#discount-voucher), [Gift Card](#gift-card), [Loyalty Card](#loyalty-card) | +| voucher | See: [Campaign Discount Voucher](#campaign-discount-voucher) | | auto_join
`boolean` |

Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled.

| | join_once
`boolean` |

If this value is set to true, customers will be able to join the campaign only once.

| | use_voucher_metadata_schema
`boolean` |

Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema.

| @@ -32,51 +32,40 @@ order: 1 | updated_at
`string` |

Timestamp representing the date and time when the voucher was updated in ISO 8601 format.

**Example:**

2022-09-20T09:18:19.623Z

| | category
`string` |

Unique category name.

| | creation_status
`string` |

Indicates the status of the campaign creation.

Available values: `DONE`, `IN_PROGRESS`, `FAILED`, `DRAFT`, `MODIFYING` | -| vouchers_generation_status
`string` |

Indicates the status of the campaign's vouchers.

Available values: `DONE`, `IN_PROGRESS`, `FAILED`, `DRAFT` | +| vouchers_generation_status
`string` |

Indicates the status of the campaign's vouchers.

Available values: `DONE`, `IN_PROGRESS`, `FAILED`, `DRAFT`, `MODIFYING` | | protected
`boolean` |

Indicates whether the resource can be deleted.

| | category_id
`string` |

Unique category ID that this campaign belongs to.

**Example:**

cat_0b688929a2476386a7

| -| categories | See: [Category Object](#category-object) | +| categories | See: [Category](#category) | | object
`string` |

The type of object represented by JSON. This object stores information about the campaign.

| | referral_program
`object` |

Defines the referee reward and the way a referral is triggered. Context: REFERRAL_PROGRAM.

AttributesDescription
conversion_event_type
string

How a referral is triggered.

Available values: redemption, custom_event
custom_event
object

Contains details about the custom event.

AttributesDescription
id
string

Unique custom event ID.

Example:

ms_fi47Dcu5T0m3v3nT5ch3ma

name
string

Custom event name.

referee_reward
object

Defines the referee reward.

AttributesDescription
related_object_parent
object

Details of the resource from which the reward originates.

AttributesDescription
id
string

Unique ID of the reward source.

name
string

Name of the reward source.

object
string

Type of resource represented by the source of the reward.

type
string

Type of reward.

Available values: LOYALTY_CARD, GIFT_VOUCHER
amount
string

The number of points to add to a loyalty card or credits to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.

| | promotion | See: [Promotion Tiers](#promotion-tiers) | -| loyalty_tiers_expiration
`object` |

Defines the expiration mechanism for loyalty tiers.

Any of: [Balance](#balance), [Points in Period](#points-in-period) | +| validation_rules_assignments | See: [Validation Rules Assignments List](#validation-rules-assignments-list) | +| loyalty_tiers_expiration | See: [Loyalty Tiers Expiration](#loyalty-tiers-expiration) | -## Discount Voucher +## Campaign Discount Voucher | Attributes | Description | |:-----|:--------| | type
`string` |

Type of voucher.

| -| discount |

Defines the voucher discount type and details.

One of: [Amount](#amount), [Percentage](#percentage), [Fixed](#fixed), [Unit, single item](#unit-single-item), [Unit, multiple items](#unit-multiple-items), [Shipping](#shipping) | +| discount |

Defines the voucher discount type and details.

See: [Discount](#discount) | +| gift |

Defines the voucher gift details.

See: [Gift](#gift) | +| loyalty_card |

Defines the voucher loyalty card details.

See: [Campaign Loyalty Card](#campaign-loyalty-card) | | redemption
`object` |

Defines the redemption limits on vouchers.

AttributesDescription
quantity
integer

How many times a voucher can be redeemed. A null value means unlimited.

| -| code_config
`object` |

Defines code's pattern (prefix, suffix, length, charset, etc).

AttributesDescription
length
string

Number of characters in a generated code (excluding prefix and postfix).

charset
string

Characters that can appear in the code.

Examples:

  • Alphanumeric: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Alphabetic: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Alphabetic Lowercase: abcdefghijklmnopqrstuvwxyz
  • Alphabetic Uppercase: ABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Numbers: 0123456789
  • Custom: a custom character set
prefix
string

A text appended before the code.

postfix
string

A text appended after the code.

pattern
string

A pattern for codes where hashes (#) will be replaced with random characters. Overrides length.

| -| is_referral_code
`boolean` |

Indicates whether the voucher is a referral code; this is true for campaign type REFERRAL_PROGRAM.

| - -## Gift Card -| Attributes | Description | -|:-----|:--------| -| type
`string` |

Type of voucher.

| -| gift
`object` |

Defines the gift card details.

AttributesDescription
amount
integer

Initial gift card income to be applied to the gift card at voucher generation. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.

effect
string

Defines how the credits are applied to the customer's order.

Available values: APPLY_TO_ORDER, APPLY_TO_ITEMS
| -| redemption
`object` |

Defines the redemption limits on vouchers.

AttributesDescription
quantity
integer

How many times a voucher can be redeemed. A null value means unlimited.

| -| code_config
`object` |

Defines code's pattern (prefix, suffix, length, charset, etc).

AttributesDescription
length
string

Number of characters in a generated code (excluding prefix and postfix).

charset
string

Characters that can appear in the code.

Examples:

  • Alphanumeric: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Alphabetic: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Alphabetic Lowercase: abcdefghijklmnopqrstuvwxyz
  • Alphabetic Uppercase: ABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Numbers: 0123456789
  • Custom: a custom character set
prefix
string

A text appended before the code.

postfix
string

A text appended after the code.

pattern
string

A pattern for codes where hashes (#) will be replaced with random characters. Overrides length.

| -| is_referral_code
`boolean` |

Indicates whether the voucher is a referral code; this is true for campaign type REFERRAL_PROGRAM.

| - -## Loyalty Card -| Attributes | Description | -|:-----|:--------| -| type
`string` |

Type of voucher.

| -| loyalty_card
`object` |

Defines the loyalty card details.

AttributesDescription
points
integer

Initial loyalty card income in points to be applied to the loyalty card at voucher generation.

expiration_rules
object

Defines point expiration rules.

AttributesDescription
period_type
string

The expiration period.

Available values: MONTH
period_value
integer

How many periods should pass before the expiration occurs.

rounding_type
string

Round up expiration till the end of the given period type.

Available values: END_OF_MONTH, END_OF_QUARTER, END_OF_HALF_YEAR, END_OF_YEAR, PARTICULAR_MONTH
| -| redemption
`object` |

Defines the redemption limits on vouchers.

AttributesDescription
quantity
integer

How many times a voucher can be redeemed. A null value means unlimited.

| -| code_config
`object` |

Defines code's pattern (prefix, suffix, length, charset, etc).

AttributesDescription
length
string

Number of characters in a generated code (excluding prefix and postfix).

charset
string

Characters that can appear in the code.

Examples:

  • Alphanumeric: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Alphabetic: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Alphabetic Lowercase: abcdefghijklmnopqrstuvwxyz
  • Alphabetic Uppercase: ABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Numbers: 0123456789
  • Custom: a custom character set
prefix
string

A text appended before the code.

postfix
string

A text appended after the code.

pattern
string

A pattern for codes where hashes (#) will be replaced with random characters. Overrides length.

| +| code_config
`object` |

Defines code's pattern (prefix, suffix, length, charset, etc).

AttributesDescription
length
string

Number of characters in a generated code (excluding prefix and postfix).

charset
string

Characters that can appear in the code.

Examples:

  • Alphanumeric: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Alphabetic: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Alphabetic Lowercase: abcdefghijklmnopqrstuvwxyz
  • Alphabetic Uppercase: ABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Numbers: 0123456789
  • Custom: a custom character set
prefix
string

A text appended before the code.

postfix
string

A text appended after the code.

pattern
string

A pattern for codes where hashes (#) will be replaced with random characters. Overrides length.

initial_count
integer

The initial count

| | is_referral_code
`boolean` |

Indicates whether the voucher is a referral code; this is true for campaign type REFERRAL_PROGRAM.

| +| start_date
`string` |

Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is inactive before this date.

**Example:**

2022-09-20T00:00:00.000Z

| +| expiration_date
`string` |

Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is inactive after this date.

**Example:**

2022-09-30T00:00:00.000Z

| +| validity_timeframe
`object` |

Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.start_date required when including the validity_timeframe.

AttributesDescription
interval
string

Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an interval of P2D will be active every other day.

duration
string

Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a duration of P1D will be valid for a duration of one day.

| -## Category Object +## Category | Attributes | Description | |:-----|:--------| | id
`string` |

Unique category ID assigned by Voucherify.

| | name
`string` |

Category name.

| | hierarchy
`integer` |

Category hierarchy.

| +| object
`string` |

The type of object represented by the JSON. This object stores information about the category.

Available values: `category` | | created_at
`string` |

Timestamp representing the date and time when the category was created in ISO 8601 format.

**Example:**

2022-07-14T10:45:13.156Z

| | updated_at
`string` |

Timestamp representing the date and time when the category was updated in ISO 8601 format.

**Example:**

2022-08-16T10:52:08.094Z

| -| object
`string` |

The type of object represented by the JSON. This object stores information about the category.

| +| stacking_rules_type
`string` |

The type of the stacking rule eligibility.

Available values: `JOINT`, `EXCLUSIVE` | ## Promotion Tiers | Attributes | Description | @@ -87,71 +76,41 @@ order: 1 | total
`integer` |

Total number of promotion tiers.

| | has_more
`boolean` |

As query results are always limited (by the limit parameter), the has_more flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different page or a different start date filter) to get more records returned in the results.

| -## Balance +## Validation Rules Assignments List | Attributes | Description | |:-----|:--------| -| qualification_type
`string` |

Tier qualification.

BALANCE: Points balance is based on the customer's current points balance. Customers qualify for the tier if their points balance is in the points range of the tier.

Available values: `BALANCE` | -| start_date
`object` |

Defines the conditions for the start date of the tier.

AttributesDescription
type
string

What triggers the tier to be valid for a customer.
IMMEDIATE: After reaching the minimum required points.

Available values: IMMEDIATE
| -| expiration_date |

Defines the conditions for the expiration date of a tier.

Any of: [Balance Drop](#balance-drop), [Custom](#custom) | +| object
`string` |

The type of object represented by JSON. This object stores information about validation rules assignments.

Available values: `list` | +| data_ref
`string` |

Identifies the name of the attribute that contains the array of validation rules assignments.

Available values: `data` | +| data
`array` |

Contains array of validation rules assignments.

Array of [Business Validation Rule Assignment](#business-validation-rule-assignment) | +| total
`integer` |

Total number of validation rules assignments.

| -## Points in Period +## Loyalty Tiers Expiration | Attributes | Description | |:-----|:--------| -| qualification_type
`string` |

Tier qualification.

POINTS_IN_PERIOD: A customer qualifies for the tier only if the sum of the accumulated points in a defined time interval reaches the tier threshold.

Available values: `POINTS_IN_PERIOD` | +| qualification_type
`string` |

Tier qualification.

BALANCE: Points balance is based on the customer's current points balance. Customers qualify for the tier if their points balance is in the points range of the tier.
POINTS_IN_PERIOD: A customer qualifies for the tier only if the sum of the accumulated points in a defined time interval reaches the tier threshold.

Available values: `BALANCE`, `POINTS_IN_PERIOD` | | qualification_period
`string` |

Customers can qualify for the tier if they collected enough points in a given time period. So, in addition to the customer having to reach a points range, they also need to have collected the points within a set time period.

PeriodDefinition
Calendar MonthPoints collected in one calendar month
January, February, March, etc.
Calendar QuarterPoints collected in the quarter
- January - March
- April - June
- July - September
- October - December
Calendar Half-yearPoints collected in the half-year
- January - June
- July - December
Calendar YearPoints collected in one calendar year
January - December
Available values: `MONTH`, `QUARTER`, `HALF_YEAR`, `YEAR` | | start_date
`object` |

Defines the conditions for the start date of the tier.

AttributesDescription
type
string

What triggers the tier to be valid for a customer.
IMMEDIATE: After reaching the minimum required points.
NEXT_PERIOD: When the next qualification period starts.

Available values: IMMEDIATE, NEXT_PERIOD
| -| expiration_date
`object` |

Defines the conditions for the expiration date of a tier.

AttributesDescription
type
string

What triggers the tier to expire for a customer.
END_OF_PERIOD: Expire tier at the end of the period.
END_OF_NEXT_PERIOD: Expire tier at the end of the next period.

Available values: END_OF_PERIOD, END_OF_NEXT_PERIOD
extend
string

Extend the expiration by adding extra months or days in ISO 8601 format. The tier will remain active even though it reaches its expiration time period. For example, a tier with a duration of P3M will be valid for an additional duration of 3 months and a tier with a duration of P1D will be valid for an additional duration of 1 day.

| +| expiration_date
`object` |

Defines the conditions for the expiration date of a tier.

AttributesDescription
type
string

What triggers the tier to expire for a customer.
END_OF_PERIOD: Expire tier at the end of the period.
END_OF_NEXT_PERIOD: Expire tier at the end of the next period.
BALANCE_DROP: Tier expires when the points balance drops below the required range of the tier.
CUSTOM: Tier expires after a certain time period passes following the instance the points balance drops below the required range of the tier.

Available values: END_OF_PERIOD, END_OF_NEXT_PERIOD, BALANCE_DROP, CUSTOM
extend
string

Extend the expiration by adding extra months or days in ISO 8601 format. The tier will remain active even though it reaches its expiration time period. For example, a tier with a duration of P3M will be valid for an additional duration of 3 months and a tier with a duration of P1D will be valid for an additional duration of 1 day.

rounding

Defines the rounding mechanism for tier expiration.

| -## Amount -| Attributes | Description | -|:-----|:--------| -| type
`string` |

Applies an amount discount.

| -| amount_off
`integer` |

Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. In case of the amount being calculated by the formula, i.e. the amount_off_formula parameter is present in the amount definition, this value becomes the fallback value. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the amount off.

**Example:**

100

| -| amount_off_formula
`string` |

Formula used to calculate the discount.

| -| aggregated_amount_limit
`integer` |

Maximum discount amount per order. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount on the entire order is written as 600. This value is definable for the following discount effects:

| -| effect
`string` |

Defines how the discount is applied to the customer's order. The discount effects are defined as follows:

Available values: `APPLY_TO_ORDER`, `APPLY_TO_ITEMS`, `APPLY_TO_ITEMS_PROPORTIONALLY`, `APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY`, `APPLY_TO_ITEMS_BY_QUANTITY` | - -## Percentage -| Attributes | Description | -|:-----|:--------| -| type
`string` |

Applies a percentage discount.

| -| amount_limit
`string` |

Upper limit allowed to be applied as a discount per order line item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600.

| -| aggregated_amount_limit
`integer` |

Maximum discount amount per order. This value is definable for the APPLY_TO_ITEMS discount effect. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount on the entire order is written as 600.

| -| percent_off
`integer` |

Percent taken off the subtotal amount. In case of the percent being calculated by the formula, i.e. the percent_off_formula parameter is present in the percent definition, this value becomes the fallback value. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the percent off.

| -| percent_off_formula
`string` |

Formula used to calculate the discount.

| -| effect
`string` |

Defines how the discount is applied to the customer's order.

Available values: `APPLY_TO_ORDER`, `APPLY_TO_ITEMS` | +## Discount +

Contains information about discount.

-## Fixed -| Attributes | Description | -|:-----|:--------| -| type
`string` |

Sets a fixed total on cart or item(s) and then calculates the discount to apply.

| -| fixed_amount
`integer` |

Sets a fixed value for an order total or the item price. The value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. If the fixed amount is calculated by the formula, i.e. the fixed_amount_formula parameter is present in the fixed amount definition, this value becomes the fallback value. As a result, if the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed value.

**Example:**

1000

| -| fixed_amount_formula
`string` |

Formula used to calculate the discounted price of an item or a new order total.

| -| effect
`string` |
EffectDefinition
APPLY_TO_ORDERSets the order total amount to the value of the fixed amount. The discount value is calculated dynamically during the redemption as it's a difference between the total amount of the customer's order and the fixed amount. For example, if the fixed amount is set to equal $10 and the order amount equals $25, then the calculated discount will be $15.
APPLY_TO_ITEMSSets a new price on items. The total discount amount is dynamically calculated during the redemption and it's a difference between the initial item price and the fixed amount. During the redemption, prices for items will change only if the new price is lower than the original price. If the new product price you set is different from the product price in a collection, then the new product price will be passed during the redemption. If a prodct is in more than one collection, the price is always changed to the lowest price. The new price for products with several SKUs will force the price change for SKUs if their original price is higher than the new price.
Available values: `APPLY_TO_ORDER`, `APPLY_TO_ITEMS` | +Any of: -## Unit, single item -| Attributes | Description | -|:-----|:--------| -| type
`string` |

Applies a full value discount to item(s).

| -| unit_off
`number` |

Number of units to be granted a full value discount. In case of the unit being calculated by the formula, i.e. the unit_off_formula parameter is present in the unit definition, this value becomes the fallback value. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the unit value.

**Example:**

1

| -| unit_off_formula
`string` |

Formula used to calculate the number of units.

| -| unit_type
`string` |

The product deemed as free, chosen from the product inventory (e.g. time, items).

**Example:**

prod_f1r5Tpr0DuC7

| -| effect
`string` |

Defines how the unit is added to the customer's order.

Available values: `ADD_NEW_ITEMS`, `ADD_MISSING_ITEMS` | +[Amount](#amount), [Unit](#unit), [Unit Multiple](#unit-multiple), [Percent](#percent), [Fixed](#fixed) -## Unit, multiple items +## Gift | Attributes | Description | |:-----|:--------| -| type
`string` |

Applies a full value discount to item(s).

| -| effect
`string` |

Defines the effect for adding multiple item types.

| -| units
`array` |

Array of objects defining items to be offered for free. Each item type can have a different discount effect assigned.

Array of:
AttributesDescription
unit_off
integer

Number of units to be granted a full value discount. In case of the unit being calculated by the formula, i.e. the unit_off_formula parameter is present in the unit definition, this value becomes the fallback value. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the unit value.

Example:

1

unit_off_formula
string

Formula used to calculate the number of units.

unit_type
string

The product deemed as free, chosen from the product inventory (e.g. time, items).

Example:

prod_f1r5Tpr0DuC7

effect
string

Defines how the unit is added to the customer's order.

Available values: ADD_NEW_ITEMS, ADD_MISSING_ITEMS
| +| amount
`number` |

Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.

| +| balance
`number` |

Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.

| +| effect
`string` |

Defines how the credits are applied to the customer's order.

Available values: `APPLY_TO_ORDER`, `APPLY_TO_ITEMS` | -## Shipping +## Campaign Loyalty Card | Attributes | Description | |:-----|:--------| -| type
`string` |

Applies a full value discount to item(s).

| -| unit_off
`number` |

Subtracts 1 shipping item from the subtotal.

| -| unit_type
`string` |

The shipping product deemed as free.

| -| effect
`string` |

Defines how the unit is added to the customer's order.

| +| points
`integer` |

The initial number of points to assign to the loyalty card. This is the current loyalty card score i.e. the number of loyalty points on the card.

| +| expiration_rules
`object` |
AttributesDescription
period_type
string

Type of period

period_value
integer

Value of the period

rounding_type
string

Type of rounding

rounding_value
integer

Value of rounding

| ## Promotion Tier | Attributes | Description | @@ -178,57 +137,18 @@ order: 1 | category_id
`string` |

Promotion tier category ID.

**Example:**

cat_0c9da30e7116ba6bba

| | categories
`array` | Array of [Category](#category) | -## Balance Drop +## Business Validation Rule Assignment | Attributes | Description | |:-----|:--------| -| type
`string` |

What triggers the tier to expire for a customer.
BALANCE_DROP: Tier expires when the points balance drops below the required range of the tier.

Available values: `BALANCE_DROP` | - -## Custom -| Attributes | Description | -|:-----|:--------| -| type
`string` |

What triggers the tier to expire for a customer.
CUSTOM: Tier expires after a certain time period passes following the instance the points balance drops below the required range of the tier.

Available values: `CUSTOM` | -| extend
`string` |

Defines the amount of time the tier will remain active in ISO 8601 format. The expiration date counter starts at the moment when the customer reaches the minimum required points that are required to be in the tier. For example, a tier with a duration of P3M will be valid for a duration of 3 months.

| -| rounding |

Defines the rounding mechanism for tier expiration.

Any of: [Calendar Periods](#calendar-periods), [Specific Month](#specific-month) | - -## Discount -

Contains information about discount.

- -Any of: - -[Amount](#amount), [Unit](#unit), [Unit Multiple](#unit-multiple), [Percent](#percent), [Fixed](#fixed) - -## Validation Rule Assignments -| Attributes | Description | -|:-----|:--------| -| object
`string` |

The type of object represented by JSON. This object stores information about validation rule assignments.

| -| data_ref
`string` |

Identifies the name of the JSON property that contains the array of validation rule assignments.

| -| data
`array` |

A dictionary that contains an array of validation rule assignments.

Array of [Validation Rule Assignment](#validation-rule-assignment) | -| total
`integer` |

Total number of validation rule assignments.

| - -## Category -| Attributes | Description | -|:-----|:--------| -| id
`string` |

Unique category ID assigned by Voucherify.

| -| name
`string` |

Category name.

| -| hierarchy
`integer` |

Category hierarchy.

| -| object
`string` |

The type of object represented by the JSON. This object stores information about the category.

Available values: `category` | -| created_at
`string` |

Timestamp representing the date and time when the category was created in ISO 8601 format.

**Example:**

2022-07-14T10:45:13.156Z

| -| updated_at
`string` |

Timestamp representing the date and time when the category was updated in ISO 8601 format.

**Example:**

2022-08-16T10:52:08.094Z

| -| stacking_rules_type
`string` |

The type of the stacking rule eligibility.

Available values: `JOINT`, `EXCLUSIVE` | - -## Calendar Periods -| Attributes | Description | -|:-----|:--------| -| type
`string` |

Period to which the expiration will be rounded to.

Available values: `MONTH`, `QUARTER`, `HALF_YEAR`, `YEAR` | -| strategy
`string` |

Which portion of the given period should the rounding be applied to.

Available values: `END` | - -## Specific Month -| Attributes | Description | -|:-----|:--------| -| type
`string` |

This mechanism describes a custom rounding for the expiration date.

Available values: `CUSTOM` | -| strategy
`string` |

Which portion of the given period should the rounding be applied to.

Available values: `END` | -| unit
`string` |

Defines the type of unit of time in which the rounding period is counted.

Available values: `MONTH` | -| value
`integer` |

Value for the unit of time that the rounding applies to. Units for this parameter are defined by the rounding.unit parameter.

| +| id
`string` |

The unique identifier for a assignment

| +| rule_id
`string` |

The unique identifier for a rule

| +| related_object_id
`string` |

The unique identifier for a related object

| +| related_object_type
`string` |

The type of related object

| +| created_at
`string` |

Timestamp representing the date and time when the object was created in ISO 8601 format.

**Example:**

2022-03-09T11:19:04.819Z

| +| updated_at
`string` |

Timestamp representing the date and time when the object was last updated in ISO 8601 format.

**Example:**

2022-03-09T11:19:04.819Z

| +| object
`string` |

The type of object represented by JSON.

Available values: `validation_rules_assignment` | +| validation_status
`string` |

The validation status of the assignment

Available values: `VALID`, `PARTIALLY_VALID`, `INVALID` | +| validation_omitted_rules
`array` |

The list of omitted rules

| ## Amount | Attributes | Description | @@ -279,15 +199,13 @@ Any of: | effect |

Defines how the discount is applied to the customer's order.

See: [Discount Fixed Vouchers Effect Types](#discount-fixed-vouchers-effect-types) | | is_dynamic
`boolean` |

Flag indicating whether the discount was calculated using a formula.

| -## Validation Rule Assignment +## Validation Rule Assignments | Attributes | Description | |:-----|:--------| -| id
`string` |

Validation rule assignment ID.

**Example:**

asgm_74F7QZoYbUoljwQO

| -| rule_id
`string` |

Validation rule ID.

**Example:**

val_4j7DCRm2IS59

| -| related_object_id
`string` |

The resource ID to which the validation rule was assigned.

**Example:**

v_JtWunK6jUo7X2qOFj0SyRHq4p9tgENlT

| -| related_object_type
`string` |

The type of resource to which the validation rule was assigned.

Available values: `voucher`, `campaign`, `earning_rule`, `reward_assignment`, `promotion_tier`, `distribution` | -| created_at
`string` |

Timestamp representing the date and time when the validation rule assignment was created in ISO 8601 format.

**Example:**

2022-02-17T08:18:15.085Z

| -| object
`string` |

The type of object represented by the ID.

Available values: `validation_rules_assignment` | +| object
`string` |

The type of object represented by JSON. This object stores information about validation rule assignments.

| +| data_ref
`string` |

Identifies the name of the JSON property that contains the array of validation rule assignments.

| +| data
`array` |

A dictionary that contains an array of validation rule assignments.

Array of [Validation Rule Assignment](#validation-rule-assignment) | +| total
`integer` |

Total number of validation rule assignments.

| ## Discount Amount Vouchers Effect Types Available values: `APPLY_TO_ORDER`, `APPLY_TO_ITEMS`, `APPLY_TO_ITEMS_PROPORTIONALLY`, `APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY`, `APPLY_TO_ITEMS_BY_QUANTITY` @@ -325,6 +243,16 @@ Available values: `APPLY_TO_ORDER`, `APPLY_TO_ITEMS` ## Discount Fixed Vouchers Effect Types Available values: `APPLY_TO_ORDER`, `APPLY_TO_ITEMS` +## Validation Rule Assignment +| Attributes | Description | +|:-----|:--------| +| id
`string` |

Validation rule assignment ID.

**Example:**

asgm_74F7QZoYbUoljwQO

| +| rule_id
`string` |

Validation rule ID.

**Example:**

val_4j7DCRm2IS59

| +| related_object_id
`string` |

The resource ID to which the validation rule was assigned.

**Example:**

v_JtWunK6jUo7X2qOFj0SyRHq4p9tgENlT

| +| related_object_type
`string` |

The type of resource to which the validation rule was assigned.

Available values: `voucher`, `campaign`, `earning_rule`, `reward_assignment`, `promotion_tier`, `distribution` | +| created_at
`string` |

Timestamp representing the date and time when the validation rule assignment was created in ISO 8601 format.

**Example:**

2022-02-17T08:18:15.085Z

| +| object
`string` |

The type of object represented by the ID.

Available values: `validation_rules_assignment` | + [block:html] { "html": "" diff --git a/docs/reference-docs/LOYALTIES-API-Loyalty-Campaign-Object.md b/docs/reference-docs/LOYALTIES-API-Loyalty-Campaign-Object.md index 50d55cb9f..5c75f492e 100644 --- a/docs/reference-docs/LOYALTIES-API-Loyalty-Campaign-Object.md +++ b/docs/reference-docs/LOYALTIES-API-Loyalty-Campaign-Object.md @@ -34,7 +34,7 @@ order: 1 | vouchers_generation_status
`string` |

Indicates the status of the campaign's vouchers.

Available values: `DONE`, `IN_PROGRESS`, `FAILED`, `DRAFT` | | protected
`boolean` |

Indicates whether the resource can be deleted.

| | category_id
`string` |

Unique category ID that this campaign belongs to.

**Example:**

cat_0b688929a2476386a7

| -| categories | See: [Category Object](#category-object) | +| categories | See: [Category](#category) | | loyalty_tiers_expiration
`object` |

Defines the expiration mechanism for loyalty tiers.

Any of: [Balance](#balance), [Points in Period](#points-in-period) | | object
`string` |

The type of object represented by JSON. This object stores information about the campaign.

| @@ -47,15 +47,16 @@ order: 1 | code_config
`object` |

Defines code's pattern (prefix, suffix, length, charset, etc).

AttributesDescription
length
string

Number of characters in a generated code (excluding prefix and postfix).

charset
string

Characters that can appear in the code.

Examples:

  • Alphanumeric: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Alphabetic: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Alphabetic Lowercase: abcdefghijklmnopqrstuvwxyz
  • Alphabetic Uppercase: ABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Numbers: 0123456789
  • Custom: a custom character set
prefix
string

A text appended before the code.

postfix
string

A text appended after the code.

pattern
string

A pattern for codes where hashes (#) will be replaced with random characters. Overrides length.

| | is_referral_code
`boolean` |

Indicates whether the voucher is a referral code; this is true for campaign type REFERRAL_PROGRAM.

| -## Category Object +## Category | Attributes | Description | |:-----|:--------| | id
`string` |

Unique category ID assigned by Voucherify.

| | name
`string` |

Category name.

| | hierarchy
`integer` |

Category hierarchy.

| +| object
`string` |

The type of object represented by the JSON. This object stores information about the category.

Available values: `category` | | created_at
`string` |

Timestamp representing the date and time when the category was created in ISO 8601 format.

**Example:**

2022-07-14T10:45:13.156Z

| | updated_at
`string` |

Timestamp representing the date and time when the category was updated in ISO 8601 format.

**Example:**

2022-08-16T10:52:08.094Z

| -| object
`string` |

The type of object represented by the JSON. This object stores information about the category.

| +| stacking_rules_type
`string` |

The type of the stacking rule eligibility.

Available values: `JOINT`, `EXCLUSIVE` | ## Balance | Attributes | Description | diff --git a/docs/reference-docs/LOYALTIES-API-Loyalty-Card-Object.md b/docs/reference-docs/LOYALTIES-API-Loyalty-Card-Object.md index 37eae7f9b..32f1ca1e1 100644 --- a/docs/reference-docs/LOYALTIES-API-Loyalty-Card-Object.md +++ b/docs/reference-docs/LOYALTIES-API-Loyalty-Card-Object.md @@ -17,7 +17,7 @@ order: 2 | campaign_id
`string` |

Assigned by the Voucherify API, identifies the voucher's parent campaign.

**Example:**

camp_FNYR4jhqZBM9xTptxDGgeNBV

| | category
`string` |

Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint.

| | category_id
`string` |

Unique category ID assigned by Voucherify.

**Example:**

cat_0bb343dee3cdb5ec0c

| -| categories
`array` |

Contains details about the category.

Array of [Category Object](#category-object) | +| categories
`array` |

Contains details about the category.

Array of [Category](#category) | | type
`string` |

Defines the type of the voucher.

Available values: `LOYALTY_CARD` | | discount
`null` |

Object representing discount parameters. Child attributes are present only if type is DISCOUNT_VOUCHER. Defaults to null.

| | gift
`null` |

Object representing gift parameters. Child attributes are present only if type is GIFT_VOUCHER. Defaults to null.

| @@ -38,15 +38,16 @@ order: 2 | publish
`object` |

This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or publish voucher API method.

RequiredOptional
type:LOYALTY_CARDtype:DISCOUNT_VOUCHER
is_referral_code:truetype:GIFT_VOUCHER
AttributesDescription
object
string

The type of object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute.

count
integer

Publication events counter.

Example:

0

url
string

The endpoint where this list of publications can be accessed using a GET method. /v1/vouchers/{voucher_code}/publications

Example:

/v1/vouchers/WVPblOYX/publications?page=1&limit=10

| | object
`string` |

The type of object represented by JSON. Default is voucher.

| -## Category Object +## Category | Attributes | Description | |:-----|:--------| | id
`string` |

Unique category ID assigned by Voucherify.

| | name
`string` |

Category name.

| | hierarchy
`integer` |

Category hierarchy.

| +| object
`string` |

The type of object represented by the JSON. This object stores information about the category.

Available values: `category` | | created_at
`string` |

Timestamp representing the date and time when the category was created in ISO 8601 format.

**Example:**

2022-07-14T10:45:13.156Z

| | updated_at
`string` |

Timestamp representing the date and time when the category was updated in ISO 8601 format.

**Example:**

2022-08-16T10:52:08.094Z

| -| object
`string` |

The type of object represented by the JSON. This object stores information about the category.

| +| stacking_rules_type
`string` |

The type of the stacking rule eligibility.

Available values: `JOINT`, `EXCLUSIVE` | [block:html] { diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index e7c437a8f..1d0cbe792 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -7368,7 +7368,7 @@ {} ] }, - "Campaign": { + "CampaignResponse": { "type": "object", "title": "Campaign Object", "description": "This is an object representing a campaign.", @@ -7410,17 +7410,7 @@ ] }, "voucher": { - "anyOf": [ - { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_DISCOUNT" - }, - { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_GIFT_CARD" - }, - { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_LOYALTY_CARD" - } - ] + "$ref": "#/components/schemas/CampaignVoucher" }, "auto_join": { "type": "boolean", @@ -7608,6 +7598,135 @@ }, "validation_rules_assignments": { "$ref": "#/components/schemas/ValidationRulesAssignmentsList" + }, + "loyalty_tiers_expiration": { + "$ref": "#/components/schemas/LoyaltyTiersExpirationAll" + } + } + }, + "CampaignVoucher": { + "type": "object", + "description": "Schema model for a campaign voucher.", + "title": "Campaign Discount Voucher", + "properties": { + "type": { + "type": "string", + "default": "DISCOUNT_VOUCHER", + "description": "Type of voucher." + }, + "discount": { + "$ref": "#/components/schemas/Discount", + "description": "Defines the voucher discount type and details." + }, + "gift": { + "$ref": "#/components/schemas/Gift", + "description": "Defines the voucher gift details." + }, + "loyalty_card": { + "$ref": "#/components/schemas/CampaignLoyaltyCard", + "description": "Defines the voucher loyalty card details." + }, + "redemption": { + "type": "object", + "description": "Defines the redemption limits on vouchers.", + "properties": { + "quantity": { + "type": "integer", + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + } + } + }, + "code_config": { + "type": "object", + "description": "Defines code's pattern (prefix, suffix, length, charset, etc).", + "properties": { + "length": { + "type": "string", + "description": "Number of characters in a generated code (excluding prefix and postfix)." + }, + "charset": { + "type": "string", + "description": "Characters that can appear in the code. \n\nExamples:\n\n- Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` \n- Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Numbers: `0123456789` \n- Custom: a custom character set" + }, + "prefix": { + "type": "string", + "description": "A text appended before the code." + }, + "postfix": { + "type": "string", + "description": "A text appended after the code." + }, + "pattern": { + "type": "string", + "description": "A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`." + }, + "initial_count": { + "type": "integer", + "description": "The initial count" + } + } + }, + "is_referral_code": { + "type": "boolean", + "description": "Indicates whether the voucher is a referral code; this is `true` for campaign type `REFERRAL_PROGRAM`." + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." + } + } + } + } + }, + "CampaignLoyaltyCard": { + "type": "object", + "description": "Schema model for a campaign loyalty card.", + "title": "Campaign Loyalty Card", + "properties": { + "points": { + "type": "integer", + "description": "The initial number of points to assign to the loyalty card. This is the current loyalty card score i.e. the number of loyalty points on the card." + }, + "expiration_rules": { + "type": "object", + "properties": { + "period_type": { + "type": "string", + "description": "Type of period" + }, + "period_value": { + "type": "integer", + "description": "Value of the period" + }, + "rounding_type": { + "type": "string", + "description": "Type of rounding" + }, + "rounding_value": { + "type": "integer", + "description": "Value of rounding" + } + } } } }, @@ -9042,7 +9161,7 @@ "type": "array", "description": "Contains array of campaign objects.", "items": { - "$ref": "#/components/schemas/2_obj_campaign_object" + "$ref": "#/components/schemas/CampaignResponse" } }, "total": { @@ -23912,6 +24031,100 @@ } } }, + "LoyaltyTiersExpirationAll": { + "title": "Loyalty Tiers Expiration", + "type": "object", + "description": "Defines the Loyalty Tiers Expiration.", + "properties": { + "qualification_type": { + "type": "string", + "enum": [ + "BALANCE", + "POINTS_IN_PERIOD" + ], + "description": "Tier qualification. \n\n`BALANCE`: Points balance is based on the customer's current points balance. Customers qualify for the tier if their points balance is in the points range of the tier. \n `POINTS_IN_PERIOD`: A customer qualifies for the tier only if the sum of the accumulated points in a **defined time interval** reaches the tier threshold." + }, + "qualification_period": { + "type": "string", + "description": "Customers can qualify for the tier if they collected enough points in a given time period. So, in addition to the customer having to reach a points range, they also need to have collected the points within a set time period. \n\n| **Period** | **Definition** |\n|:---|:---|\n| **Calendar Month** | Points collected in one calendar month
January, February, March, etc. |\n| **Calendar Quarter** | Points collected in the quarter
- January - March
- April - June
- July - September
- October - December |\n| **Calendar Half-year** | Points collected in the half-year
- January - June
- July - December |\n| **Calendar Year** | Points collected in one calendar year
January - December |", + "enum": [ + "MONTH", + "QUARTER", + "HALF_YEAR", + "YEAR" + ] + }, + "start_date": { + "type": "object", + "description": "Defines the conditions for the start date of the tier.", + "properties": { + "type": { + "type": "string", + "enum": [ + "IMMEDIATE", + "NEXT_PERIOD" + ], + "description": "What triggers the tier to be valid for a customer. \n`IMMEDIATE`: After reaching the minimum required points. \n`NEXT_PERIOD`: When the next qualification period starts." + } + } + }, + "expiration_date": { + "type": "object", + "description": "Defines the conditions for the expiration date of a tier.", + "properties": { + "type": { + "type": "string", + "enum": [ + "END_OF_PERIOD", + "END_OF_NEXT_PERIOD", + "BALANCE_DROP", + "CUSTOM" + ], + "description": "What triggers the tier to expire for a customer. \n`END_OF_PERIOD`: Expire tier at the end of the period. \n`END_OF_NEXT_PERIOD`: Expire tier at the end of the next period. \n `BALANCE_DROP`: Tier expires when the points balance drops below the required range of the tier. \n `CUSTOM`: Tier expires after a certain time period passes following the instance the points balance drops below the required range of the tier." + }, + "extend": { + "type": "string", + "description": "Extend the expiration by adding extra months or days in ISO 8601 format. The tier will remain active even though it reaches its expiration time period. For example, a tier with a duration of `P3M` will be valid for an additional duration of 3 months and a tier with a duration of `P1D` will be valid for an additional duration of 1 day." + }, + "rounding": { + "description": "Defines the rounding mechanism for tier expiration.", + "properties": { + "type": { + "type": "string", + "enum": [ + "MONTH", + "QUARTER", + "HALF_YEAR", + "YEAR", + "CUSTOM" + ], + "description": "This mechanism describes a custom rounding for the expiration date." + }, + "strategy": { + "type": "string", + "enum": [ + "START", + "END" + ], + "description": "This mechanism describes a rounding strategy for the expiration date." + }, + "unit": { + "type": "string", + "description": "Defines the type of unit of time in which the rounding period is counted.", + "enum": [ + "MONTH" + ] + }, + "value": { + "type": "integer", + "description": "Value for the unit of time that the rounding applies to. Units for this parameter are defined by the `rounding.unit` parameter. \n- `0`: January\n- `1`: February\n- `2`: March\n- `3`: April\n- `4`: May\n- `5`: June\n- `6`: July\n- `7`: August\n- `8`: September\n- `9`: October\n- `10`: November\n- `11`: December" + } + } + } + } + } + } + }, "8_loyalty_tiers_expiration_balance_expiration_date_balance_drop": { "title": "Balance Drop", "type": "object", @@ -28108,7 +28321,7 @@ "13_obj_validation_rule_object": { "title": "Validation Rule Object", "type": "object", - "description": "This is an object representing a validation rule. \n\nThis entity stores the rules used to limit resources in Voucherify. The validation rule can be assigned to resources such as a: \n- [voucher](ref:get-voucher)\n- [campaign](ref:get-campaign)\n- [earning rule](ref:get-earning-rule)\n- [reward assignment](ref:get-reward-assignment)\n- [promotion tier](ref:list-promotion-tiers)\n- [publication](ref:list-publications)\n\nYou can configure the Validation Rule to include your own custom error messages which are going to be returned from the API upon a validation / redemption failure. You can read more [here](ref:errors#custom-error-messages-with-validation-rules).", + "description": "This is an object representing a validation rule. \n\nThis entity stores the rules used to limit resources in Voucherify. The validation rule can be assigned to resources such as a: \n- [voucher](ref:get-voucher)\n- [campaign](ref:get-campaign)\n- [earning rule](ref:get-earning-rule)\n- [reward assignment](ref:get-reward-assignment)\n- [promotion tier](ref:list-promotion-tiers)\n- [publication](ref:list-publications)\n\nYou can configure the Validation Rule to include your own custom error messages which are going to be returned from the API upon a validation / redemption failure. You can read more [here](ref:errors#custom-error-messages-with-validation-rules).", "x-tags": [ "VALIDATION RULES API" ], @@ -44039,7 +44252,7 @@ "PROMOTIONS API" ], "summary": "Create Campaign", - "description": "Method to create a batch of vouchers aggregated in one campaign. You can choose a variety of voucher types and define a unique pattern for generating codes. \n\n\n> 📘 Global uniqueness\n>\n> All campaign codes are unique across the whole project. Voucherify will not allow you to generate 2 campaigns with the same coupon code. \n\n> 🚧 Code generation status\n>\n> This is an asynchronous action; you can't read or modify a newly created campaign until the code generation is completed. See the `creation_status` field in the [campaign object](ref:get-campaign) description.", + "description": "Method to create a batch of vouchers aggregated in one campaign. You can choose a variety of voucher types and define a unique pattern for generating codes. \n\n\n> 📘 Global uniqueness\n>\n> All campaign codes are unique across the whole project. Voucherify will not allow you to generate 2 campaigns with the same coupon code. \n\n> 🚧 Code generation status\n>\n> This is an asynchronous action; you can't read or modify a newly created campaign until the code generation is completed. See the `creation_status` field in the [campaign object](ref:get-campaign) description.", "parameters": [], "security": [ { @@ -44321,7 +44534,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/2_obj_campaign_object" + "$ref": "#/components/schemas/CampaignResponse" }, "examples": { "Discount Campaign": { @@ -45245,7 +45458,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/2_obj_campaign_object" + "$ref": "#/components/schemas/CampaignResponse" }, "examples": { "Example": { @@ -45358,7 +45571,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/2_obj_campaign_object" + "$ref": "#/components/schemas/CampaignResponse" }, "examples": { "Example": { @@ -45806,7 +46019,7 @@ } ], "requestBody": { - "description": "Discount type, expiration date and the remaining attributes will be taken from the [Campaign](ref:get-campaign) settings.", + "description": "Discount type, expiration date and the remaining attributes will be taken from the [Campaign](ref:get-campaign) settings.", "content": { "application/json": { "schema": { @@ -46033,7 +46246,7 @@ "CAMPAIGNS API" ], "summary": "Import Vouchers to Campaign by CSV", - "description": "Imports vouchers to an **existing** campaign. \n\n\nThe CSV file has to include headers in the first line. \n\nCurl Example\n\n```cURL\ncurl -X POST \\\n https://api.voucherify.io/v1/campaigns/TEST-CAMPAIGN/importCSV \\\n -F file=@/path/to/campaigns.csv \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\"\n```\n\nYou can import values for the following fields: `Code` (**required**), `Category`, `Active`. In a gift cards import, you can also include the current card balance using the `Gift Amount` header and the amount that was redeemed using the `Redeemed Amount` header. In a loyalty cards import, you can also include the current loyalty card score in points using the `Loyalty Points` header. Remaining CSV columns will be mapped to metadata properties. \n\nDiscount type, time limits, and validation rules will be taken from the [campaign object](ref:get-campaign) settings. \n\n\n| **Active** | **Code** | **Loyalty Points** | **Gift Amount** | **Redeemed Amount** | **Redeemed Quantity** | **Category** | **Custom_metadata_property** |\n|---|---|---|---|---|---|---|---|\n| Use `true` or `false` to enable or disable the voucher; this flag can be used to turn off the ability to redeem a voucher even though it is within the campaign's start/end validity timeframe. | The unique voucher code. | The number of points to be added to the loyalty card. If you leave this undefined, then the initial number of points will be set according to the campaign settings.
Context: `LOYALTY_PROGRAM` | The initial gift card balance.
Context: `GIFT_VOUCHERS` | The amount that was redeemed from the available balance on a gift card. | The number of times the voucher has been redeemed. | A custom tag for the voucher to help you filter codes; you can either import the category name or a unique Voucherify-assigned category ID. | Any additional data that you would like to store for the given loyalty card as a Custom attribute. Remember to define the metadata schema in the Dashboard prior to importing codes. |\n|\n\n> 📘 Active\n>\n> The CSV file is allowed in two versions; either with or without a column titled `Active`. It indicates whether the voucher is enabled after the import event. \n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the `IN_PROGRESS` status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "description": "Imports vouchers to an **existing** campaign. \n\n\nThe CSV file has to include headers in the first line. \n\nCurl Example\n\n```cURL\ncurl -X POST \\\n https://api.voucherify.io/v1/campaigns/TEST-CAMPAIGN/importCSV \\\n -F file=@/path/to/campaigns.csv \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\"\n```\n\nYou can import values for the following fields: `Code` (**required**), `Category`, `Active`. In a gift cards import, you can also include the current card balance using the `Gift Amount` header and the amount that was redeemed using the `Redeemed Amount` header. In a loyalty cards import, you can also include the current loyalty card score in points using the `Loyalty Points` header. Remaining CSV columns will be mapped to metadata properties. \n\nDiscount type, time limits, and validation rules will be taken from the [campaign object](ref:get-campaign) settings. \n\n\n| **Active** | **Code** | **Loyalty Points** | **Gift Amount** | **Redeemed Amount** | **Redeemed Quantity** | **Category** | **Custom_metadata_property** |\n|---|---|---|---|---|---|---|---|\n| Use `true` or `false` to enable or disable the voucher; this flag can be used to turn off the ability to redeem a voucher even though it is within the campaign's start/end validity timeframe. | The unique voucher code. | The number of points to be added to the loyalty card. If you leave this undefined, then the initial number of points will be set according to the campaign settings.
Context: `LOYALTY_PROGRAM` | The initial gift card balance.
Context: `GIFT_VOUCHERS` | The amount that was redeemed from the available balance on a gift card. | The number of times the voucher has been redeemed. | A custom tag for the voucher to help you filter codes; you can either import the category name or a unique Voucherify-assigned category ID. | Any additional data that you would like to store for the given loyalty card as a Custom attribute. Remember to define the metadata schema in the Dashboard prior to importing codes. |\n|\n\n> 📘 Active\n>\n> The CSV file is allowed in two versions; either with or without a column titled `Active`. It indicates whether the voucher is enabled after the import event. \n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the `IN_PROGRESS` status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", "parameters": [], "security": [ { diff --git a/scripts/md-tables.ts b/scripts/md-tables.ts index 9c868843c..95d9f1f00 100644 --- a/scripts/md-tables.ts +++ b/scripts/md-tables.ts @@ -1,6 +1,6 @@ export const mdTables: [string, string?][] = [ ["Voucher", "VOUCHERS-API-Voucher-Object.md"], - ["2_obj_campaign_object", "CAMPAIGNS-API-Campaign-Object.md"], + ["CampaignResponse", "CAMPAIGNS-API-Campaign-Object.md"], ["PromotionTier", "PROMOTIONS-API-Promotion-Tier-Object.md"], ["reward", "REWARDS-API-Reward-Object.md"], ["RewardAssignment", "REWARDS-API-Reward-Assignment-Object.md"], From a1424f30df8a9c6494e5315169a4874b0993b6b7 Mon Sep 17 00:00:00 2001 From: jkaliszuk Date: Mon, 20 Nov 2023 15:00:11 +0100 Subject: [PATCH 3/9] Finished CampaignResponse object. --- reference/OpenAPI.json | 84 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 69 insertions(+), 15 deletions(-) diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index 1d0cbe792..0ca5f6d4f 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -7516,7 +7516,7 @@ "description": "Indicates whether the resource can be deleted." }, "category_id": { - "type": "string", + "type": [ "string", "null" ], "description": "Unique category ID that this campaign belongs to.", "example": "cat_0b688929a2476386a7" }, @@ -7594,7 +7594,7 @@ } }, "promotion": { - "$ref": "#/components/schemas/3_res_list_promotion_tiers_from_campaign" + "$ref": "#/components/schemas/PromotionTiersList" }, "validation_rules_assignments": { "$ref": "#/components/schemas/ValidationRulesAssignmentsList" @@ -7602,7 +7602,24 @@ "loyalty_tiers_expiration": { "$ref": "#/components/schemas/LoyaltyTiersExpirationAll" } - } + }, + "required": [ + "id", + "name", + "campaign_type", + "type", + "auto_join", + "join_once", + "use_voucher_metadata_schema", + "created_at", + "creation_status", + "vouchers_generation_status", + "protected", + "category_id", + "categories", + "object", + "metadata" + ] }, "CampaignVoucher": { "type": "object", @@ -7631,9 +7648,12 @@ "description": "Defines the redemption limits on vouchers.", "properties": { "quantity": { - "type": "integer", + "type": [ "integer", "null" ], "description": "How many times a voucher can be redeemed. A `null` value means unlimited." - } + }, + "required": [ + "quantity" + ] } }, "code_config": { @@ -7664,7 +7684,12 @@ "type": "integer", "description": "The initial count" } - } + }, + "required": [ + "length", + "charset", + "pattern" + ] }, "is_referral_code": { "type": "boolean", @@ -7696,7 +7721,13 @@ } } } - } + }, + "required": [ + "type", + "redemption", + "code_config", + "is_referral_code" + ] }, "CampaignLoyaltyCard": { "type": "object", @@ -7726,9 +7757,19 @@ "type": "integer", "description": "Value of rounding" } - } + }, + "required": [ + "period_type", + "period_value", + "rounding_type", + "rounding_value" + ] } - } + }, + "required": [ + "points", + "expiration_rules" + ] }, "2_loyalty_tiers_expiration_balance": { "title": "Balance", @@ -9529,7 +9570,8 @@ "description": "This is an object representing a promotion tier. Promotion tiers are always assigned to a campaign and cannot be used standalone.", "title": "Promotion Tier", "x-tags": [ - "PROMOTIONS API" + "PROMOTIONS API", + "CAMPAIGNS API" ], "properties": { "id": { @@ -9950,7 +9992,7 @@ } } }, - "3_res_list_promotion_tiers_from_campaign": { + "PromotionTiersList": { "type": "object", "description": "Promotion Tiers", "title": "Promotion Tiers", @@ -24066,7 +24108,10 @@ ], "description": "What triggers the tier to be valid for a customer. \n`IMMEDIATE`: After reaching the minimum required points. \n`NEXT_PERIOD`: When the next qualification period starts." } - } + }, + "required": [ + "type" + ] }, "expiration_date": { "type": "object", @@ -24121,9 +24166,18 @@ } } } - } + }, + "required": [ + "type", + "extend" + ] } - } + }, + "required": [ + "qualification_type", + "start_date", + "expiration_date" + ] }, "8_loyalty_tiers_expiration_balance_expiration_date_balance_drop": { "title": "Balance Drop", @@ -47075,7 +47129,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/3_res_list_promotion_tiers_from_campaign" + "$ref": "#/components/schemas/PromotionTiersList" }, "examples": { "Example": { From 52fd360820b07f61ce9c7db68ad6ecb529aa558a Mon Sep 17 00:00:00 2001 From: jkaliszuk Date: Tue, 21 Nov 2023 11:17:45 +0100 Subject: [PATCH 4/9] First iteration of CampaignsCreateRequestBody. --- reference/OpenAPI.json | 155 ++++++++++++++++++++++++----------------- 1 file changed, 92 insertions(+), 63 deletions(-) diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index 0ca5f6d4f..69607d64a 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -7657,39 +7657,7 @@ } }, "code_config": { - "type": "object", - "description": "Defines code's pattern (prefix, suffix, length, charset, etc).", - "properties": { - "length": { - "type": "string", - "description": "Number of characters in a generated code (excluding prefix and postfix)." - }, - "charset": { - "type": "string", - "description": "Characters that can appear in the code. \n\nExamples:\n\n- Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` \n- Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Numbers: `0123456789` \n- Custom: a custom character set" - }, - "prefix": { - "type": "string", - "description": "A text appended before the code." - }, - "postfix": { - "type": "string", - "description": "A text appended after the code." - }, - "pattern": { - "type": "string", - "description": "A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`." - }, - "initial_count": { - "type": "integer", - "description": "The initial count" - } - }, - "required": [ - "length", - "charset", - "pattern" - ] + "$ref": "#/components/schemas/CodeConfig" }, "is_referral_code": { "type": "boolean", @@ -7729,6 +7697,41 @@ "is_referral_code" ] }, + "CodeConfig": { + "type": "object", + "description": "Defines code's pattern (prefix, suffix, length, charset, etc).", + "properties": { + "length": { + "type": "string", + "description": "Number of characters in a generated code (excluding prefix and postfix)." + }, + "charset": { + "type": "string", + "description": "Characters that can appear in the code. \n\nExamples:\n\n- Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` \n- Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Numbers: `0123456789` \n- Custom: a custom character set" + }, + "prefix": { + "type": "string", + "description": "A text appended before the code." + }, + "postfix": { + "type": "string", + "description": "A text appended after the code." + }, + "pattern": { + "type": "string", + "description": "A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`." + }, + "initial_count": { + "type": "integer", + "description": "The initial count" + } + }, + "required": [ + "length", + "charset", + "pattern" + ] + }, "CampaignLoyaltyCard": { "type": "object", "description": "Schema model for a campaign loyalty card.", @@ -7964,31 +7967,10 @@ } } }, - "2_req_create_campaign": { - "title": "Create Campaign Request Body", - "description": "Request body schema for **POST** `/campaigns`.", - "oneOf": [ - { - "$ref": "#/components/schemas/2_req_create_campaign_discount_voucher" - }, - { - "$ref": "#/components/schemas/2_req_create_campaign_loyalty" - }, - { - "$ref": "#/components/schemas/2_req_create_campaign_gift" - }, - { - "$ref": "#/components/schemas/2_req_create_campaign_promotion" - }, - { - "$ref": "#/components/schemas/2_req_create_campaign_referral" - } - ] - }, - "2_req_create_campaign_discount_voucher": { + "CampaignsCreateBase": { "type": "object", - "title": "Discount Campaign", - "description": "Request body schema for creating a discount voucher campaign using **POST** `/campaigns`.", + "title": "Campaign Create Schema Discount Campaign", + "description": "Base body schema for creating a campaign using **POST** `/campaigns`.", "properties": { "name": { "type": "string", @@ -8015,6 +7997,10 @@ "type": "boolean", "description": "If this value is set to `true`, customers will be able to join the campaign only once." }, + "auto_join": { + "type": "boolean", + "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled." + }, "use_voucher_metadata_schema": { "type": "boolean", "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." @@ -8060,6 +8046,14 @@ "type": "string", "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." }, + "validation_rules": { + "type": "array", + "description": "Array containing the ID of the validation rule associated with the promotion tier.", + "items": { + "type": "string" + }, + "maxItems": 1 + }, "category_id": { "type": "string", "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", @@ -8072,12 +8066,47 @@ "metadata": { "type": "object", "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - }, - "voucher": { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_DISCOUNT" } } }, + "CampaignsCreateRequestBody": { + "title": "Create Campaign Request Body", + "description": "Request body schema for **POST** `/campaigns`.", + "oneOf": [ + { + "$ref": "#/components/schemas/CampaignsCreateDiscountType" + }, + { + "$ref": "#/components/schemas/2_req_create_campaign_loyalty" + }, + { + "$ref": "#/components/schemas/2_req_create_campaign_gift" + }, + { + "$ref": "#/components/schemas/2_req_create_campaign_promotion" + }, + { + "$ref": "#/components/schemas/2_req_create_campaign_referral" + } + ] + }, + "CampaignsCreateDiscountType": { + "title": "", + "allOf": [ + { + "$ref": "#/components/schemas/CampaignsCreateBase" + }, + { + "type": "object", + "title": "Loyalty Campaign", + "properties": { + "voucher": { + "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_DISCOUNT" + } + } + } + ] + }, "2_req_create_campaign_loyalty": { "type": "object", "title": "Loyalty Campaign", @@ -9183,7 +9212,7 @@ } } }, - "2_res_list_campaigns": { + "CampaignsListResponseBody": { "type": "object", "description": "Schema model for **GET** `/campaigns`.", "title": "List Campaigns Response Body", @@ -44319,7 +44348,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/2_req_create_campaign" + "$ref": "#/components/schemas/CampaignsCreateRequestBody" }, "examples": { "Discount Campaign": { @@ -45213,7 +45242,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/2_res_list_campaigns" + "$ref": "#/components/schemas/CampaignsListResponseBody" }, "examples": { "Example": { From d4cb9bb2a11a6a8966583060e2fd8958f11842a5 Mon Sep 17 00:00:00 2001 From: jkaliszuk Date: Wed, 22 Nov 2023 16:28:45 +0100 Subject: [PATCH 5/9] Finished Create Campaign endpoint with all properties support. --- .../CAMPAIGNS-API-Campaign-Object.md | 21 +- .../CUSTOMERS-API-Customer-Activity-Object.md | 2 +- reference/OpenAPI.json | 877 +++++++++--------- 3 files changed, 443 insertions(+), 457 deletions(-) diff --git a/docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md b/docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md index bf75fdb8f..6468bec61 100644 --- a/docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md +++ b/docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md @@ -34,7 +34,7 @@ order: 1 | creation_status
`string` |

Indicates the status of the campaign creation.

Available values: `DONE`, `IN_PROGRESS`, `FAILED`, `DRAFT`, `MODIFYING` | | vouchers_generation_status
`string` |

Indicates the status of the campaign's vouchers.

Available values: `DONE`, `IN_PROGRESS`, `FAILED`, `DRAFT`, `MODIFYING` | | protected
`boolean` |

Indicates whether the resource can be deleted.

| -| category_id
`string` |

Unique category ID that this campaign belongs to.

**Example:**

cat_0b688929a2476386a7

| +| category_id
`string,null` |

Unique category ID that this campaign belongs to.

**Example:**

cat_0b688929a2476386a7

| | categories | See: [Category](#category) | | object
`string` |

The type of object represented by JSON. This object stores information about the campaign.

| | referral_program
`object` |

Defines the referee reward and the way a referral is triggered. Context: REFERRAL_PROGRAM.

AttributesDescription
conversion_event_type
string

How a referral is triggered.

Available values: redemption, custom_event
custom_event
object

Contains details about the custom event.

AttributesDescription
id
string

Unique custom event ID.

Example:

ms_fi47Dcu5T0m3v3nT5ch3ma

name
string

Custom event name.

referee_reward
object

Defines the referee reward.

AttributesDescription
related_object_parent
object

Details of the resource from which the reward originates.

AttributesDescription
id
string

Unique ID of the reward source.

name
string

Name of the reward source.

object
string

Type of resource represented by the source of the reward.

type
string

Type of reward.

Available values: LOYALTY_CARD, GIFT_VOUCHER
amount
string

The number of points to add to a loyalty card or credits to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.

| @@ -49,8 +49,8 @@ order: 1 | discount |

Defines the voucher discount type and details.

See: [Discount](#discount) | | gift |

Defines the voucher gift details.

See: [Gift](#gift) | | loyalty_card |

Defines the voucher loyalty card details.

See: [Campaign Loyalty Card](#campaign-loyalty-card) | -| redemption
`object` |

Defines the redemption limits on vouchers.

AttributesDescription
quantity
integer

How many times a voucher can be redeemed. A null value means unlimited.

| -| code_config
`object` |

Defines code's pattern (prefix, suffix, length, charset, etc).

AttributesDescription
length
string

Number of characters in a generated code (excluding prefix and postfix).

charset
string

Characters that can appear in the code.

Examples:

  • Alphanumeric: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Alphabetic: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Alphabetic Lowercase: abcdefghijklmnopqrstuvwxyz
  • Alphabetic Uppercase: ABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Numbers: 0123456789
  • Custom: a custom character set
prefix
string

A text appended before the code.

postfix
string

A text appended after the code.

pattern
string

A pattern for codes where hashes (#) will be replaced with random characters. Overrides length.

initial_count
integer

The initial count

| +| redemption
`object` |

Defines the redemption limits on vouchers.

AttributesDescription
quantity
integer,null

How many times a voucher can be redeemed. A null value means unlimited.

| +| code_config | See: [Schema containing information about config used for voucher](#schema-containing-information-about-config-used-for-voucher) | | is_referral_code
`boolean` |

Indicates whether the voucher is a referral code; this is true for campaign type REFERRAL_PROGRAM.

| | start_date
`string` |

Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is inactive before this date.

**Example:**

2022-09-20T00:00:00.000Z

| | expiration_date
`string` |

Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is inactive after this date.

**Example:**

2022-09-30T00:00:00.000Z

| @@ -112,6 +112,11 @@ Any of: | points
`integer` |

The initial number of points to assign to the loyalty card. This is the current loyalty card score i.e. the number of loyalty points on the card.

| | expiration_rules
`object` |
AttributesDescription
period_type
string

Type of period

period_value
integer

Value of the period

rounding_type
string

Type of rounding

rounding_value
integer

Value of rounding

| +## Schema containing information about config used for voucher +All of: + +1. [Schema containing information about config used for voucher](#schema-containing-information-about-config-used-for-voucher) + ## Promotion Tier | Attributes | Description | |:-----|:--------| @@ -199,6 +204,16 @@ Any of: | effect |

Defines how the discount is applied to the customer's order.

See: [Discount Fixed Vouchers Effect Types](#discount-fixed-vouchers-effect-types) | | is_dynamic
`boolean` |

Flag indicating whether the discount was calculated using a formula.

| +## Schema containing information about config used for voucher +| Attributes | Description | +|:-----|:--------| +| length
`string` |

Number of characters in a generated code (excluding prefix and postfix).

| +| charset
`string` |

Characters that can appear in the code.

Examples:

  • Alphanumeric: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Alphabetic: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Alphabetic Lowercase: abcdefghijklmnopqrstuvwxyz
  • Alphabetic Uppercase: ABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Numbers: 0123456789
  • Custom: a custom character set
| +| prefix
`string` |

A text appended before the code.

| +| postfix
`string` |

A text appended after the code.

| +| pattern
`string` |

A pattern for codes where hashes (#) will be replaced with random characters. Overrides length.

| +| initial_count
`integer` |

The initial count

| + ## Validation Rule Assignments | Attributes | Description | |:-----|:--------| diff --git a/docs/reference-docs/CUSTOMERS-API-Customer-Activity-Object.md b/docs/reference-docs/CUSTOMERS-API-Customer-Activity-Object.md index a440dc4f7..1d7bb6c46 100644 --- a/docs/reference-docs/CUSTOMERS-API-Customer-Activity-Object.md +++ b/docs/reference-docs/CUSTOMERS-API-Customer-Activity-Object.md @@ -791,7 +791,7 @@ All of: |:-----|:--------| | conversion_event_type
`string` |

Define how a referral is triggered.

Available values: `redemption`, `custom_event` | | custom_event
`object` |

Contains details about the custom event.

AttributesDescription
id
string

Unique custom event ID.

Example:

ms_Ll9enAm2BCN0M1s4VxWobLFM

name
string

Custom event name.

| -| referee_reward
`object` |

Defines the referee reward.

AttributesDescription
related_object_parent
object

Details of the resource from which the reward originates.

AttributesDescription
id
string

Unique ID of the reward source.

Example:

camp_kdxp3vf1clQ9CFs1jpqv3tZe

name
string

Name of the reward source.

object
string

Type of resource represented by the source of the reward.

Available values: CAMPAIGN
type
string

Type of reward.

Available values: LOYALTY_CARD, GIFT_VOUCHER
amount
string

Define the number of points to add to a loyalty card or credits to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.

| +| referee_reward
`object` |

Defines the referee reward.

AttributesDescription
related_object_parent
object

Details of the resource from which the reward originates.

AttributesDescription
id
string

Unique ID of the reward source.

Example:

camp_kdxp3vf1clQ9CFs1jpqv3tZe

name
string

Name of the reward source.

object
string

Type of resource represented by the source of the reward.

Available values: CAMPAIGN
type
string

Type of reward.

Available values: DISCOUNT_VOUCHER, LOYALTY_CARD, GIFT_VOUCHER, LUCKY_DRAW_CODE
amount
string

Define the number of points to add to a loyalty card or credits to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.

| ## Gift | Attributes | Description | diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index 69607d64a..11d5ad2c7 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -7640,7 +7640,7 @@ "description": "Defines the voucher gift details." }, "loyalty_card": { - "$ref": "#/components/schemas/CampaignLoyaltyCard", + "$ref": "#/components/schemas/CampaignLoyaltyCardResponse", "description": "Defines the voucher loyalty card details." }, "redemption": { @@ -7650,14 +7650,14 @@ "quantity": { "type": [ "integer", "null" ], "description": "How many times a voucher can be redeemed. A `null` value means unlimited." - }, - "required": [ - "quantity" - ] - } + } + }, + "required": [ + "quantity" + ] }, "code_config": { - "$ref": "#/components/schemas/CodeConfig" + "$ref": "#/components/schemas/CodeConfigResponse" }, "is_referral_code": { "type": "boolean", @@ -7698,6 +7698,7 @@ ] }, "CodeConfig": { + "title": "Schema containing information about config used for voucher", "type": "object", "description": "Defines code's pattern (prefix, suffix, length, charset, etc).", "properties": { @@ -7725,14 +7726,22 @@ "type": "integer", "description": "The initial count" } - }, + } + }, + "CodeConfigResponse": { + "title": "Schema containing information about config used for voucher", + "allOf": [ + { + "$ref": "#/components/schemas/CodeConfig" + } + ], "required": [ "length", "charset", "pattern" ] }, - "CampaignLoyaltyCard": { + "CampaignLoyaltyCardResponse": { "type": "object", "description": "Schema model for a campaign loyalty card.", "title": "Campaign Loyalty Card", @@ -7769,11 +7778,48 @@ ] } }, - "required": [ - "points", - "expiration_rules" + "required": [ + "points" ] }, + "CampaignLoyaltyCardRequestBody": { + "type": "object", + "description": "Schema representing request body model for a campaign loyalty card.", + "title": "Campaign Loyalty Card", + "properties": { + "points": { + "type": ["integer", "null" ], + "description": "The initial number of points to assign to the loyalty card. This is the current loyalty card score i.e. the number of loyalty points on the card." + }, + "expiration_rules": { + "type": "object", + "properties": { + "period_type": { + "type": "string", + "description": "Type of period" + }, + "period_value": { + "type": "integer", + "description": "Value of the period" + }, + "rounding_type": { + "type": "string", + "description": "Type of rounding" + }, + "rounding_value": { + "type": "integer", + "description": "Value of rounding" + } + }, + "required": [ + "period_type", + "period_value", + "rounding_type", + "rounding_value" + ] + } + } + }, "2_loyalty_tiers_expiration_balance": { "title": "Balance", "type": "object", @@ -7967,9 +8013,29 @@ } } }, + "LuckyDraw": { + "type": "object", + "title": "Lucky Draw", + "description": "Object for defining detailed information about lucky draw should be applied", + "properties": { + "winners_count": { + "description": "It represents the total number of winners in a lucky draw.", + "minimum": 1, + "type": ["string", "integer"] + }, + "unique_winners_per_draw" : { + "description": "It indicates whether each winner in a draw is unique or not.", + "type": ["string", "boolean"] + }, + "unique_winners": { + "description": "Specifies whether each participant can win only once across multiple draws.", + "type": ["string", "boolean"] + } + } + }, "CampaignsCreateBase": { "type": "object", - "title": "Campaign Create Schema Discount Campaign", + "title": "Campaign Create Schema Base", "description": "Base body schema for creating a campaign using **POST** `/campaigns`.", "properties": { "name": { @@ -8046,6 +8112,12 @@ "type": "string", "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." }, + "referral_program": { + "$ref": "#/components/schemas/ReferralProgram" + }, + "lucky_draw": { + "$ref": "#/components/schemas/LuckyDraw" + }, "validation_rules": { "type": "array", "description": "Array containing the ID of the validation rule associated with the promotion tier.", @@ -8074,502 +8146,129 @@ "description": "Request body schema for **POST** `/campaigns`.", "oneOf": [ { - "$ref": "#/components/schemas/CampaignsCreateDiscountType" + "$ref": "#/components/schemas/CampaignsCreateDiscountVoucherType" + }, + { + "$ref": "#/components/schemas/CampaignsCreateReferralProgramType" }, { - "$ref": "#/components/schemas/2_req_create_campaign_loyalty" + "$ref": "#/components/schemas/CampaignsCreateGiftType" }, { - "$ref": "#/components/schemas/2_req_create_campaign_gift" + "$ref": "#/components/schemas/CampaignsCreateLoyalty" }, { - "$ref": "#/components/schemas/2_req_create_campaign_promotion" + "$ref": "#/components/schemas/CampaignsCreatePromotion" }, { - "$ref": "#/components/schemas/2_req_create_campaign_referral" + "$ref": "#/components/schemas/CampaignsCreateGiveawayType" } ] }, - "CampaignsCreateDiscountType": { - "title": "", + "CampaignsCreateDiscountVoucherType": { + "title": "Campaign Create Schema for Discount Coupons Campaign", "allOf": [ { "$ref": "#/components/schemas/CampaignsCreateBase" }, { "type": "object", - "title": "Loyalty Campaign", + "title": "Schema that contains unique properties for Discount Coupons Campaign", "properties": { "voucher": { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_DISCOUNT" + "$ref": "#/components/schemas/DiscountCouponsCampaignVoucher" } } } ] }, - "2_req_create_campaign_loyalty": { - "type": "object", - "title": "Loyalty Campaign", - "description": "Request body schema for creating a loyalty campaign using **POST** `/campaigns`.", - "properties": { - "name": { - "type": "string", - "description": "Campaign name." - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "campaign_type": { - "type": "string", - "default": "LOYALTY_PROGRAM", - "description": "Type of campaign." - }, - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "auto_join": { - "type": "boolean", - "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. CONTEXT: `LOYALTY_PROGRAM`." - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "use_voucher_metadata_schema": { - "type": "boolean", - "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." - }, - "vouchers_count": { - "type": "integer", - "description": "Total number of unique vouchers in campaign (size of campaign)." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" + "CampaignsCreateReferralProgramType": { + "title": "Campaign Create Schema for Referral Program", + "allOf": [ + { + "$ref": "#/components/schemas/CampaignsCreateBase" }, - "validity_timeframe": { + { "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "title": "Schema that contains unique properties for Referral Program", "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." + "voucher": { + "$ref": "#/components/schemas/ReferralProgramVoucher" } } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", - "example": "cat_0b688929a2476386a7" - }, - "category": { - "type": "string", - "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - }, - "voucher": { - "$ref": "#/components/schemas/2_req_campaign_object_voucher_object_LOYALTY_CARD" } - } + ] }, - "2_req_create_campaign_gift": { - "type": "object", - "title": "Gift Card campaign", - "description": "Request body schema for creating a gift card campaign using **POST** `/campaigns`.", - "properties": { - "name": { - "type": "string", - "description": "Campaign name." - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "campaign_type": { - "type": "string", - "default": "GIFT_VOUCHERS", - "description": "Type of campaign." - }, - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "use_voucher_metadata_schema": { - "type": "boolean", - "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." - }, - "vouchers_count": { - "type": "integer", - "description": "Total number of unique vouchers in campaign (size of campaign)." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" + "CampaignsCreateGiftType": { + "title": "Campaign Create Schema for Gift Campaign", + "allOf": [ + { + "$ref": "#/components/schemas/CampaignsCreateBase" }, - "validity_timeframe": { + { "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "title": "Schema that contains unique properties for Gift Campaign", "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." + "voucher": { + "$ref": "#/components/schemas/GiftCampaignVoucher" } } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", - "example": "cat_0b688929a2476386a7" - }, - "category": { - "type": "string", - "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - }, - "voucher": { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_GIFT_CARD" } - } + ] }, - "2_req_create_campaign_referral": { - "type": "object", - "title": "Referral Campaign", - "description": "Request body schema for creating a referral campaign using **POST** `/campaigns`.", - "properties": { - "name": { - "type": "string", - "description": "Campaign name." - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "campaign_type": { - "type": "string", - "default": "REFERRAL_PROGRAM", - "description": "Type of campaign." - }, - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "use_voucher_metadata_schema": { - "type": "boolean", - "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." - }, - "vouchers_count": { - "type": "integer", - "description": "Total number of unique vouchers in campaign (size of campaign)." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" + "CampaignsCreateLoyalty": { + "title": "Campaign Create Schema for Loyalty Campaign", + "allOf": [ + { + "$ref": "#/components/schemas/CampaignsCreateBase" }, - "validity_timeframe": { + { "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "title": "Schema that contains unique properties for Loyalty Campaign", "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." + "voucher": { + "$ref": "#/components/schemas/LoyaltyCampaignVoucher" } } + } + ] + }, + "CampaignsCreatePromotion": { + "title": "Campaign Create Schema for Promotion Campaign", + "allOf": [ + { + "$ref": "#/components/schemas/CampaignsCreateBase" }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", - "example": "cat_0b688929a2476386a7" - }, - "category": { - "type": "string", - "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - }, - "voucher": { - "anyOf": [ - { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_DISCOUNT" - }, - { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_GIFT_CARD" - }, - { - "$ref": "#/components/schemas/2_req_campaign_object_voucher_object_LOYALTY_CARD" - } - ] - }, - "referral_program": { - "description": "Defines the referee reward and the way a referral is triggered. Context: `REFERRAL_PROGRAM`.", + { "type": "object", + "title": "Schema that contains unique properties for Promotion Campaign", "properties": { - "conversion_event_type": { - "type": "string", - "enum": [ - "redemption", - "custom_event" - ], - "description": "Define how a referral is triggered." - }, - "custom_event": { - "type": "object", - "description": "Contains details about the custom event.", - "properties": { - "id": { - "type": "string", - "example": "ms_Ll9enAm2BCN0M1s4VxWobLFM", - "description": "Unique custom event ID." - }, - "name": { - "type": "string", - "description": "Custom event name." - } - } - }, - "referee_reward": { - "type": "object", - "description": "Defines the referee reward.", - "properties": { - "related_object_parent": { - "type": "object", - "description": "Details of the resource from which the reward originates.", - "properties": { - "id": { - "type": "string", - "example": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", - "description": "Unique ID of the reward source." - }, - "name": { - "type": "string", - "description": "Name of the reward source." - }, - "object": { - "type": "string", - "enum": [ - "CAMPAIGN" - ], - "description": "Type of resource represented by the source of the reward." - } - } - }, - "type": { - "type": "string", - "enum": [ - "LOYALTY_CARD", - "GIFT_VOUCHER" - ], - "description": "Type of reward." - }, - "amount": { - "type": "string", - "description": "Define the number of `points` to add to a loyalty card or `credits` to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - } + "promotion": { + "type": [ "array", "null" ], + "items": { + "$ref": "#/components/schemas/PromotionTierCreateParams" } } } } - } + ] }, - "2_req_create_campaign_promotion": { - "type": "object", - "title": "Promotion", - "description": "Request body schema for creating a promotions campaign using **POST** `/campaigns`.", - "properties": { - "name": { - "type": "string", - "description": "Campaign name." - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "campaign_type": { - "type": "string", - "default": "PROMOTION", - "description": "Type of campaign." - }, - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "use_voucher_metadata_schema": { - "type": "boolean", - "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." - }, - "vouchers_count": { - "type": "integer", - "description": "Total number of unique vouchers in campaign (size of campaign)." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", - "example": "cat_0b688929a2476386a7" - }, - "category": { - "type": "string", - "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." + "CampaignsCreateGiveawayType": { + "title": "Campaign Create Schema for Giveaway Campaign", + "allOf": [ + { + "$ref": "#/components/schemas/CampaignsCreateBase" }, - "promotion": { + { "type": "object", - "description": "Define the promotion tiers within the campaign.", + "title": "Schema that contains unique properties for Giveaway Campaign", "properties": { - "tiers": { - "type": "array", - "items": { - "$ref": "#/components/schemas/3_req_add_promotion_tier_to_campaign" - } + "voucher": { + "$ref": "#/components/schemas/GiveawayCampaignVoucher" } } } - } + ] }, "2_req_update_campaign": { "type": "object", @@ -9240,6 +8939,184 @@ } } }, + "DiscountCouponsCampaignVoucher": { + "title": "Object representing voucher property for Discount Coupons Campaign", + "properties": { + "type": { + "type": "string", + "default": "DISCOUNT_VOUCHER", + "description": "Type of voucher.", + "enum": [ + "DISCOUNT_VOUCHER" + ] + }, + "discount": { + "$ref": "#/components/schemas/Discount" + }, + "code_config": { + "$ref": "#/components/schemas/CodeConfig" + }, + "redemption": { + "type": "object", + "description": "Defines the redemption limits on vouchers.", + "properties": { + "quantity": { + "type": [ "integer", "null" ], + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + } + } + } + }, + "required": [ + "type", + "discount" + ] + }, + "ReferralProgramVoucher": { + "title": "Object representing voucher property for Referal Program", + "properties": { + "type": { + "type": "string", + "default": "DISCOUNT_VOUCHER", + "description": "Type of voucher.", + "enum": [ + "DISCOUNT_VOUCHER" + ] + }, + "discount": { + "$ref": "#/components/schemas/Discount" + }, + "code_config": { + "$ref": "#/components/schemas/CodeConfig" + }, + "redemption": { + "type": "object", + "description": "Defines the redemption limits on vouchers.", + "properties": { + "quantity": { + "type": [ "integer", "null" ], + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + } + } + }, + "is_referral_code": { + "type": "boolean", + "description": "Indicates whether the voucher is a referral code; this is `true` for campaign type `REFERRAL_PROGRAM`." + } + }, + "required": [ + "type", + "discount", + "is_referral_code" + ] + }, + "GiveawayCampaignVoucher": { + "title": "Object representing voucher property for Giveaway Campaign", + "properties": { + "type": { + "type": "string", + "default": "DISCOUNT_VOUCHER", + "description": "Type of voucher.", + "enum": [ + "DISCOUNT_VOUCHER" + ] + }, + "discount": { + "$ref": "#/components/schemas/Discount" + }, + "code_config": { + "$ref": "#/components/schemas/CodeConfig" + }, + "redemption": { + "type": "object", + "description": "Defines the redemption limits on vouchers.", + "properties": { + "quantity": { + "type": [ "integer", "null" ], + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + } + } + }, + "is_referral_code": { + "type": "boolean", + "description": "Indicates whether the voucher is a referral code; this is `true` for campaign type `REFERRAL_PROGRAM`." + } + }, + "required": [ + "type", + "discount" + ] + }, + "GiftCampaignVoucher": { + "type": "object", + "description": "Schema model for a discount voucher.", + "title": "Discount Voucher", + "properties": { + "type": { + "type": "string", + "default": "GIFT_VOUCHER", + "description": "Type of voucher.", + "enum": [ + "GIFT_VOUCHER" + ] + }, + "gift": { + "$ref": "#/components/schemas/Gift" + }, + "redemption": { + "type": "object", + "description": "Defines the redemption limits on vouchers.", + "properties": { + "quantity": { + "type": [ "integer", "null" ], + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + } + } + }, + "code_config": { + "$ref": "#/components/schemas/CodeConfig" + } + }, + "required": [ + "type", + "gift" + ] + }, + "LoyaltyCampaignVoucher": { + "type": "object", + "description": "Schema model for a discount voucher.", + "title": "Discount Voucher", + "properties": { + "type": { + "type": "string", + "default": "LOYALTY_CARD", + "description": "Type of voucher.", + "enum": [ + "LOYALTY_CARD" + ] + }, + "loyalty_card": { + "$ref": "#/components/schemas/CampaignLoyaltyCardRequestBody" + }, + "redemption": { + "type": "object", + "description": "Defines the redemption limits on vouchers.", + "properties": { + "quantity": { + "type": [ "integer", "null" ], + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + } + } + }, + "code_config": { + "$ref": "#/components/schemas/CodeConfig" + } + }, + "required": [ + "type", + "loyalty_card" + ] + }, "2_obj_campaign_object_voucher_object_DISCOUNT": { "type": "object", "description": "Schema model for a discount voucher.", @@ -9798,6 +9675,98 @@ } } }, + "PromotionTierCreateParams": { + "type": "object", + "description": "This is an object representing a promotion tier create params. Promotion tiers are always assigned to a campaign and cannot be used standalone.", + "title": "Promotion Tier", + "x-tags": [ + "PROMOTIONS API", + "CAMPAIGNS API" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the promotion tier." + }, + "banner": { + "type": "string", + "description": "Text to be displayed to your customers on your website." + }, + "action": { + "type": "object", + "description": "Contains details about the discount applied by the promotion tier.", + "properties": { + "discount": { + "$ref": "#/components/schemas/Discount" + } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format." + }, + "validation_rules": { + "type": "array", + "description": "Array containing the ID of the validation rule associated with the promotion tier.", + "items": { + "type": "string" + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* promotion tier\n- `false` indicates an *inactive* promotion tier" + }, + "hierarchy": { + "type": "integer", + "description": "The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy." + }, + "start_date": { + "type": "string", + "description": "Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. ", + "format": "date-time", + "example": "2022-09-23T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "description": "Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. ", + "format": "date-time", + "example": "2022-09-26T00:00:00.000Z" + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the promotion tier is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a promotion tier with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the promotion tier will be active in ISO 8601 format. For example, a promotion tier with a `duration` of `P1D` will be valid for a duration of one day." + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the promotion tier is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "category": { + "type": "string", + "description": "Assign category to the promotion tier." + }, + "category_id": { + "type": "string", + "description": "Instead of using the category name, you can alternatively assign a new category to a promotion tier using a unique category ID, i.e. `cat_0c9da30e7116ba6bba`.", + "example": "cat_0c9da30e7116ba6bba" + } + }, + "required": [ + "name" + ] + }, "3_req_add_promotion_tier_to_campaign": { "type": "object", "description": "Request body schema for creating a promotion tier within a campaign in **POST** `/promotions/{campaignId}/tiers`.", @@ -25356,8 +25325,10 @@ "type": { "type": "string", "enum": [ + "DISCOUNT_VOUCHER", "LOYALTY_CARD", - "GIFT_VOUCHER" + "GIFT_VOUCHER", + "LUCKY_DRAW_CODE" ], "description": "Type of reward." }, From 68bc9e903f0fcc2db6a731a65f23214bb4cd0031 Mon Sep 17 00:00:00 2001 From: jkaliszuk Date: Thu, 23 Nov 2023 17:12:56 +0100 Subject: [PATCH 6/9] Adding vouchers to campaigns and update campaign endpoints. --- reference/OpenAPI.json | 590 ++++++++++++++++++++++++++--------------- 1 file changed, 372 insertions(+), 218 deletions(-) diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index 11d5ad2c7..5a2d738d8 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -7741,6 +7741,20 @@ "pattern" ] }, + "CampaigngsImportVoucherLoyaltyCard": { + "type": "object", + "description": "Schema model for a campaign loyalty card.", + "title": "Campaign Loyalty Card", + "properties": { + "points": { + "type": "integer", + "description": "The initial number of points to assign to the loyalty card. This is the current loyalty card score i.e. the number of loyalty points on the card." + } + }, + "required": [ + "points" + ] + }, "CampaignLoyaltyCardResponse": { "type": "object", "description": "Schema model for a campaign loyalty card.", @@ -8115,9 +8129,6 @@ "referral_program": { "$ref": "#/components/schemas/ReferralProgram" }, - "lucky_draw": { - "$ref": "#/components/schemas/LuckyDraw" - }, "validation_rules": { "type": "array", "description": "Array containing the ID of the validation rule associated with the promotion tier.", @@ -8141,32 +8152,269 @@ } } }, + "CampaignsUpdateBase": { + "type": "object", + "title": "Campaign Update Schema Base", + "description": "Base body schema for creating a campaign using **PUT** `/campaigns`.", + "properties": { + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "description": { + "type": "string", + "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." + }, + "category": { + "type": "string", + "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." + }, + "unset_metadata_fields": { + "type": [ "array", "null" ], + "description": "Determine which metadata should be removed from campaign.", + "items": { + "type": "string" + } + }, + "category_id": { + "type": "string", + "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", + "example": "cat_0b688929a2476386a7" + } + } + }, + "CampaignsUpdateCouponCampaignBase": { + "type": "object", + "title": "Update Coupon Campaign Schema Base", + "description": "Base body schema for updating a campaign which contains coupon codes using **PUT** `/campaigns`.", + "allOf": [ + { + "$ref": "#/components/schemas/CampaignsUpdateBase" + }, + { + "type": "object", + "title": "", + "properties": { + "activity_duration_after_publishing": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." + }, + "join_once": { + "type": "boolean", + "description": "If this value is set to `true`, customers will be able to join the campaign only once." + }, + "auto_join": { + "type": "boolean", + "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled." + }, + "type": { + "type": "string", + "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", + "enum": [ + "AUTO_UPDATE", + "STATIC" + ] + } + } + } + ] + }, + "CampaignsUpdateDiscountCouponsCampaign": { + "type": "object", + "title": "Update Discount Coupons Campaign", + "allOf": [ + { + "$ref": "#/components/schemas/CampaignsUpdateCouponCampaignBase" + }, + { + "type": "object", + "title": "Properties For Discount Coupons Campaign", + "description": "Body schema for update a campaign of discount coupons type using **PUT** `/campaigns`.", + "properties": { + "discount": { + "$ref": "#/components/schemas/Discount", + "description": "Defines the voucher discount type and details." + } + } + } + ] + }, + "CampaignsUpdateGiftCampaign": { + "type": "object", + "title": "Update Gift Campaign", + "allOf": [ + { + "$ref": "#/components/schemas/CampaignsUpdateCouponCampaignBase" + }, + { + "type": "object", + "title": "Properties For Gift Campaign", + "description": "Body schema for update a campaign of give type using **PUT** `/campaigns`.", + "properties": { + "gift": { + "$ref": "#/components/schemas/Gift", + "description": "Defines the voucher gift details." + } + } + } + ] + }, + "CampaignsUpdateReferralCampaign": { + "type": "object", + "title": "Update Referral Campaign", + "allOf": [ + { + "$ref": "#/components/schemas/CampaignsUpdateCouponCampaignBase" + }, + { + "type": "object", + "title": "Properties For Referral Campaign", + "description": "Body schema for update a campaign of referral type using **PUT** `/campaigns`.", + "properties": { + "discount": { + "$ref": "#/components/schemas/Discount", + "description": "Defines the voucher discount type and details." + }, + "referral_program": { + "$ref": "#/components/schemas/ReferralProgram" + } + } + } + ] + }, + "CampaignsUpdateLoyaltyCampaign": { + "type": "object", + "title": "Update Loyalty Campaign", + "allOf": [ + { + "$ref": "#/components/schemas/CampaignsUpdateCouponCampaignBase" + }, + { + "type": "object", + "title": "Properties For Loyalty Campaign", + "description": "Body schema for update a campaign of loyalty type using **PUT** `/campaigns`.", + "properties": { + "loyalty_tiers_expiration": { + "$ref": "#/components/schemas/LoyaltyTiersExpirationAll" + }, + "options": { + "type": "object", + "properties": { + "recalculate_tiers" : { + "type": "boolean", + "description" : "Determine if tiers should be recalculated or no." + } + } + } + } + } + ] + }, + "CampaignsUpdateGiveawayCampaign": { + "type": "object", + "title": "Update Giveaway Campaign", + "allOf": [ + { + "$ref": "#/components/schemas/CampaignsUpdateCouponCampaignBase" + }, + { + "type": "object", + "title": "Properties For Giveaway Campaign", + "description": "Body schema for update a campaign of giveaway type using **PUT** `/campaigns`.", + "$ref": "#/components/schemas/LuckyDraw" + } + ] + }, + "CampaignsUpdatePromotionCampaign": { + "type": "object", + "title": "Update Promotion Campaign", + "$ref": "#/components/schemas/CampaignsUpdateBase" + }, "CampaignsCreateRequestBody": { + "type": "object", "title": "Create Campaign Request Body", "description": "Request body schema for **POST** `/campaigns`.", "oneOf": [ { - "$ref": "#/components/schemas/CampaignsCreateDiscountVoucherType" + "$ref": "#/components/schemas/CampaignsCreateDiscountCouponsCampaign" }, { - "$ref": "#/components/schemas/CampaignsCreateReferralProgramType" + "$ref": "#/components/schemas/CampaignsCreateReferralCampaign" }, { - "$ref": "#/components/schemas/CampaignsCreateGiftType" + "$ref": "#/components/schemas/CampaignsCreateGiftCampaign" }, { - "$ref": "#/components/schemas/CampaignsCreateLoyalty" + "$ref": "#/components/schemas/CampaignsCreateLoyaltyCampaign" }, { - "$ref": "#/components/schemas/CampaignsCreatePromotion" + "$ref": "#/components/schemas/CampaignsCreatePromotionCampaign" }, { - "$ref": "#/components/schemas/CampaignsCreateGiveawayType" + "$ref": "#/components/schemas/CampaignsCreateGiveawayCampaign" } ] }, - "CampaignsCreateDiscountVoucherType": { - "title": "Campaign Create Schema for Discount Coupons Campaign", + "CampaignsUpdateRequestBody": { + "type": "object", + "title": "Update Campaign Request Body", + "description": "Request body schema for **PUT** `/campaigns/{campaignId}`.", + "oneOf": [ + { + "$ref": "#/components/schemas/CampaignsUpdateDiscountCouponsCampaign" + }, + { + "$ref": "#/components/schemas/CampaignsUpdateReferralCampaign" + }, + { + "$ref": "#/components/schemas/CampaignsUpdateGiftCampaign" + }, + { + "$ref": "#/components/schemas/CampaignsUpdateLoyaltyCampaign" + }, + { + "$ref": "#/components/schemas/CampaignsUpdatePromotionCampaign" + }, + { + "$ref": "#/components/schemas/CampaignsUpdateGiveawayCampaign" + } + ] + }, + "CampaignsCreateDiscountCouponsCampaign": { + "title": "Create Schema for Discount Coupons Campaign", "allOf": [ { "$ref": "#/components/schemas/CampaignsCreateBase" @@ -8174,6 +8422,7 @@ { "type": "object", "title": "Schema that contains unique properties for Discount Coupons Campaign", + "description": "Body schema for creating a campaign of discount coupons type using **POST** `/campaigns`.", "properties": { "voucher": { "$ref": "#/components/schemas/DiscountCouponsCampaignVoucher" @@ -8182,8 +8431,8 @@ } ] }, - "CampaignsCreateReferralProgramType": { - "title": "Campaign Create Schema for Referral Program", + "CampaignsCreateReferralCampaign": { + "title": "Create Schema for Referral Program", "allOf": [ { "$ref": "#/components/schemas/CampaignsCreateBase" @@ -8191,16 +8440,17 @@ { "type": "object", "title": "Schema that contains unique properties for Referral Program", + "description": "Body schema for creating a campaign of referral type using **POST** `/campaigns`.", "properties": { "voucher": { - "$ref": "#/components/schemas/ReferralProgramVoucher" + "$ref": "#/components/schemas/ReferralCampaignVoucher" } } } ] }, - "CampaignsCreateGiftType": { - "title": "Campaign Create Schema for Gift Campaign", + "CampaignsCreateGiftCampaign": { + "title": "Create Schema for Gift Campaign", "allOf": [ { "$ref": "#/components/schemas/CampaignsCreateBase" @@ -8208,6 +8458,7 @@ { "type": "object", "title": "Schema that contains unique properties for Gift Campaign", + "description": "Body schema for creating a campaign of gift type using **POST** `/campaigns`.", "properties": { "voucher": { "$ref": "#/components/schemas/GiftCampaignVoucher" @@ -8216,8 +8467,8 @@ } ] }, - "CampaignsCreateLoyalty": { - "title": "Campaign Create Schema for Loyalty Campaign", + "CampaignsCreateLoyaltyCampaign": { + "title": "Create Schema for Loyalty Campaign", "allOf": [ { "$ref": "#/components/schemas/CampaignsCreateBase" @@ -8225,6 +8476,7 @@ { "type": "object", "title": "Schema that contains unique properties for Loyalty Campaign", + "description": "Body schema for creating a campaign of loyalty type using **POST** `/campaigns`.", "properties": { "voucher": { "$ref": "#/components/schemas/LoyaltyCampaignVoucher" @@ -8233,8 +8485,8 @@ } ] }, - "CampaignsCreatePromotion": { - "title": "Campaign Create Schema for Promotion Campaign", + "CampaignsCreatePromotionCampaign": { + "title": "Create Schema for Promotion Campaign", "allOf": [ { "$ref": "#/components/schemas/CampaignsCreateBase" @@ -8242,6 +8494,7 @@ { "type": "object", "title": "Schema that contains unique properties for Promotion Campaign", + "description": "Body schema for creating a campaign of promotion type using **POST** `/campaigns`.", "properties": { "promotion": { "type": [ "array", "null" ], @@ -8253,8 +8506,8 @@ } ] }, - "CampaignsCreateGiveawayType": { - "title": "Campaign Create Schema for Giveaway Campaign", + "CampaignsCreateGiveawayCampaign": { + "title": "Create Schema for Giveaway Campaign", "allOf": [ { "$ref": "#/components/schemas/CampaignsCreateBase" @@ -8262,116 +8515,44 @@ { "type": "object", "title": "Schema that contains unique properties for Giveaway Campaign", + "description": "Body schema for creating a campaign of giveaway type using **POST** `/campaigns`.", "properties": { "voucher": { "$ref": "#/components/schemas/GiveawayCampaignVoucher" + }, + "lucky_draw": { + "$ref": "#/components/schemas/LuckyDraw" } } } ] }, - "2_req_update_campaign": { + "CampaignsCreateCampaignVoucherWithCodeRequestBody": { "type": "object", - "title": "Update Campaign Request Body", - "description": "Request body schema for **PUT** `/campaigns/{campaignId}`.", - "properties": { - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "auto_join": { - "type": "boolean", - "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled." - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "validity_timeframe": { + "title": "Add Voucher With Code To Campaign Request Body", + "allOf": [ + { "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { + "code": { "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." + "description": "Unique custom voucher code." } } }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to. Either pass this parameter or the `category` parameter.", - "example": "cat_0b688929a2476386a7" - }, - "category": { - "type": "string", - "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id` parameter." + { + "$ref": "#/components/schemas/CampaignsCreateCampaignVoucherRequestBody" } - } + ] }, - "2_req_add_vouchers_to_campaign": { + "CampaignsCreateCampaignVoucherRequestBody": { "type": "object", - "title": "Add Vouchers to Campaign Request Body", + "title": "Add Voucher To Campaign Request Body", "description": "Request body schema for **POST** `/campaigns/{campaignId}/vouchers`.", "properties": { - "category_id": { - "type": "string", - "description": "Unique category ID that you would like to assign to the voucher.", - "example": "cat_0b688929a2476386a7" - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { + "category": { "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* voucher\n- `false` indicates an *inactive* voucher" + "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." }, "metadata": { "type": "object", @@ -8387,35 +8568,24 @@ } } }, + "code_config": { + "$ref": "#/components/schemas/CodeConfig" + }, "additional_info": { "type": "string", "description": "An optional field to keep any extra textual information about the code such as a code description and details." }, - "code_config": { - "type": "object", - "description": "Defines code's pattern (prefix, suffix, length, charset, etc). ", - "properties": { - "length": { - "type": "string", - "description": "Number of characters in a generated code (excluding prefix and postfix)." - }, - "charset": { - "type": "string", - "description": "Characters that can appear in the code. \n\nExamples:\n\n- Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` \n- Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Numbers: `0123456789` \n- Custom: a custom character set" - }, - "prefix": { - "type": "string", - "description": "A text appended before the code." - }, - "postfix": { - "type": "string", - "description": "A text appended after the code." - }, - "pattern": { - "type": "string", - "description": "A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`." - } - } + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" } } }, @@ -8465,15 +8635,15 @@ } } }, - "2_req_import_vouchers_to_campaign": { + "CampaignsImportVoucherRequestBody": { "type": "array", "title": "Import Vouchers to Campaign Request Body", "description": "Request body schema for **POST** `/campaigns/{campaignId}/import`.", "items": { - "$ref": "#/components/schemas/2_obj_import_vouchers_to_campaign_object" + "$ref": "#/components/schemas/CampaignsImportVoucherItem" } }, - "2_obj_import_vouchers_to_campaign_object": { + "CampaignsImportVoucherItem": { "type": "object", "title": "Import Vouchers to Campaign", "description": "Import Vouchers to Campaign", @@ -8482,14 +8652,25 @@ "type": "string", "description": "Unique custom voucher code." }, - "category_id": { + "type": { "type": "string", - "description": "Unique category ID that you would like to assign to the voucher. Either pass this parameter OR the `category`.", - "example": "cat_0b688929a2476386a7" + "description": "Type of voucher.", + "enum": [ + "DISCOUNT_VOUCHER", + "GIFT_VOUCHER", + "LOYALTY_CARD", + "LUCKY_DRAW_CODE" + ] }, - "category": { - "type": "string", - "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." + "redemption": { + "type": "object", + "description": "Stores the quantity of redemptions that can be applied to the voucher.", + "properties": { + "quantity": { + "type": "integer", + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + } + } }, "active": { "type": "boolean", @@ -8499,39 +8680,52 @@ "type": "object", "description": "The metadata object stores all custom attributes assigned to the voucher. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." }, - "redemption": { + "category": { + "type": "string", + "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "validity_timeframe": { "type": "object", - "description": "Stores the quantity of redemptions that can be applied to the voucher.", + "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", "properties": { - "quantity": { - "type": "integer", - "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." } } }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, "additional_info": { "type": "string", "description": "An optional field to keep any extra textual information about the code such as a code description and details." }, - "loyalty_card": { - "type": "object", - "description": " Assign an initial points balance for a loyalty card. Context: `LOYALTY_PROGRAM`.", - "properties": { - "points": { - "type": "integer", - "description": "The initial number of points to assign to the loyalty card. This is the current loyalty card score i.e. the number of loyalty points on the card." - } - } + "discount": { + "$ref": "#/components/schemas/Discount", + "description": "Defines the voucher discount type and details." }, "gift": { - "type": "object", - "description": "Assign an initial cash balance for a gift card. Context: `GIFT_VOUCHERS`.", - "properties": { - "amount": { - "type": "integer", - "description": "The cash balance to assign to the gift card. This is the current gift card balance." - } - } + "$ref": "#/components/schemas/Gift", + "description": "Defines the voucher gift details." + }, + "loyalty_card": { + "$ref": "#/components/schemas/CampaigngsImportVoucherLoyaltyCard", + "description": "Defines the voucher loyalty card details." } }, "required": [ @@ -8972,7 +9166,7 @@ "discount" ] }, - "ReferralProgramVoucher": { + "ReferralCampaignVoucher": { "title": "Object representing voucher property for Referal Program", "properties": { "type": { @@ -39565,45 +39759,6 @@ } } }, - "e_409_duplicate_found": { - "title": "Duplicated Resource", - "type": "object", - "description": "Error: Conflict → Duplicated resource found", - "properties": { - "code": { - "type": "integer", - "default": 409, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "duplicate_found", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Duplicated resource found", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0aa36e570e44cb3bdd", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - }, - "resource_id": { - "type": "string", - "description": "Name or ID of the resource that already exists." - }, - "resource_type": { - "type": "string", - "description": "Specifies the type of resource that already exists." - } - } - }, "e_400_duplicate_key": { "title": "Duplicated Key", "type": "object", @@ -42429,7 +42584,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/e_409_duplicate_found" + "$ref": "#/components/schemas/Error" }, "examples": { "Duplicate Code": { @@ -45140,7 +45295,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/e_409_duplicate_found" + "$ref": "#/components/schemas/Error" }, "examples": { "Example": { @@ -45607,7 +45762,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/2_req_update_campaign" + "$ref": "#/components/schemas/CampaignsUpdateRequestBody" }, "examples": { "Example": { @@ -45818,12 +45973,11 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/2_req_add_vouchers_to_campaign" + "$ref": "#/components/schemas/CampaignsCreateCampaignVoucherWithCodeRequestBody" }, "examples": { "Example": { "value": { - "category_id": "cat_0bb81a481615a37b5e", "start_date": "2022-09-24T00:00:00Z", "expiration_date": "2022-09-25T23:59:59Z", "active": false, @@ -45919,7 +46073,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/2_req_add_vouchers_with_specific_code_to_campaign" + "$ref": "#/components/schemas/CampaignsCreateCampaignVoucherRequestBody" }, "examples": { "Example": { @@ -46024,7 +46178,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/e_409_duplicate_found" + "$ref": "#/components/schemas/Error" }, "examples": { "Duplicate": { @@ -46077,7 +46231,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/2_req_import_vouchers_to_campaign" + "$ref": "#/components/schemas/CampaignsImportVoucherRequestBody" }, "examples": { "Example": { @@ -49282,7 +49436,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/e_409_duplicate_found" + "$ref": "#/components/schemas/Error" }, "examples": { "Duplicate Found": { @@ -67363,7 +67517,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/e_409_duplicate_found" + "$ref": "#/components/schemas/Error" }, "examples": { "Example": { @@ -76771,7 +76925,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/e_409_duplicate_found" + "$ref": "#/components/schemas/Error" }, "examples": { "Duplicate": { From 04c813935429c976055f48dc1817ef8251591739 Mon Sep 17 00:00:00 2001 From: jkaliszuk Date: Thu, 23 Nov 2023 17:28:08 +0100 Subject: [PATCH 7/9] Changelog for campaigns api and minor fixes. --- Changelog.md | 60 +++++++++++++++++++ .../CAMPAIGNS-API-Add-Vouchers-To-Campaign.md | 2 +- reference/OpenAPI.json | 8 +-- 3 files changed, 65 insertions(+), 5 deletions(-) diff --git a/Changelog.md b/Changelog.md index 477d9a6fe..e50e78e4f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,65 @@ # Changelog +## 20231123 - Campaigns API + +**Added schemas** +- CampaignResponse +- CampaignVoucher +- CodeConfig +- CodeConfigResponse +- CampaignsImportVoucherLoyaltyCard +- CampaignLoyaltyCardResponse +- CampaignLoyaltyCardResponse +- CampaignLoyaltyCardRequestBody +- LuckyDraw +- CampaignsCreateBase +- CampaignsUpdateBase +- CampaignsUpdateCouponCampaignBase +- CampaignsUpdateDiscountCouponsCampaign +- CampaignsUpdateGiftCampaign +- CampaignsUpdateReferralCampaign +- CampaignsUpdateLoyaltyCampaign +- CampaignsUpdateGiveawayCampaign +- CampaignsUpdatePromotionCampaign +- CampaignsCreateRequestBody +- CampaignsUpdateRequestBody +- CampaignsCreateDiscountCouponsCampaign +- CampaignsCreateReferralCampaign +- CampaignsCreateGiftCampaign +- CampaignsCreateLoyaltyCampaign +- CampaignsCreatePromotionCampaign +- CampaignsCreateGiveawayCampaign +- CampaignsCreateCampaignVoucherWithCodeRequestBody +- CampaignsCreateCampaignVoucherRequestBody +- CampaignsImportVoucherRequestBody +- CampaignsImportVoucherItem +- CampaignsListResponseBody +- DiscountCouponsCampaignVoucher +- ReferralCampaignVoucher +- GiveawayCampaignVoucher +- GiftCampaignVoucher +- LoyaltyCampaignVoucher +- PromotionTierCreateParams +- PromotionTiersList +- LoyaltyTiersExpirationAll + +**Deleted schemas** +- 2_obj_campaign_object +- 2_req_create_campaign +- 2_req_create_campaign_discount_voucher +- 2_req_create_campaign_loyalty +- 2_req_create_campaign_gift +- 2_req_create_campaign_referral +- 2_req_create_campaign_promotion +- 2_req_update_campaign +- 2_req_add_vouchers_to_campaign +- 2_req_import_vouchers_to_campaign +- 2_obj_import_vouchers_to_campaign_object +- 2_res_list_campaigns +- 3_res_list_promotion_tiers_from_campaign +- 20_obj_category_object +- e_409_duplicate_found + ## 20231117 - Quality Fixes **Changed schemas** diff --git a/docs/reference-docs/CAMPAIGNS-API-Add-Vouchers-To-Campaign.md b/docs/reference-docs/CAMPAIGNS-API-Add-Vouchers-To-Campaign.md index ef0b21ec5..53dc5b3d3 100644 --- a/docs/reference-docs/CAMPAIGNS-API-Add-Vouchers-To-Campaign.md +++ b/docs/reference-docs/CAMPAIGNS-API-Add-Vouchers-To-Campaign.md @@ -1,5 +1,5 @@ --- -title: Add Vouchers to Campaign +title: Add Voucher to Campaign type: endpoint categorySlug: voucherify-api slug: add-vouchers-to-campaign diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index 5a2d738d8..dd46a5a8e 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -7741,7 +7741,7 @@ "pattern" ] }, - "CampaigngsImportVoucherLoyaltyCard": { + "CampaignsImportVoucherLoyaltyCard": { "type": "object", "description": "Schema model for a campaign loyalty card.", "title": "Campaign Loyalty Card", @@ -8724,7 +8724,7 @@ "description": "Defines the voucher gift details." }, "loyalty_card": { - "$ref": "#/components/schemas/CampaigngsImportVoucherLoyaltyCard", + "$ref": "#/components/schemas/CampaignsImportVoucherLoyaltyCard", "description": "Defines the voucher loyalty card details." } }, @@ -45950,7 +45950,7 @@ "tags": [ "CAMPAIGNS API" ], - "summary": "Add Vouchers to Campaign", + "summary": "Add Voucher to Campaign", "description": "This method gives the possibility to push new vouchers to an existing campaign. New vouchers will inherit properties from the campaign profile. However, it is possible to overwrite some of them in the request body. If you provide an optional `code_config` parameter with a voucher code configuration, then it will be used to generate new voucher codes. Otherwise, the voucher code configuration from the campaign will be used.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the `IN_PROGRESS` status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", "parameters": [ { @@ -46108,7 +46108,7 @@ "value": { "id": "v_EJwB9Wy2aOIsDpWhnl2QBY51OqjQ5Ukg", "code": "Code3", - "campaign": "Add Vouchers to Campaign", + "campaign": "Add Voucher to Campaign", "campaign_id": "camp_xxpmFyWO9h9s5cEe7HtmOK5B", "category": null, "category_id": "cat_0bb81a481615a37b5e", From 554d3653e1c05fbfdc0171a24ffb62db52d8cfbf Mon Sep 17 00:00:00 2001 From: p-zielinski <82354717+p-zielinski@users.noreply.github.com> Date: Fri, 24 Nov 2023 12:25:20 +0100 Subject: [PATCH 8/9] fixing bugs found during review --- .../CAMPAIGNS-API-Campaign-Object.md | 133 ++++++++++-------- reference/OpenAPI.json | 113 +++++---------- 2 files changed, 108 insertions(+), 138 deletions(-) diff --git a/docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md b/docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md index 6468bec61..936535fe9 100644 --- a/docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md +++ b/docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md @@ -8,7 +8,13 @@ hidden: false order: 1 --- -## Campaign Object +## Campaign Response +All of: + +1. [Campaign](#campaign) +2.

Campaign Additional Data

AttributesDescription
promotionSee: Promotion Tiers
validation_rules_assignmentsSee: Validation Rules Assignments List
+ +## Campaign | Attributes | Description | |:-----|:--------| | id
`string` |

Unique campaign ID, assigned by Voucherify.

**Example:**

camp_f7fBbQxUuTN7dI7tGOo5XMDA

| @@ -35,13 +41,28 @@ order: 1 | vouchers_generation_status
`string` |

Indicates the status of the campaign's vouchers.

Available values: `DONE`, `IN_PROGRESS`, `FAILED`, `DRAFT`, `MODIFYING` | | protected
`boolean` |

Indicates whether the resource can be deleted.

| | category_id
`string,null` |

Unique category ID that this campaign belongs to.

**Example:**

cat_0b688929a2476386a7

| -| categories | See: [Category](#category) | +| categories
`array` |

Contains details about the category.

Array of [Category](#category) | | object
`string` |

The type of object represented by JSON. This object stores information about the campaign.

| -| referral_program
`object` |

Defines the referee reward and the way a referral is triggered. Context: REFERRAL_PROGRAM.

AttributesDescription
conversion_event_type
string

How a referral is triggered.

Available values: redemption, custom_event
custom_event
object

Contains details about the custom event.

AttributesDescription
id
string

Unique custom event ID.

Example:

ms_fi47Dcu5T0m3v3nT5ch3ma

name
string

Custom event name.

referee_reward
object

Defines the referee reward.

AttributesDescription
related_object_parent
object

Details of the resource from which the reward originates.

AttributesDescription
id
string

Unique ID of the reward source.

name
string

Name of the reward source.

object
string

Type of resource represented by the source of the reward.

type
string

Type of reward.

Available values: LOYALTY_CARD, GIFT_VOUCHER
amount
string

The number of points to add to a loyalty card or credits to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.

| -| promotion | See: [Promotion Tiers](#promotion-tiers) | -| validation_rules_assignments | See: [Validation Rules Assignments List](#validation-rules-assignments-list) | +| referral_program | See: [Referral Program](#referral-program) | | loyalty_tiers_expiration | See: [Loyalty Tiers Expiration](#loyalty-tiers-expiration) | +## Promotion Tiers +| Attributes | Description | +|:-----|:--------| +| object
`string` |

The type of object represented by JSON. This object stores information about promotion tiers in a dictionary.

| +| data_ref
`string` |

Identifies the name of the attribute that contains the array of promotion tier objects.

| +| tiers
`array` |

Contains array of promotion tier objects.

Array of [Promotion Tier](#promotion-tier) | +| total
`integer` |

Total number of promotion tiers.

| +| has_more
`boolean` |

As query results are always limited (by the limit parameter), the has_more flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different page or a different start date filter) to get more records returned in the results.

| + +## Validation Rules Assignments List +| Attributes | Description | +|:-----|:--------| +| object
`string` |

The type of object represented by JSON. This object stores information about validation rules assignments.

Available values: `list` | +| data_ref
`string` |

Identifies the name of the attribute that contains the array of validation rules assignments.

Available values: `data` | +| data
`array` |

Contains array of validation rules assignments.

Array of [Business Validation Rule Assignment](#business-validation-rule-assignment) | +| total
`integer` |

Total number of validation rules assignments.

| + ## Campaign Discount Voucher | Attributes | Description | |:-----|:--------| @@ -50,7 +71,7 @@ order: 1 | gift |

Defines the voucher gift details.

See: [Gift](#gift) | | loyalty_card |

Defines the voucher loyalty card details.

See: [Campaign Loyalty Card](#campaign-loyalty-card) | | redemption
`object` |

Defines the redemption limits on vouchers.

AttributesDescription
quantity
integer,null

How many times a voucher can be redeemed. A null value means unlimited.

| -| code_config | See: [Schema containing information about config used for voucher](#schema-containing-information-about-config-used-for-voucher) | +| code_config | See: [Code Config Response](#code-config-response) | | is_referral_code
`boolean` |

Indicates whether the voucher is a referral code; this is true for campaign type REFERRAL_PROGRAM.

| | start_date
`string` |

Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is inactive before this date.

**Example:**

2022-09-20T00:00:00.000Z

| | expiration_date
`string` |

Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is inactive after this date.

**Example:**

2022-09-30T00:00:00.000Z

| @@ -67,22 +88,12 @@ order: 1 | updated_at
`string` |

Timestamp representing the date and time when the category was updated in ISO 8601 format.

**Example:**

2022-08-16T10:52:08.094Z

| | stacking_rules_type
`string` |

The type of the stacking rule eligibility.

Available values: `JOINT`, `EXCLUSIVE` | -## Promotion Tiers +## Referral Program | Attributes | Description | |:-----|:--------| -| object
`string` |

The type of object represented by JSON. This object stores information about promotion tiers in a dictionary.

| -| data_ref
`string` |

Identifies the name of the attribute that contains the array of promotion tier objects.

| -| tiers
`array` |

Contains array of promotion tier objects.

Array of [Promotion Tier](#promotion-tier) | -| total
`integer` |

Total number of promotion tiers.

| -| has_more
`boolean` |

As query results are always limited (by the limit parameter), the has_more flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different page or a different start date filter) to get more records returned in the results.

| - -## Validation Rules Assignments List -| Attributes | Description | -|:-----|:--------| -| object
`string` |

The type of object represented by JSON. This object stores information about validation rules assignments.

Available values: `list` | -| data_ref
`string` |

Identifies the name of the attribute that contains the array of validation rules assignments.

Available values: `data` | -| data
`array` |

Contains array of validation rules assignments.

Array of [Business Validation Rule Assignment](#business-validation-rule-assignment) | -| total
`integer` |

Total number of validation rules assignments.

| +| conversion_event_type
`string` |

Define how a referral is triggered.

Available values: `redemption`, `custom_event` | +| custom_event
`object` |

Contains details about the custom event.

AttributesDescription
id
string

Unique custom event ID.

Example:

ms_Ll9enAm2BCN0M1s4VxWobLFM

name
string

Custom event name.

| +| referee_reward
`object` |

Defines the referee reward.

AttributesDescription
related_object_parent
object

Details of the resource from which the reward originates.

AttributesDescription
id
string

Unique ID of the reward source.

Example:

camp_kdxp3vf1clQ9CFs1jpqv3tZe

name
string

Name of the reward source.

object
string

Type of resource represented by the source of the reward.

Available values: CAMPAIGN
type
string

Type of reward.

Available values: DISCOUNT_VOUCHER, LOYALTY_CARD, GIFT_VOUCHER, LUCKY_DRAW_CODE
amount
string

Define the number of points to add to a loyalty card or credits to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.

| ## Loyalty Tiers Expiration | Attributes | Description | @@ -92,31 +103,6 @@ order: 1 | start_date
`object` |

Defines the conditions for the start date of the tier.

AttributesDescription
type
string

What triggers the tier to be valid for a customer.
IMMEDIATE: After reaching the minimum required points.
NEXT_PERIOD: When the next qualification period starts.

Available values: IMMEDIATE, NEXT_PERIOD
| | expiration_date
`object` |

Defines the conditions for the expiration date of a tier.

AttributesDescription
type
string

What triggers the tier to expire for a customer.
END_OF_PERIOD: Expire tier at the end of the period.
END_OF_NEXT_PERIOD: Expire tier at the end of the next period.
BALANCE_DROP: Tier expires when the points balance drops below the required range of the tier.
CUSTOM: Tier expires after a certain time period passes following the instance the points balance drops below the required range of the tier.

Available values: END_OF_PERIOD, END_OF_NEXT_PERIOD, BALANCE_DROP, CUSTOM
extend
string

Extend the expiration by adding extra months or days in ISO 8601 format. The tier will remain active even though it reaches its expiration time period. For example, a tier with a duration of P3M will be valid for an additional duration of 3 months and a tier with a duration of P1D will be valid for an additional duration of 1 day.

rounding

Defines the rounding mechanism for tier expiration.

| -## Discount -

Contains information about discount.

- -Any of: - -[Amount](#amount), [Unit](#unit), [Unit Multiple](#unit-multiple), [Percent](#percent), [Fixed](#fixed) - -## Gift -| Attributes | Description | -|:-----|:--------| -| amount
`number` |

Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.

| -| balance
`number` |

Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.

| -| effect
`string` |

Defines how the credits are applied to the customer's order.

Available values: `APPLY_TO_ORDER`, `APPLY_TO_ITEMS` | - -## Campaign Loyalty Card -| Attributes | Description | -|:-----|:--------| -| points
`integer` |

The initial number of points to assign to the loyalty card. This is the current loyalty card score i.e. the number of loyalty points on the card.

| -| expiration_rules
`object` |
AttributesDescription
period_type
string

Type of period

period_value
integer

Value of the period

rounding_type
string

Type of rounding

rounding_value
integer

Value of rounding

| - -## Schema containing information about config used for voucher -All of: - -1. [Schema containing information about config used for voucher](#schema-containing-information-about-config-used-for-voucher) - ## Promotion Tier | Attributes | Description | |:-----|:--------| @@ -155,6 +141,39 @@ All of: | validation_status
`string` |

The validation status of the assignment

Available values: `VALID`, `PARTIALLY_VALID`, `INVALID` | | validation_omitted_rules
`array` |

The list of omitted rules

| +## Discount +

Contains information about discount.

+ +Any of: + +[Amount](#amount), [Unit](#unit), [Unit Multiple](#unit-multiple), [Percent](#percent), [Fixed](#fixed) + +## Gift +| Attributes | Description | +|:-----|:--------| +| amount
`number` |

Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.

| +| balance
`number` |

Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.

| +| effect
`string` |

Defines how the credits are applied to the customer's order.

Available values: `APPLY_TO_ORDER`, `APPLY_TO_ITEMS` | + +## Campaign Loyalty Card +| Attributes | Description | +|:-----|:--------| +| points
`integer` |

The initial number of points to assign to the loyalty card. This is the current loyalty card score i.e. the number of loyalty points on the card.

| +| expiration_rules
`object` |
AttributesDescription
period_type
string

Type of period

period_value
integer

Value of the period

rounding_type
string

Type of rounding

rounding_value
integer

Value of rounding

| + +## Code Config Response +All of: + +1. [Code Config](#code-config) + +## Validation Rule Assignments +| Attributes | Description | +|:-----|:--------| +| object
`string` |

The type of object represented by JSON. This object stores information about validation rule assignments.

| +| data_ref
`string` |

Identifies the name of the JSON property that contains the array of validation rule assignments.

| +| data
`array` |

A dictionary that contains an array of validation rule assignments.

Array of [Validation Rule Assignment](#validation-rule-assignment) | +| total
`integer` |

Total number of validation rule assignments.

| + ## Amount | Attributes | Description | |:-----|:--------| @@ -204,7 +223,7 @@ All of: | effect |

Defines how the discount is applied to the customer's order.

See: [Discount Fixed Vouchers Effect Types](#discount-fixed-vouchers-effect-types) | | is_dynamic
`boolean` |

Flag indicating whether the discount was calculated using a formula.

| -## Schema containing information about config used for voucher +## Code Config | Attributes | Description | |:-----|:--------| | length
`string` |

Number of characters in a generated code (excluding prefix and postfix).

| @@ -214,13 +233,15 @@ All of: | pattern
`string` |

A pattern for codes where hashes (#) will be replaced with random characters. Overrides length.

| | initial_count
`integer` |

The initial count

| -## Validation Rule Assignments +## Validation Rule Assignment | Attributes | Description | |:-----|:--------| -| object
`string` |

The type of object represented by JSON. This object stores information about validation rule assignments.

| -| data_ref
`string` |

Identifies the name of the JSON property that contains the array of validation rule assignments.

| -| data
`array` |

A dictionary that contains an array of validation rule assignments.

Array of [Validation Rule Assignment](#validation-rule-assignment) | -| total
`integer` |

Total number of validation rule assignments.

| +| id
`string` |

Validation rule assignment ID.

**Example:**

asgm_74F7QZoYbUoljwQO

| +| rule_id
`string` |

Validation rule ID.

**Example:**

val_4j7DCRm2IS59

| +| related_object_id
`string` |

The resource ID to which the validation rule was assigned.

**Example:**

v_JtWunK6jUo7X2qOFj0SyRHq4p9tgENlT

| +| related_object_type
`string` |

The type of resource to which the validation rule was assigned.

Available values: `voucher`, `campaign`, `earning_rule`, `reward_assignment`, `promotion_tier`, `distribution` | +| created_at
`string` |

Timestamp representing the date and time when the validation rule assignment was created in ISO 8601 format.

**Example:**

2022-02-17T08:18:15.085Z

| +| object
`string` |

The type of object represented by the ID.

Available values: `validation_rules_assignment` | ## Discount Amount Vouchers Effect Types Available values: `APPLY_TO_ORDER`, `APPLY_TO_ITEMS`, `APPLY_TO_ITEMS_PROPORTIONALLY`, `APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY`, `APPLY_TO_ITEMS_BY_QUANTITY` @@ -258,16 +279,6 @@ Available values: `APPLY_TO_ORDER`, `APPLY_TO_ITEMS` ## Discount Fixed Vouchers Effect Types Available values: `APPLY_TO_ORDER`, `APPLY_TO_ITEMS` -## Validation Rule Assignment -| Attributes | Description | -|:-----|:--------| -| id
`string` |

Validation rule assignment ID.

**Example:**

asgm_74F7QZoYbUoljwQO

| -| rule_id
`string` |

Validation rule ID.

**Example:**

val_4j7DCRm2IS59

| -| related_object_id
`string` |

The resource ID to which the validation rule was assigned.

**Example:**

v_JtWunK6jUo7X2qOFj0SyRHq4p9tgENlT

| -| related_object_type
`string` |

The type of resource to which the validation rule was assigned.

Available values: `voucher`, `campaign`, `earning_rule`, `reward_assignment`, `promotion_tier`, `distribution` | -| created_at
`string` |

Timestamp representing the date and time when the validation rule assignment was created in ISO 8601 format.

**Example:**

2022-02-17T08:18:15.085Z

| -| object
`string` |

The type of object represented by the ID.

Available values: `validation_rules_assignment` | - [block:html] { "html": "" diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index 4a896e8dc..f639d45d9 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -7368,9 +7368,9 @@ {} ] }, - "CampaignResponse": { + "CampaignResponseBase": { "type": "object", - "title": "Campaign Object", + "title": "Campaign", "description": "This is an object representing a campaign.", "x-tags": [ "CAMPAIGNS API" @@ -7521,7 +7521,11 @@ "example": "cat_0b688929a2476386a7" }, "categories": { - "$ref": "#/components/schemas/Category" + "type": "array", + "description": "Contains details about the category.", + "items": { + "$ref": "#/components/schemas/Category" + } }, "object": { "type": "string", @@ -7529,75 +7533,7 @@ "description": "The type of object represented by JSON. This object stores information about the campaign." }, "referral_program": { - "type": "object", - "description": "Defines the referee reward and the way a referral is triggered. Context: `REFERRAL_PROGRAM`.", - "properties": { - "conversion_event_type": { - "type": "string", - "enum": [ - "redemption", - "custom_event" - ], - "description": "How a referral is triggered." - }, - "custom_event": { - "type": "object", - "description": "Contains details about the custom event.", - "properties": { - "id": { - "type": "string", - "example": "ms_fi47Dcu5T0m3v3nT5ch3ma", - "description": "Unique custom event ID." - }, - "name": { - "type": "string", - "description": "Custom event name." - } - } - }, - "referee_reward": { - "type": "object", - "description": "Defines the referee reward.", - "properties": { - "related_object_parent": { - "type": "object", - "description": "Details of the resource from which the reward originates.", - "properties": { - "id": { - "type": "string", - "description": "Unique ID of the reward source." - }, - "name": { - "type": "string", - "description": "Name of the reward source." - }, - "object": { - "type": "string", - "description": "Type of resource represented by the source of the reward." - } - } - }, - "type": { - "type": "string", - "description": "Type of reward.", - "enum": [ - "LOYALTY_CARD", - "GIFT_VOUCHER" - ] - }, - "amount": { - "type": "string", - "description": "The number of `points` to add to a loyalty card or `credits` to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - } - } - } - } - }, - "promotion": { - "$ref": "#/components/schemas/PromotionTiersList" - }, - "validation_rules_assignments": { - "$ref": "#/components/schemas/ValidationRulesAssignmentsList" + "$ref": "#/components/schemas/ReferralProgram" }, "loyalty_tiers_expiration": { "$ref": "#/components/schemas/LoyaltyTiersExpirationAll" @@ -7621,6 +7557,29 @@ "metadata" ] }, + "CampaignResponse": { + "title": "Campaign Response", + "x-tags": [ + "CAMPAIGNS API" + ], + "allOf": [ + { + "$ref": "#/components/schemas/CampaignResponseBase" + }, + { + "title": "Campaign Additional Data", + "type": "object", + "properties": { + "promotion": { + "$ref": "#/components/schemas/PromotionTiersList" + }, + "validation_rules_assignments": { + "$ref": "#/components/schemas/ValidationRulesAssignmentsList" + } + } + } + ] + }, "CampaignVoucher": { "type": "object", "description": "Schema model for a campaign voucher.", @@ -7698,9 +7657,9 @@ ] }, "CodeConfig": { - "title": "Schema containing information about config used for voucher", + "title": "Code Config", "type": "object", - "description": "Defines code's pattern (prefix, suffix, length, charset, etc).", + "description": "Schema containing information about config used for voucher. Defines code's pattern (prefix, suffix, length, charset, etc).", "properties": { "length": { "type": "string", @@ -7729,7 +7688,7 @@ } }, "CodeConfigResponse": { - "title": "Schema containing information about config used for voucher", + "title": "Code Config Response", "allOf": [ { "$ref": "#/components/schemas/CodeConfig" @@ -9124,7 +9083,7 @@ "type": "array", "description": "Contains array of campaign objects.", "items": { - "$ref": "#/components/schemas/CampaignResponse" + "$ref": "#/components/schemas/CampaignResponseBase" } }, "total": { @@ -45104,7 +45063,7 @@ { "schema": { "type": "string", - "default": "category" + "enum": ["category"] }, "in": "query", "name": "expand", From 9f2f841660b353dda737dc250da0750b09036d09 Mon Sep 17 00:00:00 2001 From: p-zielinski <82354717+p-zielinski@users.noreply.github.com> Date: Fri, 24 Nov 2023 13:23:11 +0100 Subject: [PATCH 9/9] naming changes --- reference/OpenAPI.json | 18 +++++++++++------- scripts/manage-project.ts | 5 +++-- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index f639d45d9..be9a16adc 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -8320,7 +8320,11 @@ "CampaignsUpdatePromotionCampaign": { "type": "object", "title": "Update Promotion Campaign", - "$ref": "#/components/schemas/CampaignsUpdateBase" + "allOf": [ + { + "$ref": "#/components/schemas/CampaignsUpdateBase" + } + ] }, "CampaignsCreateRequestBody": { "type": "object", @@ -8373,7 +8377,7 @@ ] }, "CampaignsCreateDiscountCouponsCampaign": { - "title": "Create Schema for Discount Coupons Campaign", + "title": "Create Discount Coupons Campaign", "allOf": [ { "$ref": "#/components/schemas/CampaignsCreateBase" @@ -8391,7 +8395,7 @@ ] }, "CampaignsCreateReferralCampaign": { - "title": "Create Schema for Referral Program", + "title": "Create Referral Program", "allOf": [ { "$ref": "#/components/schemas/CampaignsCreateBase" @@ -8409,7 +8413,7 @@ ] }, "CampaignsCreateGiftCampaign": { - "title": "Create Schema for Gift Campaign", + "title": "Create Gift Campaign", "allOf": [ { "$ref": "#/components/schemas/CampaignsCreateBase" @@ -8427,7 +8431,7 @@ ] }, "CampaignsCreateLoyaltyCampaign": { - "title": "Create Schema for Loyalty Campaign", + "title": "Create Loyalty Campaign", "allOf": [ { "$ref": "#/components/schemas/CampaignsCreateBase" @@ -8445,7 +8449,7 @@ ] }, "CampaignsCreatePromotionCampaign": { - "title": "Create Schema for Promotion Campaign", + "title": "Create Promotion Campaign", "allOf": [ { "$ref": "#/components/schemas/CampaignsCreateBase" @@ -8466,7 +8470,7 @@ ] }, "CampaignsCreateGiveawayCampaign": { - "title": "Create Schema for Giveaway Campaign", + "title": "Create Giveaway Campaign", "allOf": [ { "$ref": "#/components/schemas/CampaignsCreateBase" diff --git a/scripts/manage-project.ts b/scripts/manage-project.ts index 60ec95deb..9e2db1ad4 100644 --- a/scripts/manage-project.ts +++ b/scripts/manage-project.ts @@ -49,7 +49,7 @@ const main = async ({ await updateMdTablesInDocs(); await uploadImagesUsedInMdFiles(); await uploadGuideFiles(version); - await uploadReferenceDocsWithMaxNumberOfAttempts(version, 4); + await uploadReferenceDocsWithMaxNumberOfAttempts(version, 2); console.log( colors.green(`\n\nDONE!\nVisit: https://docs.voucherify.io/${version}/`) ); @@ -117,8 +117,8 @@ const uploadReferenceDocsWithMaxNumberOfAttempts = async ( maxNumberOfUploadingAttempts = 3 ) => { console.log(colors.green("UPLOADING REFERENCE DOC FILES...")); + await new Promise((r) => setTimeout(r, 60000)); for (let i = 1; i <= maxNumberOfUploadingAttempts; i++) { - await new Promise((r) => setTimeout(r, 10000)); const { success, error } = await runCliProcess({ command: `rdme docs ./docs/reference-docs --version=${version}`, stdoutIncludes: "successfully created", @@ -132,6 +132,7 @@ const uploadReferenceDocsWithMaxNumberOfAttempts = async ( console.log(error); throw new Error("REFERENCE DOC FILES WERE NOT UPLOADED!"); } + await new Promise((r) => setTimeout(r, 10000)); } return; };