@wix/crm 1.0.71 → 1.0.73

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 (53) hide show
  1. package/build/cjs/index.d.ts +0 -1
  2. package/build/cjs/index.js +1 -2
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/index.typings.d.ts +0 -1
  5. package/build/cjs/index.typings.js +1 -2
  6. package/build/cjs/index.typings.js.map +1 -1
  7. package/build/cjs/meta.d.ts +0 -1
  8. package/build/cjs/meta.js +1 -2
  9. package/build/cjs/meta.js.map +1 -1
  10. package/build/cjs/src/contacts-v4-contact.universal.d.ts +5 -2
  11. package/build/cjs/src/contacts-v4-contact.universal.js.map +1 -1
  12. package/build/es/index.d.ts +0 -1
  13. package/build/es/index.js +0 -1
  14. package/build/es/index.js.map +1 -1
  15. package/build/es/index.typings.d.ts +0 -1
  16. package/build/es/index.typings.js +0 -1
  17. package/build/es/index.typings.js.map +1 -1
  18. package/build/es/meta.d.ts +0 -1
  19. package/build/es/meta.js +0 -1
  20. package/build/es/meta.js.map +1 -1
  21. package/build/es/src/contacts-v4-contact.universal.d.ts +5 -2
  22. package/build/es/src/contacts-v4-contact.universal.js.map +1 -1
  23. package/package.json +2 -2
  24. package/build/cjs/src/crm-tasks-v1-task.http.d.ts +0 -43
  25. package/build/cjs/src/crm-tasks-v1-task.http.js +0 -215
  26. package/build/cjs/src/crm-tasks-v1-task.http.js.map +0 -1
  27. package/build/cjs/src/crm-tasks-v1-task.meta.d.ts +0 -25
  28. package/build/cjs/src/crm-tasks-v1-task.meta.js +0 -119
  29. package/build/cjs/src/crm-tasks-v1-task.meta.js.map +0 -1
  30. package/build/cjs/src/crm-tasks-v1-task.public.d.ts +0 -12
  31. package/build/cjs/src/crm-tasks-v1-task.public.js +0 -40
  32. package/build/cjs/src/crm-tasks-v1-task.public.js.map +0 -1
  33. package/build/cjs/src/crm-tasks-v1-task.types.d.ts +0 -269
  34. package/build/cjs/src/crm-tasks-v1-task.types.js +0 -21
  35. package/build/cjs/src/crm-tasks-v1-task.types.js.map +0 -1
  36. package/build/cjs/src/crm-tasks-v1-task.universal.d.ts +0 -350
  37. package/build/cjs/src/crm-tasks-v1-task.universal.js +0 -361
  38. package/build/cjs/src/crm-tasks-v1-task.universal.js.map +0 -1
  39. package/build/es/src/crm-tasks-v1-task.http.d.ts +0 -43
  40. package/build/es/src/crm-tasks-v1-task.http.js +0 -207
  41. package/build/es/src/crm-tasks-v1-task.http.js.map +0 -1
  42. package/build/es/src/crm-tasks-v1-task.meta.d.ts +0 -25
  43. package/build/es/src/crm-tasks-v1-task.meta.js +0 -92
  44. package/build/es/src/crm-tasks-v1-task.meta.js.map +0 -1
  45. package/build/es/src/crm-tasks-v1-task.public.d.ts +0 -12
  46. package/build/es/src/crm-tasks-v1-task.public.js +0 -29
  47. package/build/es/src/crm-tasks-v1-task.public.js.map +0 -1
  48. package/build/es/src/crm-tasks-v1-task.types.d.ts +0 -269
  49. package/build/es/src/crm-tasks-v1-task.types.js +0 -18
  50. package/build/es/src/crm-tasks-v1-task.types.js.map +0 -1
  51. package/build/es/src/crm-tasks-v1-task.universal.d.ts +0 -350
  52. package/build/es/src/crm-tasks-v1-task.universal.js +0 -334
  53. package/build/es/src/crm-tasks-v1-task.universal.js.map +0 -1
@@ -1,350 +0,0 @@
1
- export declare const __debug: {
2
- verboseLogging: {
3
- on: () => boolean;
4
- off: () => boolean;
5
- };
6
- };
7
- export interface Task {
8
- /**
9
- * The ID of the task. Should not be populated in `createTask`.
10
- * @readonly
11
- */
12
- taskId?: string;
13
- /** The ID of the creator of the task. */
14
- creator?: Creator;
15
- /** The title of the task. */
16
- title?: string;
17
- /** Indicates if the task is completed. */
18
- isCompleted?: boolean;
19
- /** Expected due date for the task. */
20
- dueAt?: Date;
21
- /** Assigned contact ID for the task */
22
- contactId?: string;
23
- /** Task version. Incremented on each change. */
24
- version?: number;
25
- /** Assignee ID for the task. */
26
- assigneeId?: string;
27
- /** The labels assigned to the task */
28
- labels?: Label[];
29
- }
30
- export interface Creator {
31
- /**
32
- * Creator ID.
33
- * @readonly
34
- */
35
- _id?: string;
36
- /** Creator type */
37
- creatorType?: CreatorType;
38
- }
39
- export declare enum CreatorType {
40
- USER = "USER",
41
- APP = "APP"
42
- }
43
- export interface Label {
44
- /**
45
- * The ID of the label. Should not be populated in `createTask`.
46
- * @readonly
47
- */
48
- labelId?: string;
49
- /**
50
- * Label name.
51
- *
52
- * Max: 50 characters
53
- */
54
- name?: string;
55
- /** Label's color. */
56
- color?: string;
57
- }
58
- export interface GetTaskRequest {
59
- /** Task ID. */
60
- _id: string;
61
- }
62
- export interface GetTaskResponse {
63
- /** Task information. */
64
- task?: Task;
65
- }
66
- export interface GetTasksListRequest {
67
- /** Assigned contact ID for the task. Optional. */
68
- contactId?: string;
69
- /** Sort key. */
70
- key?: SortKey;
71
- }
72
- export declare enum SortKey {
73
- /** Sort by position */
74
- position = "position",
75
- /** Sort by date created */
76
- dateCreated = "dateCreated"
77
- }
78
- export interface GetTasksListResponse {
79
- /** Array of the site's tasks */
80
- tasks?: Task[];
81
- }
82
- export interface ListTasksRequest extends ListTasksRequestGetByOneOf {
83
- /** List params */
84
- params?: ListParams;
85
- /** Optional cursor */
86
- cursor?: string | null;
87
- }
88
- /** @oneof */
89
- export interface ListTasksRequestGetByOneOf {
90
- /** List params */
91
- params?: ListParams;
92
- /** Optional cursor */
93
- cursor?: string | null;
94
- }
95
- export interface ListParams {
96
- /** Filter */
97
- filter?: FilterBy;
98
- /** Order */
99
- order?: string[];
100
- /** Limit */
101
- limit?: number;
102
- /** Offset */
103
- offset?: number;
104
- }
105
- export interface FilterBy {
106
- /** List of contact IDs. */
107
- contactIds?: string[];
108
- /** From due date */
109
- fromDate?: Date;
110
- /** To due date */
111
- toDate?: Date;
112
- /** Completed status. */
113
- isCompleted?: boolean | null;
114
- /** Assignee ID. */
115
- assigneeId?: string | null;
116
- /** The title of the task. */
117
- title?: string | null;
118
- /** Task title contains substring */
119
- subtitle?: string | null;
120
- /** List of tasks IDs. */
121
- tasksIds?: string[];
122
- /** List of labels IDs. */
123
- labelIds?: string[];
124
- }
125
- export interface ListTasksResponse {
126
- /** Array of the site's tasks */
127
- tasks?: Task[];
128
- /** Pagination information */
129
- pagination?: Pagination;
130
- }
131
- export interface Pagination {
132
- /** Pagination offset */
133
- offset?: number;
134
- /** Pagination limit */
135
- limit?: number;
136
- /** Pagination total */
137
- total?: number;
138
- /** Optional cursor */
139
- cursor?: string | null;
140
- }
141
- export interface CountTasksRequest {
142
- /** Group by field */
143
- field?: GroupBy;
144
- /** Where strings */
145
- where?: string[];
146
- }
147
- export declare enum GroupBy {
148
- total = "total",
149
- contactId = "contactId"
150
- }
151
- export interface CountTasksResponse {
152
- /** Tasks in site */
153
- tasksInSite?: number;
154
- /** Map by requested field */
155
- byRequestedField?: Record<string, number>;
156
- }
157
- export interface CreateTaskRequest {
158
- /** Task information. */
159
- task?: TaskData;
160
- }
161
- export interface TaskData {
162
- /**
163
- * The title of the task.
164
- *
165
- * Max: 500 characters.
166
- */
167
- title?: string;
168
- /** Expected due date for the task. */
169
- dueAt?: Date;
170
- /** Assigned contact ID for the task. */
171
- contactId?: string;
172
- /** Assignee ID for the task. */
173
- assigneeId?: string;
174
- /** The label IDs assigned to the task. */
175
- labelIds?: string[];
176
- }
177
- export interface CreateTaskResponse {
178
- /** Task ID. */
179
- _id?: string;
180
- /** The task version. Incremented on each change */
181
- version?: number;
182
- }
183
- export interface TaskNotification {
184
- /** Instance ID of the task in Tasks App. */
185
- instanceId?: string;
186
- /** Task ID. */
187
- taskId?: string;
188
- /** The changed task */
189
- task?: Task;
190
- /** The action that was performed on the task */
191
- taskAction?: string;
192
- /** Set of updated fields */
193
- changes?: string[];
194
- }
195
- export interface UpdateTaskRequest {
196
- /** Task ID. */
197
- _id: string;
198
- /** Required fields. */
199
- fields?: string[];
200
- /** Task information. */
201
- task?: TaskData;
202
- }
203
- export interface UpdateTaskResponse {
204
- /** Task ID. */
205
- _id?: string;
206
- /** The task version. Incremented on each change */
207
- version?: number;
208
- }
209
- export interface CompleteTaskRequest {
210
- /** Task ID. */
211
- _id: string;
212
- /** Indicates whether the task is completed. */
213
- isCompleted?: boolean | null;
214
- }
215
- export interface CompleteTaskResponse {
216
- /** Task ID. */
217
- _id?: string;
218
- /** The task version. Incremented on each change */
219
- version?: number;
220
- }
221
- export interface MoveTaskRequest {
222
- /** Task ID. */
223
- _id?: string;
224
- /** Task ID of the task positioned before. */
225
- taskBeforeId?: string;
226
- }
227
- export interface MoveTaskResponse {
228
- /** Task ID. */
229
- _id?: string;
230
- /** The task version. Incremented on each change */
231
- version?: number;
232
- }
233
- export interface DeleteTaskRequest {
234
- /** Task ID. */
235
- _id: string;
236
- }
237
- export interface DeleteTaskResponse {
238
- /** Task ID. */
239
- _id?: string;
240
- /** The task version. Incremented on each change */
241
- version?: number;
242
- }
243
- export interface DeleteCompletedRequest {
244
- }
245
- export interface DeleteCompletedResponse {
246
- /** Array of deleted task IDs. */
247
- ids?: string[];
248
- }
249
- export interface GetTaskResponseNonNullableFields {
250
- task?: {
251
- taskId: string;
252
- creator?: {
253
- _id: string;
254
- creatorType: CreatorType;
255
- };
256
- title: string;
257
- isCompleted: boolean;
258
- contactId: string;
259
- version: number;
260
- assigneeId: string;
261
- labels: {
262
- labelId: string;
263
- name: string;
264
- color: string;
265
- }[];
266
- };
267
- }
268
- export interface CreateTaskResponseNonNullableFields {
269
- _id: string;
270
- version: number;
271
- }
272
- export interface UpdateTaskResponseNonNullableFields {
273
- _id: string;
274
- version: number;
275
- }
276
- export interface CompleteTaskResponseNonNullableFields {
277
- _id: string;
278
- version: number;
279
- }
280
- export interface DeleteTaskResponseNonNullableFields {
281
- _id: string;
282
- version: number;
283
- }
284
- /**
285
- * Gets a task by ID.
286
- *
287
- *
288
- * The `getTask()` function returns a Promise that resolves to the task with the given ID.
289
- * @public
290
- * @documentationMaturity preview
291
- * @requiredField _id
292
- * @param _id - Task ID.
293
- */
294
- export declare function getTask(_id: string): Promise<GetTaskResponse & GetTaskResponseNonNullableFields>;
295
- /**
296
- * Creates a new task.
297
- *
298
- *
299
- * The `createTask()` function returns a Promise that resolves to the ID of the created task.
300
- *
301
- * When creating a new task, the specified `task` object must contain a `title` value.
302
- * @public
303
- * @documentationMaturity preview
304
- * @requiredField task
305
- * @param task - Task information.
306
- */
307
- export declare function createTask(task: TaskData): Promise<CreateTaskResponse & CreateTaskResponseNonNullableFields>;
308
- /**
309
- * Updates the specified fields of an existing task.
310
- *
311
- *
312
- * The `updateTaskFields()` function returns a Promise that resolves to the ID of the updated task after it has been successfully updated.
313
- *
314
- * Only the properties in the `task` object are updated. All other properties remain the same.
315
- *
316
- * To remove a value from the task, pass its corresponding property with a value of `null`.
317
- * @public
318
- * @documentationMaturity preview
319
- * @requiredField _id
320
- * @requiredField fields
321
- * @requiredField task
322
- * @param _id - Task ID.
323
- * @param task - Task information.
324
- * @param fields - Required fields.
325
- */
326
- export declare function updateTaskFields(_id: string, fields: string[], task: TaskData): Promise<UpdateTaskResponse & UpdateTaskResponseNonNullableFields>;
327
- /**
328
- * Updates completed status of task.
329
- *
330
- *
331
- * The `updateTaskStatus()` function returns a Promise that resolves to the ID of the task whose completed status was updated.
332
- * @public
333
- * @documentationMaturity preview
334
- * @requiredField _id
335
- * @requiredField isCompleted
336
- * @param _id - Task ID.
337
- * @param isCompleted - Indicates whether the task is completed.
338
- */
339
- export declare function updateTaskStatus(_id: string, isCompleted: boolean | null): Promise<CompleteTaskResponse & CompleteTaskResponseNonNullableFields>;
340
- /**
341
- * Removes an existing task.
342
- *
343
- *
344
- * The `removeTask()` function returns a Promise that resolves to the ID of the removed task after it has been successfully removed.
345
- * @public
346
- * @documentationMaturity preview
347
- * @requiredField _id
348
- * @param _id - Task ID.
349
- */
350
- export declare function removeTask(_id: string): Promise<DeleteTaskResponse & DeleteTaskResponseNonNullableFields>;
@@ -1,361 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
- return new (P || (P = Promise))(function (resolve, reject) {
24
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27
- step((generator = generator.apply(thisArg, _arguments || [])).next());
28
- });
29
- };
30
- Object.defineProperty(exports, "__esModule", { value: true });
31
- exports.removeTask = exports.updateTaskStatus = exports.updateTaskFields = exports.createTask = exports.getTask = exports.GroupBy = exports.SortKey = exports.CreatorType = exports.__debug = void 0;
32
- const velo_1 = require("@wix/metro-runtime/velo");
33
- const ambassadorWixCrmTasksV1Task = __importStar(require("./crm-tasks-v1-task.http"));
34
- let __verbose = false;
35
- function __log(...args) {
36
- __verbose && console.log(...args);
37
- }
38
- function __inspect(obj) {
39
- return obj;
40
- }
41
- exports.__debug = {
42
- verboseLogging: {
43
- on: () => (__verbose = true),
44
- off: () => (__verbose = false),
45
- },
46
- };
47
- const _toVeloEntity = '$';
48
- const _fromVeloEntity = '$';
49
- var CreatorType;
50
- (function (CreatorType) {
51
- CreatorType["USER"] = "USER";
52
- CreatorType["APP"] = "APP";
53
- })(CreatorType = exports.CreatorType || (exports.CreatorType = {}));
54
- var SortKey;
55
- (function (SortKey) {
56
- /** Sort by position */
57
- SortKey["position"] = "position";
58
- /** Sort by date created */
59
- SortKey["dateCreated"] = "dateCreated";
60
- })(SortKey = exports.SortKey || (exports.SortKey = {}));
61
- var GroupBy;
62
- (function (GroupBy) {
63
- GroupBy["total"] = "total";
64
- GroupBy["contactId"] = "contactId";
65
- })(GroupBy = exports.GroupBy || (exports.GroupBy = {}));
66
- const _completeTaskRequest = {};
67
- const _completeTaskResponse = {};
68
- const _createTaskRequest = {};
69
- const _createTaskResponse = {};
70
- const _deleteTaskRequest = {};
71
- const _deleteTaskResponse = {};
72
- const _getTaskRequest = {};
73
- const _getTaskResponse = {};
74
- const _updateTaskRequest = {};
75
- const _updateTaskResponse = {};
76
- /**
77
- * Gets a task by ID.
78
- *
79
- *
80
- * The `getTask()` function returns a Promise that resolves to the task with the given ID.
81
- * @public
82
- * @documentationMaturity preview
83
- * @requiredField _id
84
- * @param _id - Task ID.
85
- */
86
- function getTask(_id) {
87
- var _a, _b, _c;
88
- return __awaiter(this, arguments, void 0, function* () {
89
- const requestTransformation = { id: '$[0]' };
90
- const responseTransformation = '$';
91
- // @ts-ignore
92
- const { httpClient, sideEffects } = arguments[1];
93
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
94
- rootSchema: _getTaskRequest,
95
- depSchemas: {},
96
- fqdnTransformation: {
97
- paths: [],
98
- transformation: _fromVeloEntity,
99
- },
100
- customTransformation: requestTransformation,
101
- });
102
- const { fromJSON } = (0, velo_1.serializer)({
103
- rootSchema: _getTaskResponse,
104
- depSchemas: {},
105
- fqdnTransformation: {
106
- paths: [...['task']],
107
- transformation: _toVeloEntity,
108
- },
109
- customTransformation: responseTransformation,
110
- });
111
- const payload = toAmbassadorRequest([_id]);
112
- const reqOpts = ambassadorWixCrmTasksV1Task.getTask(payload);
113
- __log(`"GetTask" sending request with: ${__inspect(reqOpts)}`);
114
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
115
- try {
116
- const result = yield httpClient.request(reqOpts);
117
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
118
- return fromJSON(result.data);
119
- }
120
- catch (err) {
121
- const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
122
- '_id',
123
- ]);
124
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
125
- throw transformedError;
126
- }
127
- });
128
- }
129
- exports.getTask = getTask;
130
- /**
131
- * Creates a new task.
132
- *
133
- *
134
- * The `createTask()` function returns a Promise that resolves to the ID of the created task.
135
- *
136
- * When creating a new task, the specified `task` object must contain a `title` value.
137
- * @public
138
- * @documentationMaturity preview
139
- * @requiredField task
140
- * @param task - Task information.
141
- */
142
- function createTask(task) {
143
- var _a, _b, _c;
144
- return __awaiter(this, arguments, void 0, function* () {
145
- const requestTransformation = { task: '$[0]' };
146
- const responseTransformation = '$';
147
- // @ts-ignore
148
- const { httpClient, sideEffects } = arguments[1];
149
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
150
- rootSchema: _createTaskRequest,
151
- depSchemas: {},
152
- fqdnTransformation: {
153
- paths: [],
154
- transformation: _fromVeloEntity,
155
- },
156
- customTransformation: requestTransformation,
157
- });
158
- const { fromJSON } = (0, velo_1.serializer)({
159
- rootSchema: _createTaskResponse,
160
- depSchemas: {},
161
- fqdnTransformation: {
162
- paths: [],
163
- transformation: _toVeloEntity,
164
- },
165
- customTransformation: responseTransformation,
166
- });
167
- const payload = toAmbassadorRequest([task]);
168
- const reqOpts = ambassadorWixCrmTasksV1Task.createTask(payload);
169
- __log(`"CreateTask" sending request with: ${__inspect(reqOpts)}`);
170
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
171
- try {
172
- const result = yield httpClient.request(reqOpts);
173
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
174
- return fromJSON(result.data);
175
- }
176
- catch (err) {
177
- const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
178
- 'task',
179
- ]);
180
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
181
- throw transformedError;
182
- }
183
- });
184
- }
185
- exports.createTask = createTask;
186
- /**
187
- * Updates the specified fields of an existing task.
188
- *
189
- *
190
- * The `updateTaskFields()` function returns a Promise that resolves to the ID of the updated task after it has been successfully updated.
191
- *
192
- * Only the properties in the `task` object are updated. All other properties remain the same.
193
- *
194
- * To remove a value from the task, pass its corresponding property with a value of `null`.
195
- * @public
196
- * @documentationMaturity preview
197
- * @requiredField _id
198
- * @requiredField fields
199
- * @requiredField task
200
- * @param _id - Task ID.
201
- * @param task - Task information.
202
- * @param fields - Required fields.
203
- */
204
- function updateTaskFields(_id, fields, task) {
205
- var _a, _b, _c;
206
- return __awaiter(this, arguments, void 0, function* () {
207
- const requestTransformation = { id: '$[0]', fields: '$[1]', task: '$[2]' };
208
- const responseTransformation = '$';
209
- // @ts-ignore
210
- const { httpClient, sideEffects } = arguments[3];
211
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
212
- rootSchema: _updateTaskRequest,
213
- depSchemas: {},
214
- fqdnTransformation: {
215
- paths: [],
216
- transformation: _fromVeloEntity,
217
- },
218
- customTransformation: requestTransformation,
219
- });
220
- const { fromJSON } = (0, velo_1.serializer)({
221
- rootSchema: _updateTaskResponse,
222
- depSchemas: {},
223
- fqdnTransformation: {
224
- paths: [],
225
- transformation: _toVeloEntity,
226
- },
227
- customTransformation: responseTransformation,
228
- });
229
- const payload = toAmbassadorRequest([_id, fields, task]);
230
- const reqOpts = ambassadorWixCrmTasksV1Task.updateTask(payload);
231
- __log(`"UpdateTask" sending request with: ${__inspect(reqOpts)}`);
232
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
233
- try {
234
- const result = yield httpClient.request(reqOpts);
235
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
236
- return fromJSON(result.data);
237
- }
238
- catch (err) {
239
- const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
240
- '_id',
241
- 'fields',
242
- 'task',
243
- ]);
244
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
245
- throw transformedError;
246
- }
247
- });
248
- }
249
- exports.updateTaskFields = updateTaskFields;
250
- /**
251
- * Updates completed status of task.
252
- *
253
- *
254
- * The `updateTaskStatus()` function returns a Promise that resolves to the ID of the task whose completed status was updated.
255
- * @public
256
- * @documentationMaturity preview
257
- * @requiredField _id
258
- * @requiredField isCompleted
259
- * @param _id - Task ID.
260
- * @param isCompleted - Indicates whether the task is completed.
261
- */
262
- function updateTaskStatus(_id, isCompleted) {
263
- var _a, _b, _c;
264
- return __awaiter(this, arguments, void 0, function* () {
265
- const requestTransformation = { id: '$[0]', isCompleted: '$[1]' };
266
- const responseTransformation = '$';
267
- // @ts-ignore
268
- const { httpClient, sideEffects } = arguments[2];
269
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
270
- rootSchema: _completeTaskRequest,
271
- depSchemas: {},
272
- fqdnTransformation: {
273
- paths: [],
274
- transformation: _fromVeloEntity,
275
- },
276
- customTransformation: requestTransformation,
277
- });
278
- const { fromJSON } = (0, velo_1.serializer)({
279
- rootSchema: _completeTaskResponse,
280
- depSchemas: {},
281
- fqdnTransformation: {
282
- paths: [],
283
- transformation: _toVeloEntity,
284
- },
285
- customTransformation: responseTransformation,
286
- });
287
- const payload = toAmbassadorRequest([_id, isCompleted]);
288
- const reqOpts = ambassadorWixCrmTasksV1Task.setCompletedStatus(payload);
289
- __log(`"SetCompletedStatus" sending request with: ${__inspect(reqOpts)}`);
290
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
291
- try {
292
- const result = yield httpClient.request(reqOpts);
293
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
294
- return fromJSON(result.data);
295
- }
296
- catch (err) {
297
- const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
298
- '_id',
299
- 'isCompleted',
300
- ]);
301
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
302
- throw transformedError;
303
- }
304
- });
305
- }
306
- exports.updateTaskStatus = updateTaskStatus;
307
- /**
308
- * Removes an existing task.
309
- *
310
- *
311
- * The `removeTask()` function returns a Promise that resolves to the ID of the removed task after it has been successfully removed.
312
- * @public
313
- * @documentationMaturity preview
314
- * @requiredField _id
315
- * @param _id - Task ID.
316
- */
317
- function removeTask(_id) {
318
- var _a, _b, _c;
319
- return __awaiter(this, arguments, void 0, function* () {
320
- const requestTransformation = { id: '$[0]' };
321
- const responseTransformation = '$';
322
- // @ts-ignore
323
- const { httpClient, sideEffects } = arguments[1];
324
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
325
- rootSchema: _deleteTaskRequest,
326
- depSchemas: {},
327
- fqdnTransformation: {
328
- paths: [],
329
- transformation: _fromVeloEntity,
330
- },
331
- customTransformation: requestTransformation,
332
- });
333
- const { fromJSON } = (0, velo_1.serializer)({
334
- rootSchema: _deleteTaskResponse,
335
- depSchemas: {},
336
- fqdnTransformation: {
337
- paths: [],
338
- transformation: _toVeloEntity,
339
- },
340
- customTransformation: responseTransformation,
341
- });
342
- const payload = toAmbassadorRequest([_id]);
343
- const reqOpts = ambassadorWixCrmTasksV1Task.deleteTask(payload);
344
- __log(`"DeleteTask" sending request with: ${__inspect(reqOpts)}`);
345
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
346
- try {
347
- const result = yield httpClient.request(reqOpts);
348
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
349
- return fromJSON(result.data);
350
- }
351
- catch (err) {
352
- const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
353
- '_id',
354
- ]);
355
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
356
- throw transformedError;
357
- }
358
- });
359
- }
360
- exports.removeTask = removeTask;
361
- //# sourceMappingURL=crm-tasks-v1-task.universal.js.map