/** * Represents anything that an external system exposes as a benefit. It could be a specific event, a booking session, or even a physical good. * `category` is used to identify the type of the item and id is used to uniquely identify it within the category. * For example, if the item is a blog post, then the category could be "post" and the id could be the post id. */ export interface Item { /** * Item identifier * @readonly */ _id?: string | null; /** Represents the current state of an item. Each time the item is modified, its `revision` changes. for an update operation to succeed, you MUST pass the latest revision */ revision?: string | null; /** * Represents the time this Item was created * @readonly */ _createdDate?: Date | null; /** * Represents the time this Item was last updated * @readonly */ _updatedDate?: Date | null; /** External item identifier */ externalId?: string; /** Item category. Discriminates between different types of items. E.g. posts, groups etc. */ category?: string | null; /** Key of the set that this item is part of */ itemSetId?: string; /** Display name of the item */ displayName?: string | null; /** ID of the app that provides this item, eg. bookings, blog or events */ providerAppId?: string | null; /** Data extensions */ extendedFields?: ExtendedFields; /** Item namespace */ namespace?: string | null; } export interface ExtendedFields { /** * Extended field data. Each key corresponds to the namespace of the app that created the extended fields. * The value of each key is structured according to the schema defined when the extended fields were configured. * * You can only access fields for which you have the appropriate permissions. * * Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields). */ namespaces?: Record>; } export interface ItemsCloned { /** ID of the pool that had its items provisioned */ itemSetId?: string; } export interface CreateItemRequest { /** Item to be created */ item: Item; } export interface CreateItemResponse { /** Item that was created */ item?: Item; } export interface BulkCreateItemsRequest { /** Items to be added */ items: Item[]; /** set to `true` if you wish to receive back the created items in the response */ returnEntity?: boolean; } export interface BulkCreateItemsResponse { /** Item that were added */ results?: BulkItemResult[]; /** Bulk action metadata */ bulkActionMetadata?: BulkActionMetadata; } export interface BulkItemResult { /** Item metadata */ itemMetadata?: ItemMetadata; /** Only exists if `returnEntity` was set to true in the request */ item?: Item; } export interface ItemMetadata { /** Item ID. Should always be available, unless it's impossible (for example, when failing to create an item). */ _id?: string | null; /** Index of the item within the request array. Allows for correlation between request and response items. */ originalIndex?: number; /** Whether the requested action was successful for this item. When `false`, the `error` field is populated. */ success?: boolean; /** Details about the error in case of failure. */ error?: ApplicationError; } export interface ApplicationError { /** Error code. */ code?: string; /** Description of the error. */ description?: string; /** Data related to the error. */ data?: Record | null; } export interface BulkActionMetadata { /** Number of items that were successfully processed. */ totalSuccesses?: number; /** Number of items that couldn't be processed. */ totalFailures?: number; /** Number of failures without details because detailed failure threshold was exceeded. */ undetailedFailures?: number; } export interface DeleteItemRequest { /** Item id */ itemId: string; } export interface DeleteItemResponse { } export interface BulkDeleteItemsRequest { /** Items to be deleted */ itemIds: string[]; } export interface BulkDeleteItemsResponse { /** Items that were removed */ results?: BulkItemResult[]; /** Bulk action metadata */ bulkActionMetadata?: BulkActionMetadata; } export interface BulkDeleteItemsByFilterRequest { /** Namespace */ namespace: string; /** Filter to delete items by */ filter?: Record | null; } export interface BulkDeleteItemsByFilterResponse { /** Bulk delete job ID */ jobId?: string; } export interface UpdateItemRequest { /** Item to be updated, may be partial */ item: Item; } export interface UpdateItemResponse { /** Item that was updated */ item?: Item; } export interface BulkUpdateItemsRequest { /** Items to be added */ items?: MaskedItem[]; /** set to `true` if you wish to receive back the delete items in the response */ returnEntity?: boolean; } export interface MaskedItem { /** Item to be updated, may be partial */ item?: Item; } export interface BulkUpdateItemsResponse { /** Item that were updated */ results?: BulkItemResult[]; /** Bulk action metadata */ bulkActionMetadata?: BulkActionMetadata; } export interface GetItemRequest { /** Id of the Item to retrieve */ itemId: string; } export interface GetItemResponse { /** The retrieved Item */ item?: Item; } export interface ListItemsRequest { /** The filter */ filter?: Filter; /** Cursor paging */ cursorPaging?: CursorPaging; } export declare enum Type { UNKNOWN_FILTER = "UNKNOWN_FILTER", BY_ITEM_SET_ID_AND_REFERENCE = "BY_ITEM_SET_ID_AND_REFERENCE", BY_REFERENCE = "BY_REFERENCE" } export interface ByItemSetIdAndReference { /** A list of filters */ filters?: ByItemSetIdAndReferenceFilter[]; } export interface ByItemSetIdAndReferenceFilter { /** Key of the set that this item is part of */ itemSetId?: string; /** External item identifier */ externalId?: string; /** Item category. Discriminates between different types of items. E.g. posts, groups etc. */ category?: string; /** Item provider app id */ providerAppId?: string; } export interface ByReference { /** A list of filters */ filters?: ByReferenceFilter[]; } export interface ByReferenceFilter { /** External item identifier */ externalId?: string; /** Item category. Discriminates between different types of items. E.g. posts, groups etc. */ category?: string; /** Item provider app id */ providerAppId?: string; } export interface Filter extends FilterFilterOneOf { /** A list of filters by itemSetId and reference */ byItemSetIdAndReferenceOptions?: ByItemSetIdAndReference; /** A list of filters by reference */ byReferenceOptions?: ByReference; /** Type of the filter */ type?: Type; /** Item namespace */ namespace?: string; } /** @oneof */ export interface FilterFilterOneOf { /** A list of filters by itemSetId and reference */ byItemSetIdAndReferenceOptions?: ByItemSetIdAndReference; /** A list of filters by reference */ byReferenceOptions?: ByReference; } export interface CursorPaging { /** Maximum number of items to return in the results. */ limit?: number | null; /** * Pointer to the next or previous page in the list of results. * * Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response. * Not relevant for the first request. */ cursor?: string | null; } export interface ListItemsResponse { /** The retrieved items */ items?: Item[]; /** Paging information */ metadata?: CursorPagingMetadata; } export interface CursorPagingMetadata { /** Number of items returned in the response. */ count?: number | null; /** Cursor strings that point to the next page, previous page, or both. */ cursors?: Cursors; /** * Whether there are more pages to retrieve following the current page. * * + `true`: Another page of results can be retrieved. * + `false`: This is the last page. */ hasNext?: boolean | null; } export interface Cursors { /** Cursor string pointing to the next page in the list of results. */ next?: string | null; /** Cursor pointing to the previous page in the list of results. */ prev?: string | null; } export interface QueryItemsRequest { /** WQL expression */ query?: CursorQuery; } export interface CursorQuery extends CursorQueryPagingMethodOneOf { /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */ cursorPaging?: CursorPaging; /** * Filter object in the following format: * `"filter" : { * "fieldName1": "value1", * "fieldName2":{"$operator":"value2"} * }` * Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains` */ filter?: Record | null; /** * Sort object in the following format: * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]` */ sort?: Sorting[]; } /** @oneof */ export interface CursorQueryPagingMethodOneOf { /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */ cursorPaging?: CursorPaging; } export interface Sorting { /** Name of the field to sort by. */ fieldName?: string; /** Sort order. */ order?: SortOrder; } export declare enum SortOrder { ASC = "ASC", DESC = "DESC" } export interface QueryItemsResponse { /** The retrieved Items */ items?: Item[]; /** Paging information */ metadata?: CursorPagingMetadata; } export interface CountItemsRequest { /** Items filter to count */ filter?: Record | null; } export interface CountItemsResponse { /** Number of counted items */ count?: number; } export interface CloneItemsRequest { /** Id of the item set to be cloned */ itemSetId: string; } export interface CloneItemsResponse { /** Id of the item set that these items were added to */ clonedItemSetId?: string; /** Id of the job that is cloning the item set */ cloneJobId?: string; } export interface BulkCloneItemSetsRequest { /** Id of the item sets to be cloned */ itemSetIds: string[]; } export interface BulkCloneItemSetsResponse { /** Results */ results?: BulkCloneItemSetsResult[]; /** Bulk action metadata */ bulkActionMetadata?: BulkActionMetadata; /** Id of the job that is cloning the item set */ jobId?: string; } export interface BulkCloneItemSetsResult { /** Item metadata */ itemMetadata?: ItemMetadata; /** Id of the item set that these items were added to */ clonedItemSetId?: string; } export interface AllocateItemSetsRequest { /** Number of sets to allocate */ numberOfSets?: number; } export interface AllocateItemSetsResponse { /** Key of the item set that was created */ itemSetIds?: string[]; } export interface DomainEvent extends DomainEventBodyOneOf { createdEvent?: EntityCreatedEvent; updatedEvent?: EntityUpdatedEvent; deletedEvent?: EntityDeletedEvent; actionEvent?: ActionEvent; /** * Unique event ID. * Allows clients to ignore duplicate webhooks. */ _id?: string; /** * Assumes actions are also always typed to an entity_type * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction */ entityFqdn?: string; /** * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug) * This is although the created/updated/deleted notion is duplication of the oneof types * Example: created/updated/deleted/started/completed/email_opened */ slug?: string; /** ID of the entity associated with the event. */ entityId?: string; /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */ eventTime?: Date | null; /** * Whether the event was triggered as a result of a privacy regulation application * (for example, GDPR). */ triggeredByAnonymizeRequest?: boolean | null; /** If present, indicates the action that triggered the event. */ originatedFrom?: string | null; /** * A sequence number defining the order of updates to the underlying entity. * For example, given that some entity was updated at 16:00 and than again at 16:01, * it is guaranteed that the sequence number of the second update is strictly higher than the first. * As the consumer, you can use this value to ensure that you handle messages in the correct order. * To do so, you will need to persist this number on your end, and compare the sequence number from the * message against the one you have stored. Given that the stored number is higher, you should ignore the message. */ entityEventSequence?: string | null; } /** @oneof */ export interface DomainEventBodyOneOf { createdEvent?: EntityCreatedEvent; updatedEvent?: EntityUpdatedEvent; deletedEvent?: EntityDeletedEvent; actionEvent?: ActionEvent; } export interface EntityCreatedEvent { entity?: string; } export interface RestoreInfo { deletedDate?: Date | null; } export interface EntityUpdatedEvent { /** * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff. * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects. * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it. */ currentEntity?: string; } export interface EntityDeletedEvent { /** Entity that was deleted */ deletedEntity?: string | null; } export interface ActionEvent { body?: string; } export interface MessageEnvelope { /** App instance ID. */ instanceId?: string | null; /** Event type. */ eventType?: string; /** The identification type and identity data. */ identity?: IdentificationData; /** Stringify payload. */ data?: string; } export interface IdentificationData extends IdentificationDataIdOneOf { /** ID of a site visitor that has not logged in to the site. */ anonymousVisitorId?: string; /** ID of a site visitor that has logged in to the site. */ memberId?: string; /** ID of a Wix user (site owner, contributor, etc.). */ wixUserId?: string; /** ID of an app. */ appId?: string; /** @readonly */ identityType?: WebhookIdentityType; } /** @oneof */ export interface IdentificationDataIdOneOf { /** ID of a site visitor that has not logged in to the site. */ anonymousVisitorId?: string; /** ID of a site visitor that has logged in to the site. */ memberId?: string; /** ID of a Wix user (site owner, contributor, etc.). */ wixUserId?: string; /** ID of an app. */ appId?: string; } export declare enum WebhookIdentityType { UNKNOWN = "UNKNOWN", ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR", MEMBER = "MEMBER", WIX_USER = "WIX_USER", APP = "APP" } export interface ItemNonNullableFields { externalId: string; itemSetId: string; } export interface CreateItemResponseNonNullableFields { item?: ItemNonNullableFields; } interface ApplicationErrorNonNullableFields { code: string; description: string; } interface ItemMetadataNonNullableFields { originalIndex: number; success: boolean; error?: ApplicationErrorNonNullableFields; } interface BulkItemResultNonNullableFields { itemMetadata?: ItemMetadataNonNullableFields; item?: ItemNonNullableFields; } interface BulkActionMetadataNonNullableFields { totalSuccesses: number; totalFailures: number; undetailedFailures: number; } export interface BulkCreateItemsResponseNonNullableFields { results: BulkItemResultNonNullableFields[]; bulkActionMetadata?: BulkActionMetadataNonNullableFields; } export interface BulkDeleteItemsResponseNonNullableFields { results: BulkItemResultNonNullableFields[]; bulkActionMetadata?: BulkActionMetadataNonNullableFields; } export interface BulkDeleteItemsByFilterResponseNonNullableFields { jobId: string; } export interface UpdateItemResponseNonNullableFields { item?: ItemNonNullableFields; } export interface BulkUpdateItemsResponseNonNullableFields { results: BulkItemResultNonNullableFields[]; bulkActionMetadata?: BulkActionMetadataNonNullableFields; } export interface GetItemResponseNonNullableFields { item?: ItemNonNullableFields; } export interface ListItemsResponseNonNullableFields { items: ItemNonNullableFields[]; } export interface QueryItemsResponseNonNullableFields { items: ItemNonNullableFields[]; } export interface CountItemsResponseNonNullableFields { count: number; } export interface CloneItemsResponseNonNullableFields { clonedItemSetId: string; cloneJobId: string; } interface BulkCloneItemSetsResultNonNullableFields { itemMetadata?: ItemMetadataNonNullableFields; clonedItemSetId: string; } export interface BulkCloneItemSetsResponseNonNullableFields { results: BulkCloneItemSetsResultNonNullableFields[]; bulkActionMetadata?: BulkActionMetadataNonNullableFields; jobId: string; } export interface AllocateItemSetsResponseNonNullableFields { itemSetIds: string[]; } /** * Create an item * @param item - Item to be created * @public * @documentationMaturity preview * @requiredField item * @requiredField item.externalId * @requiredField item.itemSetId * @requiredField item.namespace * @requiredField item.providerAppId * @permissionId BENEFIT_PROGRAMS.ITEM_CREATE * @returns Item that was created */ export declare function createItem(item: Item): Promise; /** * Adds items to the benefit * @param items - Items to be added * @public * @documentationMaturity preview * @requiredField items * @requiredField items.externalId * @requiredField items.itemSetId * @requiredField items.namespace * @permissionId BENEFIT_PROGRAMS.ITEM_CREATE */ export declare function bulkCreateItems(items: Item[], options?: BulkCreateItemsOptions): Promise; export interface BulkCreateItemsOptions { /** set to `true` if you wish to receive back the created items in the response */ returnEntity?: boolean; } /** * Removes the item from the benefit * @param itemId - Item id * @public * @documentationMaturity preview * @requiredField itemId * @permissionId BENEFIT_PROGRAMS.ITEM_DELETE */ export declare function deleteItem(itemId: string): Promise; /** * Deletes the items * @param itemIds - Items to be deleted * @public * @documentationMaturity preview * @requiredField itemIds * @permissionId BENEFIT_PROGRAMS.ITEM_DELETE */ export declare function bulkDeleteItems(itemIds: string[]): Promise; /** * Deletes the items by filter * @param namespace - Namespace * @public * @documentationMaturity preview * @requiredField namespace * @permissionId BENEFIT_PROGRAMS.ITEM_DELETE */ export declare function bulkDeleteItemsByFilter(namespace: string, options?: BulkDeleteItemsByFilterOptions): Promise; export interface BulkDeleteItemsByFilterOptions { /** Filter to delete items by */ filter?: Record | null; } /** * Update the Item, supports partial update * Pass the latest `revision` for a successful update * @param _id - Item identifier * @public * @documentationMaturity preview * @requiredField _id * @requiredField item * @requiredField item.revision * @permissionId BENEFIT_PROGRAMS.ITEM_UPDATE * @returns Item that was updated */ export declare function updateItem(_id: string | null, item: UpdateItem): Promise; export interface UpdateItem { /** * Item identifier * @readonly */ _id?: string | null; /** Represents the current state of an item. Each time the item is modified, its `revision` changes. for an update operation to succeed, you MUST pass the latest revision */ revision?: string | null; /** * Represents the time this Item was created * @readonly */ _createdDate?: Date | null; /** * Represents the time this Item was last updated * @readonly */ _updatedDate?: Date | null; /** External item identifier */ externalId?: string; /** Item category. Discriminates between different types of items. E.g. posts, groups etc. */ category?: string | null; /** Key of the set that this item is part of */ itemSetId?: string; /** Display name of the item */ displayName?: string | null; /** ID of the app that provides this item, eg. bookings, blog or events */ providerAppId?: string | null; /** Data extensions */ extendedFields?: ExtendedFields; /** Item namespace */ namespace?: string | null; } /** * Update the Item, supports partial update * Pass the latest `revision` for a successful update * @public * @documentationMaturity preview * @requiredField options.items.item * @requiredField options.items.item._id * @requiredField options.items.item.revision * @permissionId BENEFIT_PROGRAMS.ITEM_UPDATE */ export declare function bulkUpdateItems(options?: BulkUpdateItemsOptions): Promise; export interface BulkUpdateItemsOptions { /** Items to be added */ items?: MaskedItem[]; /** set to `true` if you wish to receive back the delete items in the response */ returnEntity?: boolean; } /** * Get a Benefit Item by id * @param itemId - Id of the Item to retrieve * @public * @documentationMaturity preview * @requiredField itemId * @permissionId BENEFIT_PROGRAMS.ITEM_READ * @returns The retrieved Item */ export declare function getItem(itemId: string): Promise; /** * Get all items matching the filter * @public * @documentationMaturity preview * @permissionId BENEFIT_PROGRAMS.ITEM_READ */ export declare function listItems(options?: ListItemsOptions): Promise; export interface ListItemsOptions { /** The filter */ filter?: Filter; /** Cursor paging */ cursorPaging?: CursorPaging; } /** * Query Items using [WQL - Wix Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language) * @public * @documentationMaturity preview * @permissionId BENEFIT_PROGRAMS.ITEM_READ */ export declare function queryItems(): ItemsQueryBuilder; interface QueryCursorResult { cursors: Cursors; hasNext: () => boolean; hasPrev: () => boolean; length: number; pageSize: number; } export interface ItemsQueryResult extends QueryCursorResult { items: Item[]; query: ItemsQueryBuilder; next: () => Promise; prev: () => Promise; } export interface ItemsQueryBuilder { /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. * @documentationMaturity preview */ eq: (propertyName: '_id' | '_createdDate' | 'externalId' | 'category' | 'itemSetId' | 'providerAppId' | 'namespace', value: any) => ItemsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. * @documentationMaturity preview */ ne: (propertyName: '_id' | '_createdDate' | 'externalId' | 'category' | 'itemSetId' | 'providerAppId' | 'namespace', value: any) => ItemsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. * @documentationMaturity preview */ ge: (propertyName: '_createdDate', value: any) => ItemsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. * @documentationMaturity preview */ gt: (propertyName: '_createdDate', value: any) => ItemsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. * @documentationMaturity preview */ le: (propertyName: '_createdDate', value: any) => ItemsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. * @documentationMaturity preview */ lt: (propertyName: '_createdDate', value: any) => ItemsQueryBuilder; /** @param propertyName - Property whose value is compared with `string`. * @param string - String to compare against. Case-insensitive. * @documentationMaturity preview */ startsWith: (propertyName: '_id' | 'externalId' | 'category' | 'itemSetId' | 'providerAppId' | 'namespace', value: string) => ItemsQueryBuilder; /** @param propertyName - Property whose value is compared with `values`. * @param values - List of values to compare against. * @documentationMaturity preview */ hasSome: (propertyName: '_id' | '_createdDate' | 'externalId' | 'category' | 'itemSetId' | 'providerAppId' | 'namespace', value: any[]) => ItemsQueryBuilder; /** @documentationMaturity preview */ in: (propertyName: '_id' | '_createdDate' | 'externalId' | 'category' | 'itemSetId' | 'providerAppId' | 'namespace', value: any) => ItemsQueryBuilder; /** @documentationMaturity preview */ exists: (propertyName: '_id' | '_createdDate' | 'externalId' | 'category' | 'itemSetId' | 'providerAppId' | 'namespace', value: boolean) => ItemsQueryBuilder; /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. * @documentationMaturity preview */ ascending: (...propertyNames: Array<'_id' | '_createdDate' | 'externalId' | 'category' | 'itemSetId' | 'providerAppId' | 'namespace'>) => ItemsQueryBuilder; /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. * @documentationMaturity preview */ descending: (...propertyNames: Array<'_id' | '_createdDate' | 'externalId' | 'category' | 'itemSetId' | 'providerAppId' | 'namespace'>) => ItemsQueryBuilder; /** @param limit - Number of items to return, which is also the `pageSize` of the results object. * @documentationMaturity preview */ limit: (limit: number) => ItemsQueryBuilder; /** @param cursor - A pointer to specific record * @documentationMaturity preview */ skipTo: (cursor: string) => ItemsQueryBuilder; /** @documentationMaturity preview */ find: () => Promise; } /** * Used for counting items * @public * @documentationMaturity preview * @permissionId BENEFIT_PROGRAMS.ITEM_READ */ export declare function countItems(options?: CountItemsOptions): Promise; export interface CountItemsOptions { /** Items filter to count */ filter?: Record | null; } /** * Clone the item set * @param itemSetId - Id of the item set to be cloned * @public * @documentationMaturity preview * @requiredField itemSetId * @permissionId BENEFIT_PROGRAMS.ITEM_CLONE */ export declare function cloneItems(itemSetId: string): Promise; /** * Clone the item set * @param itemSetIds - Id of the item sets to be cloned * @public * @documentationMaturity preview * @requiredField itemSetIds * @permissionId BENEFIT_PROGRAMS.ITEM_CLONE */ export declare function bulkCloneItemSets(itemSetIds: string[]): Promise; /** * Allocates the provided number of sets * @public * @documentationMaturity preview * @permissionId BENEFIT_PROGRAMS.ITEM_SET_ALLOCATE */ export declare function allocateItemSets(options?: AllocateItemSetsOptions): Promise; export interface AllocateItemSetsOptions { /** Number of sets to allocate */ numberOfSets?: number; } export {};