@wix/auto_sdk_benefit-programs_items 1.0.27 → 1.0.28

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,42 @@ declare enum WebhookIdentityType {
652
654
  }
653
655
  /** @enumType */
654
656
  type WebhookIdentityTypeWithLiterals = WebhookIdentityType | 'UNKNOWN' | 'ANONYMOUS_VISITOR' | 'MEMBER' | 'WIX_USER' | 'APP';
657
+ type CountItemsApplicationErrors = {
658
+ code?: 'TOO_MANY_TO_COUNT';
659
+ description?: string;
660
+ data?: Record<string, any>;
661
+ };
662
+ /**
663
+ * Creates a benefit item.
664
+ * @param item - Item to create.
665
+ * @public
666
+ * @documentationMaturity preview
667
+ * @requiredField item
668
+ * @requiredField item.externalId
669
+ * @requiredField item.itemSetId
670
+ * @requiredField item.namespace
671
+ * @requiredField item.providerAppId
672
+ * @permissionId BENEFIT_PROGRAMS.ITEM_CREATE
673
+ * @applicableIdentity APP
674
+ * @returns Created item.
675
+ * @fqn wix.benefit_programs.v1.item.ItemService.CreateItem
676
+ */
677
+ declare function createItem(item: NonNullablePaths<Item, `externalId` | `itemSetId` | `namespace` | `providerAppId`, 2>): Promise<Item>;
678
+ /**
679
+ * Creates benefit items.
680
+ * @param items - Items to create.
681
+ * @public
682
+ * @documentationMaturity preview
683
+ * @requiredField items
684
+ * @requiredField items.externalId
685
+ * @requiredField items.itemSetId
686
+ * @requiredField items.namespace
687
+ * @requiredField items.providerAppId
688
+ * @permissionId BENEFIT_PROGRAMS.ITEM_CREATE
689
+ * @applicableIdentity APP
690
+ * @fqn wix.benefit_programs.v1.item.ItemService.BulkCreateItems
691
+ */
692
+ 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
693
  interface BulkCreateItemsOptions {
656
694
  /**
657
695
  * Whether to return the full item entities.
@@ -660,10 +698,83 @@ interface BulkCreateItemsOptions {
660
698
  */
661
699
  returnEntity?: boolean;
662
700
  }
701
+ /**
702
+ * Deletes a benefit item.
703
+ *
704
+ * <blockquote class="caution">
705
+ * <strong>Caution:</strong>
706
+ *
707
+ * Deleting a benefit item removes the association between a benefit and the item with immediate effect. This may affect currently active pools.
708
+ * </blockquote>
709
+ * @param itemId - Item ID.
710
+ * @public
711
+ * @documentationMaturity preview
712
+ * @requiredField itemId
713
+ * @permissionId BENEFIT_PROGRAMS.ITEM_DELETE
714
+ * @applicableIdentity APP
715
+ * @fqn wix.benefit_programs.v1.item.ItemService.DeleteItem
716
+ */
717
+ declare function deleteItem(itemId: string): Promise<void>;
718
+ /**
719
+ * Deletes benefit items.
720
+ *
721
+ * <blockquote class="caution">
722
+ * <strong>Caution:</strong>
723
+ *
724
+ * Deleting a benefit item removes the association between a benefit and the item with immediate effect. This may affect currently active pools.
725
+ * </blockquote>
726
+ * @param itemIds - List of IDs of the items to delete.
727
+ * @public
728
+ * @documentationMaturity preview
729
+ * @requiredField itemIds
730
+ * @permissionId BENEFIT_PROGRAMS.ITEM_DELETE
731
+ * @applicableIdentity APP
732
+ * @fqn wix.benefit_programs.v1.item.ItemService.BulkDeleteItems
733
+ */
734
+ 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>>;
735
+ /**
736
+ * Deletes benefit items that fulfill the specified filter conditions.
737
+ *
738
+ * For a list of supported filters, see [Filtering and Sorting](https://dev.wix.com/docs/rest/business-solutions/benefit-programs/items/filtering-and-sorting).
739
+ *
740
+ * <blockquote class="caution">
741
+ * <strong>Caution:</strong>
742
+ *
743
+ * Deleting a benefit item removes the association between a benefit and the item with immediate effect. This may affect currently active pools.
744
+ * </blockquote>
745
+ * @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.
746
+ * @public
747
+ * @documentationMaturity preview
748
+ * @requiredField namespace
749
+ * @permissionId BENEFIT_PROGRAMS.ITEM_DELETE
750
+ * @applicableIdentity APP
751
+ * @fqn wix.benefit_programs.v1.item.ItemService.BulkDeleteItemsByFilter
752
+ */
753
+ declare function bulkDeleteItemsByFilter(namespace: string, options?: BulkDeleteItemsByFilterOptions): Promise<NonNullablePaths<BulkDeleteItemsByFilterResponse, `jobId`, 2>>;
663
754
  interface BulkDeleteItemsByFilterOptions {
664
755
  /** Filter options. To learn more, see [API Query Language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language). */
665
756
  filter?: Record<string, any> | null;
666
757
  }
758
+ /**
759
+ * Updates a benefit item.
760
+ *
761
+ * Each time the benefit item is updated,
762
+ * `revision` increments by 1.
763
+ * The current `revision` must be passed when updating the benefit item.
764
+ * This ensures you're working with the latest benefit item
765
+ * and prevents unintended overwrites.
766
+ * @param _id - Benefit item ID.
767
+ * @public
768
+ * @documentationMaturity preview
769
+ * @requiredField _id
770
+ * @requiredField item
771
+ * @requiredField item.revision
772
+ * @permissionId BENEFIT_PROGRAMS.ITEM_UPDATE
773
+ * @applicableIdentity APP
774
+ * @returns Updated item.
775
+ * @fqn wix.benefit_programs.v1.item.ItemService.UpdateItem
776
+ */
777
+ declare function updateItem(_id: string, item: NonNullablePaths<UpdateItem, `revision`, 2>): Promise<Item>;
667
778
  interface UpdateItem {
668
779
  /**
669
780
  * Benefit item ID.
@@ -739,6 +850,24 @@ interface UpdateItem {
739
850
  */
740
851
  namespace?: string | null;
741
852
  }
853
+ /**
854
+ * Updates benefit items.
855
+ *
856
+ * Each time the benefit item is updated,
857
+ * `revision` increments by 1.
858
+ * The current `revision` must be passed when updating the benefit item.
859
+ * This ensures you're working with the latest benefit item
860
+ * and prevents unintended overwrites.
861
+ * @public
862
+ * @documentationMaturity preview
863
+ * @requiredField options.items.item
864
+ * @requiredField options.items.item._id
865
+ * @requiredField options.items.item.revision
866
+ * @permissionId BENEFIT_PROGRAMS.ITEM_UPDATE
867
+ * @applicableIdentity APP
868
+ * @fqn wix.benefit_programs.v1.item.ItemService.BulkUpdateItems
869
+ */
870
+ 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
871
  interface BulkUpdateItemsOptions {
743
872
  /**
744
873
  * Items to update.
@@ -753,12 +882,52 @@ interface BulkUpdateItemsOptions {
753
882
  */
754
883
  returnEntity?: boolean;
755
884
  }
885
+ /**
886
+ * Retrieves a benefit item.
887
+ * @param itemId - ID of the item to retrieve.
888
+ * @public
889
+ * @documentationMaturity preview
890
+ * @requiredField itemId
891
+ * @permissionId BENEFIT_PROGRAMS.ITEM_READ
892
+ * @applicableIdentity APP
893
+ * @returns Retrieved item.
894
+ * @fqn wix.benefit_programs.v1.item.ItemService.GetItem
895
+ */
896
+ declare function getItem(itemId: string): Promise<Item>;
897
+ /**
898
+ * Retrieves a list of up to 1000 benefit items.
899
+ * @public
900
+ * @documentationMaturity preview
901
+ * @permissionId BENEFIT_PROGRAMS.ITEM_READ
902
+ * @applicableIdentity APP
903
+ * @fqn wix.benefit_programs.v1.item.ItemService.ListItems
904
+ */
905
+ declare function listItems(options?: ListItemsOptions): Promise<NonNullablePaths<ListItemsResponse, `items`, 2>>;
756
906
  interface ListItemsOptions {
757
907
  /** Filter. */
758
908
  filter?: Filter;
759
909
  /** Cursor paging */
760
910
  cursorPaging?: CursorPaging;
761
911
  }
912
+ /**
913
+ * Creates a query to retrieve a list of items.
914
+ *
915
+ * The Query Items method builds a query to retrieve a list of items and returns a `ItemsQueryBuilder` object.
916
+ *
917
+ * The returned object contains the query definition, which is used to run the query using the `find()` method.
918
+ *
919
+ * 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.
920
+ *
921
+ * Query Items has a default paging limit of 50, which you can override.
922
+ *
923
+ * For a full description of the item object, see the object returned for the `items` property in `ItemsQueryResult`.
924
+ * @public
925
+ * @documentationMaturity preview
926
+ * @permissionId BENEFIT_PROGRAMS.ITEM_READ
927
+ * @applicableIdentity APP
928
+ * @fqn wix.benefit_programs.v1.item.ItemService.QueryItems
929
+ */
930
+ declare function queryItems(): ItemsQueryBuilder;
762
931
  interface QueryCursorResult {
763
932
  cursors: Cursors;
764
933
  hasNext: () => boolean;
@@ -836,6 +1005,19 @@ interface ItemsQueryBuilder {
836
1005
  /** @documentationMaturity preview */
837
1006
  find: () => Promise<ItemsQueryResult>;
838
1007
  }
1008
+ /**
1009
+ * Counts how many benefit items exist that fulfill the specified filtering conditions.
1010
+ *
1011
+ * For a list of supported filters, see [Filtering and Sorting](https://dev.wix.com/docs/rest/business-solutions/benefit-programs/items/filtering-and-sorting).
1012
+ * @public
1013
+ * @documentationMaturity preview
1014
+ * @permissionId BENEFIT_PROGRAMS.ITEM_READ
1015
+ * @applicableIdentity APP
1016
+ * @fqn wix.benefit_programs.v1.item.ItemService.CountItems
1017
+ */
1018
+ declare function countItems(options?: CountItemsOptions): Promise<NonNullablePaths<CountItemsResponse, `count`, 2> & {
1019
+ __applicationErrorsType?: CountItemsApplicationErrors;
1020
+ }>;
839
1021
  interface CountItemsOptions {
840
1022
  /**
841
1023
  * Items to count.
@@ -845,4 +1027,4 @@ interface CountItemsOptions {
845
1027
  filter?: Record<string, any> | null;
846
1028
  }
847
1029
 
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 };
1030
+ 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 };