diff --git a/clients/pricing-client/src/openapi.d.ts b/clients/pricing-client/src/openapi.d.ts index 98c78e17..d4cf50e8 100644 --- a/clients/pricing-client/src/openapi.d.ts +++ b/clients/pricing-client/src/openapi.d.ts @@ -254,36 +254,111 @@ declare namespace Components { _meta?: /* Signature meta data payload */ SignatureMeta; } /** - * The coupon configuration + * The common properties for a composite price entity, without the price components * example: * { - * "_id": "123e4567-e89b-12d3-a456-426614174000", - * "_schema": "coupon", - * "_org": "org_12345", - * "_created_at": "2024-01-15T10:00:00.000Z", - * "_updated_at": "2024-01-20T12:00:00.000Z", - * "_title": "Sample Coupon", - * "name": "Sample Coupon", - * "type": "fixed", - * "fixed_value": 555, - * "fixed_value_currency": "USD", - * "fixed_value_decimal": "5.55", - * "active": true, - * "prices": { - * "$relation": [ - * { - * "entity_id": "abc12345-def6-7890-gh12-ijklmnopqrst", - * "_tags": [ - * "discount", - * "special" - * ], - * "_schema": "price" - * } - * ] - * } + * "$ref": "#/components/examples/composite-price" * } */ - export interface BaseCoupon { + export interface BaseCompositePrice { + [name: string]: any; + /** + * The billing period duration + */ + billing_duration_amount?: number; + /** + * The billing period duration unit + */ + billing_duration_unit?: "weeks" | "months" | "years"; + /** + * The notice period duration + */ + notice_time_amount?: number; + /** + * The notice period duration unit + */ + notice_time_unit?: "weeks" | "months" | "years"; + /** + * The termination period duration + */ + termination_time_amount?: number; + /** + * The termination period duration unit + */ + termination_time_unit?: "weeks" | "months" | "years"; + /** + * The renewal period duration + */ + renewal_duration_amount?: number; + /** + * The renewal period duration unit + */ + renewal_duration_unit?: "weeks" | "months" | "years"; + /** + * Whether the price can be used for new purchases. + */ + active?: boolean; + /** + * A brief description of the price. + */ + description?: string; + /** + * A set of [price](/api/pricing#tag/simple_price_schema) components that define the composite price. + */ + price_components?: /* A set of [price](/api/pricing#tag/simple_price_schema) components that define the composite price. */ /** + * The price entity schema for simple pricing + * example: + * { + * "$ref": "#/components/examples/price" + * } + */ + Price[] | { + $relation?: PriceComponentRelation[]; + }; + /** + * Three-letter ISO currency code, in lowercase. + */ + unit_amount_currency?: /* Three-letter ISO currency code, in lowercase. */ /** + * Three-letter ISO currency code, in lowercase. Must be a supported currency. + * ISO 4217 CURRENCY CODES as specified in the documentation: https://www.iso.org/iso-4217-currency-codes.html + * + * example: + * EUR + */ + Currency; + /** + * The flag for prices that contain price components. + */ + is_composite_price: true; + /** + * The price creation date + */ + _created_at?: string; + /** + * The price id + */ + _id?: string; + /** + * The price autogenerated title + */ + _title?: string; + /** + * The price last update date + */ + _updated_at?: string; + /** + * The organization id the price belongs to + */ + _org_id?: string; + /** + * An arbitrary set of tags attached to the composite price + */ + _tags?: string[]; + } + /** + * The shared properties for the coupon entity and coupon item entity + */ + export interface BaseCouponCommon { [name: string]: any; _id: EntityId /* uuid */; /** @@ -309,8 +384,8 @@ declare namespace Components { _updated_at: string; // date-time name: string | null; description?: string | null; - type?: "fixed" | "percentage"; - category?: "discount" | "cashback"; + type: "fixed" | "percentage"; + category: "discount" | "cashback"; /** * Use if type is set to percentage. The percentage to be discounted, represented as a whole integer. */ @@ -343,19 +418,6 @@ declare namespace Components { * Whether the coupon requires a promo code to be applied */ requires_promo_code?: boolean; - /** - * The prices associated with the coupon. Will hold price entities if hydrated, relations otherwise. - */ - prices?: /* The prices associated with the coupon. Will hold price entities if hydrated, relations otherwise. */ { - $relation?: EntityRelation[]; - } | /** - * The price entity schema for simple pricing - * example: - * { - * "$ref": "#/components/examples/price" - * } - */ - Price[]; } export interface BaseMarketPriceRecord { /** @@ -456,10 +518,6 @@ declare namespace Components { * The id of the price. */ price_id?: string; - /** - * The flag for prices that contain price components. - */ - is_composite_price?: boolean; /** * An arbitrary string attached to the price item. Often useful for displaying to users. Defaults to product name. */ @@ -706,14 +764,7 @@ declare namespace Components { * "$ref": "#/components/examples/price" * } */ - Price | /** - * The price entity schema for dynamic pricing - * example: - * { - * "$ref": "#/components/examples/composite-price" - * } - */ - CompositePrice; + Price | /* The composite price entity */ CompositePrice; /** * The taxes applied to the price item. */ @@ -725,7 +776,7 @@ declare namespace Components { /** * The coupons applicable to the price item */ - _coupons?: (CouponItem)[]; + _coupons?: (/* The shared properties for the coupon entity and coupon item entity */ CouponItem)[]; /** * When set to true on a `_price` displayed as OnRequest (`show_as_on_request: 'on_request'`) this flag means the price has been approved and can now be displayed to the customer. This flag is only valid for prices shown as 'on_request'. */ @@ -748,10 +799,6 @@ declare namespace Components { * The id of the price. */ price_id?: string; - /** - * The flag for prices that contain price components. - */ - is_composite_price?: boolean; /** * An arbitrary string attached to the price item. Often useful for displaying to users. Defaults to product name. */ @@ -905,10 +952,6 @@ declare namespace Components { * The id of the price. */ price_id?: string; - /** - * The flag for prices that contain price components. - */ - is_composite_price?: boolean; /** * An arbitrary string attached to the price item. Often useful for displaying to users. Defaults to product name. */ @@ -1071,7 +1114,7 @@ declare namespace Components { /** * The coupons applicable to the price item */ - _coupons?: (CouponItem)[]; + _coupons?: (/* The shared properties for the coupon entity and coupon item entity */ CouponItem)[]; } export interface BasicAuthCredentials { /** @@ -1329,7 +1372,7 @@ declare namespace Components { * } */ Price | /** - * The coupon configuration + * The coupon entity * example: * { * "_id": "123e4567-e89b-12d3-a456-426614174000", @@ -1386,107 +1429,23 @@ declare namespace Components { */ export type CheckoutMode = "create_order" | "create_invoice" | "create_quote"; /** - * The price entity schema for dynamic pricing + * The composite price entity + */ + export type CompositePrice = /* The composite price entity */ /** + * The composite price entity * example: * { * "$ref": "#/components/examples/composite-price" * } */ - export interface CompositePrice { - [name: string]: any; - /** - * The billing period duration - */ - billing_duration_amount?: number; - /** - * The billing period duration unit - */ - billing_duration_unit?: "weeks" | "months" | "years"; - /** - * The notice period duration - */ - notice_time_amount?: number; - /** - * The notice period duration unit - */ - notice_time_unit?: "weeks" | "months" | "years"; - /** - * The termination period duration - */ - termination_time_amount?: number; - /** - * The termination period duration unit - */ - termination_time_unit?: "weeks" | "months" | "years"; - /** - * The renewal period duration - */ - renewal_duration_amount?: number; - /** - * The renewal period duration unit - */ - renewal_duration_unit?: "weeks" | "months" | "years"; - /** - * Whether the price can be used for new purchases. - */ - active?: boolean; - /** - * A brief description of the price. - */ - description?: string; - /** - * A set of [price](/api/pricing#tag/simple_price_schema) components that define the composite price. - */ - price_components?: /* A set of [price](/api/pricing#tag/simple_price_schema) components that define the composite price. */ /** - * The price entity schema for simple pricing - * example: - * { - * "$ref": "#/components/examples/price" - * } - */ - Price[] | { - $relation?: PriceComponentRelation[]; - }; - /** - * Three-letter ISO currency code, in lowercase. - */ - unit_amount_currency?: /* Three-letter ISO currency code, in lowercase. */ /** - * Three-letter ISO currency code, in lowercase. Must be a supported currency. - * ISO 4217 CURRENCY CODES as specified in the documentation: https://www.iso.org/iso-4217-currency-codes.html - * - * example: - * EUR - */ - Currency; - /** - * The flag for prices that contain price components. - */ - is_composite_price?: boolean; - /** - * The price creation date - */ - _created_at?: string; - /** - * The price id - */ - _id?: string; - /** - * The price autogenerated title - */ - _title?: string; - /** - * The price last update date - */ - _updated_at?: string; - /** - * The organization id the price belongs to - */ - _org_id?: string; - /** - * An arbitrary set of tags attached to the composite price - */ - _tags?: string[]; - } + NonHydratedCompositePrice | /** + * The composite price entity + * example: + * { + * "$ref": "#/components/examples/composite-price" + * } + */ + HydratedCompositePrice; /** * Represents a composite price input to the pricing library. * example: @@ -1564,10 +1523,6 @@ declare namespace Components { * The id of the price. */ price_id?: string; - /** - * The flag for prices that contain price components. - */ - is_composite_price?: boolean; /** * An arbitrary string attached to the price item. Often useful for displaying to users. Defaults to product name. */ @@ -1814,14 +1769,7 @@ declare namespace Components { * "$ref": "#/components/examples/price" * } */ - Price | /** - * The price entity schema for dynamic pricing - * example: - * { - * "$ref": "#/components/examples/composite-price" - * } - */ - CompositePrice; + Price | /* The composite price entity */ CompositePrice; /** * The taxes applied to the price item. */ @@ -1833,11 +1781,15 @@ declare namespace Components { /** * The coupons applicable to the price item */ - _coupons?: (CouponItem)[]; + _coupons?: (/* The shared properties for the coupon entity and coupon item entity */ CouponItem)[]; /** * When set to true on a `_price` displayed as OnRequest (`show_as_on_request: 'on_request'`) this flag means the price has been approved and can now be displayed to the customer. This flag is only valid for prices shown as 'on_request'. */ on_request_approved?: boolean; + /** + * The flag for prices that contain price components. + */ + is_composite_price: true; /** * Contains price item configurations, per price component, when the main price item is a [composite price](/api/pricing#tag/dynamic_price_schema). */ @@ -1868,10 +1820,6 @@ declare namespace Components { * The id of the price. */ price_id?: string; - /** - * The flag for prices that contain price components. - */ - is_composite_price?: true; /** * An arbitrary string attached to the price item. Often useful for displaying to users. Defaults to product name. */ @@ -2034,7 +1982,11 @@ declare namespace Components { /** * The coupons applicable to the price item */ - _coupons?: (CouponItem)[]; + _coupons?: (/* The shared properties for the coupon entity and coupon item entity */ CouponItem)[]; + /** + * The flag for prices that contain price components. + */ + is_composite_price: true; /** * Contains price item configurations, per price component, when the main price item is a [composite price](/api/pricing#tag/dynamic_price_schema). */ @@ -2049,14 +2001,7 @@ declare namespace Components { price_component_coupon_ids?: { [name: string]: string[]; }; - _price?: /** - * The price entity schema for dynamic pricing - * example: - * { - * "$ref": "#/components/examples/composite-price" - * } - */ - CompositePrice; + _price?: /* The composite price entity */ CompositePrice; } /** * The compute price payload @@ -2285,7 +2230,7 @@ declare namespace Components { } export type ConsumptionTypeGetAg = "household" | "heating_pump" | "night_storage_heating" | "night_storage_heating_common_meter"; /** - * The coupon configuration + * The coupon entity * example: * { * "_id": "123e4567-e89b-12d3-a456-426614174000", @@ -2340,8 +2285,8 @@ declare namespace Components { _updated_at: string; // date-time name: string | null; description?: string | null; - type?: "fixed" | "percentage"; - category?: "discount" | "cashback"; + type: "fixed" | "percentage"; + category: "discount" | "cashback"; /** * Use if type is set to percentage. The percentage to be discounted, represented as a whole integer. */ @@ -2404,16 +2349,20 @@ declare namespace Components { [name: string]: number; }; } + /** + * The shared properties for the coupon entity and coupon item entity + */ export interface CouponItem { - _id?: EntityId /* uuid */; + [name: string]: any; + _id: EntityId /* uuid */; /** * The auto-generated title for the title */ - _title?: string; + _title: string; /** * Organization Id the entity belongs to */ - _org?: string; + _org: string; /** * The schema of the entity, for coupons it is always `coupon` */ @@ -2422,12 +2371,12 @@ declare namespace Components { /** * The creation date for the opportunity */ - _created_at?: string; // date-time + _created_at: string; // date-time /** * The date the coupon was last updated */ - _updated_at?: string; // date-time - name?: string | null; + _updated_at: string; // date-time + name: string | null; description?: string | null; type: "fixed" | "percentage"; category: "discount" | "cashback"; @@ -2465,7 +2414,7 @@ declare namespace Components { requires_promo_code?: boolean; } /** - * The coupon configuration + * The base for the coupon entity without promo codes * example: * { * "_id": "123e4567-e89b-12d3-a456-426614174000", @@ -2520,8 +2469,8 @@ declare namespace Components { _updated_at: string; // date-time name: string | null; description?: string | null; - type?: "fixed" | "percentage"; - category?: "discount" | "cashback"; + type: "fixed" | "percentage"; + category: "discount" | "cashback"; /** * Use if type is set to percentage. The percentage to be discounted, represented as a whole integer. */ @@ -2796,16 +2745,104 @@ declare namespace Components { /** * Cost in Cents, e.g. 12.3 for 12,3 Cents = 0.123€. * example: - * 12.3 + * 12.3 + */ + unit_amount: number; + /** + * Cost in decimal format, e.g. 0.123€. + * example: + * 0.123 + */ + unit_amount_decimal: string; + unit_amount_currency: /** + * Three-letter ISO currency code, in lowercase. Must be a supported currency. + * ISO 4217 CURRENCY CODES as specified in the documentation: https://www.iso.org/iso-4217-currency-codes.html + * + * example: + * EUR + */ + Currency; + /** + * ISO 8601 timestamp of the price record in UTC. + */ + timestamp: string; // date-time + } + export interface HistoricMarketPricesResult { + market: /* The market for a spot market price. */ SpotMarketType; + bidding_zone: /* The bidding zone for a spot market price. */ SpotMarketBiddingZone; + prices: /* A market price at a given point in time. */ HistoricMarketPriceRecord[]; + } + /** + * The composite price entity + * example: + * { + * "$ref": "#/components/examples/composite-price" + * } + */ + export interface HydratedCompositePrice { + [name: string]: any; + /** + * The billing period duration + */ + billing_duration_amount?: number; + /** + * The billing period duration unit + */ + billing_duration_unit?: "weeks" | "months" | "years"; + /** + * The notice period duration + */ + notice_time_amount?: number; + /** + * The notice period duration unit + */ + notice_time_unit?: "weeks" | "months" | "years"; + /** + * The termination period duration + */ + termination_time_amount?: number; + /** + * The termination period duration unit + */ + termination_time_unit?: "weeks" | "months" | "years"; + /** + * The renewal period duration + */ + renewal_duration_amount?: number; + /** + * The renewal period duration unit + */ + renewal_duration_unit?: "weeks" | "months" | "years"; + /** + * Whether the price can be used for new purchases. + */ + active?: boolean; + /** + * A brief description of the price. + */ + description?: string; + /** + * A set of [price](/api/pricing#tag/simple_price_schema) components that define the composite price. + */ + price_components?: /* A set of [price](/api/pricing#tag/simple_price_schema) components that define the composite price. */ /** + * The price entity schema for simple pricing + * example: + * { + * "$ref": "#/components/examples/price" + * } */ - unit_amount: number; - /** - * Cost in decimal format, e.g. 0.123€. + Price[] | /** + * The price entity schema for simple pricing * example: - * 0.123 + * { + * "$ref": "#/components/examples/price" + * } */ - unit_amount_decimal: string; - unit_amount_currency: /** + Price[]; + /** + * Three-letter ISO currency code, in lowercase. + */ + unit_amount_currency?: /* Three-letter ISO currency code, in lowercase. */ /** * Three-letter ISO currency code, in lowercase. Must be a supported currency. * ISO 4217 CURRENCY CODES as specified in the documentation: https://www.iso.org/iso-4217-currency-codes.html * @@ -2814,14 +2851,33 @@ declare namespace Components { */ Currency; /** - * ISO 8601 timestamp of the price record in UTC. + * The flag for prices that contain price components. */ - timestamp: string; // date-time - } - export interface HistoricMarketPricesResult { - market: /* The market for a spot market price. */ SpotMarketType; - bidding_zone: /* The bidding zone for a spot market price. */ SpotMarketBiddingZone; - prices: /* A market price at a given point in time. */ HistoricMarketPriceRecord[]; + is_composite_price: true; + /** + * The price creation date + */ + _created_at?: string; + /** + * The price id + */ + _id?: string; + /** + * The price autogenerated title + */ + _title?: string; + /** + * The price last update date + */ + _updated_at?: string; + /** + * The organization id the price belongs to + */ + _org_id?: string; + /** + * An arbitrary set of tags attached to the composite price + */ + _tags?: string[]; } /** * The auth credentials for external integrations @@ -2915,6 +2971,103 @@ declare namespace Components { */ value?: string; })[]; + /** + * The composite price entity + * example: + * { + * "$ref": "#/components/examples/composite-price" + * } + */ + export interface NonHydratedCompositePrice { + [name: string]: any; + /** + * The billing period duration + */ + billing_duration_amount?: number; + /** + * The billing period duration unit + */ + billing_duration_unit?: "weeks" | "months" | "years"; + /** + * The notice period duration + */ + notice_time_amount?: number; + /** + * The notice period duration unit + */ + notice_time_unit?: "weeks" | "months" | "years"; + /** + * The termination period duration + */ + termination_time_amount?: number; + /** + * The termination period duration unit + */ + termination_time_unit?: "weeks" | "months" | "years"; + /** + * The renewal period duration + */ + renewal_duration_amount?: number; + /** + * The renewal period duration unit + */ + renewal_duration_unit?: "weeks" | "months" | "years"; + /** + * Whether the price can be used for new purchases. + */ + active?: boolean; + /** + * A brief description of the price. + */ + description?: string; + /** + * A set of [price](/api/pricing#tag/simple_price_schema) components that define the composite price. + */ + price_components?: /* A set of [price](/api/pricing#tag/simple_price_schema) components that define the composite price. */ { + $relation?: PriceComponentRelation[]; + } | { + $relation?: PriceComponentRelation[]; + }; + /** + * Three-letter ISO currency code, in lowercase. + */ + unit_amount_currency?: /* Three-letter ISO currency code, in lowercase. */ /** + * Three-letter ISO currency code, in lowercase. Must be a supported currency. + * ISO 4217 CURRENCY CODES as specified in the documentation: https://www.iso.org/iso-4217-currency-codes.html + * + * example: + * EUR + */ + Currency; + /** + * The flag for prices that contain price components. + */ + is_composite_price: true; + /** + * The price creation date + */ + _created_at?: string; + /** + * The price id + */ + _id?: string; + /** + * The price autogenerated title + */ + _title?: string; + /** + * The price last update date + */ + _updated_at?: string; + /** + * The organization id the price belongs to + */ + _org_id?: string; + /** + * An arbitrary set of tags attached to the composite price + */ + _tags?: string[]; + } export interface OAuthCredentials { /** * The OAuth client ID @@ -2973,6 +3126,11 @@ declare namespace Components { */ base_url?: string; } + export interface Offer { + product_id?: string; + price_id?: string; + target_id?: string; + } /** * The opportunity entity * example: @@ -3454,7 +3612,7 @@ declare namespace Components { /** * The flag for prices that contain price components. */ - is_composite_price?: boolean; + is_composite_price?: false; /** * Describes how to compute the price per period. Either `per_unit`, `tiered_graduated` or `tiered_volume`. * - `per_unit` indicates that the fixed amount (specified in unit_amount or unit_amount_decimal) will be charged per unit in quantity @@ -3839,10 +3997,6 @@ declare namespace Components { * The id of the price. */ price_id?: string; - /** - * The flag for prices that contain price components. - */ - is_composite_price?: boolean; /** * An arbitrary string attached to the price item. Often useful for displaying to users. Defaults to product name. */ @@ -4089,14 +4243,7 @@ declare namespace Components { * "$ref": "#/components/examples/price" * } */ - Price | /** - * The price entity schema for dynamic pricing - * example: - * { - * "$ref": "#/components/examples/composite-price" - * } - */ - CompositePrice; + Price | /* The composite price entity */ CompositePrice; /** * The taxes applied to the price item. */ @@ -4108,7 +4255,7 @@ declare namespace Components { /** * The coupons applicable to the price item */ - _coupons?: (CouponItem)[]; + _coupons?: (/* The shared properties for the coupon entity and coupon item entity */ CouponItem)[]; /** * When set to true on a `_price` displayed as OnRequest (`show_as_on_request: 'on_request'`) this flag means the price has been approved and can now be displayed to the customer. This flag is only valid for prices shown as 'on_request'. */ @@ -4117,6 +4264,10 @@ declare namespace Components { * One of `one_time` or `recurring` depending on whether the price is for a one-time purchase or a recurring (subscription) purchase. */ type?: "one_time" | "recurring"; + /** + * The flag for prices that contain price components. + */ + is_composite_price?: false; /** * The price billing period. */ @@ -4153,10 +4304,6 @@ declare namespace Components { * The id of the price. */ price_id?: string; - /** - * The flag for prices that contain price components. - */ - is_composite_price?: false; /** * An arbitrary string attached to the price item. Often useful for displaying to users. Defaults to product name. */ @@ -4319,7 +4466,7 @@ declare namespace Components { /** * The coupons applicable to the price item */ - _coupons?: (CouponItem)[]; + _coupons?: (/* The shared properties for the coupon entity and coupon item entity */ CouponItem)[]; /** * One of `one_time` or `recurring` depending on whether the price is for a one-time purchase or a recurring (subscription) purchase. */ @@ -4348,6 +4495,10 @@ declare namespace Components { * The unit amount in cents to be charged, represented as a decimal string with at most 12 decimal places. */ unit_amount_decimal?: string; + /** + * The flag for prices that contain price components. + */ + is_composite_price?: false; /** * Describes how to compute the price per period. Either `per_unit`, `tiered_graduated` or `tiered_volume`. * - `per_unit` indicates that the fixed amount (specified in unit_amount or unit_amount_decimal) will be charged per unit in quantity @@ -4407,7 +4558,7 @@ declare namespace Components { /** * The flag for prices that contain price components. */ - is_composite_price?: boolean; + is_composite_price?: false; /** * Describes how to compute the price per period. Either `per_unit`, `tiered_graduated` or `tiered_volume`. * - `per_unit` indicates that the fixed amount (specified in unit_amount or unit_amount_decimal) will be charged per unit in quantity @@ -4540,7 +4691,7 @@ declare namespace Components { _tags?: string[]; }; } - export type PriceItemUnion = /* Represents a price input to the pricing library. */ PriceItemDto | /* Represents a composite price input to the pricing library. */ CompositePriceItemDto; + export type PriceItemDtoUnion = /* Represents a price input to the pricing library. */ PriceItemDto | /* Represents a composite price input to the pricing library. */ CompositePriceItemDto; /** * Tracks a set of product prices, quantities, (discounts) and taxes. */ @@ -4562,7 +4713,7 @@ declare namespace Components { /** * A valid set of product prices, quantities, (discounts) and taxes from a client. */ - export type PriceItemsDto = PriceItemUnion[]; + export type PriceItemsDto = PriceItemDtoUnion[]; export interface PriceTier { up_to?: number | null; flat_fee_amount?: number; @@ -4796,6 +4947,95 @@ declare namespace Components { _updated_at?: string; } export type ProductCategory = "power" | "gas"; + /** + * example: + * { + * "_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", + * "_org": "123", + * "_schema": "contact", + * "_tags": [ + * "example", + * "mock" + * ], + * "_created_at": "2021-02-09T12:41:43.662Z", + * "_updated_at": "2021-02-09T12:41:43.662Z" + * } + */ + export interface ProductRecommendation { + _id: EntityId /* uuid */; + /** + * Title of entity + */ + _title: string; + /** + * Organization Id the entity belongs to + */ + _org: string; + _schema: string; + _tags?: string[]; + _created_at: string; // date-time + _updated_at: string; // date-time + /** + * Price being used as source + */ + source_price?: { + $relation?: EntityRelation[]; + }; + /** + * Product being used as source + */ + source_product?: { + $relation?: EntityRelation[]; + }; + /** + * Type of product recommendation + */ + type?: "change" | "cross-sell" | "up-sell"; + offer?: Offer[]; + } + /** + * Product recommendations request payload + */ + export interface ProductRecommendationResponse { + /** + * The number os results returned. + */ + hits?: number; + results?: /** + * example: + * { + * "_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", + * "_org": "123", + * "_schema": "contact", + * "_tags": [ + * "example", + * "mock" + * ], + * "_created_at": "2021-02-09T12:41:43.662Z", + * "_updated_at": "2021-02-09T12:41:43.662Z" + * } + */ + ProductRecommendation[]; + } + /** + * Product recommendations request payload + */ + export interface ProductRecommendationSearch { + product_recommendation_ids?: string[]; + /** + * The catalog item to be used as source for the recommendation + */ + catalog_item?: { + /** + * Product id + */ + product_id?: string; + /** + * Product id + */ + price_id?: string; + }; + } /** * example: * { @@ -4828,7 +5068,7 @@ declare namespace Components { */ export interface PromoCodeValidationResponse { matched_coupons?: /** - * The coupon configuration + * The base for the coupon entity without promo codes * example: * { * "_id": "123e4567-e89b-12d3-a456-426614174000", @@ -4857,7 +5097,7 @@ declare namespace Components { * } * } */ - BaseCoupon[]; + CouponWithoutPromoCodes[]; } /** * The provider entity @@ -5086,7 +5326,7 @@ declare namespace Components { * The coupons that got redeemed with received the code */ coupons: /** - * The coupon configuration + * The base for the coupon entity without promo codes * example: * { * "_id": "123e4567-e89b-12d3-a456-426614174000", @@ -5612,6 +5852,19 @@ declare namespace Paths { export type $400 = Components.Schemas.Error; } } + namespace $ProductRecommendations { + export interface HeaderParameters { + "X-Ivy-Org-ID"?: Parameters.XIvyOrgID; + } + namespace Parameters { + export type XIvyOrgID = string; + } + export type RequestBody = /* Product recommendations request payload */ Components.Schemas.ProductRecommendationSearch; + namespace Responses { + export type $200 = /* Product recommendations request payload */ Components.Schemas.ProductRecommendationResponse; + export type $400 = Components.Schemas.Error; + } + } namespace $SaveCredentials { namespace Parameters { export type IntegrationId = Components.Schemas.IntegrationId; @@ -5996,6 +6249,16 @@ export interface OperationMethods { data?: any, config?: AxiosRequestConfig ): OperationResponse + /** + * $productRecommendations - productRecommendations + * + * Get a list of product recommendations based on the search parameters. + */ + '$productRecommendations'( + parameters?: Parameters | null, + data?: Paths.$ProductRecommendations.RequestBody, + config?: AxiosRequestConfig + ): OperationResponse } export interface PathsDictionary { @@ -6226,6 +6489,18 @@ export interface PathsDictionary { config?: AxiosRequestConfig ): OperationResponse } + ['/v1/public/product-recommendations']: { + /** + * $productRecommendations - productRecommendations + * + * Get a list of product recommendations based on the search parameters. + */ + 'post'( + parameters?: Parameters | null, + data?: Paths.$ProductRecommendations.RequestBody, + config?: AxiosRequestConfig + ): OperationResponse + } } export type Client = OpenAPIClient @@ -6239,7 +6514,8 @@ export type AvailabilityLocation = Components.Schemas.AvailabilityLocation; export type AvailabilityResult = Components.Schemas.AvailabilityResult; export type AverageMarketPriceRecord = Components.Schemas.AverageMarketPriceRecord; export type AverageMarketPriceResult = Components.Schemas.AverageMarketPriceResult; -export type BaseCoupon = Components.Schemas.BaseCoupon; +export type BaseCompositePrice = Components.Schemas.BaseCompositePrice; +export type BaseCouponCommon = Components.Schemas.BaseCouponCommon; export type BaseMarketPriceRecord = Components.Schemas.BaseMarketPriceRecord; export type BasePriceItem = Components.Schemas.BasePriceItem; export type BasePriceItemCommon = Components.Schemas.BasePriceItemCommon; @@ -6287,14 +6563,17 @@ export type File = Components.Schemas.File; export type GasConcessionType = Components.Schemas.GasConcessionType; export type HistoricMarketPriceRecord = Components.Schemas.HistoricMarketPriceRecord; export type HistoricMarketPricesResult = Components.Schemas.HistoricMarketPricesResult; +export type HydratedCompositePrice = Components.Schemas.HydratedCompositePrice; export type IntegrationAuthCredentials = Components.Schemas.IntegrationAuthCredentials; export type IntegrationCredentialsResult = Components.Schemas.IntegrationCredentialsResult; export type IntegrationId = Components.Schemas.IntegrationId; export type JourneyContext = Components.Schemas.JourneyContext; export type MarkupPricingModel = Components.Schemas.MarkupPricingModel; export type MetaData = Components.Schemas.MetaData; +export type NonHydratedCompositePrice = Components.Schemas.NonHydratedCompositePrice; export type OAuthCredentials = Components.Schemas.OAuthCredentials; export type OAuthIntegration = Components.Schemas.OAuthIntegration; +export type Offer = Components.Schemas.Offer; export type Opportunity = Components.Schemas.Opportunity; export type OpportunitySource = Components.Schemas.OpportunitySource; export type Order = Components.Schemas.Order; @@ -6313,7 +6592,7 @@ export type PriceInputMapping = Components.Schemas.PriceInputMapping; export type PriceInputMappings = Components.Schemas.PriceInputMappings; export type PriceItem = Components.Schemas.PriceItem; export type PriceItemDto = Components.Schemas.PriceItemDto; -export type PriceItemUnion = Components.Schemas.PriceItemUnion; +export type PriceItemDtoUnion = Components.Schemas.PriceItemDtoUnion; export type PriceItems = Components.Schemas.PriceItems; export type PriceItemsDto = Components.Schemas.PriceItemsDto; export type PriceTier = Components.Schemas.PriceTier; @@ -6324,6 +6603,9 @@ export type PricingDetailsResponse = Components.Schemas.PricingDetailsResponse; export type PricingModel = Components.Schemas.PricingModel; export type Product = Components.Schemas.Product; export type ProductCategory = Components.Schemas.ProductCategory; +export type ProductRecommendation = Components.Schemas.ProductRecommendation; +export type ProductRecommendationResponse = Components.Schemas.ProductRecommendationResponse; +export type ProductRecommendationSearch = Components.Schemas.ProductRecommendationSearch; export type PromoCode = Components.Schemas.PromoCode; export type PromoCodeValidationResponse = Components.Schemas.PromoCodeValidationResponse; export type Provider = Components.Schemas.Provider; diff --git a/clients/pricing-client/src/openapi.json b/clients/pricing-client/src/openapi.json index e66d61d7..729b1fba 100644 --- a/clients/pricing-client/src/openapi.json +++ b/clients/pricing-client/src/openapi.json @@ -2211,6 +2211,133 @@ } } } + }, + "/v1/public/product-recommendations": { + "post": { + "description": "Get a list of product recommendations based on the search parameters.", + "operationId": "$productRecommendations", + "summary": "productRecommendations", + "security": [ + { + "EpilotPublicAuth": [] + } + ], + "tags": [ + "Product Recommendations API" + ], + "parameters": [ + { + "in": "header", + "name": "X-Ivy-Org-ID", + "description": "The target Organization Id represented by the caller", + "example": 739224, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProductRecommendationSearch" + }, + "examples": { + "Search product recommendations by id": { + "value": { + "product_recommendation_ids": [ + "bae8d40a-0093-483a-b4f9-3653800b6781" + ] + } + }, + "Search product recommendations source product and price": { + "value": { + "catalog_item": { + "product_id": "aa1ebf85-f36e-46ff-978c-ed948c646f12", + "price_id": "4ecf9a61-a974-4594-bae2-bcb798f54d76" + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "The product recommendations result", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProductRecommendationResponse" + }, + "examples": { + "Product recommendations": { + "value": { + "hits": 1, + "results": [ + { + "_title": "Tarifwechsel 2025", + "_created_at": "2025-01-29T15:46:41.014Z", + "_updated_at": "2025-01-29T15:46:41.014Z", + "name": "Tarifwechsel 2025", + "type": "change", + "source_product": { + "$relation": [ + { + "entity_id": "e2b12b54-d904-42b7-ac44-802d8ebaadf4" + } + ] + }, + "source_price": { + "$relation": [ + { + "entity_id": "255877f3-f9c2-483e-9c71-89088c142bfc" + } + ] + }, + "_schema": "product_recommendation", + "offers": [ + { + "target_id": "f9aa8757-505b-46bd-9310-605d64849565", + "items": [ + { + "product_id": "70ad8a08-46c2-473b-b1c5-8bccfb85e452", + "price_id": "26c9c39d-db4a-4132-af2e-86ab5c7b156c" + }, + { + "product_id": "dd97a2a4-e48b-43c5-8717-7ac563c67e05", + "price_id": "4ecf9a61-a974-4594-bae2-bcb798f54d76" + }, + { + "product_id": "aa1ebf85-f36e-46ff-978c-ed948c646f12", + "price_id": "4ecf9a61-a974-4594-bae2-bcb798f54d76" + } + ] + } + ], + "_id": "6d872912-ef8a-4815-b9db-01744c0828ac", + "_org": "739224" + } + ] + } + } + } + } + } + }, + "400": { + "description": "Invalid payload", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } } }, "components": { @@ -2841,7 +2968,10 @@ }, "is_composite_price": { "description": "The flag for prices that contain price components.", - "type": "boolean" + "type": "boolean", + "enum": [ + false + ] }, "pricing_model": { "type": "string", @@ -3017,19 +3147,22 @@ "pricing_model" ] }, - "CompositePrice": { + "BaseCompositePrice": { "allOf": [ { "$ref": "#/components/schemas/PriceConditions" } ], "type": "object", - "description": "The price entity schema for dynamic pricing", + "description": "The common properties for a composite price entity, without the price components", "example": { "$ref": "#/components/examples/composite-price" }, "additionalProperties": true, "readOnly": true, + "required": [ + "is_composite_price" + ], "properties": { "active": { "type": "boolean", @@ -3071,7 +3204,10 @@ }, "is_composite_price": { "description": "The flag for prices that contain price components.", - "type": "boolean" + "type": "boolean", + "enum": [ + true + ] }, "_created_at": { "description": "The price creation date", @@ -3102,6 +3238,58 @@ } } }, + "NonHydratedCompositePrice": { + "allOf": [ + { + "$ref": "#/components/schemas/BaseCompositePrice" + } + ], + "type": "object", + "description": "The composite price entity", + "properties": { + "price_components": { + "description": "A set of [price](/api/pricing#tag/simple_price_schema) components that define the composite price.", + "type": "object", + "properties": { + "$relation": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PriceComponentRelation" + } + } + } + } + } + }, + "HydratedCompositePrice": { + "allOf": [ + { + "$ref": "#/components/schemas/BaseCompositePrice" + } + ], + "type": "object", + "description": "The composite price entity", + "properties": { + "price_components": { + "description": "A set of [price](/api/pricing#tag/simple_price_schema) components that define the composite price.", + "type": "array", + "items": { + "$ref": "#/components/schemas/Price" + } + } + } + }, + "CompositePrice": { + "oneOf": [ + { + "$ref": "#/components/schemas/NonHydratedCompositePrice" + }, + { + "$ref": "#/components/schemas/HydratedCompositePrice" + } + ], + "description": "The composite price entity" + }, "PriceComponentRelation": { "type": "object", "properties": { @@ -4357,10 +4545,6 @@ "type": "string", "description": "The id of the price." }, - "is_composite_price": { - "description": "The flag for prices that contain price components.", - "type": "boolean" - }, "description": { "type": "string", "description": "An arbitrary string attached to the price item. Often useful for displaying to users. Defaults to product name." @@ -4391,7 +4575,7 @@ } } }, - "PriceItemUnion": { + "PriceItemDtoUnion": { "anyOf": [ { "$ref": "#/components/schemas/PriceItemDto" @@ -4412,7 +4596,7 @@ "description": "A valid set of product prices, quantities, (discounts) and taxes from a client.", "type": "array", "items": { - "$ref": "#/components/schemas/PriceItemUnion" + "$ref": "#/components/schemas/PriceItemDtoUnion" } }, "BasePriceItemDto": { @@ -4569,6 +4753,9 @@ }, { "type": "object", + "required": [ + "is_composite_price" + ], "properties": { "is_composite_price": { "description": "The flag for prices that contain price components.", @@ -4876,7 +5063,17 @@ ], "description": "Represents a composite price input to the pricing library.", "type": "object", + "required": [ + "is_composite_price" + ], "properties": { + "is_composite_price": { + "description": "The flag for prices that contain price components.", + "type": "boolean", + "enum": [ + true + ] + }, "item_components": { "type": "array", "description": "Contains price item configurations, per price component, when the main price item is a [composite price](/api/pricing#tag/dynamic_price_schema).", @@ -5174,6 +5371,13 @@ "recurring" ] }, + "is_composite_price": { + "description": "The flag for prices that contain price components.", + "type": "boolean", + "enum": [ + false + ] + }, "billing_period": { "type": "string", "description": "The price billing period.", @@ -5506,7 +5710,7 @@ "matched_coupons": { "type": "array", "items": { - "$ref": "#/components/schemas/BaseCoupon" + "$ref": "#/components/schemas/CouponWithoutPromoCodes" } } } @@ -5955,9 +6159,9 @@ } } }, - "BaseCoupon": { + "BaseCouponCommon": { "type": "object", - "description": "The coupon configuration", + "description": "The shared properties for the coupon entity and coupon item entity", "additionalProperties": true, "required": [ "name", @@ -5966,7 +6170,9 @@ "_org", "_schema", "_created_at", - "_updated_at" + "_updated_at", + "type", + "category" ], "properties": { "_id": { @@ -6067,7 +6273,18 @@ "requires_promo_code": { "type": "boolean", "description": "Whether the coupon requires a promo code to be applied" - }, + } + } + }, + "CouponWithoutPromoCodes": { + "type": "object", + "description": "The base for the coupon entity without promo codes", + "allOf": [ + { + "$ref": "#/components/schemas/BaseCouponCommon" + } + ], + "properties": { "prices": { "description": "The prices associated with the coupon. Will hold price entities if hydrated, relations otherwise.", "oneOf": [ @@ -6119,9 +6336,10 @@ } }, "Coupon": { + "description": "The coupon entity", "allOf": [ { - "$ref": "#/components/schemas/BaseCoupon" + "$ref": "#/components/schemas/CouponWithoutPromoCodes" } ], "type": "object", @@ -6143,117 +6361,9 @@ }, "CouponItem": { "type": "object", - "required": [ - "type", - "category", - "_schema" - ], - "properties": { - "_id": { - "$ref": "#/components/schemas/EntityId", - "readOnly": true - }, - "_title": { - "type": "string", - "description": "The auto-generated title for the title", - "readOnly": true - }, - "_org": { - "type": "string", - "description": "Organization Id the entity belongs to", - "readOnly": true - }, - "_schema": { - "type": "string", - "enum": [ - "coupon" - ], - "readOnly": true, - "description": "The schema of the entity, for coupons it is always `coupon`" - }, - "_tags": { - "type": "array", - "items": { - "type": "string" - } - }, - "_created_at": { - "type": "string", - "format": "date-time", - "readOnly": true, - "description": "The creation date for the opportunity" - }, - "_updated_at": { - "type": "string", - "format": "date-time", - "readOnly": true, - "description": "The date the coupon was last updated" - }, - "name": { - "type": "string", - "nullable": true - }, - "description": { - "type": "string", - "nullable": true - }, - "type": { - "type": "string", - "enum": [ - "fixed", - "percentage" - ] - }, - "category": { - "type": "string", - "enum": [ - "discount", - "cashback" - ] - }, - "percentage_value": { - "type": "string", - "description": "Use if type is set to percentage. The percentage to be discounted, represented as a whole integer.", - "nullable": true - }, - "fixed_value": { - "description": "Use if type is set to fixed. The fixed amount in cents to be discounted, represented as a whole integer.", - "type": "number" - }, - "fixed_value_decimal": { - "description": "Use if type is set to fixed. The unit amount in cents to be discounted, represented as a decimal string with at most 12 decimal places.", - "type": "string" - }, - "fixed_value_currency": { - "description": "Use if type is set to fixed. Three-letter ISO currency code, in lowercase.", - "oneOf": [ - { - "$ref": "#/components/schemas/Currency" - } - ] - }, - "cashback_period": { - "type": "string", - "description": "The cashback period, for now it's limited to either 0 months or 12 months", - "enum": [ - "0", - "12" - ], - "nullable": true - }, - "active": { - "type": "boolean" - }, - "requires_promo_code": { - "type": "boolean", - "description": "Whether the coupon requires a promo code to be applied" - } - } - }, - "CouponWithoutPromoCodes": { "allOf": [ { - "$ref": "#/components/schemas/BaseCoupon" + "$ref": "#/components/schemas/BaseCouponCommon" } ] }, @@ -6720,6 +6830,112 @@ "pricing_details", "_meta" ] + }, + "ProductRecommendationSearch": { + "description": "Product recommendations request payload", + "type": "object", + "properties": { + "product_recommendation_ids": { + "type": "array", + "items": { + "type": "string", + "description": "Product recommendation id" + } + }, + "catalog_item": { + "type": "object", + "description": "The catalog item to be used as source for the recommendation", + "properties": { + "product_id": { + "type": "string", + "description": "Product id" + }, + "price_id": { + "type": "string", + "description": "Product id" + } + } + } + } + }, + "ProductRecommendationResponse": { + "description": "Product recommendations request payload", + "type": "object", + "properties": { + "hits": { + "type": "number", + "description": "The number os results returned." + }, + "results": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ProductRecommendation" + } + } + } + }, + "Offer": { + "type": "object", + "properties": { + "product_id": { + "type": "string" + }, + "price_id": { + "type": "string" + }, + "target_id": { + "type": "string" + } + } + }, + "ProductRecommendation": { + "allOf": [ + { + "$ref": "#/components/schemas/EntityItem" + } + ], + "type": "object", + "properties": { + "source_price": { + "type": "object", + "description": "Price being used as source", + "properties": { + "$relation": { + "type": "array", + "items": { + "$ref": "#/components/schemas/EntityRelation" + } + } + } + }, + "source_product": { + "type": "object", + "description": "Product being used as source", + "properties": { + "$relation": { + "type": "array", + "items": { + "$ref": "#/components/schemas/EntityRelation" + } + } + } + }, + "type": { + "type": "string", + "description": "Type of product recommendation", + "enum": [ + "change", + "cross-sell", + "up-sell" + ] + }, + "offer": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Offer" + } + } + } } }, "examples": {