@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,938 @@
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
+ * explicit list of fields to update
189
+ * @internal
190
+ */
191
+ fieldMask?: string[];
192
+ }
193
+ interface UpdateVoteResponse {
194
+ /** updated vote */
195
+ vote?: Vote;
196
+ }
197
+ interface RemoveVoteRequest {
198
+ /**
199
+ * context token to be passed
200
+ * @deprecated
201
+ * @replacedBy context_data
202
+ */
203
+ contextToken?: string;
204
+ /** id of the vote which will be deleted */
205
+ voteId: string;
206
+ /** context data */
207
+ contextData?: ContextData;
208
+ }
209
+ interface RemoveVoteResponse {
210
+ /** removed vote */
211
+ vote?: Vote;
212
+ }
213
+ interface VoteDeleted {
214
+ /** Vote */
215
+ vote?: Vote;
216
+ }
217
+ interface QueryVotesRequest {
218
+ /**
219
+ * context token to be passed
220
+ * @deprecated
221
+ * @replacedBy context_data
222
+ */
223
+ contextToken?: string;
224
+ /** query request. Filter supports only "resourceId" field. Fields and Fieldset are not supported */
225
+ query?: QueryV2;
226
+ /** context data */
227
+ contextData?: ContextData;
228
+ }
229
+ interface QueryV2 extends QueryV2PagingMethodOneOf {
230
+ /** Paging options to limit and offset the number of items. */
231
+ paging?: Paging;
232
+ /** 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`. */
233
+ cursorPaging?: CursorPaging;
234
+ /**
235
+ * Filter object.
236
+ *
237
+ * Learn more about [filtering](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#filters).
238
+ */
239
+ filter?: Record<string, any> | null;
240
+ /**
241
+ * Sort object.
242
+ *
243
+ * Learn more about [sorting](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#sorting).
244
+ */
245
+ sort?: Sorting[];
246
+ /** 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. */
247
+ fields?: string[];
248
+ /** 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. */
249
+ fieldsets?: string[];
250
+ }
251
+ /** @oneof */
252
+ interface QueryV2PagingMethodOneOf {
253
+ /** Paging options to limit and offset the number of items. */
254
+ paging?: Paging;
255
+ /** 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`. */
256
+ cursorPaging?: CursorPaging;
257
+ }
258
+ interface Sorting {
259
+ /**
260
+ * Name of the field to sort by.
261
+ * @maxLength 512
262
+ */
263
+ fieldName?: string;
264
+ /** Sort order. */
265
+ order?: SortOrderWithLiterals;
266
+ /**
267
+ * When `field_name` is a property of repeated field that is marked as `MATCH_ITEMS` and sort should be done by
268
+ * a specific element from a collection, filter can/should be provided to ensure correct sort value is picked.
269
+ *
270
+ * If multiple filters are provided, they are combined with AND operator.
271
+ *
272
+ * Example:
273
+ * Given we have document like {"id": "1", "nestedField": [{"price": 10, "region": "EU"}, {"price": 20, "region": "US"}]}
274
+ * and `nestedField` is marked as `MATCH_ITEMS`, to ensure that sorting is done by correct region, filter should be
275
+ * { fieldName: "nestedField.price", "select_items_by": [{"nestedField.region": "US"}] }
276
+ * @internal
277
+ * @maxSize 10
278
+ */
279
+ selectItemsBy?: Record<string, any>[] | null;
280
+ /**
281
+ * Origin point for geo-distance sorting on a GEO field
282
+ * results are ordered by distance from this point (ASC = nearest first, DESC = farthest first).
283
+ */
284
+ origin?: AddressLocation;
285
+ }
286
+ declare enum SortOrder {
287
+ ASC = "ASC",
288
+ DESC = "DESC"
289
+ }
290
+ /** @enumType */
291
+ type SortOrderWithLiterals = SortOrder | 'ASC' | 'DESC';
292
+ interface AddressLocation {
293
+ /** Address latitude. */
294
+ latitude?: number | null;
295
+ /** Address longitude. */
296
+ longitude?: number | null;
297
+ }
298
+ interface Paging {
299
+ /** Number of items to load. */
300
+ limit?: number | null;
301
+ /** Number of items to skip in the current sort order. */
302
+ offset?: number | null;
303
+ }
304
+ interface CursorPaging {
305
+ /**
306
+ * Maximum number of items to return in the results.
307
+ * @max 100
308
+ */
309
+ limit?: number | null;
310
+ /**
311
+ * Pointer to the next or previous page in the list of results.
312
+ *
313
+ * Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response.
314
+ * Not relevant for the first request.
315
+ * @maxLength 16000
316
+ */
317
+ cursor?: string | null;
318
+ }
319
+ interface QueryVotesResponse {
320
+ /** matching votes */
321
+ votes?: Vote[];
322
+ /** paging metadata. Only contains cursors */
323
+ paging?: PagingMetadataV2;
324
+ }
325
+ interface PagingMetadataV2 {
326
+ /** Number of items returned in the response. */
327
+ count?: number | null;
328
+ /** Offset that was requested. */
329
+ offset?: number | null;
330
+ /** Total number of items that match the query. Returned if offset paging is used and the `tooManyToCount` flag is not set. */
331
+ total?: number | null;
332
+ /** Flag that indicates the server failed to calculate the `total` field. */
333
+ tooManyToCount?: boolean | null;
334
+ /** Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used. */
335
+ cursors?: Cursors;
336
+ /**
337
+ * Indicates if there are more results after the current page.
338
+ * If `true`, another page of results can be retrieved.
339
+ * If `false`, this is the last page.
340
+ * @internal
341
+ */
342
+ hasNext?: boolean | null;
343
+ }
344
+ interface Cursors {
345
+ /**
346
+ * Cursor string pointing to the next page in the list of results.
347
+ * @maxLength 16000
348
+ */
349
+ next?: string | null;
350
+ /**
351
+ * Cursor pointing to the previous page in the list of results.
352
+ * @maxLength 16000
353
+ */
354
+ prev?: string | null;
355
+ }
356
+ interface GetResourceVoteSummaryRequest {
357
+ /** appDef ID */
358
+ appDefId?: string;
359
+ /** context ID */
360
+ contextId?: string;
361
+ /** resource ID */
362
+ resourceId?: string;
363
+ }
364
+ interface GetResourceVoteSummaryResponse {
365
+ /** Resource vote summary */
366
+ summary?: ResourceVoteSummary;
367
+ }
368
+ interface ResourceVoteSummary {
369
+ /** vote context */
370
+ context?: VoteContext;
371
+ /** resource ID */
372
+ resourceId?: string;
373
+ /** vote score */
374
+ score?: number;
375
+ /** upvote count */
376
+ upvoteCount?: number;
377
+ /** downvote count */
378
+ downvoteCount?: number;
379
+ }
380
+ interface DomainEvent extends DomainEventBodyOneOf {
381
+ createdEvent?: EntityCreatedEvent;
382
+ updatedEvent?: EntityUpdatedEvent;
383
+ deletedEvent?: EntityDeletedEvent;
384
+ actionEvent?: ActionEvent;
385
+ /** Event ID. With this ID you can easily spot duplicated events and ignore them. */
386
+ _id?: string;
387
+ /**
388
+ * Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities.
389
+ * For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`.
390
+ */
391
+ entityFqdn?: string;
392
+ /**
393
+ * Event action name, placed at the top level to make it easier for users to dispatch messages.
394
+ * For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`.
395
+ */
396
+ slug?: string;
397
+ /** ID of the entity associated with the event. */
398
+ entityId?: string;
399
+ /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`. */
400
+ eventTime?: Date | null;
401
+ /**
402
+ * Whether the event was triggered as a result of a privacy regulation application
403
+ * (for example, GDPR).
404
+ */
405
+ triggeredByAnonymizeRequest?: boolean | null;
406
+ /** If present, indicates the action that triggered the event. */
407
+ originatedFrom?: string | null;
408
+ /**
409
+ * 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.
410
+ * 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.
411
+ */
412
+ entityEventSequence?: string | null;
413
+ }
414
+ /** @oneof */
415
+ interface DomainEventBodyOneOf {
416
+ createdEvent?: EntityCreatedEvent;
417
+ updatedEvent?: EntityUpdatedEvent;
418
+ deletedEvent?: EntityDeletedEvent;
419
+ actionEvent?: ActionEvent;
420
+ }
421
+ interface EntityCreatedEvent {
422
+ entity?: string;
423
+ }
424
+ interface RestoreInfo {
425
+ deletedDate?: Date | null;
426
+ }
427
+ interface EntityUpdatedEvent {
428
+ /**
429
+ * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.
430
+ * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.
431
+ * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.
432
+ */
433
+ currentEntity?: string;
434
+ }
435
+ interface EntityDeletedEvent {
436
+ /** Entity that was deleted. */
437
+ deletedEntity?: string | null;
438
+ }
439
+ interface ActionEvent {
440
+ body?: string;
441
+ }
442
+ interface Empty {
443
+ }
444
+ interface ImportVoteRequest {
445
+ /** metaSite ID */
446
+ metaSiteId?: string;
447
+ /** vote to import */
448
+ vote?: ImportVote;
449
+ }
450
+ interface ImportVote {
451
+ /**
452
+ * Resource ID
453
+ * @maxLength 128
454
+ */
455
+ resourceId?: string;
456
+ /**
457
+ * Resource fully qualified domain name
458
+ * @maxLength 300
459
+ */
460
+ resourceFqdn?: string;
461
+ /**
462
+ * Vote ID
463
+ * @format GUID
464
+ */
465
+ voteId?: string;
466
+ /** Type of vote */
467
+ type?: TypeWithLiterals;
468
+ /** Vote author */
469
+ createdBy?: SocialIdentity;
470
+ /** Vote creation date */
471
+ _createdDate?: Date | null;
472
+ /** Vote update date */
473
+ _updatedDate?: Date | null;
474
+ /** Vote context */
475
+ context?: VoteContext;
476
+ }
477
+ interface MessageEnvelope {
478
+ /**
479
+ * App instance ID.
480
+ * @format GUID
481
+ */
482
+ instanceId?: string | null;
483
+ /**
484
+ * Event type.
485
+ * @maxLength 150
486
+ */
487
+ eventType?: string;
488
+ /** The identification type and identity data. */
489
+ identity?: IdentificationData;
490
+ /** Stringify payload. */
491
+ data?: string;
492
+ /** Details related to the account */
493
+ accountInfo?: AccountInfo;
494
+ }
495
+ interface IdentificationData extends IdentificationDataIdOneOf {
496
+ /**
497
+ * ID of a site visitor that has not logged in to the site.
498
+ * @format GUID
499
+ */
500
+ anonymousVisitorId?: string;
501
+ /**
502
+ * ID of a site visitor that has logged in to the site.
503
+ * @format GUID
504
+ */
505
+ memberId?: string;
506
+ /**
507
+ * ID of a Wix user (site owner, contributor, etc.).
508
+ * @format GUID
509
+ */
510
+ wixUserId?: string;
511
+ /**
512
+ * ID of an app.
513
+ * @format GUID
514
+ */
515
+ appId?: string;
516
+ /** @readonly */
517
+ identityType?: WebhookIdentityTypeWithLiterals;
518
+ }
519
+ /** @oneof */
520
+ interface IdentificationDataIdOneOf {
521
+ /**
522
+ * ID of a site visitor that has not logged in to the site.
523
+ * @format GUID
524
+ */
525
+ anonymousVisitorId?: string;
526
+ /**
527
+ * ID of a site visitor that has logged in to the site.
528
+ * @format GUID
529
+ */
530
+ memberId?: string;
531
+ /**
532
+ * ID of a Wix user (site owner, contributor, etc.).
533
+ * @format GUID
534
+ */
535
+ wixUserId?: string;
536
+ /**
537
+ * ID of an app.
538
+ * @format GUID
539
+ */
540
+ appId?: string;
541
+ }
542
+ declare enum WebhookIdentityType {
543
+ UNKNOWN = "UNKNOWN",
544
+ ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
545
+ MEMBER = "MEMBER",
546
+ WIX_USER = "WIX_USER",
547
+ APP = "APP"
548
+ }
549
+ /** @enumType */
550
+ type WebhookIdentityTypeWithLiterals = WebhookIdentityType | 'UNKNOWN' | 'ANONYMOUS_VISITOR' | 'MEMBER' | 'WIX_USER' | 'APP';
551
+ interface AccountInfo {
552
+ /**
553
+ * ID of the Wix account associated with the event.
554
+ * @format GUID
555
+ */
556
+ accountId?: string | null;
557
+ /**
558
+ * ID of the parent Wix account. Only included when accountId belongs to a child account.
559
+ * @format GUID
560
+ */
561
+ parentAccountId?: string | null;
562
+ /**
563
+ * ID of the Wix site associated with the event. Only included when the event is tied to a specific site.
564
+ * @format GUID
565
+ */
566
+ siteId?: string | null;
567
+ }
568
+ /** @docsIgnore */
569
+ type UpvoteApplicationErrors = {
570
+ code?: 'MISSING_METASITE_CONTEXT';
571
+ description?: string;
572
+ data?: Record<string, any>;
573
+ } | {
574
+ code?: 'PERMISSION_DENIED';
575
+ description?: string;
576
+ data?: Record<string, any>;
577
+ };
578
+ /** @docsIgnore */
579
+ type DownvoteApplicationErrors = {
580
+ code?: 'MISSING_METASITE_CONTEXT';
581
+ description?: string;
582
+ data?: Record<string, any>;
583
+ } | {
584
+ code?: 'PERMISSION_DENIED';
585
+ description?: string;
586
+ data?: Record<string, any>;
587
+ };
588
+ /** @docsIgnore */
589
+ type RemoveVoteApplicationErrors = {
590
+ code?: 'MISSING_METASITE_CONTEXT';
591
+ description?: string;
592
+ data?: Record<string, any>;
593
+ } | {
594
+ code?: 'PERMISSION_DENIED';
595
+ description?: string;
596
+ data?: Record<string, any>;
597
+ } | {
598
+ code?: 'VOTE_NOT_FOUND';
599
+ description?: string;
600
+ data?: Record<string, any>;
601
+ };
602
+ /** @docsIgnore */
603
+ type QueryVotesApplicationErrors = {
604
+ code?: 'MISSING_METASITE_CONTEXT';
605
+ description?: string;
606
+ data?: Record<string, any>;
607
+ } | {
608
+ code?: 'PERMISSION_DENIED';
609
+ description?: string;
610
+ data?: Record<string, any>;
611
+ } | {
612
+ code?: 'UNSUPPORTED_FILTER_FIELDS';
613
+ description?: string;
614
+ data?: Record<string, any>;
615
+ };
616
+ interface BaseEventMetadata {
617
+ /**
618
+ * App instance ID.
619
+ * @format GUID
620
+ */
621
+ instanceId?: string | null;
622
+ /**
623
+ * Event type.
624
+ * @maxLength 150
625
+ */
626
+ eventType?: string;
627
+ /** The identification type and identity data. */
628
+ identity?: IdentificationData;
629
+ /** Details related to the account */
630
+ accountInfo?: AccountInfo;
631
+ }
632
+ interface EventMetadata extends BaseEventMetadata {
633
+ /** Event ID. With this ID you can easily spot duplicated events and ignore them. */
634
+ _id?: string;
635
+ /**
636
+ * Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities.
637
+ * For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`.
638
+ */
639
+ entityFqdn?: string;
640
+ /**
641
+ * Event action name, placed at the top level to make it easier for users to dispatch messages.
642
+ * For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`.
643
+ */
644
+ slug?: string;
645
+ /** ID of the entity associated with the event. */
646
+ entityId?: string;
647
+ /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`. */
648
+ eventTime?: Date | null;
649
+ /**
650
+ * Whether the event was triggered as a result of a privacy regulation application
651
+ * (for example, GDPR).
652
+ */
653
+ triggeredByAnonymizeRequest?: boolean | null;
654
+ /** If present, indicates the action that triggered the event. */
655
+ originatedFrom?: string | null;
656
+ /**
657
+ * 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.
658
+ * 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.
659
+ */
660
+ entityEventSequence?: string | null;
661
+ accountInfo?: AccountInfoMetadata;
662
+ }
663
+ interface AccountInfoMetadata {
664
+ /** ID of the Wix account associated with the event */
665
+ accountId: string;
666
+ /** ID of the Wix site associated with the event. Only included when the event is tied to a specific site. */
667
+ siteId?: string;
668
+ /** ID of the parent Wix account. Only included when 'accountId' belongs to a child account. */
669
+ parentAccountId?: string;
670
+ }
671
+ interface VoteContextResourceVoteChangeEnvelope {
672
+ data: ContextResourceVoteChange;
673
+ metadata: EventMetadata;
674
+ }
675
+ /** @webhook
676
+ * @eventType wix.comments.v1.vote_context_resource_vote_change
677
+ * @serviceIdentifier com.wixpress.comments.Votes
678
+ * @slug context_resource_vote_change
679
+ * @documentationMaturity preview
680
+ */
681
+ declare function onVoteContextResourceVoteChange(handler: (event: VoteContextResourceVoteChangeEnvelope) => void | Promise<void>): void;
682
+ interface VoteCastEnvelope {
683
+ data: VoteCast;
684
+ metadata: EventMetadata;
685
+ }
686
+ /** @webhook
687
+ * @eventType wix.comments.v1.vote_vote_cast
688
+ * @serviceIdentifier com.wixpress.comments.Votes
689
+ * @slug vote_cast
690
+ * @documentationMaturity preview
691
+ */
692
+ declare function onVoteCast(handler: (event: VoteCastEnvelope) => void | Promise<void>): void;
693
+ interface VoteDeletedEnvelope {
694
+ data: VoteDeleted;
695
+ metadata: EventMetadata;
696
+ }
697
+ /** @webhook
698
+ * @eventType wix.comments.v1.vote_vote_deleted
699
+ * @serviceIdentifier com.wixpress.comments.Votes
700
+ * @slug vote_deleted
701
+ * @documentationMaturity preview
702
+ */
703
+ declare function onVoteDeleted(handler: (event: VoteDeletedEnvelope) => void | Promise<void>): void;
704
+ /**
705
+ * 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.
709
+ * @public
710
+ * @documentationMaturity preview
711
+ * @requiredField options.resourceFqdn
712
+ * @requiredField options.resourceId
713
+ * @fqn com.wixpress.comments.Votes.Upvote
714
+ */
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> & {
716
+ __applicationErrorsType?: UpvoteApplicationErrors;
717
+ }>;
718
+ interface UpvoteOptions {
719
+ /**
720
+ * context token to be passed
721
+ * @deprecated
722
+ * @replacedBy context_data
723
+ */
724
+ contextToken?: string;
725
+ /**
726
+ * resource identifier for vote be cast on
727
+ * @maxLength 128
728
+ */
729
+ resourceId: string;
730
+ /**
731
+ * resource name
732
+ * @maxLength 300
733
+ */
734
+ resourceFqdn: string;
735
+ /** context data */
736
+ contextData?: ContextData;
737
+ }
738
+ /**
739
+ * 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.
743
+ * @public
744
+ * @documentationMaturity preview
745
+ * @requiredField options.resourceFqdn
746
+ * @requiredField options.resourceId
747
+ * @fqn com.wixpress.comments.Votes.Downvote
748
+ */
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> & {
750
+ __applicationErrorsType?: DownvoteApplicationErrors;
751
+ }>;
752
+ interface DownvoteOptions {
753
+ /**
754
+ * context token to be passed
755
+ * @deprecated
756
+ * @replacedBy context_data
757
+ */
758
+ contextToken?: string;
759
+ /**
760
+ * resource identifier for vote be cast on
761
+ * @maxLength 128
762
+ */
763
+ resourceId: string;
764
+ /**
765
+ * resource name
766
+ * @maxLength 300
767
+ */
768
+ resourceFqdn: string;
769
+ /** context data */
770
+ contextData?: ContextData;
771
+ }
772
+ /**
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
777
+ * @public
778
+ * @documentationMaturity preview
779
+ * @requiredField voteId
780
+ * @fqn com.wixpress.comments.Votes.RemoveVote
781
+ */
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> & {
783
+ __applicationErrorsType?: RemoveVoteApplicationErrors;
784
+ }>;
785
+ interface RemoveVoteOptions {
786
+ /**
787
+ * context token to be passed
788
+ * @deprecated
789
+ * @replacedBy context_data
790
+ */
791
+ contextToken?: string;
792
+ /** context data */
793
+ contextData?: ContextData;
794
+ }
795
+ /**
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.
802
+ * @public
803
+ * @documentationMaturity preview
804
+ * @fqn com.wixpress.comments.Votes.QueryVotes
805
+ */
806
+ declare function queryVotes(options?: QueryVotesOptions): VotesQueryBuilder;
807
+ interface QueryVotesOptions {
808
+ /**
809
+ * context token to be passed
810
+ * @deprecated
811
+ * @replacedBy context_data
812
+ */
813
+ contextToken?: string | undefined;
814
+ /** context data */
815
+ contextData?: ContextData | undefined;
816
+ }
817
+ interface QueryCursorResult {
818
+ cursors: Cursors;
819
+ hasNext: () => boolean;
820
+ hasPrev: () => boolean;
821
+ length: number;
822
+ pageSize: number;
823
+ }
824
+ interface VotesQueryResult extends QueryCursorResult {
825
+ items: Vote[];
826
+ query: VotesQueryBuilder;
827
+ next: () => Promise<VotesQueryResult>;
828
+ prev: () => Promise<VotesQueryResult>;
829
+ }
830
+ interface VotesQueryBuilder {
831
+ /** @param propertyName - Property whose value is compared with `value`.
832
+ * @param value - Value to compare against.
833
+ * @documentationMaturity preview
834
+ */
835
+ eq: (propertyName: 'resourceId', value: any) => VotesQueryBuilder;
836
+ /** @param propertyName - Property whose value is compared with `value`.
837
+ * @param value - Value to compare against.
838
+ * @documentationMaturity preview
839
+ */
840
+ ne: (propertyName: 'resourceId', value: any) => VotesQueryBuilder;
841
+ /** @documentationMaturity preview */
842
+ in: (propertyName: 'resourceId', value: any) => VotesQueryBuilder;
843
+ /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
844
+ * @documentationMaturity preview
845
+ */
846
+ limit: (limit: number) => VotesQueryBuilder;
847
+ /** @param cursor - A pointer to specific record
848
+ * @documentationMaturity preview
849
+ */
850
+ skipTo: (cursor: string) => VotesQueryBuilder;
851
+ /** @documentationMaturity preview */
852
+ find: () => Promise<VotesQueryResult>;
853
+ }
854
+ /**
855
+ * @hidden
856
+ * @fqn com.wixpress.comments.Votes.QueryVotes
857
+ * @requiredField query
858
+ */
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> & {
860
+ __applicationErrorsType?: QueryVotesApplicationErrors;
861
+ }>;
862
+ interface VoteQuerySpec extends QuerySpec {
863
+ paging: 'cursor';
864
+ wql: [
865
+ {
866
+ fields: ['resourceId'];
867
+ operators: ['$eq', '$in', '$ne'];
868
+ sort: 'NONE';
869
+ }
870
+ ];
871
+ }
872
+ type CommonQueryWithEntityContext = Query<Vote, VoteQuerySpec>;
873
+ type VoteQuery = {
874
+ /**
875
+ 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`.
876
+ */
877
+ cursorPaging?: {
878
+ /**
879
+ Maximum number of items to return in the results.
880
+ @max: 100
881
+ */
882
+ limit?: NonNullable<CommonQueryWithEntityContext['cursorPaging']>['limit'] | null;
883
+ /**
884
+ Pointer to the next or previous page in the list of results.
885
+
886
+ Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response.
887
+ Not relevant for the first request.
888
+ @maxLength: 16000
889
+ */
890
+ cursor?: NonNullable<CommonQueryWithEntityContext['cursorPaging']>['cursor'] | null;
891
+ };
892
+ /**
893
+ Filter object.
894
+
895
+ Learn more about [filtering](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#filters).
896
+ */
897
+ filter?: CommonQueryWithEntityContext['filter'] | null;
898
+ /**
899
+ Sort object.
900
+
901
+ Learn more about [sorting](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#sorting).
902
+ */
903
+ sort?: {
904
+ /**
905
+ Name of the field to sort by.
906
+ @maxLength: 512
907
+ */
908
+ fieldName?: NonNullable<CommonQueryWithEntityContext['sort']>[number]['fieldName'];
909
+ /**
910
+ Sort order.
911
+ */
912
+ order?: NonNullable<CommonQueryWithEntityContext['sort']>[number]['order'];
913
+ /**
914
+ When `field_name` is a property of repeated field that is marked as `MATCH_ITEMS` and sort should be done by
915
+ a specific element from a collection, filter can/should be provided to ensure correct sort value is picked.
916
+
917
+ If multiple filters are provided, they are combined with AND operator.
918
+
919
+ Example:
920
+ Given we have document like {"id": "1", "nestedField": [{"price": 10, "region": "EU"}, {"price": 20, "region": "US"}]}
921
+ and `nestedField` is marked as `MATCH_ITEMS`, to ensure that sorting is done by correct region, filter should be
922
+ { fieldName: "nestedField.price", "select_items_by": [{"nestedField.region": "US"}] }
923
+ @internal: undefined,
924
+ @maxSize: 10
925
+ */
926
+ selectItemsBy?: NonNullable<CommonQueryWithEntityContext['sort']>[number]['selectItemsBy'] | null;
927
+ /**
928
+ Origin point for geo-distance sorting on a GEO field
929
+ results are ordered by distance from this point (ASC = nearest first, DESC = farthest first).
930
+ */
931
+ origin?: NonNullable<CommonQueryWithEntityContext['sort']>[number]['origin'];
932
+ }[];
933
+ };
934
+ declare const utils: {
935
+ query: _wix_sdk_types.QueryHelpers<Vote, VoteQuerySpec, VoteQuery>;
936
+ };
937
+
938
+ 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 };