@wix/auto_sdk_comments_ratings 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.
Files changed (39) hide show
  1. package/build/cjs/index.d.ts +50 -0
  2. package/build/cjs/index.js +366 -0
  3. package/build/cjs/index.js.map +1 -0
  4. package/build/cjs/index.typings.d.ts +521 -0
  5. package/build/cjs/index.typings.js +284 -0
  6. package/build/cjs/index.typings.js.map +1 -0
  7. package/build/cjs/meta.d.ts +382 -0
  8. package/build/cjs/meta.js +244 -0
  9. package/build/cjs/meta.js.map +1 -0
  10. package/build/es/index.d.mts +50 -0
  11. package/build/es/index.mjs +336 -0
  12. package/build/es/index.mjs.map +1 -0
  13. package/build/es/index.typings.d.mts +521 -0
  14. package/build/es/index.typings.mjs +256 -0
  15. package/build/es/index.typings.mjs.map +1 -0
  16. package/build/es/meta.d.mts +382 -0
  17. package/build/es/meta.mjs +213 -0
  18. package/build/es/meta.mjs.map +1 -0
  19. package/build/es/package.json +3 -0
  20. package/build/internal/cjs/index.d.ts +50 -0
  21. package/build/internal/cjs/index.js +366 -0
  22. package/build/internal/cjs/index.js.map +1 -0
  23. package/build/internal/cjs/index.typings.d.ts +521 -0
  24. package/build/internal/cjs/index.typings.js +284 -0
  25. package/build/internal/cjs/index.typings.js.map +1 -0
  26. package/build/internal/cjs/meta.d.ts +382 -0
  27. package/build/internal/cjs/meta.js +244 -0
  28. package/build/internal/cjs/meta.js.map +1 -0
  29. package/build/internal/es/index.d.mts +50 -0
  30. package/build/internal/es/index.mjs +336 -0
  31. package/build/internal/es/index.mjs.map +1 -0
  32. package/build/internal/es/index.typings.d.mts +521 -0
  33. package/build/internal/es/index.typings.mjs +256 -0
  34. package/build/internal/es/index.typings.mjs.map +1 -0
  35. package/build/internal/es/meta.d.mts +382 -0
  36. package/build/internal/es/meta.mjs +213 -0
  37. package/build/internal/es/meta.mjs.map +1 -0
  38. package/meta/package.json +3 -0
  39. package/package.json +54 -0
@@ -0,0 +1,521 @@
1
+ import { NonNullablePaths } from '@wix/sdk-types';
2
+
3
+ interface V1CommentResourceRating extends V1CommentResourceRatingOwnerOneOf {
4
+ /**
5
+ * Visitor Id
6
+ * @readonly
7
+ */
8
+ visitorId?: string | null;
9
+ /**
10
+ * Member Id
11
+ * @readonly
12
+ */
13
+ memberId?: string | null;
14
+ /**
15
+ * @readonly
16
+ * @format GUID
17
+ */
18
+ _id?: string | null;
19
+ /** Rating Context */
20
+ ratingContext?: RatingContext;
21
+ /** Resource Id */
22
+ resourceId?: string | null;
23
+ /**
24
+ * Rating Value
25
+ * @min 1
26
+ * @max 5
27
+ */
28
+ rating?: number | null;
29
+ /** Published comments count */
30
+ publishedCommentCount?: number;
31
+ }
32
+ /** @oneof */
33
+ interface V1CommentResourceRatingOwnerOneOf {
34
+ /**
35
+ * Visitor Id
36
+ * @readonly
37
+ */
38
+ visitorId?: string | null;
39
+ /**
40
+ * Member Id
41
+ * @readonly
42
+ */
43
+ memberId?: string | null;
44
+ }
45
+ interface RatingContext {
46
+ /**
47
+ * Context Application Definition Id
48
+ * @format GUID
49
+ */
50
+ appDefId?: string | null;
51
+ /** Context Id */
52
+ contextId?: string | null;
53
+ /** Context Type */
54
+ contextType?: string | null;
55
+ }
56
+ interface CommentResourceRatingChanged {
57
+ /** Resource rating */
58
+ resourceRating?: V1CommentResourceRating;
59
+ }
60
+ interface CommentResourceRatingDeleted {
61
+ /** resource rating */
62
+ resourceRating?: V1CommentResourceRating;
63
+ }
64
+ interface V1CreateRatingRequest {
65
+ /** Resource rating to be created or updated */
66
+ resourceRating?: V1CommentResourceRating;
67
+ }
68
+ interface V1CreateRatingResponse {
69
+ /** Created/Updated resource rating */
70
+ resourceRating?: V1CommentResourceRating;
71
+ }
72
+ interface RemoveMyRatingRequest {
73
+ /** Rating context */
74
+ ratingContext?: RatingContext;
75
+ /** Resource Id */
76
+ resourceId: string | null;
77
+ }
78
+ interface RemoveMyRatingResponse {
79
+ }
80
+ interface V1GetMyRatingRequest {
81
+ /** Rating context */
82
+ ratingContext?: RatingContext;
83
+ /** Resource Id */
84
+ resourceId: string | null;
85
+ }
86
+ interface V1GetMyRatingResponse {
87
+ /** Current member/visitor resource rating */
88
+ resourceRating?: V1CommentResourceRating;
89
+ }
90
+ interface GetResourceSummaryRequest {
91
+ /** Rating context */
92
+ ratingContext?: RatingContext;
93
+ /** Resource Id */
94
+ resourceId: string | null;
95
+ }
96
+ interface GetResourceSummaryResponse {
97
+ /** Average rating score */
98
+ average?: number;
99
+ /** Total amount of ratings */
100
+ total?: number;
101
+ /** Breakdown of how many of each rating is there */
102
+ breakdown?: Record<number, number>;
103
+ }
104
+ interface MoveRatingRequest {
105
+ /** Context for the comment that is being moved */
106
+ moveContext?: MoveContext;
107
+ /** New resourceId to which the comment is being moved to */
108
+ newResourceId?: string;
109
+ /** New contextId to which the comment is being moved to */
110
+ newContextId?: string;
111
+ }
112
+ interface MoveContext {
113
+ /**
114
+ * Comment ID
115
+ * @format GUID
116
+ */
117
+ commentId?: string;
118
+ /**
119
+ * MetaSite ID
120
+ * @format GUID
121
+ */
122
+ metaSiteId?: string;
123
+ /**
124
+ * App ID
125
+ * @format GUID
126
+ */
127
+ appDefId?: string;
128
+ /**
129
+ * Context ID
130
+ * @maxLength 300
131
+ */
132
+ contextId?: string;
133
+ /**
134
+ * Context type
135
+ * @maxLength 300
136
+ */
137
+ contextType?: string;
138
+ /**
139
+ * Resource ID
140
+ * @maxLength 128
141
+ */
142
+ resourceId?: string;
143
+ /** Member ID */
144
+ memberId?: string | null;
145
+ /** Visitor ID */
146
+ visitorId?: string | null;
147
+ }
148
+ interface MoveRatingResponse {
149
+ /** Moved resource rating */
150
+ resourceRating?: V1CommentResourceRating;
151
+ }
152
+ interface DomainEvent extends DomainEventBodyOneOf {
153
+ createdEvent?: EntityCreatedEvent;
154
+ updatedEvent?: EntityUpdatedEvent;
155
+ deletedEvent?: EntityDeletedEvent;
156
+ actionEvent?: ActionEvent;
157
+ /** Event ID. With this ID you can easily spot duplicated events and ignore them. */
158
+ _id?: string;
159
+ /**
160
+ * Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities.
161
+ * For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`.
162
+ */
163
+ entityFqdn?: string;
164
+ /**
165
+ * Event action name, placed at the top level to make it easier for users to dispatch messages.
166
+ * For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`.
167
+ */
168
+ slug?: string;
169
+ /** ID of the entity associated with the event. */
170
+ entityId?: string;
171
+ /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`. */
172
+ eventTime?: Date | null;
173
+ /**
174
+ * Whether the event was triggered as a result of a privacy regulation application
175
+ * (for example, GDPR).
176
+ */
177
+ triggeredByAnonymizeRequest?: boolean | null;
178
+ /** If present, indicates the action that triggered the event. */
179
+ originatedFrom?: string | null;
180
+ /**
181
+ * 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.
182
+ * 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.
183
+ */
184
+ entityEventSequence?: string | null;
185
+ }
186
+ /** @oneof */
187
+ interface DomainEventBodyOneOf {
188
+ createdEvent?: EntityCreatedEvent;
189
+ updatedEvent?: EntityUpdatedEvent;
190
+ deletedEvent?: EntityDeletedEvent;
191
+ actionEvent?: ActionEvent;
192
+ }
193
+ interface EntityCreatedEvent {
194
+ entity?: string;
195
+ }
196
+ interface RestoreInfo {
197
+ deletedDate?: Date | null;
198
+ }
199
+ interface EntityUpdatedEvent {
200
+ /**
201
+ * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.
202
+ * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.
203
+ * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.
204
+ */
205
+ currentEntity?: string;
206
+ }
207
+ interface EntityDeletedEvent {
208
+ /** Entity that was deleted. */
209
+ deletedEntity?: string | null;
210
+ }
211
+ interface ActionEvent {
212
+ body?: string;
213
+ }
214
+ interface Empty {
215
+ }
216
+ interface MessageEnvelope {
217
+ /**
218
+ * App instance ID.
219
+ * @format GUID
220
+ */
221
+ instanceId?: string | null;
222
+ /**
223
+ * Event type.
224
+ * @maxLength 150
225
+ */
226
+ eventType?: string;
227
+ /** The identification type and identity data. */
228
+ identity?: IdentificationData;
229
+ /** Stringify payload. */
230
+ data?: string;
231
+ /** Details related to the account */
232
+ accountInfo?: AccountInfo;
233
+ }
234
+ interface IdentificationData extends IdentificationDataIdOneOf {
235
+ /**
236
+ * ID of a site visitor that has not logged in to the site.
237
+ * @format GUID
238
+ */
239
+ anonymousVisitorId?: string;
240
+ /**
241
+ * ID of a site visitor that has logged in to the site.
242
+ * @format GUID
243
+ */
244
+ memberId?: string;
245
+ /**
246
+ * ID of a Wix user (site owner, contributor, etc.).
247
+ * @format GUID
248
+ */
249
+ wixUserId?: string;
250
+ /**
251
+ * ID of an app.
252
+ * @format GUID
253
+ */
254
+ appId?: string;
255
+ /** @readonly */
256
+ identityType?: WebhookIdentityTypeWithLiterals;
257
+ }
258
+ /** @oneof */
259
+ interface IdentificationDataIdOneOf {
260
+ /**
261
+ * ID of a site visitor that has not logged in to the site.
262
+ * @format GUID
263
+ */
264
+ anonymousVisitorId?: string;
265
+ /**
266
+ * ID of a site visitor that has logged in to the site.
267
+ * @format GUID
268
+ */
269
+ memberId?: string;
270
+ /**
271
+ * ID of a Wix user (site owner, contributor, etc.).
272
+ * @format GUID
273
+ */
274
+ wixUserId?: string;
275
+ /**
276
+ * ID of an app.
277
+ * @format GUID
278
+ */
279
+ appId?: string;
280
+ }
281
+ declare enum WebhookIdentityType {
282
+ UNKNOWN = "UNKNOWN",
283
+ ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
284
+ MEMBER = "MEMBER",
285
+ WIX_USER = "WIX_USER",
286
+ APP = "APP"
287
+ }
288
+ /** @enumType */
289
+ type WebhookIdentityTypeWithLiterals = WebhookIdentityType | 'UNKNOWN' | 'ANONYMOUS_VISITOR' | 'MEMBER' | 'WIX_USER' | 'APP';
290
+ interface AccountInfo {
291
+ /**
292
+ * ID of the Wix account associated with the event.
293
+ * @format GUID
294
+ */
295
+ accountId?: string | null;
296
+ /**
297
+ * ID of the parent Wix account. Only included when accountId belongs to a child account.
298
+ * @format GUID
299
+ */
300
+ parentAccountId?: string | null;
301
+ /**
302
+ * ID of the Wix site associated with the event. Only included when the event is tied to a specific site.
303
+ * @format GUID
304
+ */
305
+ siteId?: string | null;
306
+ }
307
+ interface CommentResourceRating extends CommentResourceRatingOwnerOneOf {
308
+ visitorId?: string | null;
309
+ memberId?: string | null;
310
+ /**
311
+ * @readonly
312
+ * @format GUID
313
+ */
314
+ _id?: string | null;
315
+ /** @format GUID */
316
+ appDefId?: string | null;
317
+ resourceId?: string | null;
318
+ /**
319
+ * @min 1
320
+ * @max 5
321
+ */
322
+ rating?: number | null;
323
+ }
324
+ /** @oneof */
325
+ interface CommentResourceRatingOwnerOneOf {
326
+ visitorId?: string | null;
327
+ memberId?: string | null;
328
+ }
329
+ interface CreateRatingRequest {
330
+ resourceRating?: CommentResourceRating;
331
+ }
332
+ interface CreateRatingResponse {
333
+ resourceRating?: CommentResourceRating;
334
+ }
335
+ interface GetMyRatingRequest {
336
+ /** @format GUID */
337
+ appDefId?: string | null;
338
+ resourceId?: string | null;
339
+ }
340
+ interface GetMyRatingResponse {
341
+ resourceRating?: CommentResourceRating;
342
+ }
343
+ /** @docsIgnore */
344
+ type RemoveMyRatingApplicationErrors = {
345
+ code?: 'RATING_NOT_FOUND';
346
+ description?: string;
347
+ data?: Record<string, any>;
348
+ };
349
+ /** @docsIgnore */
350
+ type GetMyRatingApplicationErrors = {
351
+ code?: 'RATING_NOT_FOUND';
352
+ description?: string;
353
+ data?: Record<string, any>;
354
+ };
355
+ interface BaseEventMetadata {
356
+ /**
357
+ * App instance ID.
358
+ * @format GUID
359
+ */
360
+ instanceId?: string | null;
361
+ /**
362
+ * Event type.
363
+ * @maxLength 150
364
+ */
365
+ eventType?: string;
366
+ /** The identification type and identity data. */
367
+ identity?: IdentificationData;
368
+ /** Details related to the account */
369
+ accountInfo?: AccountInfo;
370
+ }
371
+ interface EventMetadata extends BaseEventMetadata {
372
+ /** Event ID. With this ID you can easily spot duplicated events and ignore them. */
373
+ _id?: string;
374
+ /**
375
+ * Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities.
376
+ * For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`.
377
+ */
378
+ entityFqdn?: string;
379
+ /**
380
+ * Event action name, placed at the top level to make it easier for users to dispatch messages.
381
+ * For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`.
382
+ */
383
+ slug?: string;
384
+ /** ID of the entity associated with the event. */
385
+ entityId?: string;
386
+ /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`. */
387
+ eventTime?: Date | null;
388
+ /**
389
+ * Whether the event was triggered as a result of a privacy regulation application
390
+ * (for example, GDPR).
391
+ */
392
+ triggeredByAnonymizeRequest?: boolean | null;
393
+ /** If present, indicates the action that triggered the event. */
394
+ originatedFrom?: string | null;
395
+ /**
396
+ * 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.
397
+ * 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.
398
+ */
399
+ entityEventSequence?: string | null;
400
+ accountInfo?: AccountInfoMetadata;
401
+ }
402
+ interface AccountInfoMetadata {
403
+ /** ID of the Wix account associated with the event */
404
+ accountId: string;
405
+ /** ID of the Wix site associated with the event. Only included when the event is tied to a specific site. */
406
+ siteId?: string;
407
+ /** ID of the parent Wix account. Only included when 'accountId' belongs to a child account. */
408
+ parentAccountId?: string;
409
+ }
410
+ interface RatingCommentResourceRatingChangedEnvelope {
411
+ data: CommentResourceRatingChanged;
412
+ metadata: EventMetadata;
413
+ }
414
+ /** @webhook
415
+ * @eventType wix.comments.resource.v1.rating_comment_resource_rating_changed
416
+ * @serviceIdentifier wix.comments.ratings.v1.CommentsRatings
417
+ * @slug comment_resource_rating_changed
418
+ * @documentationMaturity preview
419
+ */
420
+ declare function onRatingCommentResourceRatingChanged(handler: (event: RatingCommentResourceRatingChangedEnvelope) => void | Promise<void>): void;
421
+ interface RatingCommentResourceRatingDeletedEnvelope {
422
+ data: CommentResourceRatingDeleted;
423
+ metadata: EventMetadata;
424
+ }
425
+ /** @webhook
426
+ * @eventType wix.comments.resource.v1.rating_comment_resource_rating_deleted
427
+ * @serviceIdentifier wix.comments.ratings.v1.CommentsRatings
428
+ * @slug comment_resource_rating_deleted
429
+ * @documentationMaturity preview
430
+ */
431
+ declare function onRatingCommentResourceRatingDeleted(handler: (event: RatingCommentResourceRatingDeletedEnvelope) => void | Promise<void>): void;
432
+ /**
433
+ * Creates resource rating, if member/visitor has already created an rating it will be updated with provided value
434
+ * @param resourceId - Resource Id
435
+ * @public
436
+ * @documentationMaturity preview
437
+ * @requiredField options.resourceRating.rating
438
+ * @requiredField options.resourceRating.ratingContext.appDefId
439
+ * @requiredField options.resourceRating.ratingContext.contextId
440
+ * @requiredField resourceId
441
+ * @fqn wix.comments.ratings.v1.CommentsRatings.CreateRating
442
+ */
443
+ declare function createRating(resourceId: string, options?: NonNullablePaths<CreateRatingOptions, `resourceRating.rating` | `resourceRating.ratingContext.appDefId` | `resourceRating.ratingContext.contextId`, 4>): Promise<NonNullablePaths<V1CreateRatingResponse, `resourceRating.publishedCommentCount`, 3>>;
444
+ interface CreateRatingOptions {
445
+ resourceRating?: {
446
+ /**
447
+ * Visitor Id
448
+ * @readonly
449
+ */
450
+ visitorId?: string | null;
451
+ /**
452
+ * Member Id
453
+ * @readonly
454
+ */
455
+ memberId?: string | null;
456
+ /**
457
+ * @readonly
458
+ * @format GUID
459
+ */
460
+ _id?: string | null;
461
+ /** Rating Context */
462
+ ratingContext?: RatingContext;
463
+ /**
464
+ * Rating Value
465
+ * @min 1
466
+ * @max 5
467
+ */
468
+ rating?: number | null;
469
+ /** Published comments count */
470
+ publishedCommentCount?: number;
471
+ };
472
+ }
473
+ /**
474
+ * Removes rating for current caller
475
+ * @param resourceId - Resource Id
476
+ * @public
477
+ * @documentationMaturity preview
478
+ * @requiredField options.ratingContext.appDefId
479
+ * @requiredField options.ratingContext.contextId
480
+ * @requiredField resourceId
481
+ * @fqn wix.comments.ratings.v1.CommentsRatings.RemoveMyRating
482
+ */
483
+ declare function removeMyRating(resourceId: string, options?: NonNullablePaths<RemoveMyRatingOptions, `ratingContext.appDefId` | `ratingContext.contextId`, 3>): Promise<void & {
484
+ __applicationErrorsType?: RemoveMyRatingApplicationErrors;
485
+ }>;
486
+ interface RemoveMyRatingOptions {
487
+ /** Rating context */
488
+ ratingContext?: RatingContext;
489
+ }
490
+ /**
491
+ * Returns rating for current caller
492
+ * @param resourceId - Resource Id
493
+ * @public
494
+ * @documentationMaturity preview
495
+ * @requiredField options.ratingContext.appDefId
496
+ * @requiredField options.ratingContext.contextId
497
+ * @requiredField resourceId
498
+ * @fqn wix.comments.ratings.v1.CommentsRatings.GetMyRating
499
+ */
500
+ declare function getMyRating(resourceId: string, options?: NonNullablePaths<GetMyRatingOptions, `ratingContext.appDefId` | `ratingContext.contextId`, 3>): Promise<NonNullablePaths<V1GetMyRatingResponse, `resourceRating.publishedCommentCount`, 3> & {
501
+ __applicationErrorsType?: GetMyRatingApplicationErrors;
502
+ }>;
503
+ interface GetMyRatingOptions {
504
+ /** Rating context */
505
+ ratingContext?: RatingContext;
506
+ }
507
+ /** @param resourceId - Resource Id
508
+ * @public
509
+ * @documentationMaturity preview
510
+ * @requiredField options.ratingContext.appDefId
511
+ * @requiredField options.ratingContext.contextId
512
+ * @requiredField resourceId
513
+ * @fqn wix.comments.ratings.v1.CommentsRatings.GetResourceSummary
514
+ */
515
+ declare function getResourceSummary(resourceId: string, options?: NonNullablePaths<GetResourceSummaryOptions, `ratingContext.appDefId` | `ratingContext.contextId`, 3>): Promise<NonNullablePaths<GetResourceSummaryResponse, `average` | `total`, 2>>;
516
+ interface GetResourceSummaryOptions {
517
+ /** Rating context */
518
+ ratingContext?: RatingContext;
519
+ }
520
+
521
+ export { type AccountInfo, type AccountInfoMetadata, type ActionEvent, type BaseEventMetadata, type CommentResourceRating, type CommentResourceRatingChanged, type CommentResourceRatingDeleted, type CommentResourceRatingOwnerOneOf, type CreateRatingOptions, type CreateRatingRequest, type CreateRatingResponse, type DomainEvent, type DomainEventBodyOneOf, type Empty, type EntityCreatedEvent, type EntityDeletedEvent, type EntityUpdatedEvent, type EventMetadata, type GetMyRatingApplicationErrors, type GetMyRatingOptions, type GetMyRatingRequest, type GetMyRatingResponse, type GetResourceSummaryOptions, type GetResourceSummaryRequest, type GetResourceSummaryResponse, type IdentificationData, type IdentificationDataIdOneOf, type MessageEnvelope, type MoveContext, type MoveRatingRequest, type MoveRatingResponse, type RatingCommentResourceRatingChangedEnvelope, type RatingCommentResourceRatingDeletedEnvelope, type RatingContext, type RemoveMyRatingApplicationErrors, type RemoveMyRatingOptions, type RemoveMyRatingRequest, type RemoveMyRatingResponse, type RestoreInfo, type V1CommentResourceRating, type V1CommentResourceRatingOwnerOneOf, type V1CreateRatingRequest, type V1CreateRatingResponse, type V1GetMyRatingRequest, type V1GetMyRatingResponse, WebhookIdentityType, type WebhookIdentityTypeWithLiterals, createRating, getMyRating, getResourceSummary, onRatingCommentResourceRatingChanged, onRatingCommentResourceRatingDeleted, removeMyRating };