@wix/auto_sdk_comments_votes 1.0.0

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.
@@ -0,0 +1,898 @@
1
+ import * as _wix_sdk_types from '@wix/sdk-types';
2
+ import { QuerySpec, Query, NonNullablePaths } from '@wix/sdk-types';
3
+
4
+ /** An upvote or downvote cast by one identity on a resource in an app context. */
5
+ interface Vote {
6
+ /**
7
+ * Vote resource ID
8
+ * @maxLength 128
9
+ */
10
+ resourceId?: string;
11
+ /**
12
+ * Resource fully qualified domain name
13
+ * @maxLength 300
14
+ */
15
+ resourceFqdn?: string;
16
+ /**
17
+ * Vote ID
18
+ * @format GUID
19
+ * @readonly
20
+ */
21
+ voteId?: string;
22
+ /**
23
+ * Type of vote
24
+ * @readonly
25
+ */
26
+ type?: TypeWithLiterals;
27
+ /**
28
+ * Vote author
29
+ * @readonly
30
+ */
31
+ createdBy?: SocialIdentity;
32
+ /**
33
+ * Vote created date
34
+ * @readonly
35
+ */
36
+ _createdDate?: Date | null;
37
+ /**
38
+ * Vote updated date
39
+ * @readonly
40
+ */
41
+ _updatedDate?: Date | null;
42
+ /** Vote context, defining where the vote belongs to */
43
+ context?: VoteContext;
44
+ /**
45
+ * Vote revision
46
+ * @readonly
47
+ */
48
+ revision?: string;
49
+ }
50
+ /** Type of vote */
51
+ declare enum Type {
52
+ UNKNOWN = "UNKNOWN",
53
+ UPVOTE = "UPVOTE",
54
+ DOWNVOTE = "DOWNVOTE"
55
+ }
56
+ /** @enumType */
57
+ type TypeWithLiterals = Type | 'UNKNOWN' | 'UPVOTE' | 'DOWNVOTE';
58
+ interface SocialIdentity {
59
+ /** @format GUID */
60
+ identityId?: string;
61
+ identityType?: IdentityTypeWithLiterals;
62
+ }
63
+ declare enum IdentityType {
64
+ ANONYMOUS = "ANONYMOUS",
65
+ MEMBER = "MEMBER",
66
+ USER = "USER",
67
+ SERVICE = "SERVICE",
68
+ /** indicates everyone who is a member of a group */
69
+ MEMBER_GROUP = "MEMBER_GROUP"
70
+ }
71
+ /** @enumType */
72
+ type IdentityTypeWithLiterals = IdentityType | 'ANONYMOUS' | 'MEMBER' | 'USER' | 'SERVICE' | 'MEMBER_GROUP';
73
+ interface VoteContext {
74
+ /**
75
+ * Context ID
76
+ * @maxLength 128
77
+ */
78
+ contextId?: string;
79
+ /** Context type */
80
+ contextType?: string | null;
81
+ /**
82
+ * Vote app ID
83
+ * @format GUID
84
+ * @readonly
85
+ */
86
+ appDefId?: string;
87
+ /**
88
+ * MetaSite ID
89
+ * @format GUID
90
+ * @readonly
91
+ */
92
+ metaSiteId?: string;
93
+ }
94
+ interface UpvoteRequest {
95
+ /**
96
+ * context token to be passed
97
+ * @deprecated
98
+ * @replacedBy context_data
99
+ */
100
+ contextToken?: string;
101
+ /**
102
+ * resource identifier for vote be cast on
103
+ * @maxLength 128
104
+ */
105
+ resourceId: string;
106
+ /**
107
+ * resource name
108
+ * @maxLength 300
109
+ */
110
+ resourceFqdn: string;
111
+ /** context data */
112
+ contextData?: ContextData;
113
+ }
114
+ /**
115
+ * Identifies the app and context containing the resource.
116
+ * When provided, contextData takes precedence over the deprecated contextToken.
117
+ */
118
+ interface ContextData {
119
+ /**
120
+ * ID of the app that owns the context.
121
+ * @format GUID
122
+ */
123
+ appDefId?: string;
124
+ /**
125
+ * ID of the context containing the resource.
126
+ * @maxLength 128
127
+ */
128
+ contextId?: string;
129
+ /** Optional type used by the app to resolve its context. */
130
+ contextType?: string | null;
131
+ }
132
+ interface UpvoteResponse {
133
+ /** created vote */
134
+ vote?: Vote;
135
+ }
136
+ interface ContextResourceVoteChange {
137
+ /**
138
+ * Resource ID
139
+ * @maxLength 128
140
+ */
141
+ resourceId?: string;
142
+ /**
143
+ * Resource fully qualified domain name
144
+ * @maxLength 300
145
+ */
146
+ resourceFqdn?: string;
147
+ /** Score of votes */
148
+ score?: number;
149
+ /** Upvote count */
150
+ upvoteCount?: number;
151
+ /** Downvote count */
152
+ downvoteCount?: number;
153
+ /** Vote context */
154
+ context?: VoteContext;
155
+ }
156
+ interface VoteCast {
157
+ /** Vote */
158
+ vote?: Vote;
159
+ }
160
+ interface DownvoteRequest {
161
+ /**
162
+ * context token to be passed
163
+ * @deprecated
164
+ * @replacedBy context_data
165
+ */
166
+ contextToken?: string;
167
+ /**
168
+ * resource identifier for vote be cast on
169
+ * @maxLength 128
170
+ */
171
+ resourceId: string;
172
+ /**
173
+ * resource name
174
+ * @maxLength 300
175
+ */
176
+ resourceFqdn: string;
177
+ /** context data */
178
+ contextData?: ContextData;
179
+ }
180
+ interface DownvoteResponse {
181
+ /** created vote */
182
+ vote?: Vote;
183
+ }
184
+ interface UpdateVoteRequest {
185
+ /** vote to be updated, may be partial and include only VoteId and the field to change */
186
+ vote?: Vote;
187
+ }
188
+ interface UpdateVoteResponse {
189
+ /** updated vote */
190
+ vote?: Vote;
191
+ }
192
+ interface RemoveVoteRequest {
193
+ /**
194
+ * context token to be passed
195
+ * @deprecated
196
+ * @replacedBy context_data
197
+ */
198
+ contextToken?: string;
199
+ /** id of the vote which will be deleted */
200
+ voteId: string;
201
+ /** context data */
202
+ contextData?: ContextData;
203
+ }
204
+ interface RemoveVoteResponse {
205
+ /** removed vote */
206
+ vote?: Vote;
207
+ }
208
+ interface VoteDeleted {
209
+ /** Vote */
210
+ vote?: Vote;
211
+ }
212
+ interface QueryVotesRequest {
213
+ /**
214
+ * context token to be passed
215
+ * @deprecated
216
+ * @replacedBy context_data
217
+ */
218
+ contextToken?: string;
219
+ /** query request. Filter supports only "resourceId" field. Fields and Fieldset are not supported */
220
+ query?: QueryV2;
221
+ /** context data */
222
+ contextData?: ContextData;
223
+ }
224
+ interface QueryV2 extends QueryV2PagingMethodOneOf {
225
+ /** Paging options to limit and offset the number of items. */
226
+ paging?: Paging;
227
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
228
+ cursorPaging?: CursorPaging;
229
+ /**
230
+ * Filter object.
231
+ *
232
+ * Learn more about [filtering](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#filters).
233
+ */
234
+ filter?: Record<string, any> | null;
235
+ /**
236
+ * Sort object.
237
+ *
238
+ * Learn more about [sorting](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#sorting).
239
+ */
240
+ sort?: Sorting[];
241
+ /** Array of projected fields. A list of specific field names to return. If `fieldsets` are also specified, the union of `fieldsets` and `fields` is returned. */
242
+ fields?: string[];
243
+ /** Array of named, predefined sets of projected fields. A array of predefined named sets of fields to be returned. Specifying multiple `fieldsets` will return the union of fields from all sets. If `fields` are also specified, the union of `fieldsets` and `fields` is returned. */
244
+ fieldsets?: string[];
245
+ }
246
+ /** @oneof */
247
+ interface QueryV2PagingMethodOneOf {
248
+ /** Paging options to limit and offset the number of items. */
249
+ paging?: Paging;
250
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
251
+ cursorPaging?: CursorPaging;
252
+ }
253
+ interface Sorting {
254
+ /**
255
+ * Name of the field to sort by.
256
+ * @maxLength 512
257
+ */
258
+ fieldName?: string;
259
+ /** Sort order. */
260
+ order?: SortOrderWithLiterals;
261
+ /**
262
+ * Origin point for geo-distance sorting on a GEO field
263
+ * results are ordered by distance from this point (ASC = nearest first, DESC = farthest first).
264
+ */
265
+ origin?: AddressLocation;
266
+ }
267
+ declare enum SortOrder {
268
+ ASC = "ASC",
269
+ DESC = "DESC"
270
+ }
271
+ /** @enumType */
272
+ type SortOrderWithLiterals = SortOrder | 'ASC' | 'DESC';
273
+ interface AddressLocation {
274
+ /** Address latitude. */
275
+ latitude?: number | null;
276
+ /** Address longitude. */
277
+ longitude?: number | null;
278
+ }
279
+ interface Paging {
280
+ /** Number of items to load. */
281
+ limit?: number | null;
282
+ /** Number of items to skip in the current sort order. */
283
+ offset?: number | null;
284
+ }
285
+ interface CursorPaging {
286
+ /**
287
+ * Maximum number of items to return in the results.
288
+ * @max 100
289
+ */
290
+ limit?: number | null;
291
+ /**
292
+ * Pointer to the next or previous page in the list of results.
293
+ *
294
+ * Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response.
295
+ * Not relevant for the first request.
296
+ * @maxLength 16000
297
+ */
298
+ cursor?: string | null;
299
+ }
300
+ interface QueryVotesResponse {
301
+ /** matching votes */
302
+ votes?: Vote[];
303
+ /** paging metadata. Only contains cursors */
304
+ paging?: PagingMetadataV2;
305
+ }
306
+ interface PagingMetadataV2 {
307
+ /** Number of items returned in the response. */
308
+ count?: number | null;
309
+ /** Offset that was requested. */
310
+ offset?: number | null;
311
+ /** Total number of items that match the query. Returned if offset paging is used and the `tooManyToCount` flag is not set. */
312
+ total?: number | null;
313
+ /** Flag that indicates the server failed to calculate the `total` field. */
314
+ tooManyToCount?: boolean | null;
315
+ /** Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used. */
316
+ cursors?: Cursors;
317
+ }
318
+ interface Cursors {
319
+ /**
320
+ * Cursor string pointing to the next page in the list of results.
321
+ * @maxLength 16000
322
+ */
323
+ next?: string | null;
324
+ /**
325
+ * Cursor pointing to the previous page in the list of results.
326
+ * @maxLength 16000
327
+ */
328
+ prev?: string | null;
329
+ }
330
+ interface GetResourceVoteSummaryRequest {
331
+ /** appDef ID */
332
+ appDefId?: string;
333
+ /** context ID */
334
+ contextId?: string;
335
+ /** resource ID */
336
+ resourceId?: string;
337
+ }
338
+ interface GetResourceVoteSummaryResponse {
339
+ /** Resource vote summary */
340
+ summary?: ResourceVoteSummary;
341
+ }
342
+ interface ResourceVoteSummary {
343
+ /** vote context */
344
+ context?: VoteContext;
345
+ /** resource ID */
346
+ resourceId?: string;
347
+ /** vote score */
348
+ score?: number;
349
+ /** upvote count */
350
+ upvoteCount?: number;
351
+ /** downvote count */
352
+ downvoteCount?: number;
353
+ }
354
+ interface DomainEvent extends DomainEventBodyOneOf {
355
+ createdEvent?: EntityCreatedEvent;
356
+ updatedEvent?: EntityUpdatedEvent;
357
+ deletedEvent?: EntityDeletedEvent;
358
+ actionEvent?: ActionEvent;
359
+ /** Event ID. With this ID you can easily spot duplicated events and ignore them. */
360
+ _id?: string;
361
+ /**
362
+ * Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities.
363
+ * For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`.
364
+ */
365
+ entityFqdn?: string;
366
+ /**
367
+ * Event action name, placed at the top level to make it easier for users to dispatch messages.
368
+ * For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`.
369
+ */
370
+ slug?: string;
371
+ /** ID of the entity associated with the event. */
372
+ entityId?: string;
373
+ /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`. */
374
+ eventTime?: Date | null;
375
+ /**
376
+ * Whether the event was triggered as a result of a privacy regulation application
377
+ * (for example, GDPR).
378
+ */
379
+ triggeredByAnonymizeRequest?: boolean | null;
380
+ /** If present, indicates the action that triggered the event. */
381
+ originatedFrom?: string | null;
382
+ /**
383
+ * A sequence number that indicates the order of updates to an entity. For example, if an entity was updated at `16:00` and then again at `16:01`, the second update will always have a higher sequence number.
384
+ * You can use this number to make sure you're handling updates in the right order. Just save the latest sequence number on your end and compare it to the one in each new message. If the new message has an older (lower) number, you can safely ignore it.
385
+ */
386
+ entityEventSequence?: string | null;
387
+ }
388
+ /** @oneof */
389
+ interface DomainEventBodyOneOf {
390
+ createdEvent?: EntityCreatedEvent;
391
+ updatedEvent?: EntityUpdatedEvent;
392
+ deletedEvent?: EntityDeletedEvent;
393
+ actionEvent?: ActionEvent;
394
+ }
395
+ interface EntityCreatedEvent {
396
+ entity?: string;
397
+ }
398
+ interface RestoreInfo {
399
+ deletedDate?: Date | null;
400
+ }
401
+ interface EntityUpdatedEvent {
402
+ /**
403
+ * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.
404
+ * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.
405
+ * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.
406
+ */
407
+ currentEntity?: string;
408
+ }
409
+ interface EntityDeletedEvent {
410
+ /** Entity that was deleted. */
411
+ deletedEntity?: string | null;
412
+ }
413
+ interface ActionEvent {
414
+ body?: string;
415
+ }
416
+ interface Empty {
417
+ }
418
+ interface ImportVoteRequest {
419
+ /** metaSite ID */
420
+ metaSiteId?: string;
421
+ /** vote to import */
422
+ vote?: ImportVote;
423
+ }
424
+ interface ImportVote {
425
+ /**
426
+ * Resource ID
427
+ * @maxLength 128
428
+ */
429
+ resourceId?: string;
430
+ /**
431
+ * Resource fully qualified domain name
432
+ * @maxLength 300
433
+ */
434
+ resourceFqdn?: string;
435
+ /**
436
+ * Vote ID
437
+ * @format GUID
438
+ */
439
+ voteId?: string;
440
+ /** Type of vote */
441
+ type?: TypeWithLiterals;
442
+ /** Vote author */
443
+ createdBy?: SocialIdentity;
444
+ /** Vote creation date */
445
+ _createdDate?: Date | null;
446
+ /** Vote update date */
447
+ _updatedDate?: Date | null;
448
+ /** Vote context */
449
+ context?: VoteContext;
450
+ }
451
+ interface MessageEnvelope {
452
+ /**
453
+ * App instance ID.
454
+ * @format GUID
455
+ */
456
+ instanceId?: string | null;
457
+ /**
458
+ * Event type.
459
+ * @maxLength 150
460
+ */
461
+ eventType?: string;
462
+ /** The identification type and identity data. */
463
+ identity?: IdentificationData;
464
+ /** Stringify payload. */
465
+ data?: string;
466
+ /** Details related to the account */
467
+ accountInfo?: AccountInfo;
468
+ }
469
+ interface IdentificationData extends IdentificationDataIdOneOf {
470
+ /**
471
+ * ID of a site visitor that has not logged in to the site.
472
+ * @format GUID
473
+ */
474
+ anonymousVisitorId?: string;
475
+ /**
476
+ * ID of a site visitor that has logged in to the site.
477
+ * @format GUID
478
+ */
479
+ memberId?: string;
480
+ /**
481
+ * ID of a Wix user (site owner, contributor, etc.).
482
+ * @format GUID
483
+ */
484
+ wixUserId?: string;
485
+ /**
486
+ * ID of an app.
487
+ * @format GUID
488
+ */
489
+ appId?: string;
490
+ /** @readonly */
491
+ identityType?: WebhookIdentityTypeWithLiterals;
492
+ }
493
+ /** @oneof */
494
+ interface IdentificationDataIdOneOf {
495
+ /**
496
+ * ID of a site visitor that has not logged in to the site.
497
+ * @format GUID
498
+ */
499
+ anonymousVisitorId?: string;
500
+ /**
501
+ * ID of a site visitor that has logged in to the site.
502
+ * @format GUID
503
+ */
504
+ memberId?: string;
505
+ /**
506
+ * ID of a Wix user (site owner, contributor, etc.).
507
+ * @format GUID
508
+ */
509
+ wixUserId?: string;
510
+ /**
511
+ * ID of an app.
512
+ * @format GUID
513
+ */
514
+ appId?: string;
515
+ }
516
+ declare enum WebhookIdentityType {
517
+ UNKNOWN = "UNKNOWN",
518
+ ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
519
+ MEMBER = "MEMBER",
520
+ WIX_USER = "WIX_USER",
521
+ APP = "APP"
522
+ }
523
+ /** @enumType */
524
+ type WebhookIdentityTypeWithLiterals = WebhookIdentityType | 'UNKNOWN' | 'ANONYMOUS_VISITOR' | 'MEMBER' | 'WIX_USER' | 'APP';
525
+ interface AccountInfo {
526
+ /**
527
+ * ID of the Wix account associated with the event.
528
+ * @format GUID
529
+ */
530
+ accountId?: string | null;
531
+ /**
532
+ * ID of the parent Wix account. Only included when accountId belongs to a child account.
533
+ * @format GUID
534
+ */
535
+ parentAccountId?: string | null;
536
+ /**
537
+ * ID of the Wix site associated with the event. Only included when the event is tied to a specific site.
538
+ * @format GUID
539
+ */
540
+ siteId?: string | null;
541
+ }
542
+ /** @docsIgnore */
543
+ type UpvoteApplicationErrors = {
544
+ code?: 'MISSING_METASITE_CONTEXT';
545
+ description?: string;
546
+ data?: Record<string, any>;
547
+ } | {
548
+ code?: 'PERMISSION_DENIED';
549
+ description?: string;
550
+ data?: Record<string, any>;
551
+ };
552
+ /** @docsIgnore */
553
+ type DownvoteApplicationErrors = {
554
+ code?: 'MISSING_METASITE_CONTEXT';
555
+ description?: string;
556
+ data?: Record<string, any>;
557
+ } | {
558
+ code?: 'PERMISSION_DENIED';
559
+ description?: string;
560
+ data?: Record<string, any>;
561
+ };
562
+ /** @docsIgnore */
563
+ type RemoveVoteApplicationErrors = {
564
+ code?: 'MISSING_METASITE_CONTEXT';
565
+ description?: string;
566
+ data?: Record<string, any>;
567
+ } | {
568
+ code?: 'PERMISSION_DENIED';
569
+ description?: string;
570
+ data?: Record<string, any>;
571
+ } | {
572
+ code?: 'VOTE_NOT_FOUND';
573
+ description?: string;
574
+ data?: Record<string, any>;
575
+ };
576
+ /** @docsIgnore */
577
+ type QueryVotesApplicationErrors = {
578
+ code?: 'MISSING_METASITE_CONTEXT';
579
+ description?: string;
580
+ data?: Record<string, any>;
581
+ } | {
582
+ code?: 'PERMISSION_DENIED';
583
+ description?: string;
584
+ data?: Record<string, any>;
585
+ } | {
586
+ code?: 'UNSUPPORTED_FILTER_FIELDS';
587
+ description?: string;
588
+ data?: Record<string, any>;
589
+ };
590
+ interface BaseEventMetadata {
591
+ /**
592
+ * App instance ID.
593
+ * @format GUID
594
+ */
595
+ instanceId?: string | null;
596
+ /**
597
+ * Event type.
598
+ * @maxLength 150
599
+ */
600
+ eventType?: string;
601
+ /** The identification type and identity data. */
602
+ identity?: IdentificationData;
603
+ /** Details related to the account */
604
+ accountInfo?: AccountInfo;
605
+ }
606
+ interface EventMetadata extends BaseEventMetadata {
607
+ /** Event ID. With this ID you can easily spot duplicated events and ignore them. */
608
+ _id?: string;
609
+ /**
610
+ * Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities.
611
+ * For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`.
612
+ */
613
+ entityFqdn?: string;
614
+ /**
615
+ * Event action name, placed at the top level to make it easier for users to dispatch messages.
616
+ * For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`.
617
+ */
618
+ slug?: string;
619
+ /** ID of the entity associated with the event. */
620
+ entityId?: string;
621
+ /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`. */
622
+ eventTime?: Date | null;
623
+ /**
624
+ * Whether the event was triggered as a result of a privacy regulation application
625
+ * (for example, GDPR).
626
+ */
627
+ triggeredByAnonymizeRequest?: boolean | null;
628
+ /** If present, indicates the action that triggered the event. */
629
+ originatedFrom?: string | null;
630
+ /**
631
+ * A sequence number that indicates the order of updates to an entity. For example, if an entity was updated at `16:00` and then again at `16:01`, the second update will always have a higher sequence number.
632
+ * You can use this number to make sure you're handling updates in the right order. Just save the latest sequence number on your end and compare it to the one in each new message. If the new message has an older (lower) number, you can safely ignore it.
633
+ */
634
+ entityEventSequence?: string | null;
635
+ accountInfo?: AccountInfoMetadata;
636
+ }
637
+ interface AccountInfoMetadata {
638
+ /** ID of the Wix account associated with the event */
639
+ accountId: string;
640
+ /** ID of the Wix site associated with the event. Only included when the event is tied to a specific site. */
641
+ siteId?: string;
642
+ /** ID of the parent Wix account. Only included when 'accountId' belongs to a child account. */
643
+ parentAccountId?: string;
644
+ }
645
+ interface VoteContextResourceVoteChangeEnvelope {
646
+ data: ContextResourceVoteChange;
647
+ metadata: EventMetadata;
648
+ }
649
+ /** @webhook
650
+ * @eventType wix.comments.v1.vote_context_resource_vote_change
651
+ * @serviceIdentifier com.wixpress.comments.Votes
652
+ * @slug context_resource_vote_change
653
+ * @documentationMaturity preview
654
+ */
655
+ declare function onVoteContextResourceVoteChange(handler: (event: VoteContextResourceVoteChangeEnvelope) => void | Promise<void>): void;
656
+ interface VoteCastEnvelope {
657
+ data: VoteCast;
658
+ metadata: EventMetadata;
659
+ }
660
+ /** @webhook
661
+ * @eventType wix.comments.v1.vote_vote_cast
662
+ * @serviceIdentifier com.wixpress.comments.Votes
663
+ * @slug vote_cast
664
+ * @documentationMaturity preview
665
+ */
666
+ declare function onVoteCast(handler: (event: VoteCastEnvelope) => void | Promise<void>): void;
667
+ interface VoteDeletedEnvelope {
668
+ data: VoteDeleted;
669
+ metadata: EventMetadata;
670
+ }
671
+ /** @webhook
672
+ * @eventType wix.comments.v1.vote_vote_deleted
673
+ * @serviceIdentifier com.wixpress.comments.Votes
674
+ * @slug vote_deleted
675
+ * @documentationMaturity preview
676
+ */
677
+ declare function onVoteDeleted(handler: (event: VoteDeletedEnvelope) => void | Promise<void>): void;
678
+ /**
679
+ * 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.
683
+ * @public
684
+ * @documentationMaturity preview
685
+ * @requiredField options.resourceFqdn
686
+ * @requiredField options.resourceId
687
+ * @fqn com.wixpress.comments.Votes.Upvote
688
+ */
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> & {
690
+ __applicationErrorsType?: UpvoteApplicationErrors;
691
+ }>;
692
+ interface UpvoteOptions {
693
+ /**
694
+ * context token to be passed
695
+ * @deprecated
696
+ * @replacedBy context_data
697
+ */
698
+ contextToken?: string;
699
+ /**
700
+ * resource identifier for vote be cast on
701
+ * @maxLength 128
702
+ */
703
+ resourceId: string;
704
+ /**
705
+ * resource name
706
+ * @maxLength 300
707
+ */
708
+ resourceFqdn: string;
709
+ /** context data */
710
+ contextData?: ContextData;
711
+ }
712
+ /**
713
+ * 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.
717
+ * @public
718
+ * @documentationMaturity preview
719
+ * @requiredField options.resourceFqdn
720
+ * @requiredField options.resourceId
721
+ * @fqn com.wixpress.comments.Votes.Downvote
722
+ */
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> & {
724
+ __applicationErrorsType?: DownvoteApplicationErrors;
725
+ }>;
726
+ interface DownvoteOptions {
727
+ /**
728
+ * context token to be passed
729
+ * @deprecated
730
+ * @replacedBy context_data
731
+ */
732
+ contextToken?: string;
733
+ /**
734
+ * resource identifier for vote be cast on
735
+ * @maxLength 128
736
+ */
737
+ resourceId: string;
738
+ /**
739
+ * resource name
740
+ * @maxLength 300
741
+ */
742
+ resourceFqdn: string;
743
+ /** context data */
744
+ contextData?: ContextData;
745
+ }
746
+ /**
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
751
+ * @public
752
+ * @documentationMaturity preview
753
+ * @requiredField voteId
754
+ * @fqn com.wixpress.comments.Votes.RemoveVote
755
+ */
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> & {
757
+ __applicationErrorsType?: RemoveVoteApplicationErrors;
758
+ }>;
759
+ interface RemoveVoteOptions {
760
+ /**
761
+ * context token to be passed
762
+ * @deprecated
763
+ * @replacedBy context_data
764
+ */
765
+ contextToken?: string;
766
+ /** context data */
767
+ contextData?: ContextData;
768
+ }
769
+ /**
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.
776
+ * @public
777
+ * @documentationMaturity preview
778
+ * @fqn com.wixpress.comments.Votes.QueryVotes
779
+ */
780
+ declare function queryVotes(options?: QueryVotesOptions): VotesQueryBuilder;
781
+ interface QueryVotesOptions {
782
+ /**
783
+ * context token to be passed
784
+ * @deprecated
785
+ * @replacedBy context_data
786
+ */
787
+ contextToken?: string | undefined;
788
+ /** context data */
789
+ contextData?: ContextData | undefined;
790
+ }
791
+ interface QueryCursorResult {
792
+ cursors: Cursors;
793
+ hasNext: () => boolean;
794
+ hasPrev: () => boolean;
795
+ length: number;
796
+ pageSize: number;
797
+ }
798
+ interface VotesQueryResult extends QueryCursorResult {
799
+ items: Vote[];
800
+ query: VotesQueryBuilder;
801
+ next: () => Promise<VotesQueryResult>;
802
+ prev: () => Promise<VotesQueryResult>;
803
+ }
804
+ interface VotesQueryBuilder {
805
+ /** @param propertyName - Property whose value is compared with `value`.
806
+ * @param value - Value to compare against.
807
+ * @documentationMaturity preview
808
+ */
809
+ eq: (propertyName: 'resourceId', value: any) => VotesQueryBuilder;
810
+ /** @param propertyName - Property whose value is compared with `value`.
811
+ * @param value - Value to compare against.
812
+ * @documentationMaturity preview
813
+ */
814
+ ne: (propertyName: 'resourceId', value: any) => VotesQueryBuilder;
815
+ /** @documentationMaturity preview */
816
+ in: (propertyName: 'resourceId', value: any) => VotesQueryBuilder;
817
+ /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
818
+ * @documentationMaturity preview
819
+ */
820
+ limit: (limit: number) => VotesQueryBuilder;
821
+ /** @param cursor - A pointer to specific record
822
+ * @documentationMaturity preview
823
+ */
824
+ skipTo: (cursor: string) => VotesQueryBuilder;
825
+ /** @documentationMaturity preview */
826
+ find: () => Promise<VotesQueryResult>;
827
+ }
828
+ /**
829
+ * @hidden
830
+ * @fqn com.wixpress.comments.Votes.QueryVotes
831
+ * @requiredField query
832
+ */
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> & {
834
+ __applicationErrorsType?: QueryVotesApplicationErrors;
835
+ }>;
836
+ interface VoteQuerySpec extends QuerySpec {
837
+ paging: 'cursor';
838
+ wql: [
839
+ {
840
+ fields: ['resourceId'];
841
+ operators: ['$eq', '$in', '$ne'];
842
+ sort: 'NONE';
843
+ }
844
+ ];
845
+ }
846
+ type CommonQueryWithEntityContext = Query<Vote, VoteQuerySpec>;
847
+ type VoteQuery = {
848
+ /**
849
+ Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`.
850
+ */
851
+ cursorPaging?: {
852
+ /**
853
+ Maximum number of items to return in the results.
854
+ @max: 100
855
+ */
856
+ limit?: NonNullable<CommonQueryWithEntityContext['cursorPaging']>['limit'] | null;
857
+ /**
858
+ Pointer to the next or previous page in the list of results.
859
+
860
+ Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response.
861
+ Not relevant for the first request.
862
+ @maxLength: 16000
863
+ */
864
+ cursor?: NonNullable<CommonQueryWithEntityContext['cursorPaging']>['cursor'] | null;
865
+ };
866
+ /**
867
+ Filter object.
868
+
869
+ Learn more about [filtering](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#filters).
870
+ */
871
+ filter?: CommonQueryWithEntityContext['filter'] | null;
872
+ /**
873
+ Sort object.
874
+
875
+ Learn more about [sorting](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#sorting).
876
+ */
877
+ sort?: {
878
+ /**
879
+ Name of the field to sort by.
880
+ @maxLength: 512
881
+ */
882
+ fieldName?: NonNullable<CommonQueryWithEntityContext['sort']>[number]['fieldName'];
883
+ /**
884
+ Sort order.
885
+ */
886
+ order?: NonNullable<CommonQueryWithEntityContext['sort']>[number]['order'];
887
+ /**
888
+ Origin point for geo-distance sorting on a GEO field
889
+ results are ordered by distance from this point (ASC = nearest first, DESC = farthest first).
890
+ */
891
+ origin?: NonNullable<CommonQueryWithEntityContext['sort']>[number]['origin'];
892
+ }[];
893
+ };
894
+ declare const utils: {
895
+ query: _wix_sdk_types.QueryHelpers<Vote, VoteQuerySpec, VoteQuery>;
896
+ };
897
+
898
+ export { type AccountInfo, type AccountInfoMetadata, type ActionEvent, type AddressLocation, type BaseEventMetadata, type CommonQueryWithEntityContext, type ContextData, type ContextResourceVoteChange, type CursorPaging, type Cursors, type DomainEvent, type DomainEventBodyOneOf, type DownvoteApplicationErrors, type DownvoteOptions, type DownvoteRequest, type DownvoteResponse, type Empty, type EntityCreatedEvent, type EntityDeletedEvent, type EntityUpdatedEvent, type EventMetadata, type GetResourceVoteSummaryRequest, type GetResourceVoteSummaryResponse, type IdentificationData, type IdentificationDataIdOneOf, IdentityType, type IdentityTypeWithLiterals, type ImportVote, type ImportVoteRequest, type MessageEnvelope, type Paging, type PagingMetadataV2, type QueryV2, type QueryV2PagingMethodOneOf, type QueryVotesApplicationErrors, type QueryVotesOptions, type QueryVotesRequest, type QueryVotesResponse, type RemoveVoteApplicationErrors, type RemoveVoteOptions, type RemoveVoteRequest, type RemoveVoteResponse, type ResourceVoteSummary, type RestoreInfo, type SocialIdentity, SortOrder, type SortOrderWithLiterals, type Sorting, Type, type TypeWithLiterals, type UpdateVoteRequest, type UpdateVoteResponse, type UpvoteApplicationErrors, type UpvoteOptions, type UpvoteRequest, type UpvoteResponse, type Vote, type VoteCast, type VoteCastEnvelope, type VoteContext, type VoteContextResourceVoteChangeEnvelope, type VoteDeleted, type VoteDeletedEnvelope, type VoteQuery, type VoteQuerySpec, type VotesQueryBuilder, type VotesQueryResult, WebhookIdentityType, type WebhookIdentityTypeWithLiterals, downvote, onVoteCast, onVoteContextResourceVoteChange, onVoteDeleted, queryVotes, removeVote, typedQueryVotes, upvote, utils };