@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 {
@@ -196,34 +199,34 @@ interface UpdateVoteResponse {
196
199
  }
197
200
  interface RemoveVoteRequest {
198
201
  /**
199
- * context token to be passed
202
+ * Legacy context token. Use `contextData` instead.
200
203
  * @deprecated
201
204
  * @replacedBy context_data
202
205
  */
203
206
  contextToken?: string;
204
- /** id of the vote which will be deleted */
207
+ /** ID of the vote to remove. */
205
208
  voteId: string;
206
- /** context data */
209
+ /** App and context containing the resource. */
207
210
  contextData?: ContextData;
208
211
  }
209
212
  interface RemoveVoteResponse {
210
- /** removed vote */
213
+ /** Vote removed. */
211
214
  vote?: Vote;
212
215
  }
213
216
  interface VoteDeleted {
214
- /** Vote */
217
+ /** Vote associated with the event. */
215
218
  vote?: Vote;
216
219
  }
217
220
  interface QueryVotesRequest {
218
221
  /**
219
- * context token to be passed
222
+ * Legacy context token. Use `contextData` instead.
220
223
  * @deprecated
221
224
  * @replacedBy context_data
222
225
  */
223
226
  contextToken?: string;
224
- /** query request. Filter supports only "resourceId" field. Fields and Fieldset are not supported */
227
+ /** Query options. Filter by `resourceId`. Field projection and fieldsets aren't supported. */
225
228
  query?: QueryV2;
226
- /** context data */
229
+ /** App and context containing the resource. */
227
230
  contextData?: ContextData;
228
231
  }
229
232
  interface QueryV2 extends QueryV2PagingMethodOneOf {
@@ -317,9 +320,9 @@ interface CursorPaging {
317
320
  cursor?: string | null;
318
321
  }
319
322
  interface QueryVotesResponse {
320
- /** matching votes */
323
+ /** Votes matching the query. */
321
324
  votes?: Vote[];
322
- /** paging metadata. Only contains cursors */
325
+ /** Paging metadata containing cursors for retrieving additional results. */
323
326
  paging?: PagingMetadataV2;
324
327
  }
325
328
  interface PagingMetadataV2 {
@@ -672,7 +675,9 @@ interface VoteContextResourceVoteChangeEnvelope {
672
675
  data: ContextResourceVoteChange;
673
676
  metadata: EventMetadata;
674
677
  }
675
- /** @webhook
678
+ /**
679
+ * Triggered when a vote changes the totals for a resource.
680
+ * @webhook
676
681
  * @eventType wix.comments.v1.vote_context_resource_vote_change
677
682
  * @serviceIdentifier com.wixpress.comments.Votes
678
683
  * @slug context_resource_vote_change
@@ -683,7 +688,9 @@ interface VoteCastEnvelope {
683
688
  data: VoteCast;
684
689
  metadata: EventMetadata;
685
690
  }
686
- /** @webhook
691
+ /**
692
+ * Triggered when an upvote or downvote is cast, including changes to an existing vote.
693
+ * @webhook
687
694
  * @eventType wix.comments.v1.vote_vote_cast
688
695
  * @serviceIdentifier com.wixpress.comments.Votes
689
696
  * @slug vote_cast
@@ -694,7 +701,9 @@ interface VoteDeletedEnvelope {
694
701
  data: VoteDeleted;
695
702
  metadata: EventMetadata;
696
703
  }
697
- /** @webhook
704
+ /**
705
+ * Triggered when a vote is removed.
706
+ * @webhook
698
707
  * @eventType wix.comments.v1.vote_vote_deleted
699
708
  * @serviceIdentifier com.wixpress.comments.Votes
700
709
  * @slug vote_deleted
@@ -703,115 +712,135 @@ interface VoteDeletedEnvelope {
703
712
  declare function onVoteDeleted(handler: (event: VoteDeletedEnvelope) => void | Promise<void>): void;
704
713
  /**
705
714
  * Casts an upvote on a resource for the current identity.
706
- * Changes an existing downvote to an upvote. Repeating an upvote does not remove it.
707
- * Provide contextData for the app and context. Context voting permissions apply.
708
- * Authorization is enforced by the service for the current identity and context.
715
+ *
716
+ * Changes the current identity's existing downvote to an upvote.
717
+ * Repeating the same vote doesn't remove it. To clear a vote, call
718
+ * [Remove Vote](https://dev.wix.com/docs/api-reference/crm/community/feedback-moderation/comments/vote-v1/remove-vote).
719
+ * Specify the resource's app and context in `contextData`. Voting must be enabled for that context.
709
720
  * @public
710
721
  * @documentationMaturity preview
711
722
  * @requiredField options.resourceFqdn
712
723
  * @requiredField options.resourceId
724
+ * @permissionId comments:v1:vote:upvote
713
725
  * @fqn com.wixpress.comments.Votes.Upvote
714
726
  */
715
- 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> & {
727
+ 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> & {
716
728
  __applicationErrorsType?: UpvoteApplicationErrors;
717
729
  }>;
718
730
  interface UpvoteOptions {
719
731
  /**
720
- * context token to be passed
732
+ * Legacy context token. Use `contextData` instead.
721
733
  * @deprecated
722
734
  * @replacedBy context_data
723
735
  */
724
736
  contextToken?: string;
725
737
  /**
726
- * resource identifier for vote be cast on
738
+ * ID of the resource receiving the vote. For a comment, specify the comment ID.
727
739
  * @maxLength 128
728
740
  */
729
741
  resourceId: string;
730
742
  /**
731
- * resource name
743
+ * Entity type receiving the vote. For comments, specify `wix.comments.v2.comment`.
732
744
  * @maxLength 300
733
745
  */
734
746
  resourceFqdn: string;
735
- /** context data */
747
+ /** App and context containing the resource. */
736
748
  contextData?: ContextData;
737
749
  }
738
750
  /**
739
751
  * Casts a downvote on a resource for the current identity.
740
- * Changes an existing upvote to a downvote. Use RemoveVote to clear a vote.
741
- * Provide contextData for the app and context. Context voting permissions apply.
742
- * Authorization is enforced by the service for the current identity and context.
752
+ *
753
+ * Changes the current identity's existing upvote to a downvote.
754
+ * Repeating the same vote doesn't remove it. To clear a vote, call
755
+ * [Remove Vote](https://dev.wix.com/docs/api-reference/crm/community/feedback-moderation/comments/vote-v1/remove-vote).
756
+ * Specify the resource's app and context in `contextData`. Voting must be enabled for that context.
743
757
  * @public
744
758
  * @documentationMaturity preview
745
759
  * @requiredField options.resourceFqdn
746
760
  * @requiredField options.resourceId
761
+ * @permissionId comments:v1:vote:downvote
747
762
  * @fqn com.wixpress.comments.Votes.Downvote
748
763
  */
749
- 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> & {
764
+ 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> & {
750
765
  __applicationErrorsType?: DownvoteApplicationErrors;
751
766
  }>;
752
767
  interface DownvoteOptions {
753
768
  /**
754
- * context token to be passed
769
+ * Legacy context token. Use `contextData` instead.
755
770
  * @deprecated
756
771
  * @replacedBy context_data
757
772
  */
758
773
  contextToken?: string;
759
774
  /**
760
- * resource identifier for vote be cast on
775
+ * ID of the resource receiving the vote. For a comment, specify the comment ID.
761
776
  * @maxLength 128
762
777
  */
763
778
  resourceId: string;
764
779
  /**
765
- * resource name
780
+ * Entity type receiving the vote. For comments, specify `wix.comments.v2.comment`.
766
781
  * @maxLength 300
767
782
  */
768
783
  resourceFqdn: string;
769
- /** context data */
784
+ /** App and context containing the resource. */
770
785
  contextData?: ContextData;
771
786
  }
772
787
  /**
773
- * Removes the current identity's vote in the specified context and returns it.
774
- * Obtain voteId from a vote response or QueryVotes. A repeated removal can fail.
775
- * Authorization is enforced by the service for the current identity and context.
776
- * @param voteId - id of the vote which will be deleted
788
+ * Removes the current identity's vote and returns the removed vote.
789
+ *
790
+ * Specify the `voteId` returned by a vote response or
791
+ * [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.
792
+ * A repeated removal fails when the vote no longer exists.
793
+ * @param voteId - ID of the vote to remove.
777
794
  * @public
778
795
  * @documentationMaturity preview
779
796
  * @requiredField voteId
797
+ * @permissionId comments:v1:vote:remove_vote
780
798
  * @fqn com.wixpress.comments.Votes.RemoveVote
781
799
  */
782
- 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> & {
800
+ 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> & {
783
801
  __applicationErrorsType?: RemoveVoteApplicationErrors;
784
802
  }>;
785
803
  interface RemoveVoteOptions {
786
804
  /**
787
- * context token to be passed
805
+ * Legacy context token. Use `contextData` instead.
788
806
  * @deprecated
789
807
  * @replacedBy context_data
790
808
  */
791
809
  contextToken?: string;
792
- /** context data */
810
+ /** App and context containing the resource. */
793
811
  contextData?: ContextData;
794
812
  }
795
813
  /**
796
- * Retrieves votes in the specified app and context.
797
- * Visitor and member callers receive only their own votes. Application callers
798
- * can query all votes only when granted WIX_COMMENTS.VOTE_QUERY.
799
- * Filter on resourceId, including $in for a batch of comment IDs.
800
- * Continue with query.cursorPaging.cursor from paging.cursors.next.
801
- * Authorization is enforced by the service for the current identity and context.
814
+ * Retrieves a list of votes, given the provided paging and filtering.
815
+ *
816
+ * Visitor and member callers receive their own votes in the specified app and context.
817
+ * Authorized application callers can retrieve votes from multiple identities in that context.
818
+ * Filter by `resourceId`, using `$in` to retrieve votes for multiple comment IDs.
819
+ * Results don't include comments without a matching vote.
820
+ *
821
+ * Specify `query.cursorPaging.limit` to control the page size. To retrieve the next page,
822
+ * set `query.cursorPaging.cursor` to the returned `paging.cursors.next` and keep the same context.
823
+ * Offset paging and field projection aren't supported. Don't depend on a particular result order.
824
+ *
825
+ * To learn about working with Query methods, see
826
+ * [API Query Language](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-the-wix-api-query-language) and
827
+ * [Sorting and Paging](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-sorting-and-paging).
828
+ * Retain the permission checked by RequestContextResolver for app identities.
802
829
  * @public
803
830
  * @documentationMaturity preview
831
+ * @permissionId WIX_COMMENTS.VOTE_QUERY
832
+ * @applicableIdentity APP
804
833
  * @fqn com.wixpress.comments.Votes.QueryVotes
805
834
  */
806
835
  declare function queryVotes(options?: QueryVotesOptions): VotesQueryBuilder;
807
836
  interface QueryVotesOptions {
808
837
  /**
809
- * context token to be passed
838
+ * Legacy context token. Use `contextData` instead.
810
839
  * @deprecated
811
840
  * @replacedBy context_data
812
841
  */
813
842
  contextToken?: string | undefined;
814
- /** context data */
843
+ /** App and context containing the resource. */
815
844
  contextData?: ContextData | undefined;
816
845
  }
817
846
  interface QueryCursorResult {
@@ -856,7 +885,7 @@ interface VotesQueryBuilder {
856
885
  * @fqn com.wixpress.comments.Votes.QueryVotes
857
886
  * @requiredField query
858
887
  */
859
- 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> & {
888
+ 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> & {
860
889
  __applicationErrorsType?: QueryVotesApplicationErrors;
861
890
  }>;
862
891
  interface VoteQuerySpec extends QuerySpec {