From deae34eba701acce25f15aae931b87ca0b498b91 Mon Sep 17 00:00:00 2001 From: p-zielinski <82354717+p-zielinski@users.noreply.github.com> Date: Fri, 24 Nov 2023 16:58:24 +0100 Subject: [PATCH] in progress --- reference/OpenAPI.json | 139 ++++++++++++++--------------------------- scripts/md-tables.ts | 2 +- 2 files changed, 49 insertions(+), 92 deletions(-) diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index be9a16adc..f3f5578bf 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -460,7 +460,7 @@ } }, "customer": { - "$ref": "#/components/schemas/CustomerRequest", + "$ref": "#/components/schemas/Customer", "description": "This is an object containing information about the customer." }, "customer_id": { @@ -745,7 +745,7 @@ "customer": { "anyOf": [ { - "$ref": "#/components/schemas/CustomerResponse", + "$ref": "#/components/schemas/CustomerWithSummaryLoyaltyReferrals", "description": "This is an object containing information about the customer." }, { @@ -860,7 +860,7 @@ "description": "Request schema model for validating a voucher using **POST** `/vouchers/{code}/validate`.", "properties": { "customer": { - "$ref": "#/components/schemas/CustomerRequest", + "$ref": "#/components/schemas/Customer", "description": "Customer's information." }, "order": { @@ -899,7 +899,7 @@ "description": "Request schema model for validating a voucher using **POST** `/vouchers/{code}/validate`.", "properties": { "customer": { - "$ref": "#/components/schemas/CustomerRequest", + "$ref": "#/components/schemas/Customer", "description": "Customer's information." }, "order": { @@ -937,7 +937,7 @@ } }, "customer": { - "$ref": "#/components/schemas/CustomerRequest", + "$ref": "#/components/schemas/Customer", "description": "This is an object containing information about the customer." }, "customer_id": { @@ -1006,7 +1006,7 @@ "description": "Request schema model for validating a voucher using **POST** `/vouchers/{code}/validate`.", "properties": { "customer": { - "$ref": "#/components/schemas/CustomerRequest", + "$ref": "#/components/schemas/Customer", "description": "Customer's information." }, "order": { @@ -1044,7 +1044,7 @@ } }, "customer": { - "$ref": "#/components/schemas/CustomerRequest", + "$ref": "#/components/schemas/Customer", "description": "This is an object containing information about the customer." }, "customer_id": { @@ -1117,7 +1117,7 @@ "title": "Referrer Request", "allOf": [ { - "$ref": "#/components/schemas/CustomerRequest" + "$ref": "#/components/schemas/Customer" } ] }, @@ -1125,7 +1125,7 @@ "title": "Referrer Response", "allOf": [ { - "$ref": "#/components/schemas/CustomerResponse" + "$ref": "#/components/schemas/CustomerWithSummaryLoyaltyReferrals" } ] }, @@ -1210,7 +1210,7 @@ "title": "Customers Create Request Body", "allOf": [ { - "$ref": "#/components/schemas/CustomerRequest" + "$ref": "#/components/schemas/Customer" } ] }, @@ -1226,12 +1226,12 @@ "title": "Customers Update Request Body", "allOf": [ { - "$ref": "#/components/schemas/CustomerResponse" + "$ref": "#/components/schemas/CustomerWithSummaryLoyaltyReferrals" } ] }, - "CustomerRequest": { - "title": "Customer Request", + "Customer": { + "title": "Customer", "allOf": [ { "type": "object", @@ -1277,12 +1277,12 @@ "title": "Customers Create Response Body", "allOf": [ { - "$ref": "#/components/schemas/CustomerResponse" + "$ref": "#/components/schemas/CustomerWithSummaryLoyaltyReferrals" } ] }, - "CustomerResponse": { - "title": "Customer Response", + "CustomerWithSummaryLoyaltyReferrals": { + "title": "Customer With Summary Loyalty Referrals", "allOf": [ { "type": "object", @@ -11037,7 +11037,7 @@ }, "customer": { "description": "Contains information about the customer to whom the publication was directed.", - "$ref": "#/components/schemas/CustomerRequest" + "$ref": "#/components/schemas/Customer" }, "metadata": { "type": "object", @@ -11194,7 +11194,7 @@ "description": "The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. " }, "customer": { - "$ref": "#/components/schemas/CustomerResponse" + "$ref": "#/components/schemas/CustomerWithSummaryLoyaltyReferrals" }, "vouchers_id": { "type": "array", @@ -11368,7 +11368,7 @@ "description": "Status of the publication attempt." }, "customer": { - "$ref": "#/components/schemas/CustomerResponse" + "$ref": "#/components/schemas/CustomerWithSummaryLoyaltyReferrals" }, "vouchers_id": { "type": "array", @@ -14570,7 +14570,7 @@ "description": "Order information." }, "customer": { - "$ref": "#/components/schemas/CustomerRequest", + "$ref": "#/components/schemas/Customer", "description": "Customer's information." }, "session": { @@ -21178,7 +21178,7 @@ "description": "Customer's `source_id`." }, "customer": { - "$ref": "#/components/schemas/CustomerRequest" + "$ref": "#/components/schemas/Customer" }, "order": { "$ref": "#/components/schemas/OrderRequest" @@ -25601,7 +25601,7 @@ "type": "array", "description": "Contains array of customer objects.", "items": { - "$ref": "#/components/schemas/CustomerResponse" + "$ref": "#/components/schemas/CustomerWithSummaryLoyaltyReferrals" } }, "total": { @@ -25621,7 +25621,7 @@ "description": "Retrieve customer details.", "allOf": [ { - "$ref": "#/components/schemas/CustomerResponse" + "$ref": "#/components/schemas/CustomerWithSummaryLoyaltyReferrals" } ] }, @@ -26278,7 +26278,7 @@ "type": "object", "properties": { "customer": { - "$ref": "#/components/schemas/CustomerResponse" + "$ref": "#/components/schemas/CustomerWithSummaryLoyaltyReferrals" }, "unconfirmed_customer": { "type": "object", @@ -26297,7 +26297,7 @@ "type": "object", "properties": { "customer": { - "$ref": "#/components/schemas/CustomerResponse" + "$ref": "#/components/schemas/CustomerWithSummaryLoyaltyReferrals" } } }, @@ -26307,7 +26307,7 @@ "type": "object", "properties": { "customer": { - "$ref": "#/components/schemas/CustomerResponse" + "$ref": "#/components/schemas/CustomerWithSummaryLoyaltyReferrals" } } }, @@ -26317,7 +26317,7 @@ "type": "object", "properties": { "customer": { - "$ref": "#/components/schemas/CustomerResponse" + "$ref": "#/components/schemas/CustomerWithSummaryLoyaltyReferrals" } } }, @@ -26358,7 +26358,7 @@ "type": "object", "properties": { "customer": { - "$ref": "#/components/schemas/CustomerResponse" + "$ref": "#/components/schemas/CustomerWithSummaryLoyaltyReferrals" } }, "additionalProperties": true, @@ -26372,7 +26372,7 @@ "type": "object", "properties": { "customer": { - "$ref": "#/components/schemas/CustomerResponse" + "$ref": "#/components/schemas/CustomerWithSummaryLoyaltyReferrals" }, "segment": { "$ref": "#/components/schemas/SimpleSegment" @@ -26389,7 +26389,7 @@ "type": "object", "properties": { "customer": { - "$ref": "#/components/schemas/CustomerResponse" + "$ref": "#/components/schemas/CustomerWithSummaryLoyaltyReferrals" }, "segment": { "$ref": "#/components/schemas/SimpleSegment" @@ -29409,9 +29409,13 @@ "description": "The event name." }, "customer": { - "type": "object", - "description": "A simple customer object", - "$ref": "#/components/schemas/SimpleCustomerResponse" + "title": "A Simple Customer Object", + "allOf": [ + { + "$ref": "#/components/schemas/SimpleCustomer" + } + ], + "required": ["object"] }, "referral": { "type": "object", @@ -29464,7 +29468,7 @@ }, "customer": { "nullable": true, - "$ref": "#/components/schemas/CustomerResponse" + "$ref": "#/components/schemas/CustomerWithSummaryLoyaltyReferrals" }, "assignment_id": { "type": "string", @@ -29744,7 +29748,7 @@ "maxLength": 300 }, "customer": { - "$ref": "#/components/schemas/CustomerRequest", + "$ref": "#/components/schemas/Customer", "description": "Customer's information." }, "referral": { @@ -29807,9 +29811,13 @@ "description": "The event name." }, "customer": { - "type": "object", - "description": "A simple customer object", - "$ref": "#/components/schemas/SimpleCustomerResponse" + "title": "A Simple Customer Object", + "allOf": [ + { + "$ref": "#/components/schemas/SimpleCustomer" + } + ], + "required": ["object"] }, "referral": { "type": "null", @@ -33530,7 +33538,7 @@ "description": "Request body schema for checking eligibility of a qualification`.", "properties": { "customer": { - "$ref": "#/components/schemas/CustomerRequest", + "$ref": "#/components/schemas/Customer", "description": "Customer's information." }, "order": { @@ -39653,57 +39661,6 @@ "filter" ] }, - "SimpleCustomerResponse": { - "type": "object", - "description": "This is an object representing a customer. \n\nThis entity allows you to:\n* store customer details in Voucherify\n* link [redemptions](ref:list-redemptions) and [validations](ref:validate-voucher) to a particular customer\n* build customer segments and use them in validation rules. ", - "title": "Customer Object", - "examples": [ - { - "id": "cust_4vMj8Twr5nBzvTrNCgipMb6M", - "source_id": "08dd9b5a", - "name": "Bob Smith", - "email": "bob.smith@email.com", - "metadata": { - "age": 24, - "loyalty_customer": "true", - "acquisition_channel": "Facebook" - }, - "object": "customer" - } - ], - "x-tags": [ - "EVENTS API" - ], - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_CSnYd37MXmrbS19XCrghjBsv" - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. " - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the customer.", - "default": "customer" - } - }, - "required": ["object"] - }, "InapplicableToResultList": { "title": "Inapplicable To Result List", "type": "object", @@ -49459,7 +49416,7 @@ "style": "deepObject", "explode": true, "schema": { - "$ref": "#/components/schemas/CustomerRequest" + "$ref": "#/components/schemas/Customer" } }, { diff --git a/scripts/md-tables.ts b/scripts/md-tables.ts index 6f4df6bc9..6b65a6346 100644 --- a/scripts/md-tables.ts +++ b/scripts/md-tables.ts @@ -19,7 +19,7 @@ export const mdTables: [string, string?][] = [ ], ["EarningRule", "LOYALTIES-API-Earning-Rule-Object.md"], ["LoyaltyTier", "LOYALTIES-API-Loyalty-Tier-Object.md"], - ["CustomerResponse", "CUSTOMERS-API-Customer-Object.md"], + ["CustomerWithSummaryLoyaltyReferrals", "CUSTOMERS-API-Customer-Object.md"], ["CustomerActivity", "CUSTOMERS-API-Customer-Activity-Object.md"], ["OrderResponse", "ORDERS-API-Order-Object.md"], ["ProductResponse", "PRODUCTS-API-Product-Object.md"],