diff --git a/packages/client-insights/model/addToCartEvent.ts b/packages/client-insights/model/addToCartEvent.ts new file mode 100644 index 000000000..91553746d --- /dev/null +++ b/packages/client-insights/model/addToCartEvent.ts @@ -0,0 +1,3 @@ +// 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. + +export type AddToCartEvent = 'addToCart'; diff --git a/packages/client-insights/model/addedToCartObjectIDs.ts b/packages/client-insights/model/addedToCartObjectIDs.ts new file mode 100644 index 000000000..aa5db11a4 --- /dev/null +++ b/packages/client-insights/model/addedToCartObjectIDs.ts @@ -0,0 +1,49 @@ +// 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. + +import type { AddToCartEvent } from './addToCartEvent'; +import type { ConversionEvent } from './conversionEvent'; +import type { ObjectData } from './objectData'; + +/** + * 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. + */ + eventName: string; + + eventType: ConversionEvent; + + eventSubtype: AddToCartEvent; + + /** + * Name of the Algolia index. + */ + index: string; + + /** + * List of object identifiers for items of an Algolia index. + */ + 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`. + */ + objectData?: ObjectData[]; + + /** + * 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. + */ + currency?: string; + + /** + * 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. + */ + timestamp?: number; +}; diff --git a/packages/client-insights/model/addedToCartObjectIDsAfterSearch.ts b/packages/client-insights/model/addedToCartObjectIDsAfterSearch.ts new file mode 100644 index 000000000..e18c2e9f6 --- /dev/null +++ b/packages/client-insights/model/addedToCartObjectIDsAfterSearch.ts @@ -0,0 +1,54 @@ +// 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. + +import type { AddToCartEvent } from './addToCartEvent'; +import type { ConversionEvent } from './conversionEvent'; +import type { ObjectDataAfterSearch } from './objectDataAfterSearch'; + +/** + * 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. + */ + eventName: string; + + eventType: ConversionEvent; + + eventSubtype: AddToCartEvent; + + /** + * Name of the 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. + */ + queryID: string; + + /** + * List of object identifiers for items of an Algolia index. + */ + 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`. + */ + objectData?: ObjectDataAfterSearch[]; + + /** + * 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. + */ + currency?: string; + + /** + * 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. + */ + timestamp?: number; +}; diff --git a/packages/client-insights/model/discount.ts b/packages/client-insights/model/discount.ts new file mode 100644 index 000000000..2def19326 --- /dev/null +++ b/packages/client-insights/model/discount.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. + +/** + * Absolute value of the discount in effect for this object, measured in `currency`. + */ +export type Discount = number | string; diff --git a/packages/client-insights/model/eventsItems.ts b/packages/client-insights/model/eventsItems.ts index 166b0111a..fca630875 100644 --- a/packages/client-insights/model/eventsItems.ts +++ b/packages/client-insights/model/eventsItems.ts @@ -1,20 +1,28 @@ // 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. +import type { AddedToCartObjectIDs } from './addedToCartObjectIDs'; +import type { AddedToCartObjectIDsAfterSearch } from './addedToCartObjectIDsAfterSearch'; import type { ClickedFilters } from './clickedFilters'; import type { ClickedObjectIDs } from './clickedObjectIDs'; import type { ClickedObjectIDsAfterSearch } from './clickedObjectIDsAfterSearch'; import type { ConvertedFilters } from './convertedFilters'; import type { ConvertedObjectIDs } from './convertedObjectIDs'; import type { ConvertedObjectIDsAfterSearch } from './convertedObjectIDsAfterSearch'; +import type { PurchasedObjectIDs } from './purchasedObjectIDs'; +import type { PurchasedObjectIDsAfterSearch } from './purchasedObjectIDsAfterSearch'; import type { ViewedFilters } from './viewedFilters'; import type { ViewedObjectIDs } from './viewedObjectIDs'; export type EventsItems = + | AddedToCartObjectIDs + | AddedToCartObjectIDsAfterSearch | ClickedFilters | ClickedObjectIDs | ClickedObjectIDsAfterSearch | ConvertedFilters | ConvertedObjectIDs | ConvertedObjectIDsAfterSearch + | PurchasedObjectIDs + | PurchasedObjectIDsAfterSearch | ViewedFilters | ViewedObjectIDs; diff --git a/packages/client-insights/model/index.ts b/packages/client-insights/model/index.ts index 26737d8df..638afe997 100644 --- a/packages/client-insights/model/index.ts +++ b/packages/client-insights/model/index.ts @@ -1,5 +1,8 @@ // 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. +export * from './addToCartEvent'; +export * from './addedToCartObjectIDs'; +export * from './addedToCartObjectIDsAfterSearch'; export * from './clickEvent'; export * from './clickedFilters'; export * from './clickedObjectIDs'; @@ -8,10 +11,17 @@ export * from './conversionEvent'; export * from './convertedFilters'; export * from './convertedObjectIDs'; export * from './convertedObjectIDsAfterSearch'; +export * from './discount'; export * from './errorBase'; export * from './eventsItems'; export * from './eventsResponse'; export * from './insightsEvents'; +export * from './objectData'; +export * from './objectDataAfterSearch'; +export * from './price'; +export * from './purchaseEvent'; +export * from './purchasedObjectIDs'; +export * from './purchasedObjectIDsAfterSearch'; export * from './viewEvent'; export * from './viewedFilters'; export * from './viewedObjectIDs'; diff --git a/packages/client-insights/model/objectData.ts b/packages/client-insights/model/objectData.ts new file mode 100644 index 000000000..2bce64071 --- /dev/null +++ b/packages/client-insights/model/objectData.ts @@ -0,0 +1,15 @@ +// 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. + +import type { Discount } from './discount'; +import type { Price } from './price'; + +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. + */ + quantity?: number; + + discount?: Discount; +}; diff --git a/packages/client-insights/model/objectDataAfterSearch.ts b/packages/client-insights/model/objectDataAfterSearch.ts new file mode 100644 index 000000000..3871ed068 --- /dev/null +++ b/packages/client-insights/model/objectDataAfterSearch.ts @@ -0,0 +1,20 @@ +// 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. + +import type { Discount } from './discount'; +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. + */ + 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. + */ + quantity?: number; + + discount?: Discount; +}; diff --git a/packages/client-insights/model/price.ts b/packages/client-insights/model/price.ts new file mode 100644 index 000000000..0a7d73446 --- /dev/null +++ b/packages/client-insights/model/price.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. + +/** + * The price of the item. This should be the final price, inclusive of any discounts in effect. + */ +export type Price = number | string; diff --git a/packages/client-insights/model/purchaseEvent.ts b/packages/client-insights/model/purchaseEvent.ts new file mode 100644 index 000000000..092c35a3b --- /dev/null +++ b/packages/client-insights/model/purchaseEvent.ts @@ -0,0 +1,3 @@ +// 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. + +export type PurchaseEvent = 'purchase'; diff --git a/packages/client-insights/model/purchasedObjectIDs.ts b/packages/client-insights/model/purchasedObjectIDs.ts new file mode 100644 index 000000000..1f58328d8 --- /dev/null +++ b/packages/client-insights/model/purchasedObjectIDs.ts @@ -0,0 +1,49 @@ +// 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. + +import type { ConversionEvent } from './conversionEvent'; +import type { ObjectData } from './objectData'; +import type { PurchaseEvent } from './purchaseEvent'; + +/** + * 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. + */ + eventName: string; + + eventType: ConversionEvent; + + eventSubtype: PurchaseEvent; + + /** + * Name of the Algolia index. + */ + index: string; + + /** + * List of object identifiers for items of an Algolia index. + */ + 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`. + */ + objectData?: ObjectData[]; + + /** + * 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. + */ + currency?: string; + + /** + * 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. + */ + timestamp?: number; +}; diff --git a/packages/client-insights/model/purchasedObjectIDsAfterSearch.ts b/packages/client-insights/model/purchasedObjectIDsAfterSearch.ts new file mode 100644 index 000000000..35e9bd2e7 --- /dev/null +++ b/packages/client-insights/model/purchasedObjectIDsAfterSearch.ts @@ -0,0 +1,54 @@ +// 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. + +import type { ConversionEvent } from './conversionEvent'; +import type { ObjectDataAfterSearch } from './objectDataAfterSearch'; +import type { PurchaseEvent } from './purchaseEvent'; + +/** + * 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. + */ + eventName: string; + + eventType: ConversionEvent; + + eventSubtype: PurchaseEvent; + + /** + * Name of the 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. + */ + queryID: string; + + /** + * List of object identifiers for items of an Algolia index. + */ + 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`. + */ + objectData?: ObjectDataAfterSearch[]; + + /** + * 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. + */ + currency?: string; + + /** + * 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. + */ + timestamp?: number; +};