@wix/auto_sdk_benefit-programs_items 1.0.27 → 1.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,5 @@
1
+ import { NonNullablePaths } from '@wix/sdk-types';
2
+
1
3
  interface Item {
2
4
  /**
3
5
  * Benefit item ID.
@@ -652,6 +654,43 @@ declare enum WebhookIdentityType {
652
654
  }
653
655
  /** @enumType */
654
656
  type WebhookIdentityTypeWithLiterals = WebhookIdentityType | 'UNKNOWN' | 'ANONYMOUS_VISITOR' | 'MEMBER' | 'WIX_USER' | 'APP';
657
+ /** @docsIgnore */
658
+ type CountItemsApplicationErrors = {
659
+ code?: 'TOO_MANY_TO_COUNT';
660
+ description?: string;
661
+ data?: Record<string, any>;
662
+ };
663
+ /**
664
+ * Creates a benefit item.
665
+ * @param item - Item to create.
666
+ * @public
667
+ * @documentationMaturity preview
668
+ * @requiredField item
669
+ * @requiredField item.externalId
670
+ * @requiredField item.itemSetId
671
+ * @requiredField item.namespace
672
+ * @requiredField item.providerAppId
673
+ * @permissionId BENEFIT_PROGRAMS.ITEM_CREATE
674
+ * @applicableIdentity APP
675
+ * @returns Created item.
676
+ * @fqn wix.benefit_programs.v1.item.ItemService.CreateItem
677
+ */
678
+ declare function createItem(item: NonNullablePaths<Item, `externalId` | `itemSetId` | `namespace` | `providerAppId`, 2>): Promise<Item>;
679
+ /**
680
+ * Creates benefit items.
681
+ * @param items - Items to create.
682
+ * @public
683
+ * @documentationMaturity preview
684
+ * @requiredField items
685
+ * @requiredField items.externalId
686
+ * @requiredField items.itemSetId
687
+ * @requiredField items.namespace
688
+ * @requiredField items.providerAppId
689
+ * @permissionId BENEFIT_PROGRAMS.ITEM_CREATE
690
+ * @applicableIdentity APP
691
+ * @fqn wix.benefit_programs.v1.item.ItemService.BulkCreateItems
692
+ */
693
+ declare function bulkCreateItems(items: NonNullablePaths<Item, `externalId` | `itemSetId` | `namespace` | `providerAppId`, 2>[], options?: BulkCreateItemsOptions): Promise<NonNullablePaths<BulkCreateItemsResponse, `results` | `results.${number}.itemMetadata.originalIndex` | `results.${number}.itemMetadata.success` | `results.${number}.itemMetadata.error.code` | `results.${number}.itemMetadata.error.description` | `bulkActionMetadata.totalSuccesses` | `bulkActionMetadata.totalFailures` | `bulkActionMetadata.undetailedFailures`, 6>>;
655
694
  interface BulkCreateItemsOptions {
656
695
  /**
657
696
  * Whether to return the full item entities.
@@ -660,10 +699,83 @@ interface BulkCreateItemsOptions {
660
699
  */
661
700
  returnEntity?: boolean;
662
701
  }
702
+ /**
703
+ * Deletes a benefit item.
704
+ *
705
+ * <blockquote class="caution">
706
+ * <strong>Caution:</strong>
707
+ *
708
+ * Deleting a benefit item removes the association between a benefit and the item with immediate effect. This may affect currently active pools.
709
+ * </blockquote>
710
+ * @param itemId - Item ID.
711
+ * @public
712
+ * @documentationMaturity preview
713
+ * @requiredField itemId
714
+ * @permissionId BENEFIT_PROGRAMS.ITEM_DELETE
715
+ * @applicableIdentity APP
716
+ * @fqn wix.benefit_programs.v1.item.ItemService.DeleteItem
717
+ */
718
+ declare function deleteItem(itemId: string): Promise<void>;
719
+ /**
720
+ * Deletes benefit items.
721
+ *
722
+ * <blockquote class="caution">
723
+ * <strong>Caution:</strong>
724
+ *
725
+ * Deleting a benefit item removes the association between a benefit and the item with immediate effect. This may affect currently active pools.
726
+ * </blockquote>
727
+ * @param itemIds - List of IDs of the items to delete.
728
+ * @public
729
+ * @documentationMaturity preview
730
+ * @requiredField itemIds
731
+ * @permissionId BENEFIT_PROGRAMS.ITEM_DELETE
732
+ * @applicableIdentity APP
733
+ * @fqn wix.benefit_programs.v1.item.ItemService.BulkDeleteItems
734
+ */
735
+ declare function bulkDeleteItems(itemIds: string[]): Promise<NonNullablePaths<BulkDeleteItemsResponse, `results` | `results.${number}.itemMetadata.originalIndex` | `results.${number}.itemMetadata.success` | `results.${number}.itemMetadata.error.code` | `results.${number}.itemMetadata.error.description` | `bulkActionMetadata.totalSuccesses` | `bulkActionMetadata.totalFailures` | `bulkActionMetadata.undetailedFailures`, 6>>;
736
+ /**
737
+ * Deletes benefit items that fulfill the specified filter conditions.
738
+ *
739
+ * For a list of supported filters, see [Filtering and Sorting](https://dev.wix.com/docs/rest/business-solutions/benefit-programs/items/filtering-and-sorting).
740
+ *
741
+ * <blockquote class="caution">
742
+ * <strong>Caution:</strong>
743
+ *
744
+ * Deleting a benefit item removes the association between a benefit and the item with immediate effect. This may affect currently active pools.
745
+ * </blockquote>
746
+ * @param namespace - Namespace for your app or site's benefit programs. Namespaces allow you to distinguish between entities that you created and entities that other apps created.
747
+ * @public
748
+ * @documentationMaturity preview
749
+ * @requiredField namespace
750
+ * @permissionId BENEFIT_PROGRAMS.ITEM_DELETE
751
+ * @applicableIdentity APP
752
+ * @fqn wix.benefit_programs.v1.item.ItemService.BulkDeleteItemsByFilter
753
+ */
754
+ declare function bulkDeleteItemsByFilter(namespace: string, options?: BulkDeleteItemsByFilterOptions): Promise<NonNullablePaths<BulkDeleteItemsByFilterResponse, `jobId`, 2>>;
663
755
  interface BulkDeleteItemsByFilterOptions {
664
756
  /** Filter options. To learn more, see [API Query Language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language). */
665
757
  filter?: Record<string, any> | null;
666
758
  }
759
+ /**
760
+ * Updates a benefit item.
761
+ *
762
+ * Each time the benefit item is updated,
763
+ * `revision` increments by 1.
764
+ * The current `revision` must be passed when updating the benefit item.
765
+ * This ensures you're working with the latest benefit item
766
+ * and prevents unintended overwrites.
767
+ * @param _id - Benefit item ID.
768
+ * @public
769
+ * @documentationMaturity preview
770
+ * @requiredField _id
771
+ * @requiredField item
772
+ * @requiredField item.revision
773
+ * @permissionId BENEFIT_PROGRAMS.ITEM_UPDATE
774
+ * @applicableIdentity APP
775
+ * @returns Updated item.
776
+ * @fqn wix.benefit_programs.v1.item.ItemService.UpdateItem
777
+ */
778
+ declare function updateItem(_id: string, item: NonNullablePaths<UpdateItem, `revision`, 2>): Promise<Item>;
667
779
  interface UpdateItem {
668
780
  /**
669
781
  * Benefit item ID.
@@ -739,6 +851,24 @@ interface UpdateItem {
739
851
  */
740
852
  namespace?: string | null;
741
853
  }
854
+ /**
855
+ * Updates benefit items.
856
+ *
857
+ * Each time the benefit item is updated,
858
+ * `revision` increments by 1.
859
+ * The current `revision` must be passed when updating the benefit item.
860
+ * This ensures you're working with the latest benefit item
861
+ * and prevents unintended overwrites.
862
+ * @public
863
+ * @documentationMaturity preview
864
+ * @requiredField options.items.item
865
+ * @requiredField options.items.item._id
866
+ * @requiredField options.items.item.revision
867
+ * @permissionId BENEFIT_PROGRAMS.ITEM_UPDATE
868
+ * @applicableIdentity APP
869
+ * @fqn wix.benefit_programs.v1.item.ItemService.BulkUpdateItems
870
+ */
871
+ declare function bulkUpdateItems(options?: NonNullablePaths<BulkUpdateItemsOptions, `items.${number}.item` | `items.${number}.item._id` | `items.${number}.item.revision`, 5>): Promise<NonNullablePaths<BulkUpdateItemsResponse, `results` | `results.${number}.itemMetadata.originalIndex` | `results.${number}.itemMetadata.success` | `results.${number}.itemMetadata.error.code` | `results.${number}.itemMetadata.error.description` | `bulkActionMetadata.totalSuccesses` | `bulkActionMetadata.totalFailures` | `bulkActionMetadata.undetailedFailures`, 6>>;
742
872
  interface BulkUpdateItemsOptions {
743
873
  /**
744
874
  * Items to update.
@@ -753,12 +883,52 @@ interface BulkUpdateItemsOptions {
753
883
  */
754
884
  returnEntity?: boolean;
755
885
  }
886
+ /**
887
+ * Retrieves a benefit item.
888
+ * @param itemId - ID of the item to retrieve.
889
+ * @public
890
+ * @documentationMaturity preview
891
+ * @requiredField itemId
892
+ * @permissionId BENEFIT_PROGRAMS.ITEM_READ
893
+ * @applicableIdentity APP
894
+ * @returns Retrieved item.
895
+ * @fqn wix.benefit_programs.v1.item.ItemService.GetItem
896
+ */
897
+ declare function getItem(itemId: string): Promise<Item>;
898
+ /**
899
+ * Retrieves a list of up to 1000 benefit items.
900
+ * @public
901
+ * @documentationMaturity preview
902
+ * @permissionId BENEFIT_PROGRAMS.ITEM_READ
903
+ * @applicableIdentity APP
904
+ * @fqn wix.benefit_programs.v1.item.ItemService.ListItems
905
+ */
906
+ declare function listItems(options?: ListItemsOptions): Promise<NonNullablePaths<ListItemsResponse, `items`, 2>>;
756
907
  interface ListItemsOptions {
757
908
  /** Filter. */
758
909
  filter?: Filter;
759
910
  /** Cursor paging */
760
911
  cursorPaging?: CursorPaging;
761
912
  }
913
+ /**
914
+ * Creates a query to retrieve a list of items.
915
+ *
916
+ * The Query Items method builds a query to retrieve a list of items and returns a `ItemsQueryBuilder` object.
917
+ *
918
+ * The returned object contains the query definition, which is used to run the query using the `find()` method.
919
+ *
920
+ * You can refine the query by chaining `ItemsQueryBuilder` methods onto the query. `ItemsQueryBuilder` methods enable you to filter, sort, and control the results that Query Items returns.
921
+ *
922
+ * Query Items has a default paging limit of 50, which you can override.
923
+ *
924
+ * For a full description of the item object, see the object returned for the `items` property in `ItemsQueryResult`.
925
+ * @public
926
+ * @documentationMaturity preview
927
+ * @permissionId BENEFIT_PROGRAMS.ITEM_READ
928
+ * @applicableIdentity APP
929
+ * @fqn wix.benefit_programs.v1.item.ItemService.QueryItems
930
+ */
931
+ declare function queryItems(): ItemsQueryBuilder;
762
932
  interface QueryCursorResult {
763
933
  cursors: Cursors;
764
934
  hasNext: () => boolean;
@@ -836,6 +1006,19 @@ interface ItemsQueryBuilder {
836
1006
  /** @documentationMaturity preview */
837
1007
  find: () => Promise<ItemsQueryResult>;
838
1008
  }
1009
+ /**
1010
+ * Counts how many benefit items exist that fulfill the specified filtering conditions.
1011
+ *
1012
+ * For a list of supported filters, see [Filtering and Sorting](https://dev.wix.com/docs/rest/business-solutions/benefit-programs/items/filtering-and-sorting).
1013
+ * @public
1014
+ * @documentationMaturity preview
1015
+ * @permissionId BENEFIT_PROGRAMS.ITEM_READ
1016
+ * @applicableIdentity APP
1017
+ * @fqn wix.benefit_programs.v1.item.ItemService.CountItems
1018
+ */
1019
+ declare function countItems(options?: CountItemsOptions): Promise<NonNullablePaths<CountItemsResponse, `count`, 2> & {
1020
+ __applicationErrorsType?: CountItemsApplicationErrors;
1021
+ }>;
839
1022
  interface CountItemsOptions {
840
1023
  /**
841
1024
  * Items to count.
@@ -845,4 +1028,4 @@ interface CountItemsOptions {
845
1028
  filter?: Record<string, any> | null;
846
1029
  }
847
1030
 
848
- export { type CloneItemsResponse as $, type ApplicationError as A, type BulkCreateItemsOptions as B, type CountItemsOptions as C, type DeleteItemRequest as D, type ExtendedFields as E, type ByReference as F, type GetItemRequest as G, type ByReferenceFilter as H, type Item as I, type Filter as J, type FilterFilterOneOf as K, type ListItemsOptions as L, type MaskedItem as M, type CursorPaging as N, type CursorPagingMetadata as O, type Cursors as P, type QueryItemsRequest as Q, type CursorQuery as R, SortOrder as S, Type as T, type UpdateItem as U, type CursorQueryPagingMethodOneOf as V, WebhookIdentityType as W, type Sorting as X, type QueryItemsResponse as Y, type CountItemsRequest as Z, type CloneItemsRequest as _, type BulkCreateItemsResponse as a, type BulkCloneItemSetsRequest as a0, type BulkCloneItemSetsResponse as a1, type BulkCloneItemSetsResult as a2, type AllocateItemSetsRequest as a3, type AllocateItemSetsResponse as a4, type DomainEvent as a5, type DomainEventBodyOneOf as a6, type EntityCreatedEvent as a7, type RestoreInfo as a8, type EntityUpdatedEvent as a9, type EntityDeletedEvent as aa, type ActionEvent as ab, type MessageEnvelope as ac, type IdentificationData as ad, type IdentificationDataIdOneOf as ae, type ItemsQueryResult as af, type BulkDeleteItemsResponse as b, type BulkDeleteItemsByFilterOptions as c, type BulkDeleteItemsByFilterResponse as d, type BulkUpdateItemsOptions as e, type BulkUpdateItemsResponse as f, type ListItemsResponse as g, type ItemsQueryBuilder as h, type CountItemsResponse as i, type ItemsCloned as j, type CreateItemRequest as k, type CreateItemResponse as l, type BulkCreateItemsRequest as m, type BulkItemResult as n, type ItemMetadata as o, type BulkActionMetadata as p, type DeleteItemResponse as q, type BulkDeleteItemsRequest as r, type BulkDeleteItemsByFilterRequest as s, type UpdateItemRequest as t, type UpdateItemResponse as u, type BulkUpdateItemsRequest as v, type GetItemResponse as w, type ListItemsRequest as x, type ByItemSetIdAndReference as y, type ByItemSetIdAndReferenceFilter as z };
1031
+ export { type ActionEvent, type AllocateItemSetsRequest, type AllocateItemSetsResponse, type ApplicationError, type BulkActionMetadata, type BulkCloneItemSetsRequest, type BulkCloneItemSetsResponse, type BulkCloneItemSetsResult, type BulkCreateItemsOptions, type BulkCreateItemsRequest, type BulkCreateItemsResponse, type BulkDeleteItemsByFilterOptions, type BulkDeleteItemsByFilterRequest, type BulkDeleteItemsByFilterResponse, type BulkDeleteItemsRequest, type BulkDeleteItemsResponse, type BulkItemResult, type BulkUpdateItemsOptions, type BulkUpdateItemsRequest, type BulkUpdateItemsResponse, type ByItemSetIdAndReference, type ByItemSetIdAndReferenceFilter, type ByReference, type ByReferenceFilter, type CloneItemsRequest, type CloneItemsResponse, type CountItemsApplicationErrors, type CountItemsOptions, type CountItemsRequest, type CountItemsResponse, type CreateItemRequest, type CreateItemResponse, type CursorPaging, type CursorPagingMetadata, type CursorQuery, type CursorQueryPagingMethodOneOf, type Cursors, type DeleteItemRequest, type DeleteItemResponse, type DomainEvent, type DomainEventBodyOneOf, type EntityCreatedEvent, type EntityDeletedEvent, type EntityUpdatedEvent, type ExtendedFields, type Filter, type FilterFilterOneOf, type GetItemRequest, type GetItemResponse, type IdentificationData, type IdentificationDataIdOneOf, type Item, type ItemMetadata, type ItemsCloned, type ItemsQueryBuilder, type ItemsQueryResult, type ListItemsOptions, type ListItemsRequest, type ListItemsResponse, type MaskedItem, type MessageEnvelope, type QueryItemsRequest, type QueryItemsResponse, type RestoreInfo, SortOrder, type SortOrderWithLiterals, type Sorting, Type, type TypeWithLiterals, type UpdateItem, type UpdateItemRequest, type UpdateItemResponse, WebhookIdentityType, type WebhookIdentityTypeWithLiterals, bulkCreateItems, bulkDeleteItems, bulkDeleteItemsByFilter, bulkUpdateItems, countItems, createItem, deleteItem, getItem, listItems, queryItems, updateItem };