@wix/auto_sdk_comments_votes 1.0.0 → 1.0.2

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.
@@ -4,53 +4,56 @@ import { QuerySpec, Query, NonNullablePaths } from '@wix/sdk-types';
4
4
  /** An upvote or downvote cast by one identity on a resource in an app context. */
5
5
  interface Vote {
6
6
  /**
7
- * Vote resource ID
7
+ * ID of the resource receiving the vote. For comments, this is the comment ID.
8
8
  * @maxLength 128
9
9
  */
10
10
  resourceId?: string;
11
11
  /**
12
- * Resource fully qualified domain name
12
+ * Entity type receiving the vote. For comments, this is `wix.comments.v2.comment`.
13
13
  * @maxLength 300
14
14
  */
15
15
  resourceFqdn?: string;
16
16
  /**
17
- * Vote ID
17
+ * Vote ID.
18
18
  * @format GUID
19
19
  * @readonly
20
20
  */
21
21
  voteId?: string;
22
22
  /**
23
- * Type of vote
23
+ * Vote type.
24
24
  * @readonly
25
25
  */
26
26
  type?: TypeWithLiterals;
27
27
  /**
28
- * Vote author
28
+ * Identity that cast the vote.
29
29
  * @readonly
30
30
  */
31
31
  createdBy?: SocialIdentity;
32
32
  /**
33
- * Vote created date
33
+ * Date and time the vote was created.
34
34
  * @readonly
35
35
  */
36
36
  _createdDate?: Date | null;
37
37
  /**
38
- * Vote updated date
38
+ * Date and time the vote was updated.
39
39
  * @readonly
40
40
  */
41
41
  _updatedDate?: Date | null;
42
- /** Vote context, defining where the vote belongs to */
42
+ /** App and context containing the resource. */
43
43
  context?: VoteContext;
44
44
  /**
45
- * Vote revision
45
+ * Revision number, which increments when the vote is updated.
46
46
  * @readonly
47
47
  */
48
48
  revision?: string;
49
49
  }
50
- /** Type of vote */
50
+ /** Vote type. */
51
51
  declare enum Type {
52
+ /** Unknown vote type. */
52
53
  UNKNOWN = "UNKNOWN",
54
+ /** Vote in favor of the resource. */
53
55
  UPVOTE = "UPVOTE",
56
+ /** Vote against the resource. */
54
57
  DOWNVOTE = "DOWNVOTE"
55
58
  }
56
59
  /** @enumType */
@@ -72,20 +75,20 @@ declare enum IdentityType {
72
75
  type IdentityTypeWithLiterals = IdentityType | 'ANONYMOUS' | 'MEMBER' | 'USER' | 'SERVICE' | 'MEMBER_GROUP';
73
76
  interface VoteContext {
74
77
  /**
75
- * Context ID
78
+ * ID of the context containing the resource.
76
79
  * @maxLength 128
77
80
  */
78
81
  contextId?: string;
79
- /** Context type */
82
+ /** Type used by the app to identify the context. */
80
83
  contextType?: string | null;
81
84
  /**
82
- * Vote app ID
85
+ * ID of the app that owns the context.
83
86
  * @format GUID
84
87
  * @readonly
85
88
  */
86
89
  appDefId?: string;
87
90
  /**
88
- * MetaSite ID
91
+ * Site ID.
89
92
  * @format GUID
90
93
  * @readonly
91
94
  */
@@ -93,27 +96,27 @@ interface VoteContext {
93
96
  }
94
97
  interface UpvoteRequest {
95
98
  /**
96
- * context token to be passed
99
+ * Legacy context token. Use `contextData` instead.
97
100
  * @deprecated
98
101
  * @replacedBy context_data
99
102
  */
100
103
  contextToken?: string;
101
104
  /**
102
- * resource identifier for vote be cast on
105
+ * ID of the resource receiving the vote. For a comment, specify the comment ID.
103
106
  * @maxLength 128
104
107
  */
105
108
  resourceId: string;
106
109
  /**
107
- * resource name
110
+ * Entity type receiving the vote. For comments, specify `wix.comments.v2.comment`.
108
111
  * @maxLength 300
109
112
  */
110
113
  resourceFqdn: string;
111
- /** context data */
114
+ /** App and context containing the resource. */
112
115
  contextData?: ContextData;
113
116
  }
114
117
  /**
115
118
  * Identifies the app and context containing the resource.
116
- * When provided, contextData takes precedence over the deprecated contextToken.
119
+ * When provided, `contextData` takes precedence over the deprecated `contextToken`.
117
120
  */
118
121
  interface ContextData {
119
122
  /**
@@ -130,55 +133,55 @@ interface ContextData {
130
133
  contextType?: string | null;
131
134
  }
132
135
  interface UpvoteResponse {
133
- /** created vote */
136
+ /** Vote cast or updated. */
134
137
  vote?: Vote;
135
138
  }
136
139
  interface ContextResourceVoteChange {
137
140
  /**
138
- * Resource ID
141
+ * ID of the resource receiving the vote.
139
142
  * @maxLength 128
140
143
  */
141
144
  resourceId?: string;
142
145
  /**
143
- * Resource fully qualified domain name
146
+ * Entity type receiving the vote. For comments, this is `wix.comments.v2.comment`.
144
147
  * @maxLength 300
145
148
  */
146
149
  resourceFqdn?: string;
147
- /** Score of votes */
150
+ /** Net score: upvote count minus downvote count. */
148
151
  score?: number;
149
- /** Upvote count */
152
+ /** Number of upvotes. */
150
153
  upvoteCount?: number;
151
- /** Downvote count */
154
+ /** Number of downvotes. */
152
155
  downvoteCount?: number;
153
- /** Vote context */
156
+ /** App and context containing the resource. */
154
157
  context?: VoteContext;
155
158
  }
156
159
  interface VoteCast {
157
- /** Vote */
160
+ /** Vote associated with the event. */
158
161
  vote?: Vote;
159
162
  }
160
163
  interface DownvoteRequest {
161
164
  /**
162
- * context token to be passed
165
+ * Legacy context token. Use `contextData` instead.
163
166
  * @deprecated
164
167
  * @replacedBy context_data
165
168
  */
166
169
  contextToken?: string;
167
170
  /**
168
- * resource identifier for vote be cast on
171
+ * ID of the resource receiving the vote. For a comment, specify the comment ID.
169
172
  * @maxLength 128
170
173
  */
171
174
  resourceId: string;
172
175
  /**
173
- * resource name
176
+ * Entity type receiving the vote. For comments, specify `wix.comments.v2.comment`.
174
177
  * @maxLength 300
175
178
  */
176
179
  resourceFqdn: string;
177
- /** context data */
180
+ /** App and context containing the resource. */
178
181
  contextData?: ContextData;
179
182
  }
180
183
  interface DownvoteResponse {
181
- /** created vote */
184
+ /** Vote cast or updated. */
182
185
  vote?: Vote;
183
186
  }
184
187
  interface UpdateVoteRequest {
@@ -191,34 +194,34 @@ interface UpdateVoteResponse {
191
194
  }
192
195
  interface RemoveVoteRequest {
193
196
  /**
194
- * context token to be passed
197
+ * Legacy context token. Use `contextData` instead.
195
198
  * @deprecated
196
199
  * @replacedBy context_data
197
200
  */
198
201
  contextToken?: string;
199
- /** id of the vote which will be deleted */
202
+ /** ID of the vote to remove. */
200
203
  voteId: string;
201
- /** context data */
204
+ /** App and context containing the resource. */
202
205
  contextData?: ContextData;
203
206
  }
204
207
  interface RemoveVoteResponse {
205
- /** removed vote */
208
+ /** Vote removed. */
206
209
  vote?: Vote;
207
210
  }
208
211
  interface VoteDeleted {
209
- /** Vote */
212
+ /** Vote associated with the event. */
210
213
  vote?: Vote;
211
214
  }
212
215
  interface QueryVotesRequest {
213
216
  /**
214
- * context token to be passed
217
+ * Legacy context token. Use `contextData` instead.
215
218
  * @deprecated
216
219
  * @replacedBy context_data
217
220
  */
218
221
  contextToken?: string;
219
- /** query request. Filter supports only "resourceId" field. Fields and Fieldset are not supported */
222
+ /** Query options. Filter by `resourceId`. Field projection and fieldsets aren't supported. */
220
223
  query?: QueryV2;
221
- /** context data */
224
+ /** App and context containing the resource. */
222
225
  contextData?: ContextData;
223
226
  }
224
227
  interface QueryV2 extends QueryV2PagingMethodOneOf {
@@ -298,9 +301,9 @@ interface CursorPaging {
298
301
  cursor?: string | null;
299
302
  }
300
303
  interface QueryVotesResponse {
301
- /** matching votes */
304
+ /** Votes matching the query. */
302
305
  votes?: Vote[];
303
- /** paging metadata. Only contains cursors */
306
+ /** Paging metadata containing cursors for retrieving additional results. */
304
307
  paging?: PagingMetadataV2;
305
308
  }
306
309
  interface PagingMetadataV2 {
@@ -646,7 +649,9 @@ interface VoteContextResourceVoteChangeEnvelope {
646
649
  data: ContextResourceVoteChange;
647
650
  metadata: EventMetadata;
648
651
  }
649
- /** @webhook
652
+ /**
653
+ * Triggered when a vote changes the totals for a resource.
654
+ * @webhook
650
655
  * @eventType wix.comments.v1.vote_context_resource_vote_change
651
656
  * @serviceIdentifier com.wixpress.comments.Votes
652
657
  * @slug context_resource_vote_change
@@ -657,7 +662,9 @@ interface VoteCastEnvelope {
657
662
  data: VoteCast;
658
663
  metadata: EventMetadata;
659
664
  }
660
- /** @webhook
665
+ /**
666
+ * Triggered when an upvote or downvote is cast, including changes to an existing vote.
667
+ * @webhook
661
668
  * @eventType wix.comments.v1.vote_vote_cast
662
669
  * @serviceIdentifier com.wixpress.comments.Votes
663
670
  * @slug vote_cast
@@ -668,7 +675,9 @@ interface VoteDeletedEnvelope {
668
675
  data: VoteDeleted;
669
676
  metadata: EventMetadata;
670
677
  }
671
- /** @webhook
678
+ /**
679
+ * Triggered when a vote is removed.
680
+ * @webhook
672
681
  * @eventType wix.comments.v1.vote_vote_deleted
673
682
  * @serviceIdentifier com.wixpress.comments.Votes
674
683
  * @slug vote_deleted
@@ -677,115 +686,135 @@ interface VoteDeletedEnvelope {
677
686
  declare function onVoteDeleted(handler: (event: VoteDeletedEnvelope) => void | Promise<void>): void;
678
687
  /**
679
688
  * Casts an upvote on a resource for the current identity.
680
- * Changes an existing downvote to an upvote. Repeating an upvote does not remove it.
681
- * Provide contextData for the app and context. Context voting permissions apply.
682
- * Authorization is enforced by the service for the current identity and context.
689
+ *
690
+ * Changes the current identity's existing downvote to an upvote.
691
+ * Repeating the same vote doesn't remove it. To clear a vote, call
692
+ * [Remove Vote](https://dev.wix.com/docs/api-reference/crm/community/feedback-moderation/comments/vote-v1/remove-vote).
693
+ * Specify the resource's app and context in `contextData`. Voting must be enabled for that context.
683
694
  * @public
684
695
  * @documentationMaturity preview
685
696
  * @requiredField options.resourceFqdn
686
697
  * @requiredField options.resourceId
698
+ * @permissionId comments:v1:vote:upvote
687
699
  * @fqn com.wixpress.comments.Votes.Upvote
688
700
  */
689
- declare function upvote(options?: NonNullablePaths<UpvoteOptions, `resourceFqdn` | `resourceId`, 2>): Promise<NonNullablePaths<UpvoteResponse, `vote.resourceId` | `vote.resourceFqdn` | `vote.voteId` | `vote.type` | `vote.createdBy.identityId` | `vote.createdBy.identityType` | `vote.context.contextId` | `vote.context.appDefId` | `vote.context.metaSiteId` | `vote.revision`, 4> & {
701
+ declare function upvote(options?: NonNullablePaths<UpvoteOptions, `resourceFqdn` | `resourceId`, 0>): Promise<NonNullablePaths<UpvoteResponse, `vote.resourceId` | `vote.resourceFqdn` | `vote.voteId` | `vote.type` | `vote.createdBy.identityId` | `vote.createdBy.identityType` | `vote.context.contextId` | `vote.context.appDefId` | `vote.context.metaSiteId` | `vote.revision`, 2> & {
690
702
  __applicationErrorsType?: UpvoteApplicationErrors;
691
703
  }>;
692
704
  interface UpvoteOptions {
693
705
  /**
694
- * context token to be passed
706
+ * Legacy context token. Use `contextData` instead.
695
707
  * @deprecated
696
708
  * @replacedBy context_data
697
709
  */
698
710
  contextToken?: string;
699
711
  /**
700
- * resource identifier for vote be cast on
712
+ * ID of the resource receiving the vote. For a comment, specify the comment ID.
701
713
  * @maxLength 128
702
714
  */
703
715
  resourceId: string;
704
716
  /**
705
- * resource name
717
+ * Entity type receiving the vote. For comments, specify `wix.comments.v2.comment`.
706
718
  * @maxLength 300
707
719
  */
708
720
  resourceFqdn: string;
709
- /** context data */
721
+ /** App and context containing the resource. */
710
722
  contextData?: ContextData;
711
723
  }
712
724
  /**
713
725
  * Casts a downvote on a resource for the current identity.
714
- * Changes an existing upvote to a downvote. Use RemoveVote to clear a vote.
715
- * Provide contextData for the app and context. Context voting permissions apply.
716
- * Authorization is enforced by the service for the current identity and context.
726
+ *
727
+ * Changes the current identity's existing upvote to a downvote.
728
+ * Repeating the same vote doesn't remove it. To clear a vote, call
729
+ * [Remove Vote](https://dev.wix.com/docs/api-reference/crm/community/feedback-moderation/comments/vote-v1/remove-vote).
730
+ * Specify the resource's app and context in `contextData`. Voting must be enabled for that context.
717
731
  * @public
718
732
  * @documentationMaturity preview
719
733
  * @requiredField options.resourceFqdn
720
734
  * @requiredField options.resourceId
735
+ * @permissionId comments:v1:vote:downvote
721
736
  * @fqn com.wixpress.comments.Votes.Downvote
722
737
  */
723
- declare function downvote(options?: NonNullablePaths<DownvoteOptions, `resourceFqdn` | `resourceId`, 2>): Promise<NonNullablePaths<DownvoteResponse, `vote.resourceId` | `vote.resourceFqdn` | `vote.voteId` | `vote.type` | `vote.createdBy.identityId` | `vote.createdBy.identityType` | `vote.context.contextId` | `vote.context.appDefId` | `vote.context.metaSiteId` | `vote.revision`, 4> & {
738
+ declare function downvote(options?: NonNullablePaths<DownvoteOptions, `resourceFqdn` | `resourceId`, 0>): Promise<NonNullablePaths<DownvoteResponse, `vote.resourceId` | `vote.resourceFqdn` | `vote.voteId` | `vote.type` | `vote.createdBy.identityId` | `vote.createdBy.identityType` | `vote.context.contextId` | `vote.context.appDefId` | `vote.context.metaSiteId` | `vote.revision`, 2> & {
724
739
  __applicationErrorsType?: DownvoteApplicationErrors;
725
740
  }>;
726
741
  interface DownvoteOptions {
727
742
  /**
728
- * context token to be passed
743
+ * Legacy context token. Use `contextData` instead.
729
744
  * @deprecated
730
745
  * @replacedBy context_data
731
746
  */
732
747
  contextToken?: string;
733
748
  /**
734
- * resource identifier for vote be cast on
749
+ * ID of the resource receiving the vote. For a comment, specify the comment ID.
735
750
  * @maxLength 128
736
751
  */
737
752
  resourceId: string;
738
753
  /**
739
- * resource name
754
+ * Entity type receiving the vote. For comments, specify `wix.comments.v2.comment`.
740
755
  * @maxLength 300
741
756
  */
742
757
  resourceFqdn: string;
743
- /** context data */
758
+ /** App and context containing the resource. */
744
759
  contextData?: ContextData;
745
760
  }
746
761
  /**
747
- * Removes the current identity's vote in the specified context and returns it.
748
- * Obtain voteId from a vote response or QueryVotes. A repeated removal can fail.
749
- * Authorization is enforced by the service for the current identity and context.
750
- * @param voteId - id of the vote which will be deleted
762
+ * Removes the current identity's vote and returns the removed vote.
763
+ *
764
+ * Specify the `voteId` returned by a vote response or
765
+ * [Query Votes](https://dev.wix.com/docs/api-reference/crm/community/feedback-moderation/comments/vote-v1/query-votes) and the same `contextData` used to cast the vote.
766
+ * A repeated removal fails when the vote no longer exists.
767
+ * @param voteId - ID of the vote to remove.
751
768
  * @public
752
769
  * @documentationMaturity preview
753
770
  * @requiredField voteId
771
+ * @permissionId comments:v1:vote:remove_vote
754
772
  * @fqn com.wixpress.comments.Votes.RemoveVote
755
773
  */
756
- declare function removeVote(voteId: string, options?: RemoveVoteOptions): Promise<NonNullablePaths<RemoveVoteResponse, `vote.resourceId` | `vote.resourceFqdn` | `vote.voteId` | `vote.type` | `vote.createdBy.identityId` | `vote.createdBy.identityType` | `vote.context.contextId` | `vote.context.appDefId` | `vote.context.metaSiteId` | `vote.revision`, 4> & {
774
+ declare function removeVote(voteId: string, options?: RemoveVoteOptions): Promise<NonNullablePaths<RemoveVoteResponse, `vote.resourceId` | `vote.resourceFqdn` | `vote.voteId` | `vote.type` | `vote.createdBy.identityId` | `vote.createdBy.identityType` | `vote.context.contextId` | `vote.context.appDefId` | `vote.context.metaSiteId` | `vote.revision`, 2> & {
757
775
  __applicationErrorsType?: RemoveVoteApplicationErrors;
758
776
  }>;
759
777
  interface RemoveVoteOptions {
760
778
  /**
761
- * context token to be passed
779
+ * Legacy context token. Use `contextData` instead.
762
780
  * @deprecated
763
781
  * @replacedBy context_data
764
782
  */
765
783
  contextToken?: string;
766
- /** context data */
784
+ /** App and context containing the resource. */
767
785
  contextData?: ContextData;
768
786
  }
769
787
  /**
770
- * Retrieves votes in the specified app and context.
771
- * Visitor and member callers receive only their own votes. Application callers
772
- * can query all votes only when granted WIX_COMMENTS.VOTE_QUERY.
773
- * Filter on resourceId, including $in for a batch of comment IDs.
774
- * Continue with query.cursorPaging.cursor from paging.cursors.next.
775
- * Authorization is enforced by the service for the current identity and context.
788
+ * Retrieves a list of votes, given the provided paging and filtering.
789
+ *
790
+ * Visitor and member callers receive their own votes in the specified app and context.
791
+ * Authorized application callers can retrieve votes from multiple identities in that context.
792
+ * Filter by `resourceId`, using `$in` to retrieve votes for multiple comment IDs.
793
+ * Results don't include comments without a matching vote.
794
+ *
795
+ * Specify `query.cursorPaging.limit` to control the page size. To retrieve the next page,
796
+ * set `query.cursorPaging.cursor` to the returned `paging.cursors.next` and keep the same context.
797
+ * Offset paging and field projection aren't supported. Don't depend on a particular result order.
798
+ *
799
+ * To learn about working with Query methods, see
800
+ * [API Query Language](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-the-wix-api-query-language) and
801
+ * [Sorting and Paging](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-sorting-and-paging).
802
+ * Retain the permission checked by RequestContextResolver for app identities.
776
803
  * @public
777
804
  * @documentationMaturity preview
805
+ * @permissionId WIX_COMMENTS.VOTE_QUERY
806
+ * @applicableIdentity APP
778
807
  * @fqn com.wixpress.comments.Votes.QueryVotes
779
808
  */
780
809
  declare function queryVotes(options?: QueryVotesOptions): VotesQueryBuilder;
781
810
  interface QueryVotesOptions {
782
811
  /**
783
- * context token to be passed
812
+ * Legacy context token. Use `contextData` instead.
784
813
  * @deprecated
785
814
  * @replacedBy context_data
786
815
  */
787
816
  contextToken?: string | undefined;
788
- /** context data */
817
+ /** App and context containing the resource. */
789
818
  contextData?: ContextData | undefined;
790
819
  }
791
820
  interface QueryCursorResult {
@@ -830,7 +859,7 @@ interface VotesQueryBuilder {
830
859
  * @fqn com.wixpress.comments.Votes.QueryVotes
831
860
  * @requiredField query
832
861
  */
833
- declare function typedQueryVotes(query: VoteQuery, options?: QueryVotesOptions): Promise<NonNullablePaths<QueryVotesResponse, `votes` | `votes.${number}.resourceId` | `votes.${number}.resourceFqdn` | `votes.${number}.voteId` | `votes.${number}.type` | `votes.${number}.createdBy.identityId` | `votes.${number}.createdBy.identityType` | `votes.${number}.context.contextId` | `votes.${number}.context.appDefId` | `votes.${number}.context.metaSiteId` | `votes.${number}.revision`, 5> & {
862
+ declare function typedQueryVotes(query: VoteQuery, options?: QueryVotesOptions): Promise<NonNullablePaths<QueryVotesResponse, `votes` | `votes.${number}.resourceId` | `votes.${number}.resourceFqdn` | `votes.${number}.voteId` | `votes.${number}.type` | `votes.${number}.createdBy.identityId` | `votes.${number}.createdBy.identityType` | `votes.${number}.context.contextId` | `votes.${number}.context.appDefId` | `votes.${number}.context.metaSiteId` | `votes.${number}.revision`, 3> & {
834
863
  __applicationErrorsType?: QueryVotesApplicationErrors;
835
864
  }>;
836
865
  interface VoteQuerySpec extends QuerySpec {