From 19e1d324fbb8d5adb41651cd194264d65876ccd9 Mon Sep 17 00:00:00 2001 From: algolia-bot Date: Mon, 15 Jan 2024 14:11:13 +0000 Subject: [PATCH] chore: generated code for commit 7c5ba328. [skip ci] https://github.com/algolia/api-clients-automation/commit/7c5ba32887086875d2fc9a65c9326e4d7091b617 Co-authored-by: algolia-bot Co-authored-by: Kai Welke Co-authored-by: shortcuts Co-authored-by: Pierre Millot Co-authored-by: Morgan Leroi --- .../model/addedToCartObjectIDs.ts | 29 ++++++++------- .../model/addedToCartObjectIDsAfterSearch.ts | 29 ++++++++------- .../client-insights/model/clickedFilters.ts | 14 ++++---- .../client-insights/model/clickedObjectIDs.ts | 15 +++++--- .../model/clickedObjectIDsAfterSearch.ts | 18 +++++----- .../model/clientMethodProps.ts | 10 ++++++ .../client-insights/model/convertedFilters.ts | 14 ++++---- .../model/convertedObjectIDs.ts | 16 ++++----- .../model/convertedObjectIDsAfterSearch.ts | 16 ++++----- packages/client-insights/model/discount.ts | 2 +- packages/client-insights/model/index.ts | 1 + .../client-insights/model/insightsEvents.ts | 2 +- packages/client-insights/model/objectData.ts | 2 +- .../model/objectDataAfterSearch.ts | 4 +-- packages/client-insights/model/price.ts | 2 +- .../model/purchasedObjectIDs.ts | 29 ++++++++------- .../model/purchasedObjectIDsAfterSearch.ts | 30 ++++++++-------- packages/client-insights/model/value.ts | 6 ++++ .../client-insights/model/viewedFilters.ts | 14 ++++---- .../client-insights/model/viewedObjectIDs.ts | 16 ++++----- .../client-insights/src/insightsClient.ts | 36 +++++++++++++++++++ 21 files changed, 185 insertions(+), 120 deletions(-) create mode 100644 packages/client-insights/model/value.ts diff --git a/packages/client-insights/model/addedToCartObjectIDs.ts b/packages/client-insights/model/addedToCartObjectIDs.ts index 5e668a8c0..f14ca729d 100644 --- a/packages/client-insights/model/addedToCartObjectIDs.ts +++ b/packages/client-insights/model/addedToCartObjectIDs.ts @@ -3,13 +3,14 @@ import type { AddToCartEvent } from './addToCartEvent'; import type { ConversionEvent } from './conversionEvent'; import type { ObjectData } from './objectData'; +import type { Value } from './value'; /** * Use this event to track when users add items to their shopping cart unrelated to a previous Algolia request. For example, if you don\'t use Algolia to build your category pages, use this event. To track add-to-cart events related to Algolia requests, use the \"Added to cart object IDs after search\" event. */ export type AddedToCartObjectIDs = { /** - * Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + * The name of the event, up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. */ eventName: string; @@ -18,37 +19,39 @@ export type AddedToCartObjectIDs = { eventSubtype: AddToCartEvent; /** - * Name of the Algolia index. + * The name of an Algolia index. */ index: string; /** - * List of object identifiers for items of an Algolia index. + * The object IDs of the records that are part of the event. */ objectIDs: string[]; /** - * Extra information about the records involved in the event—for example, to add price and quantities of purchased products. If provided, must be the same length as `objectIDs`. + * An anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. */ - objectData?: ObjectData[]; + userToken: string; /** - * If you include pricing information in the `objectData` parameter, you must also specify the currency as ISO-4217 currency code, such as USD or EUR. + * An identifier for authenticated users. > **Note**: Never include personally identifiable information in user tokens. */ - currency?: string; + authenticatedUserToken?: string; /** - * Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + * Three-letter [currency code](https://www.iso.org/iso-4217-currency-codes.html). */ - userToken: string; + currency?: string; /** - * Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + * Extra information about the records involved in a purchase or add-to-cart event. If specified, it must have the same length as `objectIDs`. */ - timestamp?: number; + objectData?: ObjectData[]; /** - * User token for authenticated users. + * The timestamp of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. */ - authenticatedUserToken?: string; + timestamp?: number; + + value?: Value; }; diff --git a/packages/client-insights/model/addedToCartObjectIDsAfterSearch.ts b/packages/client-insights/model/addedToCartObjectIDsAfterSearch.ts index f4ded2228..919e5f5e7 100644 --- a/packages/client-insights/model/addedToCartObjectIDsAfterSearch.ts +++ b/packages/client-insights/model/addedToCartObjectIDsAfterSearch.ts @@ -3,13 +3,14 @@ import type { AddToCartEvent } from './addToCartEvent'; import type { ConversionEvent } from './conversionEvent'; import type { ObjectDataAfterSearch } from './objectDataAfterSearch'; +import type { Value } from './value'; /** * Use this event to track when users add items to their shopping cart after a previous Algolia request. If you\'re building your category pages with Algolia, you\'ll also use this event. */ export type AddedToCartObjectIDsAfterSearch = { /** - * Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + * The name of the event, up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. */ eventName: string; @@ -18,7 +19,7 @@ export type AddedToCartObjectIDsAfterSearch = { eventSubtype: AddToCartEvent; /** - * Name of the Algolia index. + * The name of an Algolia index. */ index: string; @@ -28,32 +29,34 @@ export type AddedToCartObjectIDsAfterSearch = { queryID: string; /** - * List of object identifiers for items of an Algolia index. + * The object IDs of the records that are part of the event. */ objectIDs: string[]; /** - * Extra information about the records involved in the event—for example, to add price and quantities of purchased products. If provided, must be the same length as `objectIDs`. + * An anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. */ - objectData?: ObjectDataAfterSearch[]; + userToken: string; /** - * If you include pricing information in the `objectData` parameter, you must also specify the currency as ISO-4217 currency code, such as USD or EUR. + * An identifier for authenticated users. > **Note**: Never include personally identifiable information in user tokens. */ - currency?: string; + authenticatedUserToken?: string; /** - * Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + * Three-letter [currency code](https://www.iso.org/iso-4217-currency-codes.html). */ - userToken: string; + currency?: string; /** - * Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + * Extra information about the records involved in a purchase or add-to-cart events. If provided, it must be the same length as `objectIDs`. */ - timestamp?: number; + objectData?: ObjectDataAfterSearch[]; /** - * User token for authenticated users. + * The timestamp of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. */ - authenticatedUserToken?: string; + timestamp?: number; + + value?: Value; }; diff --git a/packages/client-insights/model/clickedFilters.ts b/packages/client-insights/model/clickedFilters.ts index 5bf839e4b..cbc891262 100644 --- a/packages/client-insights/model/clickedFilters.ts +++ b/packages/client-insights/model/clickedFilters.ts @@ -7,14 +7,14 @@ import type { ClickEvent } from './clickEvent'; */ export type ClickedFilters = { /** - * Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + * The name of the event, up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. */ eventName: string; eventType: ClickEvent; /** - * Name of the Algolia index. + * The name of an Algolia index. */ index: string; @@ -24,17 +24,17 @@ export type ClickedFilters = { filters: string[]; /** - * Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + * An anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. */ userToken: string; /** - * Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + * An identifier for authenticated users. > **Note**: Never include personally identifiable information in user tokens. */ - timestamp?: number; + authenticatedUserToken?: string; /** - * User token for authenticated users. + * The timestamp of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. */ - authenticatedUserToken?: string; + timestamp?: number; }; diff --git a/packages/client-insights/model/clickedObjectIDs.ts b/packages/client-insights/model/clickedObjectIDs.ts index 04a8caaa5..016bd9f85 100644 --- a/packages/client-insights/model/clickedObjectIDs.ts +++ b/packages/client-insights/model/clickedObjectIDs.ts @@ -7,29 +7,34 @@ import type { ClickEvent } from './clickEvent'; */ export type ClickedObjectIDs = { /** - * Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + * The name of the event, up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. */ eventName: string; eventType: ClickEvent; /** - * Name of the Algolia index. + * The name of an Algolia index. */ index: string; /** - * List of object identifiers for items of an Algolia index. + * The object IDs of the records that are part of the event. */ objectIDs: string[]; /** - * Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + * An anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. */ userToken: string; /** - * Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + * An identifier for authenticated users. > **Note**: Never include personally identifiable information in user tokens. + */ + authenticatedUserToken?: string; + + /** + * The timestamp of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. */ timestamp?: number; }; diff --git a/packages/client-insights/model/clickedObjectIDsAfterSearch.ts b/packages/client-insights/model/clickedObjectIDsAfterSearch.ts index 609e0deb1..add7d26dd 100644 --- a/packages/client-insights/model/clickedObjectIDsAfterSearch.ts +++ b/packages/client-insights/model/clickedObjectIDsAfterSearch.ts @@ -7,24 +7,24 @@ import type { ClickEvent } from './clickEvent'; */ export type ClickedObjectIDsAfterSearch = { /** - * Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + * The name of the event, up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. */ eventName: string; eventType: ClickEvent; /** - * Name of the Algolia index. + * The name of an Algolia index. */ index: string; /** - * List of object identifiers for items of an Algolia index. + * The object IDs of the records that are part of the event. */ objectIDs: string[]; /** - * Position of the clicked objects in the search results. The first search result has a position of 1 (not 0). You must provide 1 `position` for each `objectID`. + * The position of the clicked item the search results. The first search result has a position of 1 (not 0). You must provide 1 `position` for each `objectID`. */ positions: number[]; @@ -34,17 +34,17 @@ export type ClickedObjectIDsAfterSearch = { queryID: string; /** - * Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + * An anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. */ userToken: string; /** - * Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + * An identifier for authenticated users. > **Note**: Never include personally identifiable information in user tokens. */ - timestamp?: number; + authenticatedUserToken?: string; /** - * User token for authenticated users. + * The timestamp of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. */ - authenticatedUserToken?: string; + timestamp?: number; }; diff --git a/packages/client-insights/model/clientMethodProps.ts b/packages/client-insights/model/clientMethodProps.ts index 639789070..41fa1de48 100644 --- a/packages/client-insights/model/clientMethodProps.ts +++ b/packages/client-insights/model/clientMethodProps.ts @@ -63,3 +63,13 @@ export type CustomPutProps = { */ body?: Record; }; + +/** + * Properties for the `deleteUserToken` method. + */ +export type DeleteUserTokenProps = { + /** + * The user token for which to delete all associated events. + */ + userToken: string; +}; diff --git a/packages/client-insights/model/convertedFilters.ts b/packages/client-insights/model/convertedFilters.ts index 5132737a9..e2731d289 100644 --- a/packages/client-insights/model/convertedFilters.ts +++ b/packages/client-insights/model/convertedFilters.ts @@ -4,14 +4,14 @@ import type { ConversionEvent } from './conversionEvent'; export type ConvertedFilters = { /** - * Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + * The name of the event, up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. */ eventName: string; eventType: ConversionEvent; /** - * Name of the Algolia index. + * The name of an Algolia index. */ index: string; @@ -21,17 +21,17 @@ export type ConvertedFilters = { filters: string[]; /** - * Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + * An anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. */ userToken: string; /** - * Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + * An identifier for authenticated users. > **Note**: Never include personally identifiable information in user tokens. */ - timestamp?: number; + authenticatedUserToken?: string; /** - * User token for authenticated users. + * The timestamp of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. */ - authenticatedUserToken?: string; + timestamp?: number; }; diff --git a/packages/client-insights/model/convertedObjectIDs.ts b/packages/client-insights/model/convertedObjectIDs.ts index 4feec2c1a..96882a795 100644 --- a/packages/client-insights/model/convertedObjectIDs.ts +++ b/packages/client-insights/model/convertedObjectIDs.ts @@ -7,34 +7,34 @@ import type { ConversionEvent } from './conversionEvent'; */ export type ConvertedObjectIDs = { /** - * Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + * The name of the event, up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. */ eventName: string; eventType: ConversionEvent; /** - * Name of the Algolia index. + * The name of an Algolia index. */ index: string; /** - * List of object identifiers for items of an Algolia index. + * The object IDs of the records that are part of the event. */ objectIDs: string[]; /** - * Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + * An anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. */ userToken: string; /** - * Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + * An identifier for authenticated users. > **Note**: Never include personally identifiable information in user tokens. */ - timestamp?: number; + authenticatedUserToken?: string; /** - * User token for authenticated users. + * The timestamp of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. */ - authenticatedUserToken?: string; + timestamp?: number; }; diff --git a/packages/client-insights/model/convertedObjectIDsAfterSearch.ts b/packages/client-insights/model/convertedObjectIDsAfterSearch.ts index f44ab4077..64aa2787b 100644 --- a/packages/client-insights/model/convertedObjectIDsAfterSearch.ts +++ b/packages/client-insights/model/convertedObjectIDsAfterSearch.ts @@ -7,19 +7,19 @@ import type { ConversionEvent } from './conversionEvent'; */ export type ConvertedObjectIDsAfterSearch = { /** - * Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + * The name of the event, up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. */ eventName: string; eventType: ConversionEvent; /** - * Name of the Algolia index. + * The name of an Algolia index. */ index: string; /** - * List of object identifiers for items of an Algolia index. + * The object IDs of the records that are part of the event. */ objectIDs: string[]; @@ -29,17 +29,17 @@ export type ConvertedObjectIDsAfterSearch = { queryID: string; /** - * Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + * An anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. */ userToken: string; /** - * Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + * An identifier for authenticated users. > **Note**: Never include personally identifiable information in user tokens. */ - timestamp?: number; + authenticatedUserToken?: string; /** - * User token for authenticated users. + * The timestamp of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. */ - authenticatedUserToken?: string; + timestamp?: number; }; diff --git a/packages/client-insights/model/discount.ts b/packages/client-insights/model/discount.ts index 2def19326..0f22a6122 100644 --- a/packages/client-insights/model/discount.ts +++ b/packages/client-insights/model/discount.ts @@ -1,6 +1,6 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. /** - * Absolute value of the discount in effect for this object, measured in `currency`. + * The absolute value of the discount for this product, in units of `currency`. */ export type Discount = number | string; diff --git a/packages/client-insights/model/index.ts b/packages/client-insights/model/index.ts index 638afe997..04e32dab1 100644 --- a/packages/client-insights/model/index.ts +++ b/packages/client-insights/model/index.ts @@ -22,6 +22,7 @@ export * from './price'; export * from './purchaseEvent'; export * from './purchasedObjectIDs'; export * from './purchasedObjectIDsAfterSearch'; +export * from './value'; export * from './viewEvent'; export * from './viewedFilters'; export * from './viewedObjectIDs'; diff --git a/packages/client-insights/model/insightsEvents.ts b/packages/client-insights/model/insightsEvents.ts index 1e80c7814..8ad68d987 100644 --- a/packages/client-insights/model/insightsEvents.ts +++ b/packages/client-insights/model/insightsEvents.ts @@ -4,7 +4,7 @@ import type { EventsItems } from './eventsItems'; export type InsightsEvents = { /** - * List of click and conversion events. An event is an object representing a user interaction. Events have attributes that describe the interaction, such as an event name, a type, or a user token. Some attributes require other attributes to be declared, and some attributes can\'t be declared at the same time. **All** events must be valid, otherwise the API returns an error. + * List of click and conversion events. An event is an object representing a user interaction. Events have attributes that describe the interaction, such as an event name, a type, or a user token. **All** events must be valid, otherwise the API returns an error. */ events: EventsItems[]; }; diff --git a/packages/client-insights/model/objectData.ts b/packages/client-insights/model/objectData.ts index 2bce64071..3b6afb560 100644 --- a/packages/client-insights/model/objectData.ts +++ b/packages/client-insights/model/objectData.ts @@ -7,7 +7,7 @@ export type ObjectData = { price?: Price; /** - * The quantity of the purchased or added-to-cart item. The total value of a purchase is the sum of `quantity` multiplied with the `price` for each purchased item. + * The quantity of a product that has been purchased or added to the cart. The total value of a purchase is the sum of `quantity` multiplied with the `price` for each purchased item. */ quantity?: number; diff --git a/packages/client-insights/model/objectDataAfterSearch.ts b/packages/client-insights/model/objectDataAfterSearch.ts index 3871ed068..8c23136b3 100644 --- a/packages/client-insights/model/objectDataAfterSearch.ts +++ b/packages/client-insights/model/objectDataAfterSearch.ts @@ -5,14 +5,14 @@ import type { Price } from './price'; export type ObjectDataAfterSearch = { /** - * ID of the query that this specific record is attributable to. Used to track purchase events with multiple items originating from different searches. + * Unique identifier for a search query, used to track purchase events with multiple records that originate from different searches. */ queryID?: string; price?: Price; /** - * The quantity of the purchased or added-to-cart item. The total value of a purchase is the sum of `quantity` multiplied with the `price` for each purchased item. + * The quantity of a product that has been purchased or added to the cart. The total value of a purchase is the sum of `quantity` multiplied with the `price` for each purchased item. */ quantity?: number; diff --git a/packages/client-insights/model/price.ts b/packages/client-insights/model/price.ts index 0a7d73446..d6b4a58fa 100644 --- a/packages/client-insights/model/price.ts +++ b/packages/client-insights/model/price.ts @@ -1,6 +1,6 @@ // Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. /** - * The price of the item. This should be the final price, inclusive of any discounts in effect. + * The total price of a product, including any discounts, in units of `currency`. */ export type Price = number | string; diff --git a/packages/client-insights/model/purchasedObjectIDs.ts b/packages/client-insights/model/purchasedObjectIDs.ts index 82adce178..50315bb34 100644 --- a/packages/client-insights/model/purchasedObjectIDs.ts +++ b/packages/client-insights/model/purchasedObjectIDs.ts @@ -3,13 +3,14 @@ import type { ConversionEvent } from './conversionEvent'; import type { ObjectData } from './objectData'; import type { PurchaseEvent } from './purchaseEvent'; +import type { Value } from './value'; /** * Use this event to track when users make a purchase unrelated to a previous Algolia request. For example, if you don\'t use Algolia to build your category pages, use this event. To track purchase events related to Algolia requests, use the \"Purchased object IDs after search\" event. */ export type PurchasedObjectIDs = { /** - * Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + * The name of the event, up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. */ eventName: string; @@ -18,37 +19,39 @@ export type PurchasedObjectIDs = { eventSubtype: PurchaseEvent; /** - * Name of the Algolia index. + * The name of an Algolia index. */ index: string; /** - * List of object identifiers for items of an Algolia index. + * The object IDs of the records that are part of the event. */ objectIDs: string[]; /** - * Extra information about the records involved in the event—for example, to add price and quantities of purchased products. If provided, must be the same length as `objectIDs`. + * An anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. */ - objectData?: ObjectData[]; + userToken: string; /** - * If you include pricing information in the `objectData` parameter, you must also specify the currency as ISO-4217 currency code, such as USD or EUR. + * An identifier for authenticated users. > **Note**: Never include personally identifiable information in user tokens. */ - currency?: string; + authenticatedUserToken?: string; /** - * Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + * Three-letter [currency code](https://www.iso.org/iso-4217-currency-codes.html). */ - userToken: string; + currency?: string; /** - * Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + * Extra information about the records involved in a purchase or add-to-cart event. If specified, it must have the same length as `objectIDs`. */ - timestamp?: number; + objectData?: ObjectData[]; /** - * User token for authenticated users. + * The timestamp of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. */ - authenticatedUserToken?: string; + timestamp?: number; + + value?: Value; }; diff --git a/packages/client-insights/model/purchasedObjectIDsAfterSearch.ts b/packages/client-insights/model/purchasedObjectIDsAfterSearch.ts index bac8b5305..55a66490b 100644 --- a/packages/client-insights/model/purchasedObjectIDsAfterSearch.ts +++ b/packages/client-insights/model/purchasedObjectIDsAfterSearch.ts @@ -3,13 +3,14 @@ import type { ConversionEvent } from './conversionEvent'; import type { ObjectDataAfterSearch } from './objectDataAfterSearch'; import type { PurchaseEvent } from './purchaseEvent'; +import type { Value } from './value'; /** * Use this event to track when users make a purchase after a previous Algolia request. If you\'re building your category pages with Algolia, you\'ll also use this event. */ export type PurchasedObjectIDsAfterSearch = { /** - * Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + * The name of the event, up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. */ eventName: string; @@ -18,42 +19,39 @@ export type PurchasedObjectIDsAfterSearch = { eventSubtype: PurchaseEvent; /** - * Name of the Algolia index. + * The name of an Algolia index. */ index: string; /** - * Unique identifier for a search query. The query ID is required for events related to search or browse requests. If you add `clickAnalytics: true` as a search request parameter, the query ID is included in the API response. + * The object IDs of the records that are part of the event. */ - queryID: string; + objectIDs: string[]; /** - * List of object identifiers for items of an Algolia index. + * An anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. */ - objectIDs: string[]; + userToken: string; /** - * Extra information about the records involved in the event—for example, to add price and quantities of purchased products. If provided, must be the same length as `objectIDs`. + * An identifier for authenticated users. > **Note**: Never include personally identifiable information in user tokens. */ - objectData?: ObjectDataAfterSearch[]; + authenticatedUserToken?: string; /** - * If you include pricing information in the `objectData` parameter, you must also specify the currency as ISO-4217 currency code, such as USD or EUR. + * Three-letter [currency code](https://www.iso.org/iso-4217-currency-codes.html). */ currency?: string; /** - * Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + * Extra information about the records involved in a purchase or add-to-cart events. If provided, it must be the same length as `objectIDs`. */ - userToken: string; + objectData?: ObjectDataAfterSearch[]; /** - * Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + * The timestamp of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. */ timestamp?: number; - /** - * User token for authenticated users. - */ - authenticatedUserToken?: string; + value?: Value; }; diff --git a/packages/client-insights/model/value.ts b/packages/client-insights/model/value.ts new file mode 100644 index 000000000..1a2985883 --- /dev/null +++ b/packages/client-insights/model/value.ts @@ -0,0 +1,6 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +/** + * Total monetary value of this event in units of `currency`. + */ +export type Value = number | string; diff --git a/packages/client-insights/model/viewedFilters.ts b/packages/client-insights/model/viewedFilters.ts index 732208c93..2761d198b 100644 --- a/packages/client-insights/model/viewedFilters.ts +++ b/packages/client-insights/model/viewedFilters.ts @@ -7,14 +7,14 @@ import type { ViewEvent } from './viewEvent'; */ export type ViewedFilters = { /** - * Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + * The name of the event, up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. */ eventName: string; eventType: ViewEvent; /** - * Name of the Algolia index. + * The name of an Algolia index. */ index: string; @@ -24,17 +24,17 @@ export type ViewedFilters = { filters: string[]; /** - * Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + * An anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. */ userToken: string; /** - * Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + * An identifier for authenticated users. > **Note**: Never include personally identifiable information in user tokens. */ - timestamp?: number; + authenticatedUserToken?: string; /** - * User token for authenticated users. + * The timestamp of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. */ - authenticatedUserToken?: string; + timestamp?: number; }; diff --git a/packages/client-insights/model/viewedObjectIDs.ts b/packages/client-insights/model/viewedObjectIDs.ts index f23298a9e..cbe36de78 100644 --- a/packages/client-insights/model/viewedObjectIDs.ts +++ b/packages/client-insights/model/viewedObjectIDs.ts @@ -7,34 +7,34 @@ import type { ViewEvent } from './viewEvent'; */ export type ViewedObjectIDs = { /** - * Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + * The name of the event, up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment\'s [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. */ eventName: string; eventType: ViewEvent; /** - * Name of the Algolia index. + * The name of an Algolia index. */ index: string; /** - * List of object identifiers for items of an Algolia index. + * The object IDs of the records that are part of the event. */ objectIDs: string[]; /** - * Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + * An anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. */ userToken: string; /** - * Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + * An identifier for authenticated users. > **Note**: Never include personally identifiable information in user tokens. */ - timestamp?: number; + authenticatedUserToken?: string; /** - * User token for authenticated users. + * The timestamp of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. */ - authenticatedUserToken?: string; + timestamp?: number; }; diff --git a/packages/client-insights/src/insightsClient.ts b/packages/client-insights/src/insightsClient.ts index acdf9ee12..61a1787c2 100644 --- a/packages/client-insights/src/insightsClient.ts +++ b/packages/client-insights/src/insightsClient.ts @@ -19,6 +19,7 @@ import type { CustomGetProps, CustomPostProps, CustomPutProps, + DeleteUserTokenProps, } from '../model/clientMethodProps'; import type { EventsResponse } from '../model/eventsResponse'; import type { InsightsEvents } from '../model/insightsEvents'; @@ -236,6 +237,41 @@ export function createInsightsClient({ return transporter.request(request, requestOptions); }, + /** + * Delete all events related to a certain user token from events metrics and analytics. To delete a personalization user profile, see [Delete a user profile](https://www.algolia.com/doc/rest-api/personalization/#delete-a-user-profile). + * + * @summary Delete user token. + * @param deleteUserToken - The deleteUserToken object. + * @param deleteUserToken.userToken - The user token for which to delete all associated events. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. + */ + deleteUserToken( + { userToken }: DeleteUserTokenProps, + requestOptions?: RequestOptions + ): Promise { + if (!userToken) { + throw new Error( + 'Parameter `userToken` is required when calling `deleteUserToken`.' + ); + } + + const requestPath = '/1/usertokens/{userToken}'.replace( + '{userToken}', + encodeURIComponent(userToken) + ); + const headers: Headers = {}; + const queryParameters: QueryParameters = {}; + + const request: Request = { + method: 'DELETE', + path: requestPath, + queryParameters, + headers, + }; + + return transporter.request(request, requestOptions); + }, + /** * Send a list of events to the Insights API. You can include up to 1,000 events in a single request, but the request body must be smaller than 2 MB. *