@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 '@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 {
@@ -6,11 +6,13 @@ declare function upvote$1(httpClient: HttpClient): UpvoteSignature;
6
6
  interface UpvoteSignature {
7
7
  /**
8
8
  * Casts an upvote on a resource for the current identity.
9
- * Changes an existing downvote to an upvote. Repeating an upvote does not remove it.
10
- * Provide contextData for the app and context. Context voting permissions apply.
11
- * Authorization is enforced by the service for the current identity and context.
9
+ *
10
+ * Changes the current identity's existing downvote to an upvote.
11
+ * Repeating the same vote doesn't remove it. To clear a vote, call
12
+ * [Remove Vote](https://dev.wix.com/docs/api-reference/crm/community/feedback-moderation/comments/vote-v1/remove-vote).
13
+ * Specify the resource's app and context in `contextData`. Voting must be enabled for that context.
12
14
  */
13
- (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> & {
15
+ (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> & {
14
16
  __applicationErrorsType?: UpvoteApplicationErrors;
15
17
  }>;
16
18
  }
@@ -18,23 +20,27 @@ declare function downvote$1(httpClient: HttpClient): DownvoteSignature;
18
20
  interface DownvoteSignature {
19
21
  /**
20
22
  * Casts a downvote on a resource for the current identity.
21
- * Changes an existing upvote to a downvote. Use RemoveVote to clear a vote.
22
- * Provide contextData for the app and context. Context voting permissions apply.
23
- * Authorization is enforced by the service for the current identity and context.
23
+ *
24
+ * Changes the current identity's existing upvote to a downvote.
25
+ * Repeating the same vote doesn't remove it. To clear a vote, call
26
+ * [Remove Vote](https://dev.wix.com/docs/api-reference/crm/community/feedback-moderation/comments/vote-v1/remove-vote).
27
+ * Specify the resource's app and context in `contextData`. Voting must be enabled for that context.
24
28
  */
25
- (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> & {
29
+ (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> & {
26
30
  __applicationErrorsType?: DownvoteApplicationErrors;
27
31
  }>;
28
32
  }
29
33
  declare function removeVote$1(httpClient: HttpClient): RemoveVoteSignature;
30
34
  interface RemoveVoteSignature {
31
35
  /**
32
- * Removes the current identity's vote in the specified context and returns it.
33
- * Obtain voteId from a vote response or QueryVotes. A repeated removal can fail.
34
- * Authorization is enforced by the service for the current identity and context.
35
- * @param - id of the vote which will be deleted
36
+ * Removes the current identity's vote and returns the removed vote.
37
+ *
38
+ * Specify the `voteId` returned by a vote response or
39
+ * [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.
40
+ * A repeated removal fails when the vote no longer exists.
41
+ * @param - ID of the vote to remove.
36
42
  */
37
- (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> & {
43
+ (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> & {
38
44
  __applicationErrorsType?: RemoveVoteApplicationErrors;
39
45
  }>;
40
46
  }
@@ -50,11 +56,17 @@ declare const upvote: MaybeContext<BuildRESTFunction<typeof upvote$1> & typeof u
50
56
  declare const downvote: MaybeContext<BuildRESTFunction<typeof downvote$1> & typeof downvote$1>;
51
57
  declare const removeVote: MaybeContext<BuildRESTFunction<typeof removeVote$1> & typeof removeVote$1>;
52
58
  declare const queryVotes: MaybeContext<BuildRESTFunction<typeof customQueryVotes> & typeof customQueryVotes>;
53
- /** */
59
+ /**
60
+ * Triggered when a vote changes the totals for a resource.
61
+ */
54
62
  declare const onVoteContextResourceVoteChange: BuildEventDefinition<typeof onVoteContextResourceVoteChange$1> & typeof onVoteContextResourceVoteChange$1;
55
- /** */
63
+ /**
64
+ * Triggered when an upvote or downvote is cast, including changes to an existing vote.
65
+ */
56
66
  declare const onVoteCast: BuildEventDefinition<typeof onVoteCast$1> & typeof onVoteCast$1;
57
- /** */
67
+ /**
68
+ * Triggered when a vote is removed.
69
+ */
58
70
  declare const onVoteDeleted: BuildEventDefinition<typeof onVoteDeleted$1> & typeof onVoteDeleted$1;
59
71
 
60
72
  export { DownvoteApplicationErrors, DownvoteOptions, DownvoteResponse, QueryVotesOptions, RemoveVoteApplicationErrors, RemoveVoteOptions, RemoveVoteResponse, UpvoteApplicationErrors, UpvoteOptions, UpvoteResponse, VoteCastEnvelope, VoteContextResourceVoteChangeEnvelope, VoteDeletedEnvelope, VoteQuery, VotesQueryBuilder, downvote, onVoteCast, onVoteContextResourceVoteChange, onVoteDeleted, queryVotes, removeVote, upvote };