/** Label that was found or created. */ export interface ContactLabel { /** * Label namespace. * * Labels created by calling the Find Or Create Label method * are automatically assigned to the `custom` namespace. * @readonly */ namespace?: string | null; /** * Display name for the namespace, * used to organize the list of labels in the site dashboard. * @readonly */ namespaceDisplayName?: string | null; /** * Label key. * * `key` is generated when the label is created. * It can't be modified, even if `displayName` is updated. * @readonly */ key?: string; /** Label display name shown in the dashboard. */ displayName?: string; /** * Label type indicating how the label was created. * @readonly */ labelType?: LabelType; /** * Date and time the label was created. * @readonly */ _createdDate?: Date | null; /** * Date and time the label was last updated. * @readonly */ _updatedDate?: Date | null; } export declare enum LabelType { /** Default system label for the contact list. */ SYSTEM = "SYSTEM", /** Label created by calling the Find Or Create Label method. */ USER_DEFINED = "USER_DEFINED", /** Label created by an app built by Wix. */ WIX_APP_DEFINED = "WIX_APP_DEFINED" } /** Label filter options. */ export interface ListLabelsRequest { /** Filter for labels of the specified type. */ labelType?: LabelType; /** Filter for labels in the specified namespace. */ namespace?: string | null; /** Filter for labels where `displayName` starts with the specified case-sensitive string. */ startsWith?: string | null; /** Sorting options. */ sort?: Sorting; /** Paging options. */ paging?: Paging; language?: string | null; } export interface Sorting { /** Name of the field to sort by. */ fieldName?: string; /** * Sort order. * * Default: `ASC`. */ order?: SortOrder; } export declare enum SortOrder { /** Sort by ascending order. */ ASC = "ASC", /** Sort by descending order. */ DESC = "DESC" } export interface Paging { /** * Number of items to return. * * Defaults to `1000`.
* Maximum: `2000`. */ limit?: number | null; /** Number of items to skip in the current sort order. */ offset?: number | null; } /** List of labels. */ export interface ListLabelsResponse { /** List of labels. */ labels?: ContactLabel[]; /** Metadata for the page of results. */ metadata?: PagingMetadata; } export interface PagingMetadata { /** Number of items returned. */ count?: number | null; /** Requested offset. */ offset?: number | null; /** Number of items that matched the query. */ total?: number | null; /** * Indicates if `total` calculation timed out before the response was sent. * Typically this happens if there is a large set of results. */ tooManyToCount?: boolean | null; } /** Label to find or create. */ export interface FindOrCreateLabelRequest { /** * Display name to retrieve or create. * * If an existing label is an exact match * for the specified display name, * the existing label is returned. * If not, a new label is created and returned. */ displayName: string; /** * Language for localization. * 2-letter language code in [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes) format. */ language?: string | null; } /** Label that was found or created. */ export interface FindOrCreateLabelResponse { /** Label that was found or created. */ label?: ContactLabel; /** * Indicates whether the label was just created or already existed. * * Returns `true` if the label was just created. */ newLabel?: boolean; } export interface LabelsQuotaReached { /** The maximum number of labels allowed for the site. */ labelsQuota?: string | null; /** The current total number of labels on the site. */ labelsCurrentTotal?: string | null; } export interface ListLabelNamespacesRequest { /** Language for localization */ language?: string | null; } export interface ListLabelNamespacesResponse { /** List of namespaces */ namespaces?: ContactLabelNamespace[]; } export interface ContactLabelNamespace { /** * Namespace key * @readonly */ key?: string; /** * Namespace display name * @readonly */ displayName?: string | null; } export interface GetLabelRequest { /** * Label key. * * `key` is generated when the label is created. * It can't be modified, even if `displayName` is updated. */ key: string; /** * Language for localization. * 2-letter language code in [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes) format. */ language?: string | null; } /** The specified label. */ export interface GetLabelResponse { /** The specified label. */ label?: ContactLabel; } export interface GetLabelByLegacyIdRequest { /** Legacy id of the label */ legacyId?: string; /** Language for localization */ language?: string | null; } export interface GetLabelByLegacyIdResponse { /** Requested label */ label?: ContactLabel; } export interface UpdateLabelRequest { /** Label to rename. */ label?: ContactLabel; /** * Language for localization. * 2-letter language code in [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes) format. */ language?: string | null; } /** Updated label. */ export interface UpdateLabelResponse { /** Renamed label. */ label?: ContactLabel; } export interface DeleteLabelRequest { /** Label key to delete. */ key: string; } export interface DeleteLabelResponse { } export interface PurgeRequest { /** Contacts Instance ID of the site. */ instanceId?: string; /** Labels to exclude from the purge. */ exludingLabelKeys?: string[]; } export interface PurgeResponse { /** Number of deleted items */ deletedItems?: number; } export interface GdprListRequest { /** Contacts Instance ID of the site. */ instanceId?: string; } export interface GdprListResponse { /** List of labels */ labels?: ContactLabel[]; } export interface QueryLabelsRequest { /** Query options. */ query?: Query; /** * Language for localization. * 2-letter language code in [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes) format. */ language?: string | null; } export interface Query { /** * ilter object. * * Possible filters: `$eq`, `$gt`, `$gte`, `$in`, `$lt`, `$lte`, `$ne`, `$startsWith`. * * For a detailed list of supported filters, see [sorting and filtering for labels](https://dev.wix.com/api/rest/contacts/labels/sort-and-filter). * * Example: `{ "filter": { * "displayName": { * "$startsWith": "Referral" * } * } * }` */ filter?: Record | null; /** * Sorting options. For a list of fields that can be sorted, see [sorting and filtering for labels](https://dev.wix.com/api/rest/contacts/labels/sort-and-filter). * * Example: `{ "sort": [{"fieldName": "displayName", "order": "DESC"}] }` */ sort?: Sorting[]; /** Pagination options. */ paging?: Paging; } export interface QueryLabelsResponse { /** List of labels */ labels?: ContactLabel[]; /** Details on the paged set of results returned. */ pagingMetadata?: PagingMetadata; } 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 ContactLabelNonNullableFields { key: string; displayName: string; labelType: LabelType; } export interface FindOrCreateLabelResponseNonNullableFields { label?: ContactLabelNonNullableFields; newLabel: boolean; } export interface GetLabelResponseNonNullableFields { label?: ContactLabelNonNullableFields; } export interface UpdateLabelResponseNonNullableFields { label?: ContactLabelNonNullableFields; } export interface QueryLabelsResponseNonNullableFields { labels: ContactLabelNonNullableFields[]; } export interface BaseEventMetadata { /** App instance ID. */ instanceId?: string | null; /** Event type. */ eventType?: string; /** The identification type and identity data. */ identity?: IdentificationData; } export interface EventMetadata extends BaseEventMetadata { /** * 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; } export interface LabelCreatedEnvelope { entity: ContactLabel; metadata: EventMetadata; } /** * Triggered when a label is created. * @permissionScope Manage Bookings Services and Settings * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION * @permissionScope Manage Contact Labels * @permissionScopeId SCOPE.DC-CONTACTS.MANAGE-LABELS * @permissionScope Manage Portfolio * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO * @permissionScope Manage Restaurants - all permissions * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES * @permissionScope Manage Members and Contacts - all permissions * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS * @permissionId CONTACTS_LABELS.VIEW * @webhook * @eventType wix.contacts.v4.label_created */ export declare function onLabelCreated(handler: (event: LabelCreatedEnvelope) => void | Promise): void; export interface LabelDeletedEnvelope { metadata: EventMetadata; } /** * Triggered when a label is deleted. * @permissionScope Manage Bookings Services and Settings * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION * @permissionScope Manage Contact Labels * @permissionScopeId SCOPE.DC-CONTACTS.MANAGE-LABELS * @permissionScope Manage Portfolio * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO * @permissionScope Manage Restaurants - all permissions * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES * @permissionScope Manage Members and Contacts - all permissions * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS * @permissionId CONTACTS_LABELS.VIEW * @webhook * @eventType wix.contacts.v4.label_deleted */ export declare function onLabelDeleted(handler: (event: LabelDeletedEnvelope) => void | Promise): void; export interface LabelUpdatedEnvelope { entity: ContactLabel; metadata: EventMetadata; } /** * Triggered when a label is updated. * @permissionScope Manage Bookings Services and Settings * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION * @permissionScope Manage Contact Labels * @permissionScopeId SCOPE.DC-CONTACTS.MANAGE-LABELS * @permissionScope Manage Portfolio * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO * @permissionScope Manage Restaurants - all permissions * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES * @permissionScope Manage Members and Contacts - all permissions * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS * @permissionId CONTACTS_LABELS.VIEW * @webhook * @eventType wix.contacts.v4.label_updated */ export declare function onLabelUpdated(handler: (event: LabelUpdatedEnvelope) => void | Promise): void; /** * Retrieves a label with a specified name, or creates one if it doesn't exist. * * Successful calls to this method always return a label, * which can be specified in subsequent calls. * * For example, in the Contacts API, Label Contact and Unlabel Contact * calls will fail if you include a non-existent label. * To ensure successful calls, you can call this method first, * and then use the response in the Label Contact and Unlabel Contact calls. * * To find an existing label without potentially creating a new one, call * Get Label or Query Labels. * @param displayName - Display name to retrieve or create. * * If an existing label is an exact match * for the specified display name, * the existing label is returned. * If not, a new label is created and returned. * @public * @requiredField displayName * @param options - Language options. * @permissionId CONTACTS_LABELS.MODIFY * @permissionScope Manage Contact Labels * @permissionScopeId SCOPE.DC-CONTACTS.MANAGE-LABELS * @permissionScope Manage Members and Contacts - all permissions * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS * @applicableIdentity APP * @returns Label that was found or created. * @fqn com.wixpress.contacts.labels.v4.ContactLabelsServiceV4.FindOrCreateLabel */ export declare function findOrCreateLabel(displayName: string, options?: FindOrCreateLabelOptions): Promise; export interface FindOrCreateLabelOptions { /** * Language for localization. * 2-letter language code in [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes) format. */ language?: string | null; } /** * Retrieves a label by the specified label key. * @param key - Label key. * * `key` is generated when the label is created. * It can't be modified, even if `displayName` is updated. * @public * @requiredField key * @param options - Language options. * @permissionId CONTACTS_LABELS.VIEW * @permissionScope Manage Bookings Services and Settings * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION * @permissionScope Manage Contact Labels * @permissionScopeId SCOPE.DC-CONTACTS.MANAGE-LABELS * @permissionScope Manage Portfolio * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO * @permissionScope Manage Restaurants - all permissions * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES * @permissionScope Manage Members and Contacts - all permissions * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS * @applicableIdentity APP * @returns The specified label. * @fqn com.wixpress.contacts.labels.v4.ContactLabelsServiceV4.GetLabel */ export declare function getLabel(key: string, options?: GetLabelOptions): Promise; export interface GetLabelOptions { /** * Language for localization. * 2-letter language code in [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes) format. */ language?: string | null; } /** * Renames a label. * @param key - Label key. * * `key` is generated when the label is created. * It can't be modified, even if `displayName` is updated. * @public * @requiredField key * @requiredField label * @requiredField label.displayName * @param options - Language options. * @param label - Label to rename. * @permissionId CONTACTS_LABELS.MODIFY * @permissionScope Manage Contact Labels * @permissionScopeId SCOPE.DC-CONTACTS.MANAGE-LABELS * @permissionScope Manage Members and Contacts - all permissions * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS * @applicableIdentity APP * @returns Renamed label. * @fqn com.wixpress.contacts.labels.v4.ContactLabelsServiceV4.UpdateLabel */ export declare function renameLabel(key: string, label: RenameLabel, options?: RenameLabelOptions): Promise; export interface RenameLabel { /** * Label namespace. * * Labels created by calling the Find Or Create Label method * are automatically assigned to the `custom` namespace. * @readonly */ namespace?: string | null; /** * Display name for the namespace, * used to organize the list of labels in the site dashboard. * @readonly */ namespaceDisplayName?: string | null; /** Label display name shown in the dashboard. */ displayName?: string; /** * Label type indicating how the label was created. * @readonly */ labelType?: LabelType; /** * Date and time the label was created. * @readonly */ _createdDate?: Date | null; /** * Date and time the label was last updated. * @readonly */ _updatedDate?: Date | null; } export interface RenameLabelOptions { /** * Language for localization. * 2-letter language code in [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes) format. */ language?: string | null; } /** * Deletes the specified label from a site and removes it from the contacts it applies to. * @param key - Label key to delete. * @public * @requiredField key * @permissionId CONTACTS_LABELS.MODIFY * @permissionScope Manage Contact Labels * @permissionScopeId SCOPE.DC-CONTACTS.MANAGE-LABELS * @permissionScope Manage Members and Contacts - all permissions * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS * @applicableIdentity APP * @fqn com.wixpress.contacts.labels.v4.ContactLabelsServiceV4.DeleteLabel */ export declare function deleteLabel(key: string): Promise; /** * Creates a query to retrieve a list of labels. * * The `queryLabels()` method builds a query to retrieve a list of labels and returns a `LabelsQueryBuilder` object. * * The returned object contains the query definition, which is used to call the query using the `find()` method. * * You can refine the query by chaining `LabelsQueryBuilder` methods onto the query. `LabelsQueryBuilder` methods enable you to filter, sort, and control the response that `queryLabels()` returns. * * `queryLabels()` is called with the following `LabelsQueryBuilder` defaults, which you can override: * - `skip(0)` * - `limit(50)` * - `descending('_createdDate')` * * The following `LabelsQueryBuilder` methods are supported for `queryLabels()`. For a full description of the `Labels` object, see the object returned for the `items` field in `LabelsQueryResult`. * * * @public * @param options - Language options. * @permissionScope Manage Bookings Services and Settings * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION * @permissionScope Manage Contact Labels * @permissionScopeId SCOPE.DC-CONTACTS.MANAGE-LABELS * @permissionScope Manage Portfolio * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO * @permissionScope Manage Restaurants - all permissions * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES * @permissionScope Manage Members and Contacts - all permissions * @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS * @permissionId CONTACTS_LABELS.VIEW * @applicableIdentity APP * @fqn com.wixpress.contacts.labels.v4.ContactLabelsServiceV4.QueryLabels */ export declare function queryLabels(options?: QueryLabelsOptions): LabelsQueryBuilder; export interface QueryLabelsOptions { /** * Language for localization. * * 2-letter language code in * [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format. */ language?: string | null | undefined; } interface QueryOffsetResult { currentPage: number | undefined; totalPages: number | undefined; totalCount: number | undefined; hasNext: () => boolean; hasPrev: () => boolean; length: number; pageSize: number; } export interface LabelsQueryResult extends QueryOffsetResult { items: ContactLabel[]; query: LabelsQueryBuilder; next: () => Promise; prev: () => Promise; } export interface LabelsQueryBuilder { /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ eq: (propertyName: 'namespace' | 'key' | 'displayName' | 'labelType' | '_createdDate' | '_updatedDate', value: any) => LabelsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ ne: (propertyName: 'namespace' | 'key' | 'displayName' | '_createdDate' | '_updatedDate', value: any) => LabelsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ ge: (propertyName: '_createdDate' | '_updatedDate', value: any) => LabelsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ gt: (propertyName: '_createdDate' | '_updatedDate', value: any) => LabelsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ le: (propertyName: '_createdDate' | '_updatedDate', value: any) => LabelsQueryBuilder; /** @param propertyName - Property whose value is compared with `value`. * @param value - Value to compare against. */ lt: (propertyName: '_createdDate' | '_updatedDate', value: any) => LabelsQueryBuilder; /** @param propertyName - Property whose value is compared with `string`. * @param string - String to compare against. Case-insensitive. */ startsWith: (propertyName: 'displayName', value: string) => LabelsQueryBuilder; in: (propertyName: 'key' | 'displayName', value: any) => LabelsQueryBuilder; /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */ ascending: (...propertyNames: Array<'displayName' | '_createdDate' | '_updatedDate'>) => LabelsQueryBuilder; /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */ descending: (...propertyNames: Array<'displayName' | '_createdDate' | '_updatedDate'>) => LabelsQueryBuilder; /** @param limit - Number of items to return, which is also the `pageSize` of the results object. */ limit: (limit: number) => LabelsQueryBuilder; /** @param skip - Number of items to skip in the query results before returning the results. */ skip: (skip: number) => LabelsQueryBuilder; find: () => Promise; } export {};