sunsama-api 0.9.0 → 0.10.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,554 @@
1
+ "use strict";
2
+ /**
3
+ * GraphQL mutation for updating task text/title
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.UPDATE_TASK_TEXT_MUTATION = void 0;
7
+ const graphql_tag_1 = require("graphql-tag");
8
+ exports.UPDATE_TASK_TEXT_MUTATION = (0, graphql_tag_1.gql) `
9
+ mutation updateTaskText($input: UpdateTaskTextInput!) {
10
+ updateTaskText(input: $input) {
11
+ ...UpdateTaskPayload
12
+ __typename
13
+ }
14
+ }
15
+
16
+ fragment UpdateTaskPayload on UpdateTaskPayload {
17
+ updatedTask {
18
+ ...Task
19
+ __typename
20
+ }
21
+ updatedFields {
22
+ ...PartialTask
23
+ __typename
24
+ }
25
+ success
26
+ skipped
27
+ __typename
28
+ }
29
+
30
+ fragment Task on Task {
31
+ _id
32
+ groupId
33
+ taskType
34
+ streamIds
35
+ recommendedStreamId
36
+ eventInfo {
37
+ eventId
38
+ clone
39
+ __typename
40
+ }
41
+ seededEventIds
42
+ private
43
+ assigneeId
44
+ createdBy
45
+ integration {
46
+ ...TaskIntegration
47
+ __typename
48
+ }
49
+ deleted
50
+ text
51
+ notes
52
+ notesMarkdown
53
+ notesChecksum
54
+ editorVersion
55
+ collabSnapshot
56
+ completed
57
+ completedBy
58
+ completeDate
59
+ completeOn
60
+ archivedAt
61
+ duration
62
+ runDate {
63
+ startDate
64
+ endDate
65
+ __typename
66
+ }
67
+ snooze {
68
+ userId
69
+ date
70
+ until
71
+ __typename
72
+ }
73
+ timeHorizon {
74
+ type
75
+ relativeTo
76
+ __typename
77
+ }
78
+ dueDate
79
+ comments {
80
+ userId
81
+ text
82
+ markdown
83
+ editorVersion
84
+ groupId
85
+ createdAt
86
+ editedAt
87
+ deleted
88
+ file
89
+ fileMetadata {
90
+ url
91
+ filename
92
+ mimetype
93
+ size
94
+ width
95
+ height
96
+ __typename
97
+ }
98
+ __typename
99
+ }
100
+ orderings {
101
+ ordinal
102
+ panelDate
103
+ channelId
104
+ userId
105
+ __typename
106
+ }
107
+ backlogOrderings {
108
+ horizonType
109
+ position
110
+ streamId
111
+ __typename
112
+ }
113
+ subtasks {
114
+ _id
115
+ title
116
+ completedDate
117
+ completedBy
118
+ timeEstimate
119
+ actualTime {
120
+ ...TaskActualTime
121
+ __typename
122
+ }
123
+ snooze {
124
+ userId
125
+ date
126
+ until
127
+ __typename
128
+ }
129
+ scheduledTime {
130
+ ...TaskScheduledTime
131
+ __typename
132
+ }
133
+ integration {
134
+ ...TaskIntegration
135
+ __typename
136
+ }
137
+ mergedTaskId
138
+ recommendedTimeEstimate
139
+ __typename
140
+ }
141
+ subtasksCollapsed
142
+ sequence {
143
+ date
144
+ id
145
+ expiresDate
146
+ ruleString
147
+ searchable
148
+ forked
149
+ final
150
+ estimatedStart {
151
+ hour
152
+ minute
153
+ __typename
154
+ }
155
+ master
156
+ finalDate
157
+ template {
158
+ streamIds
159
+ private
160
+ text
161
+ notes
162
+ notesMarkdown
163
+ notesChecksum
164
+ editorVersion
165
+ subtasks {
166
+ _id
167
+ title
168
+ completedDate
169
+ completedBy
170
+ timeEstimate
171
+ actualTime {
172
+ ...TaskActualTime
173
+ __typename
174
+ }
175
+ __typename
176
+ }
177
+ timeEstimate
178
+ assigneeId
179
+ __typename
180
+ }
181
+ __typename
182
+ }
183
+ followers
184
+ recommendedTimeEstimate
185
+ timeEstimate
186
+ actualTime {
187
+ ...TaskActualTime
188
+ __typename
189
+ }
190
+ scheduledTime {
191
+ ...TaskScheduledTime
192
+ __typename
193
+ }
194
+ createdAt
195
+ lastModified
196
+ objectiveId
197
+ ritual {
198
+ id
199
+ period {
200
+ interval
201
+ startCalendarDay
202
+ endCalendarDay
203
+ __typename
204
+ }
205
+ __typename
206
+ }
207
+ __typename
208
+ }
209
+
210
+ fragment TaskActualTime on TaskActualTime {
211
+ userId
212
+ startDate
213
+ endDate
214
+ duration
215
+ isTimerEntry
216
+ __typename
217
+ }
218
+
219
+ fragment TaskScheduledTime on TaskScheduledTime {
220
+ eventId
221
+ serviceIds {
222
+ google
223
+ microsoft
224
+ microsoftUniqueId
225
+ apple
226
+ appleRecurrenceId
227
+ sunsama
228
+ __typename
229
+ }
230
+ calendarId
231
+ userId
232
+ startDate
233
+ endDate
234
+ isAllDay
235
+ importedFromCalendar
236
+ __typename
237
+ }
238
+
239
+ fragment TaskIntegration on TaskIntegration {
240
+ ... on TaskAsanaIntegration {
241
+ service
242
+ identifier {
243
+ id
244
+ url
245
+ accountId
246
+ __typename
247
+ }
248
+ __typename
249
+ }
250
+ ... on TaskTrelloIntegration {
251
+ service
252
+ identifier {
253
+ id
254
+ url
255
+ accountId
256
+ __typename
257
+ }
258
+ __typename
259
+ }
260
+ ... on TaskJiraIntegration {
261
+ service
262
+ identifier {
263
+ id
264
+ cloudId
265
+ accountId
266
+ url
267
+ __typename
268
+ }
269
+ __typename
270
+ }
271
+ ... on TaskGithubIntegration {
272
+ service
273
+ identifier {
274
+ id
275
+ repositoryOwnerLogin
276
+ repositoryName
277
+ number
278
+ type
279
+ url
280
+ __typename
281
+ }
282
+ __typename
283
+ }
284
+ ... on TaskTodoistIntegration {
285
+ service
286
+ identifier {
287
+ id
288
+ url
289
+ deepUrl
290
+ __typename
291
+ }
292
+ __typename
293
+ }
294
+ ... on TaskGoogleCalendarIntegration {
295
+ service
296
+ identifier {
297
+ sunsamaId
298
+ __typename
299
+ }
300
+ __typename
301
+ }
302
+ ... on TaskOutlookCalendarIntegration {
303
+ service
304
+ identifier {
305
+ sunsamaId
306
+ __typename
307
+ }
308
+ __typename
309
+ }
310
+ ... on TaskAppleCalendarIntegration {
311
+ service
312
+ identifier {
313
+ sunsamaId
314
+ __typename
315
+ }
316
+ __typename
317
+ }
318
+ ... on TaskSunsamaCalendarIntegration {
319
+ service
320
+ identifier {
321
+ sunsamaId
322
+ __typename
323
+ }
324
+ __typename
325
+ }
326
+ ... on TaskGmailIntegration {
327
+ service
328
+ identifier {
329
+ id
330
+ messageId
331
+ accountId
332
+ url
333
+ __typename
334
+ }
335
+ __typename
336
+ }
337
+ ... on TaskOutlookIntegration {
338
+ service
339
+ identifier {
340
+ id
341
+ internetMessageId
342
+ conversationId
343
+ accountId
344
+ url
345
+ __typename
346
+ }
347
+ __typename
348
+ }
349
+ ... on TaskSlackIntegration {
350
+ service
351
+ identifier {
352
+ permalink
353
+ notesMarkdown
354
+ __typename
355
+ }
356
+ __typename
357
+ }
358
+ ... on TaskNotionIntegration {
359
+ service
360
+ identifier {
361
+ id
362
+ workspaceId
363
+ url
364
+ deepUrl
365
+ __typename
366
+ }
367
+ __typename
368
+ }
369
+ ... on TaskClickUpIntegration {
370
+ service
371
+ identifier {
372
+ id
373
+ userId
374
+ teamId
375
+ url
376
+ __typename
377
+ }
378
+ __typename
379
+ }
380
+ ... on TaskGitlabIntegration {
381
+ service
382
+ identifier {
383
+ id
384
+ __typename
385
+ }
386
+ __typename
387
+ }
388
+ ... on TaskEmailIntegration {
389
+ service
390
+ identifier {
391
+ id
392
+ __typename
393
+ }
394
+ content {
395
+ subject
396
+ text
397
+ html
398
+ from {
399
+ name
400
+ email
401
+ __typename
402
+ }
403
+ date
404
+ __typename
405
+ }
406
+ __typename
407
+ }
408
+ ... on TaskLinearIntegration {
409
+ service
410
+ identifier {
411
+ id
412
+ url
413
+ identifier
414
+ linearUserId
415
+ linearOrganizationId
416
+ number
417
+ _version
418
+ __typename
419
+ }
420
+ __typename
421
+ }
422
+ ... on TaskMondayIntegration {
423
+ service
424
+ identifier {
425
+ id
426
+ boardId
427
+ mondayAccountId
428
+ url
429
+ __typename
430
+ }
431
+ __typename
432
+ }
433
+ ... on TaskWebsiteIntegration {
434
+ service
435
+ identifier {
436
+ url
437
+ private
438
+ canonicalUrl
439
+ description
440
+ faviconUrl
441
+ imageUrl
442
+ siteName
443
+ title
444
+ __typename
445
+ }
446
+ __typename
447
+ }
448
+ ... on TaskLoomVideoIntegration {
449
+ service
450
+ identifier {
451
+ url
452
+ videoId
453
+ title
454
+ description
455
+ thumbnail {
456
+ width
457
+ height
458
+ url
459
+ __typename
460
+ }
461
+ __typename
462
+ }
463
+ __typename
464
+ }
465
+ ... on TaskMicrosoftTeamsIntegration {
466
+ service
467
+ identifier {
468
+ permalink
469
+ notesMarkdown
470
+ __typename
471
+ }
472
+ __typename
473
+ }
474
+ ... on TaskAppleRemindersIntegration {
475
+ service
476
+ identifier {
477
+ id
478
+ listId
479
+ autoImported
480
+ __typename
481
+ }
482
+ __typename
483
+ }
484
+ ... on TaskGoogleTasksIntegration {
485
+ service
486
+ identifier {
487
+ id
488
+ listId
489
+ accountId
490
+ __typename
491
+ }
492
+ __typename
493
+ }
494
+ ... on TaskMicrosoftToDoIntegration {
495
+ service
496
+ identifier {
497
+ id
498
+ listId
499
+ accountId
500
+ parentTaskId
501
+ __typename
502
+ }
503
+ __typename
504
+ }
505
+ ... on TaskSunsamaTaskIntegration {
506
+ service
507
+ identifier {
508
+ taskId
509
+ groupId
510
+ sunsamaUserId
511
+ __typename
512
+ }
513
+ __typename
514
+ }
515
+ __typename
516
+ }
517
+
518
+ fragment PartialTask on PartialTask {
519
+ _id
520
+ recommendedStreamId
521
+ streamIds
522
+ recommendedTimeEstimate
523
+ subtasks {
524
+ _id
525
+ title
526
+ completedDate
527
+ completedBy
528
+ timeEstimate
529
+ actualTime {
530
+ ...TaskActualTime
531
+ __typename
532
+ }
533
+ snooze {
534
+ userId
535
+ date
536
+ until
537
+ __typename
538
+ }
539
+ scheduledTime {
540
+ ...TaskScheduledTime
541
+ __typename
542
+ }
543
+ integration {
544
+ ...TaskIntegration
545
+ __typename
546
+ }
547
+ mergedTaskId
548
+ recommendedTimeEstimate
549
+ __typename
550
+ }
551
+ __typename
552
+ }
553
+ `;
554
+ //# sourceMappingURL=updateTaskText.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateTaskText.js","sourceRoot":"","sources":["../../../../src/queries/mutations/updateTaskText.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,6CAAkC;AAErB,QAAA,yBAAyB,GAAG,IAAA,iBAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiiB3C,CAAC"}
@@ -7,7 +7,7 @@ import { print } from 'graphql';
7
7
  import { Cookie, CookieJar } from 'tough-cookie';
8
8
  import * as Y from 'yjs';
9
9
  import { SunsamaAuthError } from '../errors/index.js';
10
- import { CREATE_TASK_MUTATION, GET_ARCHIVED_TASKS_QUERY, GET_STREAMS_BY_GROUP_ID_QUERY, GET_TASK_BY_ID_QUERY, GET_TASKS_BACKLOG_QUERY, GET_TASKS_BY_DAY_QUERY, GET_USER_QUERY, UPDATE_TASK_COMPLETE_MUTATION, UPDATE_TASK_DELETE_MUTATION, UPDATE_TASK_NOTES_MUTATION, UPDATE_TASK_PLANNED_TIME_MUTATION, UPDATE_TASK_SNOOZE_DATE_MUTATION, UPDATE_TASK_DUE_DATE_MUTATION, } from '../queries/index.js';
10
+ import { CREATE_TASK_MUTATION, GET_ARCHIVED_TASKS_QUERY, GET_STREAMS_BY_GROUP_ID_QUERY, GET_TASK_BY_ID_QUERY, GET_TASKS_BACKLOG_QUERY, GET_TASKS_BY_DAY_QUERY, GET_USER_QUERY, UPDATE_TASK_COMPLETE_MUTATION, UPDATE_TASK_DELETE_MUTATION, UPDATE_TASK_NOTES_MUTATION, UPDATE_TASK_PLANNED_TIME_MUTATION, UPDATE_TASK_SNOOZE_DATE_MUTATION, UPDATE_TASK_DUE_DATE_MUTATION, UPDATE_TASK_TEXT_MUTATION, } from '../queries/index.js';
11
11
  import { validateUpdateTaskCompleteArgs, toISOString, htmlToMarkdown, markdownToHtml, } from '../utils/index.js';
12
12
  /**
13
13
  * Main Sunsama API client class
@@ -978,6 +978,54 @@ export class SunsamaClient {
978
978
  }
979
979
  return response.data.updateTaskDueDate;
980
980
  }
981
+ /**
982
+ * Updates the text/title of a task
983
+ *
984
+ * This method allows you to update the main text or title of a task. You can optionally
985
+ * specify a recommended stream ID for the task.
986
+ *
987
+ * @param taskId - The ID of the task to update
988
+ * @param text - The new text/title for the task
989
+ * @param options - Additional options for the operation
990
+ * @returns The update result with success status
991
+ * @throws SunsamaAuthError if not authenticated or request fails
992
+ *
993
+ * @example
994
+ * ```typescript
995
+ * // Update task text to a new title
996
+ * const result = await client.updateTaskText('taskId123', 'Updated task title');
997
+ *
998
+ * // Update with recommended stream ID
999
+ * const result = await client.updateTaskText('taskId123', 'Task with stream', {
1000
+ * recommendedStreamId: 'stream-id-123'
1001
+ * });
1002
+ *
1003
+ * // Get full response payload instead of limited response
1004
+ * const result = await client.updateTaskText('taskId123', 'New title', {
1005
+ * limitResponsePayload: false
1006
+ * });
1007
+ * ```
1008
+ */
1009
+ async updateTaskText(taskId, text, options) {
1010
+ const variables = {
1011
+ input: {
1012
+ taskId,
1013
+ text,
1014
+ recommendedStreamId: options?.recommendedStreamId || null,
1015
+ limitResponsePayload: options?.limitResponsePayload ?? true,
1016
+ },
1017
+ };
1018
+ const request = {
1019
+ operationName: 'updateTaskText',
1020
+ variables,
1021
+ query: UPDATE_TASK_TEXT_MUTATION,
1022
+ };
1023
+ const response = await this.graphqlRequest(request);
1024
+ if (!response.data) {
1025
+ throw new SunsamaAuthError('No response data received');
1026
+ }
1027
+ return response.data.updateTaskText;
1028
+ }
981
1029
  /**
982
1030
  * Creates an updated collaborative editing snapshot based on existing state
983
1031
  *