diff --git a/Changelog.md b/Changelog.md index 7418bcfe8..110835c39 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,43 @@ # Changelog +## 20231011 + +#### New schemas: +- LoyaltiesCreateTiersRequestBody +- LoyaltiesCreateTiersResponseBody +- LoyaltiesGetRewardAssignmentResponseBody +- LoyaltiesGetRewardDetailsResponseBody +- LoyaltiesListTiersRequestQuery +- LoyaltiesListLoyaltyTierEarningRulesRequestQuery +- LoyaltiesGetTierResponseBody +- LoyaltiesListTiersResponseBody +- LoyaltiesListMemberLoyaltyTiersResponseBody +- LoyaltiesListLoyaltyTierEarningRulesResponseBody +- CreateLoyaltyTier +- LoyaltyTier +- MappingMultiply +- MappingFixed +- EarningRule + +#### Schemas changes +- GET /v1/loyalties/{campaignId}/tiers + - new response schema `LoyaltiesListTiersResponseBody` (old `8_res_list_loyalty_tiers`) +- GET /v1/loyalties/{campaignId}/reward-assignments/{assignmentId} + - new response schema `LoyaltiesGetRewardAssignmentResponseBody` (old `4_obj_reward_assignment_object`) +- GET /v1/loyalties/{campaignId}/reward-assignments/{assignmentId}/reward + - new response schema `LoyaltiesGetRewardDetailsResponseBody` (old `4_obj_reward_object`) +- GET /v1/loyalties/{campaignId}/tiers/{tierId} + - new response schema `LoyaltiesGetTierResponseBody` (old `8_obj_loyalty_tier_object`) +- GET /v1/loyalties/{campaignId}/tiers/{tierId}/earning-rules + - new response schema `LoyaltiesListLoyaltyTierEarningRulesResponseBody` (old `8_res_list_loyalty_tier_earning_rules`) +- GET /v1/loyalties/members/{memberId}/tiers + - new response schema `LoyaltiesListMemberLoyaltyTiersResponseBody` (old `8_res_get_member_loyalty_tier`) +- GET /v1/loyalties/{campaignId}/members/{memberId}/points-expiration + - New response schema: `LoyaltiesGetPointsExpirationResponseBody` (old one: `8_res_get_points_expiration`) + +#### New endpoint +- POST /v1/loyalties/{campaignId}/tiers + ## 20231009 @@ -52,8 +90,6 @@ - /v1/loyalties/{campaignId}/members/{memberId}/points-expiration - new response schema `LoyaltiesGetPointsExpirationResponseBody` (old `8_res_get_points_expiration`) - - ## 20230831 - Exports API **New models** diff --git a/docs/reference-docs/EXPORTS-API-Export-Object.md b/docs/reference-docs/EXPORTS-API-Export-Object.md index 204062922..54ba16769 100644 --- a/docs/reference-docs/EXPORTS-API-Export-Object.md +++ b/docs/reference-docs/EXPORTS-API-Export-Object.md @@ -11,10 +11,10 @@ order: 1 ## Export All of: -1. [ExportBase](#exportbase) +1. [Export Base](#export-base) 2. Any of: [Export Vouchers](#export-vouchers), [Export Redemptions](#export-redemptions), [Export Customers](#export-customers), [Export Publications](#export-publications), [Export Orders](#export-orders), [Export Points Expirations](#export-points-expirations), [Export Vouchers Transactions Expiration](#export-vouchers-transactions-expiration) -## ExportBase +## Export Base | Attributes | Description | |:-----|:--------| | id
`string` |

Unique export ID.

| diff --git a/docs/reference-docs/LOYALTIES-API-Create-Loyalty-Tiers.md b/docs/reference-docs/LOYALTIES-API-Create-Loyalty-Tiers.md new file mode 100644 index 000000000..aea320165 --- /dev/null +++ b/docs/reference-docs/LOYALTIES-API-Create-Loyalty-Tiers.md @@ -0,0 +1,14 @@ +--- +title: Create Loyalty Tiers +type: endpoint +categorySlug: voucherify-api +slug: create-loyalty-tiers +parentDocSlug: loyalties-api +hidden: false +order: 44 +--- +[block:html] +{ + "html": "" +} +[/block] diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index 470f57629..1b9cda175 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -39240,42 +39240,112 @@ } } }, - "LoyaltiesGetEarningRuleResponseBody": { - "allOf": [ - { - "$ref": "#/components/schemas/EarningRuleBase" + "LoyaltiesGetPointsExpirationResponseBody": { + "title": "Loyalties Get Points Expiration Response Body", + "type": "object", + "properties": { + "object": { + "type": "string", + "pattern": "list", + "enum": [ + "list" + ], + "description": "The type of object represented by JSON. This object stores information about loyalty points expiration buckets in a dictionary." }, - { - "type": "object", - "properties": { - "validation_rule_id": { - "type": [ - "string", - "null" - ], - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "updated_at": { - "type": [ - "string", - "null" - ], - "format": "date-time", - "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format." + "data_ref": { + "type": "string", + "pattern": "data", + "enum": [ + "data" + ], + "description": "Identifies the name of the attribute that contains the array of loyalty points expiration bucket objects." + }, + "data": { + "type": "array", + "description": "Contains array of loyalty points expiration buckets.", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique loyalty points bucket ID." + }, + "voucher_id": { + "type": "string", + "description": "Unique parent loyalty card ID." + }, + "campaign_id": { + "type": "string", + "description": "\nUnique parent campaign ID." + }, + "bucket": { + "type": "object", + "required": [ + "total_points" + ], + "description": "Defines the number of points stored in the given loyalty points bucket.", + "properties": { + "total_points": { + "type": "integer", + "description": "Total number of points in the loyalty points bucket." + } + } + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the loyalty points bucket object was created in ISO 8601 format.", + "format": "date-time" + }, + "status": { + "type": "string", + "description": "Loyalty points bucket point status." + }, + "expires_at": { + "type": "string", + "format": "date-time", + "description": "Date when the number of points defined in the bucket object are due to expire." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the loyalty points bucket object was updated in ISO 8601 format." + }, + "object": { + "type": "string", + "pattern": "loyalty_points_bucket", + "enum": [ + "loyalty_points_bucket" + ], + "description": "The type of object represented by JSON. This object stores information about the loyalty points bucket." + } }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date.\n\n- `true` indicates an active earning rule\n- `false` indicates an inactive earning rule" - } - }, - "required": [ - "validation_rule_id", - "updated_at", - "active" - ] + "required": [ + "id", + "voucher_id", + "campaign_id", + "bucket", + "created_at", + "status", + "expires_at", + "object" + ] + } + }, + "total": { + "type": "integer", + "description": "Total number of point expiration buckets." } + }, + "required": [ + "object", + "data_ref", + "data", + "total" ] }, + "LoyaltiesGetEarningRuleResponseBody": { + "$ref": "#/components/schemas/EarningRule" + }, "LoyaltiesEnableEarningRulesResponseBody": { "allOf": [ { @@ -39336,6 +39406,9 @@ }, "EarningRuleBase": { "title": "EarningRuleBase", + "x-stoplight": { + "id": "w4ci1ljqva0r1" + }, "type": "object", "properties": { "id": { @@ -39473,6 +39546,9 @@ }, "EarningRuleEvent": { "title": "EarningRuleEvent", + "x-stoplight": { + "id": "6vxql7fnzg2zp" + }, "type": "string", "enum": [ "order.paid", @@ -39487,6 +39563,9 @@ }, "EarningRuleFixed": { "title": "Define fixed amount of points", + "x-stoplight": { + "id": "r5o8m0sdli7fq" + }, "type": "object", "properties": { "type": { @@ -39518,6 +39597,9 @@ }, "EarningRuleProportionalOrderAmount": { "title": "Order Amount", + "x-stoplight": { + "id": "1z7lk7z1lp5af" + }, "type": "object", "properties": { "type": { @@ -39569,6 +39651,9 @@ }, "EarningRuleProportionalOrderTotalAmount": { "title": "Order Total Amount", + "x-stoplight": { + "id": "ekudxr430edgk" + }, "type": "object", "properties": { "type": { @@ -39620,6 +39705,9 @@ }, "EarningRuleProportionalOrderMetadata": { "title": "Order Metadata", + "x-stoplight": { + "id": "4ccw4gz8b47u5" + }, "type": "object", "properties": { "type": { @@ -39677,6 +39765,9 @@ }, "EarningRuleProportionalOrderItemsQuantity": { "title": "Order Items Quantity", + "x-stoplight": { + "id": "pqsn9otpzyot9" + }, "type": "object", "properties": { "type": { @@ -39743,6 +39834,9 @@ }, "EarningRuleProportionalOrderItemsAmount": { "title": "Order Items Amount", + "x-stoplight": { + "id": "8pg4o23daepkb" + }, "type": "object", "properties": { "type": { @@ -39809,6 +39903,9 @@ }, "EarningRuleProportionalOrderItemsSubtotalAmount": { "title": "Order Items Subtotal Amount", + "x-stoplight": { + "id": "duxy5qw36h5ph" + }, "type": "object", "properties": { "type": { @@ -40045,109 +40142,6 @@ } } }, - "LoyaltiesGetPointsExpirationResponseBody": { - "title": "Loyalties Get Points Expiration Response Body", - "type": "object", - "properties": { - "object": { - "type": "string", - "pattern": "list", - "enum": [ - "list" - ], - "description": "The type of object represented by JSON. This object stores information about loyalty points expiration buckets in a dictionary." - }, - "data_ref": { - "type": "string", - "pattern": "data", - "enum": [ - "data" - ], - "description": "Identifies the name of the attribute that contains the array of loyalty points expiration bucket objects." - }, - "data": { - "type": "array", - "description": "Contains array of loyalty points expiration buckets.", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique loyalty points bucket ID." - }, - "voucher_id": { - "type": "string", - "description": "Unique parent loyalty card ID." - }, - "campaign_id": { - "type": "string", - "description": "\nUnique parent campaign ID." - }, - "bucket": { - "type": "object", - "required": [ - "total_points" - ], - "description": "Defines the number of points stored in the given loyalty points bucket.", - "properties": { - "total_points": { - "type": "integer", - "description": "Total number of points in the loyalty points bucket." - } - } - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the loyalty points bucket object was created in ISO 8601 format.", - "format": "date-time" - }, - "status": { - "type": "string", - "description": "Loyalty points bucket point status." - }, - "expires_at": { - "type": "string", - "format": "date-time", - "description": "Date when the number of points defined in the bucket object are due to expire." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "description": "Timestamp representing the date and time when the loyalty points bucket object was updated in ISO 8601 format." - }, - "object": { - "type": "string", - "pattern": "loyalty_points_bucket", - "enum": [ - "loyalty_points_bucket" - ], - "description": "The type of object represented by JSON. This object stores information about the loyalty points bucket." - } - }, - "required": [ - "id", - "voucher_id", - "campaign_id", - "bucket", - "created_at", - "status", - "expires_at", - "object" - ] - } - }, - "total": { - "type": "integer", - "description": "Total number of point expiration buckets." - } - }, - "required": [ - "object", - "data_ref", - "data", - "total" - ] - }, "LoyaltiesListCardTransactionsRequestQuery": { "title": "Loyalties List Card Transactions Request Query", "type": "object", @@ -40774,25 +40768,32 @@ "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "description": "Unique reward assignment ID, assigned by Voucherify." }, "reward_id": { - "type": "string" + "type": "string", + "description": "Associated reward ID." }, "related_object_id": { - "type": "string" + "type": "string", + "description": "Related object ID to which the reward was assigned." }, "related_object_type": { - "type": "string" + "type": "string", + "description": "Related object type to which the reward was assigned." }, "parameters": { "type": "object", + "description": "Defines the cost of the reward.", "properties": { "loyalty": { "type": "object", + "description": "Defines the equivalent points value of the reward.", "properties": { "points": { - "type": "integer" + "type": "integer", + "description": "The number of points required to redeem the reward." } }, "required": [ @@ -40802,13 +40803,18 @@ } }, "created_at": { - "type": "string" + "type": "string", + "description": "Timestamp representing the date and time when the reward assignment was created in ISO 8601 format.", + "format": "date-time" }, "updated_at": { - "type": "string" + "type": "string", + "description": "Timestamp representing the date and time when the reward assignment was updated in ISO 8601 format.", + "format": "date-time" }, "object": { - "type": "string" + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the reward assignment." } }, "required": [ @@ -40819,44 +40825,55 @@ ] }, "Reward": { - "title": "Reward", "allOf": [ { "type": "object", "properties": { "id": { - "type": "string" + "type": "string", + "description": "Unique reward ID, assigned by Voucherify." }, "name": { - "type": "string" + "type": "string", + "description": "Reward name." }, "stock": { - "type": "integer" + "type": "integer", + "description": "Configurable for material rewards. The number of units of the product that you want to share as reward." }, "redeemed": { - "type": "integer" + "type": "integer", + "description": "Defines the number of already invoked (successful) reward redemptions." }, "attributes": { "type": "object", + "description": "These properties are configurable for material rewards.", "properties": { "image_url": { - "type": "string" + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file." }, "description": { - "type": "string" + "type": "string", + "description": "An arbitrary string that you can attach to a material reward." } } }, "created_at": { - "type": "string" + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the reward was created in ISO 8601 format." }, "updated_at": { - "type": "string" + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the reward was updated in ISO 8601 format." }, "object": { "type": "string", "default": "reward", - "pattern": "reward" + "pattern": "reward", + "description": "The type of object represented by the JSON. This object stores information about the reward." } }, "required": [ @@ -40870,6 +40887,20 @@ } ] }, + "RewardType": { + "title": "Reward Type", + "anyOf": [ + { + "$ref": "#/components/schemas/RewardTypeCampaign" + }, + { + "$ref": "#/components/schemas/RewardTypeCoin" + }, + { + "$ref": "#/components/schemas/RewardTypeCoin" + } + ] + }, "RewardTypeCoin": { "title": "Reward Type Coin", "type": "object", @@ -40878,25 +40909,30 @@ "type": "string", "enum": [ "COIN" - ] + ], + "description": "Reward type." }, "parameters": { "type": "object", "required": [ "coin" ], + "description": "Defines how the reward is generated.", "properties": { "coin": { "type": "object", "required": [ "exchange_ratio" ], + "description": "Defines the ratio by mapping the number of loyalty points in points_ratio to a predefined cash amount in exchange_ratio.", "properties": { "exchange_ratio": { - "type": "number" + "type": "number", + "description": "The cash equivalent of the points defined in the points_ratio property." }, "points_ratio": { - "type": "integer" + "type": "integer", + "description": "The number of loyalty points that will map to the predefined cash amount defined by the exchange_ratio property." } } } @@ -40916,13 +40952,15 @@ "type": "string", "enum": [ "MATERIAL" - ] + ], + "description": "Reward type." }, "parameters": { "type": "object", "required": [ "product" ], + "description": "Defines how the reward is generated.", "properties": { "product": { "type": "object", @@ -40930,15 +40968,18 @@ "id", "sku" ], + "description": "Contains information about the product given as a reward.", "properties": { "id": { - "type": "string" + "type": "string", + "description": "Unique product ID, assigned by Voucherify." }, "sku": { "type": [ "string", "null" - ] + ], + "description": "Unique SKU ID, assigned by Voucherify, of the SKU given as a reward." } } } @@ -40958,13 +40999,15 @@ "type": "string", "enum": [ "CAMPAIGN" - ] + ], + "description": "Reward type." }, "parameters": { "type": "object", "required": [ "campaign" ], + "description": "Defines how the reward is generated.", "properties": { "campaign": { "type": "object", @@ -40972,12 +41015,15 @@ "id", "type" ], + "description": "Objects stores information about the campaign related to the reward.", "properties": { "id": { - "type": "string" + "type": "string", + "description": "Unique campaign ID, assigned by Voucherify." }, "balance": { - "type": "integer" + "type": "integer", + "description": "The incremental amout to be added to the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." }, "type": { "type": "string", @@ -40986,7 +41032,8 @@ "PROMOTION", "GIFT_VOUCHERS", "REFERRAL_PROGRAM" - ] + ], + "description": "Campaign type." } } } @@ -40998,20 +41045,6 @@ "parameters" ] }, - "RewardType": { - "title": "Reward Type", - "anyOf": [ - { - "$ref": "#/components/schemas/RewardTypeCampaign" - }, - { - "$ref": "#/components/schemas/RewardTypeCoin" - }, - { - "$ref": "#/components/schemas/RewardTypeCoin" - } - ] - }, "LoyaltiesAddOrRemoveCardBalanceResponseBody": { "title": "Loyalties Add Or Remove Card Balance Response Body", "type": "object", @@ -41739,7 +41772,7 @@ "type": "object" }, "ExportBase": { - "title": "ExportBase", + "title": "Export Base", "type": "object", "additionalProperties": false, "properties": { @@ -43207,6 +43240,470 @@ ], "title": "Any" }, + "LoyaltiesCreateTiersRequestBody": { + "title": "Loyalties Create Tiers Request Body", + "x-stoplight": { + "id": "i1emmwlaqp7lt" + }, + "type": "array", + "items": { + "allOf": [ + { + "$ref": "#/components/schemas/LoyaltyTierBase" + }, + { + "type": "object", + "properties": { + "metadata": { + "description": "The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format.", + "type": "object" + } + } + } + ] + } + }, + "LoyaltiesCreateTiersResponseBody": { + "title": "Loyalties Create Tiers Response Body", + "x-stoplight": { + "id": "ix7g5mnuwqsp6" + }, + "type": "array", + "items": { + "$ref": "#/components/schemas/LoyaltyTier" + } + }, + "LoyaltiesGetRewardAssignmentResponseBody": { + "$ref": "#/components/schemas/RewardAssignment", + "x-stoplight": { + "id": "fnbbaq9l1l9it" + } + }, + "LoyaltiesGetRewardDetailsResponseBody": { + "$ref": "#/components/schemas/Reward", + "x-stoplight": { + "id": "44hds9u0hhukf" + } + }, + "LoyaltiesListTiersRequestQuery": { + "title": "Loyalties List Tiers Request Query", + "x-stoplight": { + "id": "d5sluzqkxu8km" + }, + "type": "object", + "properties": { + "limit": { + "type": "integer", + "minimum": 1, + "multipleOf": 100, + "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100 items." + }, + "page": { + "type": "integer", + "description": "Which page of results to return." + }, + "order": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ], + "description": "Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order." + } + } + }, + "LoyaltiesListLoyaltyTierEarningRulesRequestQuery": { + "title": "LoyaltiesListLoyaltyTierEarningRulesRequestQuery", + "x-stoplight": { + "id": "zs0z1cyyzac9u" + }, + "type": "object", + "properties": { + "limit": { + "type": "integer", + "minimum": 1, + "multipleOf": 100, + "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100 items." + }, + "page": { + "type": "integer", + "description": "Which page of results to return." + } + } + }, + "LoyaltiesGetTierResponseBody": { + "$ref": "#/components/schemas/LoyaltyTier", + "x-stoplight": { + "id": "hzcsijl2b4d5o" + } + }, + "LoyaltiesListTiersResponseBody": { + "title": "Loyalties List Tiers Response Body", + "x-stoplight": { + "id": "kw06g2szvv479" + }, + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "The type of object represented by JSON. This object stores information about loyalty tiers in a dictionary." + }, + "data_ref": { + "type": "string", + "enum": [ + "data" + ], + "description": "Identifies the name of the attribute that contains the array of loyalty tier objects." + }, + "data": { + "type": "array", + "description": "This is an object representing a loyalty tier. Loyalty tiers are used to create a loyalty program with different levels of membership and varied earning rules and rewards based on customer’s tiers.", + "items": { + "$ref": "#/components/schemas/LoyaltyTier" + } + }, + "total": { + "type": "integer", + "description": "Total number of loyalty tier objects." + } + }, + "required": [ + "object", + "data_ref", + "data", + "total" + ] + }, + "LoyaltiesListMemberLoyaltyTiersResponseBody": { + "title": "Loyalties List Member Loyalty Tiers Response Body", + "x-stoplight": { + "id": "s3zpgud510xl6" + }, + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "The type of object represented by JSON. This object stores information about loyalty tiers in a dictionary." + }, + "data_ref": { + "type": "string", + "enum": [ + "data" + ], + "description": "Identifies the name of the attribute that contains the array of loyalty tier objects." + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/LoyaltyTier" + } + }, + "total": { + "type": "integer", + "description": "Total number of loyalty tier objects." + } + }, + "required": [ + "object", + "data_ref", + "data", + "total" + ] + }, + "EarningRule": { + "allOf": [ + { + "$ref": "#/components/schemas/EarningRuleBase" + }, + { + "type": "object", + "properties": { + "validation_rule_id": { + "type": [ + "string", + "null" + ], + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "updated_at": { + "type": [ + "string", + "null" + ], + "format": "date-time", + "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format." + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date.\n\n- `true` indicates an active earning rule\n- `false` indicates an inactive earning rule" + } + }, + "required": [ + "validation_rule_id", + "updated_at", + "active" + ] + } + ] + }, + "LoyaltiesListLoyaltyTierEarningRulesResponseBody": { + "title": "Loyalties List Loyalty Tier Earning Rules ResponseBody", + "x-stoplight": { + "id": "i180zbh3ffwaa" + }, + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "The type of object represented by JSON. This object stores information about earning rules in a dictionary." + }, + "data_ref": { + "type": "string", + "enum": [ + "data" + ], + "description": "Identifies the name of the attribute that contains the array of earning rule objects." + }, + "data": { + "type": "array", + "description": "Contains array of earning rule objects.", + "items": { + "$ref": "#/components/schemas/EarningRule" + } + }, + "total": { + "type": "integer", + "description": "Total number of earning rule objects." + } + }, + "required": [ + "object", + "data_ref", + "data", + "total" + ] + }, + "LoyaltyTierBase": { + "title": "Loyalty Tier Base", + "x-stoplight": { + "id": "3af9422223696" + }, + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Loyalty Tier name." + }, + "earning_rules": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/MappingPoints" + }, + "description": "Contains a list of earning rule IDs and their points mapping for the given earning rule." + }, + "rewards": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/MappingPoints" + }, + "description": "Contains a list of reward IDs and their points mapping for the given reward." + }, + "points": { + "type": "object", + "description": "Defines range of loyalty tier in points.", + "properties": { + "from": { + "type": "integer", + "description": "Bottom points threshold value." + }, + "to": { + "type": "integer", + "description": "Top points threshold value." + } + } + } + }, + "required": [ + "name", + "points" + ] + }, + "LoyaltyTier": { + "allOf": [ + { + "$ref": "#/components/schemas/LoyaltyTierBase" + }, + { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique loyalty tier ID." + }, + "campaign_id": { + "type": "string", + "description": "Unique parent campaign ID." + }, + "metadata": { + "type": [ + "object", + "null" + ], + "description": "The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format." + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the loyalty tier was created in ISO 8601 format." + }, + "updated_at": { + "type": [ + "string", + "null" + ], + "format": "date-time", + "description": "Timestamp representing the date and time when the loyalty tier was updated in ISO 8601 format." + }, + "config": { + "type": "object", + "description": "Defines loyalty tier range in points.", + "required": [ + "points" + ], + "properties": { + "points": { + "type": "object", + "description": "Defines range of loyalty tier in points.", + "properties": { + "from": { + "type": "integer", + "description": "Bottom points threshold value." + }, + "to": { + "type": "integer", + "description": "Top points threshold value." + } + } + } + } + }, + "expiration": { + "type": "object", + "description": "Defines loyalty tier expiration date.", + "properties": { + "customer_id": { + "type": "string" + }, + "campaign_id": { + "type": "string" + }, + "tier_id": { + "type": "string" + }, + "start_date": { + "type": "string", + "format": "date-time" + }, + "expiration_date": { + "type": "string", + "format": "date-time" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + }, + "required": [ + "customer_id", + "campaign_id", + "tier_id", + "created_at" + ] + }, + "object": { + "type": "string", + "enum": [ + "loyalty_tier" + ], + "description": "The type of object represented by JSON. This object stores information about the loyalty." + } + }, + "required": [ + "id", + "campaign_id", + "metadata", + "created_at", + "config", + "object" + ] + } + ] + }, + "MappingMultiply": { + "title": "MappingMultiply", + "x-stoplight": { + "id": "7zrwgr2oqh4tj" + }, + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "MULTIPLY" + ], + "description": "Type of calculation." + }, + "multiplier": { + "type": "number", + "description": "Multiplication factor used to multiply the points to obtain the mapped points." + } + } + }, + "MappingFixed": { + "title": "MappingFixed", + "x-stoplight": { + "id": "86eksegayxcxa" + }, + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "CUSTOM" + ], + "description": "Type of calculation.\n\n" + }, + "points": { + "type": "integer", + "description": "Fixed number of points to be applied." + } + } + }, + "MappingPoints": { + "anyOf": [ + { + "$ref": "#/components/schemas/MappingMultiply" + }, + { + "$ref": "#/components/schemas/MappingFixed" + } + ] + }, "a_req_importCSV": { "type": "object", "title": "Import CSV file", @@ -66961,7 +67458,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesAddOrRemoveCardBalanceRequestBody" + "$ref": "#/components/schemas/8_req_add_remove_points_balance" }, "examples": { "Add points": { @@ -66986,7 +67483,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesAddOrRemoveCardBalanceResponseBody" + "$ref": "#/components/schemas/8_res_add_remove_points_balance" }, "examples": { "Add balance": { @@ -67075,7 +67572,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesAddOrRemoveCardBalanceRequestBody" + "$ref": "#/components/schemas/8_req_add_remove_points_balance" }, "examples": { "Subtract points": { @@ -67100,7 +67597,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesAddOrRemoveCardBalanceResponseBody" + "$ref": "#/components/schemas/8_res_add_remove_points_balance" }, "examples": { "Subtract Points": { @@ -67184,7 +67681,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesTransferPointsRequestBody" + "$ref": "#/components/schemas/8_req_transfer_loyalty_points" }, "examples": { "Example": { @@ -67209,7 +67706,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesTransferPointsResponseBody" + "$ref": "#/components/schemas/8_obj_loyalty_card_object_non_expanded_categories" }, "examples": { "Example": { @@ -67321,7 +67818,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesListCardTransactionsResponseBody" + "$ref": "#/components/schemas/8_res_get_loyalty_card_transactions" }, "examples": { "Example": { @@ -67662,7 +68159,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesListCardTransactionsResponseBody" + "$ref": "#/components/schemas/8_res_get_loyalty_card_transactions" }, "examples": { "Example": { @@ -67995,7 +68492,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesExportCardTransactionsRequestBody" + "$ref": "#/components/schemas/8_req_create_loyalty_card_transactions_export" }, "examples": { "Example": { @@ -68028,7 +68525,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesExportCardTransactionsResponseBody" + "$ref": "#/components/schemas/8_obj_export_transactions_object" }, "examples": { "Example": { @@ -68161,7 +68658,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesExportCardTransactionsRequestBody" + "$ref": "#/components/schemas/8_req_create_loyalty_card_transactions_export" }, "examples": { "Example": { @@ -68194,7 +68691,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesExportCardTransactionsResponseBody" + "$ref": "#/components/schemas/8_obj_export_transactions_object" }, "examples": { "Example": { @@ -71309,7 +71806,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/4_obj_reward_object" + "$ref": "#/components/schemas/LoyaltiesGetRewardDetailsResponseBody" }, "examples": { "Material": { @@ -71842,7 +72339,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/4_obj_reward_assignment_object" + "$ref": "#/components/schemas/LoyaltiesGetRewardAssignmentResponseBody" }, "examples": { "Example": { @@ -73926,7 +74423,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/8_res_list_loyalty_tiers" + "$ref": "#/components/schemas/LoyaltiesListTiersResponseBody" }, "examples": { "Example": { @@ -74049,6 +74546,43 @@ } } } + }, + "post": { + "operationId": "create-loyalty-tiers", + "tags": [ + "LOYALTIES API" + ], + "summary": "Create loyalty tiers", + "description": "Creates loyalty tiers for desired campaign.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns created loyalty tiers.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LoyaltiesCreateTiersResponseBody" + } + } + } + } + }, + "requestBody": { + "description": "Provide tier definitions you want to add to existing loyalty campaign.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LoyaltiesCreateTiersRequestBody" + } + } + } + } } }, "/v1/loyalties/{campaignId}/tiers/{tierId}": { @@ -74094,7 +74628,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/8_obj_loyalty_tier_object" + "$ref": "#/components/schemas/LoyaltyTier" }, "examples": { "Example": { @@ -74184,7 +74718,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/8_res_get_member_loyalty_tier" + "$ref": "#/components/schemas/LoyaltiesListMemberLoyaltyTiersResponseBody" }, "examples": { "Example": { @@ -74307,7 +74841,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/8_res_list_loyalty_tier_earning_rules" + "$ref": "#/components/schemas/LoyaltiesListLoyaltyTierEarningRulesResponseBody" }, "examples": { "example-1": { @@ -82767,7 +83301,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ExportsCreateRequestBody" + "$ref": "#/components/schemas/16_req_create_export_POST" } } } @@ -82778,7 +83312,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ExportsCreateResponseBody" + "$ref": "#/components/schemas/16_obj_export_object" } } } @@ -82863,7 +83397,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ExportsListResponseBody" + "$ref": "#/components/schemas/16_res_list_exports" }, "examples": { "List Exports": { @@ -82988,7 +83522,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ExportsGetResponseBody" + "$ref": "#/components/schemas/16_obj_export_object" }, "examples": { "Get Export": { diff --git a/scripts/update-md-tables-in-doc.ts b/scripts/update-md-tables-in-doc.ts index f8282938f..ba3bc0ee7 100644 --- a/scripts/update-md-tables-in-doc.ts +++ b/scripts/update-md-tables-in-doc.ts @@ -4,7 +4,7 @@ import { EOL } from 'os'; import { mdTables } from './md-tables'; const PATH_TO_DOCS_REFERENCE = [__dirname, '../docs/reference-docs']; -const PATH_TO_GERENATED_TABLES = [__dirname, './output']; +const PATH_TO_GENERATED_TABLES = [__dirname, './output']; const updateMdTablesInDoc = async () => { for (const [objectName, docFile] of mdTables) { @@ -27,17 +27,17 @@ const updateMdTablesInDoc = async () => { } const additionalBlockquotes = fileContentBlocks[contentBlockIndexWithTableToReplace].match(/^\>.*$/gm) - + const contentBeforeTable = fileContentBlocks.slice(0, contentBlockIndexWithTableToReplace).join('') const contentAfterTable = fileContentBlocks.slice(contentBlockIndexWithTableToReplace + 1).join('') - const newTable = (await fs.readFile(path.join(...PATH_TO_GERENATED_TABLES, `${objectName}.md`))) + const newTable = (await fs.readFile(path.join(...PATH_TO_GENERATED_TABLES, `${objectName}.md`))) .toString(); // .replace((/^\# .*$/m), ''); // Remove first header as in readme.io it already exists const newFileContent = [ contentBeforeTable, - additionalBlockquotes?.length? additionalBlockquotes.join(EOL) : false, + additionalBlockquotes?.length? additionalBlockquotes.join(EOL) : false, newTable, contentAfterTable ].filter(e => !!e) @@ -53,4 +53,4 @@ const updateMdTablesInDoc = async () => { console.log('done') } -updateMdTablesInDoc(); \ No newline at end of file +updateMdTablesInDoc();