@doist/comms-sdk 0.5.1 → 0.5.2
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.
|
@@ -106,7 +106,11 @@ class GroupsClient extends base_client_1.BaseClient {
|
|
|
106
106
|
* @param args.userId - The user ID to add.
|
|
107
107
|
*/
|
|
108
108
|
addUser(args) {
|
|
109
|
-
|
|
109
|
+
// The backend only exposes the plural `add_users` endpoint (routed via
|
|
110
|
+
// Todoist); there is no `add_user`. Delegate to `addUsers` so the wire
|
|
111
|
+
// contract lives in one place.
|
|
112
|
+
const { userId, ...rest } = args;
|
|
113
|
+
return this.addUsers({ ...rest, userIds: [userId] });
|
|
110
114
|
}
|
|
111
115
|
/**
|
|
112
116
|
* Adds multiple users to a group.
|
|
@@ -137,7 +141,11 @@ class GroupsClient extends base_client_1.BaseClient {
|
|
|
137
141
|
* @param args.userId - The user ID to remove.
|
|
138
142
|
*/
|
|
139
143
|
removeUser(args) {
|
|
140
|
-
|
|
144
|
+
// The backend only exposes the plural `remove_users` endpoint (routed
|
|
145
|
+
// via Todoist); there is no `remove_user`. Delegate to `removeUsers` so
|
|
146
|
+
// the wire contract lives in one place.
|
|
147
|
+
const { userId, ...rest } = args;
|
|
148
|
+
return this.removeUsers({ ...rest, userIds: [userId] });
|
|
141
149
|
}
|
|
142
150
|
/**
|
|
143
151
|
* Removes multiple users from a group.
|
|
@@ -181,7 +181,8 @@ class ThreadsClient extends base_client_1.BaseClient {
|
|
|
181
181
|
* @param args.objIndex - The index of the last known read message.
|
|
182
182
|
*/
|
|
183
183
|
markRead(args) {
|
|
184
|
-
|
|
184
|
+
const { id, ...rest } = args;
|
|
185
|
+
return this.simple('POST', 'mark_read', { threadId: id, ...rest }, entities_1.StatusOkSchema);
|
|
185
186
|
}
|
|
186
187
|
/**
|
|
187
188
|
* Marks a thread as unread.
|
|
@@ -191,7 +192,8 @@ class ThreadsClient extends base_client_1.BaseClient {
|
|
|
191
192
|
* @param args.objIndex - The index of the last unread message. Use -1 to mark the whole thread as unread.
|
|
192
193
|
*/
|
|
193
194
|
markUnread(args) {
|
|
194
|
-
|
|
195
|
+
const { id, ...rest } = args;
|
|
196
|
+
return this.simple('POST', 'mark_unread', { threadId: id, ...rest }, entities_1.StatusOkSchema);
|
|
195
197
|
}
|
|
196
198
|
/**
|
|
197
199
|
* Marks a thread as unread for others. Useful to notify others about thread changes.
|
|
@@ -103,7 +103,11 @@ export class GroupsClient extends BaseClient {
|
|
|
103
103
|
* @param args.userId - The user ID to add.
|
|
104
104
|
*/
|
|
105
105
|
addUser(args) {
|
|
106
|
-
|
|
106
|
+
// The backend only exposes the plural `add_users` endpoint (routed via
|
|
107
|
+
// Todoist); there is no `add_user`. Delegate to `addUsers` so the wire
|
|
108
|
+
// contract lives in one place.
|
|
109
|
+
const { userId, ...rest } = args;
|
|
110
|
+
return this.addUsers({ ...rest, userIds: [userId] });
|
|
107
111
|
}
|
|
108
112
|
/**
|
|
109
113
|
* Adds multiple users to a group.
|
|
@@ -134,7 +138,11 @@ export class GroupsClient extends BaseClient {
|
|
|
134
138
|
* @param args.userId - The user ID to remove.
|
|
135
139
|
*/
|
|
136
140
|
removeUser(args) {
|
|
137
|
-
|
|
141
|
+
// The backend only exposes the plural `remove_users` endpoint (routed
|
|
142
|
+
// via Todoist); there is no `remove_user`. Delegate to `removeUsers` so
|
|
143
|
+
// the wire contract lives in one place.
|
|
144
|
+
const { userId, ...rest } = args;
|
|
145
|
+
return this.removeUsers({ ...rest, userIds: [userId] });
|
|
138
146
|
}
|
|
139
147
|
/**
|
|
140
148
|
* Removes multiple users from a group.
|
|
@@ -178,7 +178,8 @@ export class ThreadsClient extends BaseClient {
|
|
|
178
178
|
* @param args.objIndex - The index of the last known read message.
|
|
179
179
|
*/
|
|
180
180
|
markRead(args) {
|
|
181
|
-
|
|
181
|
+
const { id, ...rest } = args;
|
|
182
|
+
return this.simple('POST', 'mark_read', { threadId: id, ...rest }, StatusOkSchema);
|
|
182
183
|
}
|
|
183
184
|
/**
|
|
184
185
|
* Marks a thread as unread.
|
|
@@ -188,7 +189,8 @@ export class ThreadsClient extends BaseClient {
|
|
|
188
189
|
* @param args.objIndex - The index of the last unread message. Use -1 to mark the whole thread as unread.
|
|
189
190
|
*/
|
|
190
191
|
markUnread(args) {
|
|
191
|
-
|
|
192
|
+
const { id, ...rest } = args;
|
|
193
|
+
return this.simple('POST', 'mark_unread', { threadId: id, ...rest }, StatusOkSchema);
|
|
192
194
|
}
|
|
193
195
|
/**
|
|
194
196
|
* Marks a thread as unread for others. Useful to notify others about thread changes.
|