@nurama/sdk 0.0.0-stage → 1.4.1
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.
- package/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +1080 -2
- package/dist/BotClient.d.ts +66 -0
- package/dist/BotClient.d.ts.map +1 -0
- package/dist/BotClient.js +68 -0
- package/dist/BotClient.js.map +1 -0
- package/dist/NuramaClient.d.ts +480 -0
- package/dist/NuramaClient.d.ts.map +1 -0
- package/dist/NuramaClient.js +902 -0
- package/dist/NuramaClient.js.map +1 -0
- package/dist/browser/nurama-bot-sdk.js +12051 -0
- package/dist/browser/nurama-bot-sdk.min.js +1 -0
- package/dist/browser/nurama-sdk.js +12003 -0
- package/dist/browser/nurama-sdk.min.js +1 -0
- package/dist/routes/ai.d.ts +280 -0
- package/dist/routes/ai.d.ts.map +1 -0
- package/dist/routes/ai.js +173 -0
- package/dist/routes/ai.js.map +1 -0
- package/dist/routes/asset.d.ts +493 -0
- package/dist/routes/asset.d.ts.map +1 -0
- package/dist/routes/asset.js +848 -0
- package/dist/routes/asset.js.map +1 -0
- package/dist/routes/auth.d.ts +218 -0
- package/dist/routes/auth.d.ts.map +1 -0
- package/dist/routes/auth.js +454 -0
- package/dist/routes/auth.js.map +1 -0
- package/dist/routes/blogPosts.d.ts +17 -0
- package/dist/routes/blogPosts.d.ts.map +1 -0
- package/dist/routes/blogPosts.js +29 -0
- package/dist/routes/blogPosts.js.map +1 -0
- package/dist/routes/board.d.ts +187 -0
- package/dist/routes/board.d.ts.map +1 -0
- package/dist/routes/board.js +270 -0
- package/dist/routes/board.js.map +1 -0
- package/dist/routes/bot.d.ts +202 -0
- package/dist/routes/bot.d.ts.map +1 -0
- package/dist/routes/bot.js +229 -0
- package/dist/routes/bot.js.map +1 -0
- package/dist/routes/chat.d.ts +842 -0
- package/dist/routes/chat.d.ts.map +1 -0
- package/dist/routes/chat.js +863 -0
- package/dist/routes/chat.js.map +1 -0
- package/dist/routes/chatAi.d.ts +51 -0
- package/dist/routes/chatAi.d.ts.map +1 -0
- package/dist/routes/chatAi.js +109 -0
- package/dist/routes/chatAi.js.map +1 -0
- package/dist/routes/config.d.ts +11 -0
- package/dist/routes/config.d.ts.map +1 -0
- package/dist/routes/config.js +24 -0
- package/dist/routes/config.js.map +1 -0
- package/dist/routes/convo.d.ts +169 -0
- package/dist/routes/convo.d.ts.map +1 -0
- package/dist/routes/convo.js +284 -0
- package/dist/routes/convo.js.map +1 -0
- package/dist/routes/credits.d.ts +82 -0
- package/dist/routes/credits.d.ts.map +1 -0
- package/dist/routes/credits.js +49 -0
- package/dist/routes/credits.js.map +1 -0
- package/dist/routes/device.d.ts +74 -0
- package/dist/routes/device.d.ts.map +1 -0
- package/dist/routes/device.js +122 -0
- package/dist/routes/device.js.map +1 -0
- package/dist/routes/folder.d.ts +75 -0
- package/dist/routes/folder.d.ts.map +1 -0
- package/dist/routes/folder.js +99 -0
- package/dist/routes/folder.js.map +1 -0
- package/dist/routes/invite.d.ts +61 -0
- package/dist/routes/invite.d.ts.map +1 -0
- package/dist/routes/invite.js +86 -0
- package/dist/routes/invite.js.map +1 -0
- package/dist/routes/joinLink.d.ts +88 -0
- package/dist/routes/joinLink.d.ts.map +1 -0
- package/dist/routes/joinLink.js +205 -0
- package/dist/routes/joinLink.js.map +1 -0
- package/dist/routes/membership.d.ts +116 -0
- package/dist/routes/membership.d.ts.map +1 -0
- package/dist/routes/membership.js +183 -0
- package/dist/routes/membership.js.map +1 -0
- package/dist/routes/notification.d.ts +103 -0
- package/dist/routes/notification.d.ts.map +1 -0
- package/dist/routes/notification.js +89 -0
- package/dist/routes/notification.js.map +1 -0
- package/dist/routes/oauthGrant.d.ts +45 -0
- package/dist/routes/oauthGrant.d.ts.map +1 -0
- package/dist/routes/oauthGrant.js +32 -0
- package/dist/routes/oauthGrant.js.map +1 -0
- package/dist/routes/payment.d.ts +56 -0
- package/dist/routes/payment.d.ts.map +1 -0
- package/dist/routes/payment.js +78 -0
- package/dist/routes/payment.js.map +1 -0
- package/dist/routes/product.d.ts +43 -0
- package/dist/routes/product.d.ts.map +1 -0
- package/dist/routes/product.js +53 -0
- package/dist/routes/product.js.map +1 -0
- package/dist/routes/project.d.ts +821 -0
- package/dist/routes/project.d.ts.map +1 -0
- package/dist/routes/project.js +1153 -0
- package/dist/routes/project.js.map +1 -0
- package/dist/routes/public.d.ts +269 -0
- package/dist/routes/public.d.ts.map +1 -0
- package/dist/routes/public.js +412 -0
- package/dist/routes/public.js.map +1 -0
- package/dist/routes/scratch.d.ts +70 -0
- package/dist/routes/scratch.d.ts.map +1 -0
- package/dist/routes/scratch.js +67 -0
- package/dist/routes/scratch.js.map +1 -0
- package/dist/routes/settings.d.ts +102 -0
- package/dist/routes/settings.d.ts.map +1 -0
- package/dist/routes/settings.js +94 -0
- package/dist/routes/settings.js.map +1 -0
- package/dist/routes/shortlink.d.ts +79 -0
- package/dist/routes/shortlink.d.ts.map +1 -0
- package/dist/routes/shortlink.js +25 -0
- package/dist/routes/shortlink.js.map +1 -0
- package/dist/routes/socket.d.ts +108 -0
- package/dist/routes/socket.d.ts.map +1 -0
- package/dist/routes/socket.js +573 -0
- package/dist/routes/socket.js.map +1 -0
- package/dist/routes/storage.d.ts +44 -0
- package/dist/routes/storage.d.ts.map +1 -0
- package/dist/routes/storage.js +49 -0
- package/dist/routes/storage.js.map +1 -0
- package/dist/routes/subscription.d.ts +184 -0
- package/dist/routes/subscription.d.ts.map +1 -0
- package/dist/routes/subscription.js +219 -0
- package/dist/routes/subscription.js.map +1 -0
- package/dist/routes/supportChat.d.ts +40 -0
- package/dist/routes/supportChat.d.ts.map +1 -0
- package/dist/routes/supportChat.js +53 -0
- package/dist/routes/supportChat.js.map +1 -0
- package/dist/routes/supportTicket.d.ts +89 -0
- package/dist/routes/supportTicket.d.ts.map +1 -0
- package/dist/routes/supportTicket.js +54 -0
- package/dist/routes/supportTicket.js.map +1 -0
- package/dist/routes/tag.d.ts +72 -0
- package/dist/routes/tag.d.ts.map +1 -0
- package/dist/routes/tag.js +81 -0
- package/dist/routes/tag.js.map +1 -0
- package/dist/routes/task.d.ts +252 -0
- package/dist/routes/task.d.ts.map +1 -0
- package/dist/routes/task.js +284 -0
- package/dist/routes/task.js.map +1 -0
- package/dist/routes/taskRelation.d.ts +80 -0
- package/dist/routes/taskRelation.d.ts.map +1 -0
- package/dist/routes/taskRelation.js +71 -0
- package/dist/routes/taskRelation.js.map +1 -0
- package/dist/routes/token.d.ts +97 -0
- package/dist/routes/token.d.ts.map +1 -0
- package/dist/routes/token.js +73 -0
- package/dist/routes/token.js.map +1 -0
- package/dist/routes/user.d.ts +112 -0
- package/dist/routes/user.d.ts.map +1 -0
- package/dist/routes/user.js +151 -0
- package/dist/routes/user.js.map +1 -0
- package/dist/routes/version.d.ts +42 -0
- package/dist/routes/version.d.ts.map +1 -0
- package/dist/routes/version.js +38 -0
- package/dist/routes/version.js.map +1 -0
- package/dist/routes/webhook.d.ts +170 -0
- package/dist/routes/webhook.d.ts.map +1 -0
- package/dist/routes/webhook.js +173 -0
- package/dist/routes/webhook.js.map +1 -0
- package/dist/routes/workspace.d.ts +120 -0
- package/dist/routes/workspace.d.ts.map +1 -0
- package/dist/routes/workspace.js +199 -0
- package/dist/routes/workspace.js.map +1 -0
- package/dist/utils/uploadSessionManager.d.ts +133 -0
- package/dist/utils/uploadSessionManager.d.ts.map +1 -0
- package/dist/utils/uploadSessionManager.js +321 -0
- package/dist/utils/uploadSessionManager.js.map +1 -0
- package/dist/utils/urlParams.d.ts +35 -0
- package/dist/utils/urlParams.d.ts.map +1 -0
- package/dist/utils/urlParams.js +146 -0
- package/dist/utils/urlParams.js.map +1 -0
- package/dist/version.d.ts +15 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +12 -0
- package/dist/version.js.map +1 -0
- package/package.json +87 -3
- package/src/BotClient.ts +113 -0
- package/src/NuramaClient.ts +1253 -0
- package/src/bot-browser-entry.js +15 -0
- package/src/browser-entry.js +20 -0
- package/src/routes/ai.ts +378 -0
- package/src/routes/asset.ts +1104 -0
- package/src/routes/auth.ts +587 -0
- package/src/routes/blogPosts.ts +29 -0
- package/src/routes/board.ts +403 -0
- package/src/routes/bot.ts +356 -0
- package/src/routes/chat.ts +1292 -0
- package/src/routes/chatAi.ts +125 -0
- package/src/routes/config.ts +31 -0
- package/src/routes/convo.ts +321 -0
- package/src/routes/credits.ts +112 -0
- package/src/routes/device.ts +133 -0
- package/src/routes/folder.ts +154 -0
- package/src/routes/invite.ts +133 -0
- package/src/routes/joinLink.ts +233 -0
- package/src/routes/membership.ts +237 -0
- package/src/routes/notification.ts +166 -0
- package/src/routes/oauthGrant.ts +64 -0
- package/src/routes/payment.ts +104 -0
- package/src/routes/product.ts +67 -0
- package/src/routes/project.ts +1528 -0
- package/src/routes/public.ts +496 -0
- package/src/routes/scratch.ts +94 -0
- package/src/routes/settings.ts +152 -0
- package/src/routes/shortlink.ts +90 -0
- package/src/routes/socket.ts +757 -0
- package/src/routes/storage.ts +83 -0
- package/src/routes/subscription.ts +307 -0
- package/src/routes/supportChat.ts +62 -0
- package/src/routes/supportTicket.ts +114 -0
- package/src/routes/tag.ts +131 -0
- package/src/routes/task.ts +431 -0
- package/src/routes/taskRelation.ts +125 -0
- package/src/routes/token.ts +152 -0
- package/src/routes/user.ts +214 -0
- package/src/routes/version.ts +62 -0
- package/src/routes/webhook.ts +295 -0
- package/src/routes/workspace.ts +223 -0
- package/src/utils/uploadSessionManager.ts +407 -0
- package/src/utils/urlParams.ts +181 -0
- package/src/version.ts +22 -0
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
import NuramaClient from '../NuramaClient.js';
|
|
2
|
+
import {
|
|
3
|
+
type Board,
|
|
4
|
+
type BoardColumn,
|
|
5
|
+
type BoardWithTasks,
|
|
6
|
+
type Task,
|
|
7
|
+
} from '@nurama/types';
|
|
8
|
+
|
|
9
|
+
// --- Request Body Interfaces ---
|
|
10
|
+
|
|
11
|
+
export interface CreateBoardData {
|
|
12
|
+
projectId: string;
|
|
13
|
+
name: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
visibility?: ('creator' | 'reviewer')[];
|
|
16
|
+
columns?: {
|
|
17
|
+
name: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
color?: string;
|
|
20
|
+
isDefault?: boolean;
|
|
21
|
+
taskStatus?: 'pending' | 'inProgress' | 'complete' | 'closed' | null;
|
|
22
|
+
sortOrder?: number;
|
|
23
|
+
}[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface UpdateBoardData {
|
|
27
|
+
name?: string;
|
|
28
|
+
description?: string | null;
|
|
29
|
+
visibility?: ('creator' | 'reviewer')[];
|
|
30
|
+
status?: 'active' | 'archived';
|
|
31
|
+
sortOrder?: number;
|
|
32
|
+
/**
|
|
33
|
+
* When narrowing visibility, opt into automatic cleanup of dependent tasks,
|
|
34
|
+
* assignees, and relations. If omitted (or false) and dependents exist, the
|
|
35
|
+
* server returns 409 with a structured `errorData.blockers` payload.
|
|
36
|
+
*/
|
|
37
|
+
cascade?: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface AddColumnData {
|
|
41
|
+
name: string;
|
|
42
|
+
description?: string;
|
|
43
|
+
color?: string;
|
|
44
|
+
isDefault?: boolean;
|
|
45
|
+
taskStatus?: 'pending' | 'inProgress' | 'complete' | 'closed' | null;
|
|
46
|
+
sortOrder?: number;
|
|
47
|
+
/** When true, reviewer-role users may create tasks in this column on a reviewer-visibility board. */
|
|
48
|
+
reviewersCanContribute?: boolean;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface UpdateColumnData {
|
|
52
|
+
name?: string;
|
|
53
|
+
description?: string | null;
|
|
54
|
+
color?: string | null;
|
|
55
|
+
isDefault?: boolean;
|
|
56
|
+
taskStatus?: 'pending' | 'inProgress' | 'complete' | 'closed' | null;
|
|
57
|
+
sortOrder?: number;
|
|
58
|
+
/** When true, reviewer-role users may create tasks in this column on a reviewer-visibility board. */
|
|
59
|
+
reviewersCanContribute?: boolean;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface ReorderColumnsData {
|
|
63
|
+
columns: { id: string; sortOrder: number }[];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface CreateBoardTaskData {
|
|
67
|
+
subject: string;
|
|
68
|
+
description?: string;
|
|
69
|
+
assignedToId?: string;
|
|
70
|
+
columnId?: string;
|
|
71
|
+
/** Optional announce flag. When supplied, after the task is created
|
|
72
|
+
* the server posts a Nu reply in `chatId` threaded under `messageId`
|
|
73
|
+
* with this task as a single taskCard and links them via TaskRelation.
|
|
74
|
+
* Mirrors the same flag on `tasks.bulkCreate`. */
|
|
75
|
+
announce?: {
|
|
76
|
+
chatId: string;
|
|
77
|
+
messageId: string;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface AddExistingTaskData {
|
|
82
|
+
taskId: string;
|
|
83
|
+
columnId?: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface MoveTaskData {
|
|
87
|
+
/** Required for same-board moves; optional when `targetBoardId` is
|
|
88
|
+
* set (server defaults to the target board's default column). */
|
|
89
|
+
columnId?: string;
|
|
90
|
+
sortOrder?: number;
|
|
91
|
+
/** When supplied AND different from the URL `boardId`, the server
|
|
92
|
+
* performs a cross-board move — `boardId` and `columnId` are
|
|
93
|
+
* updated together. Omit for the original same-board move. */
|
|
94
|
+
targetBoardId?: string;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface UpdateTaskDetailsData {
|
|
98
|
+
subject?: string;
|
|
99
|
+
description?: string | null;
|
|
100
|
+
assignedToId?: string | null;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface LinkTaskData {
|
|
104
|
+
linkedTaskId: string;
|
|
105
|
+
linkType?: 'related' | 'blocks' | 'blockedBy' | 'duplicate';
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// --- Method Definitions ---
|
|
109
|
+
|
|
110
|
+
export default function createBoardMethods(client: NuramaClient) {
|
|
111
|
+
return {
|
|
112
|
+
// ========================================================================
|
|
113
|
+
// Board CRUD
|
|
114
|
+
// ========================================================================
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Create a new board inside a project. If `columns` are omitted the
|
|
118
|
+
* server seeds the standard four-column layout.
|
|
119
|
+
*/
|
|
120
|
+
async createBoard(data: CreateBoardData): Promise<Board> {
|
|
121
|
+
if (!data.projectId) throw new Error('projectId is required.');
|
|
122
|
+
if (!data.name) throw new Error('name is required.');
|
|
123
|
+
return client._request<Board>({
|
|
124
|
+
method: 'POST',
|
|
125
|
+
endpoint: '/v1/boards/',
|
|
126
|
+
body: data,
|
|
127
|
+
sendJWT: true,
|
|
128
|
+
});
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* List boards in a project. Filters by visibility, free-text search,
|
|
133
|
+
* and tag ids.
|
|
134
|
+
*/
|
|
135
|
+
async getProjectBoards(projectId: string, params?: { visibility?: string; search?: string; tags?: string[] }): Promise<Board[]> {
|
|
136
|
+
if (!projectId) throw new Error('projectId is required.');
|
|
137
|
+
return client._request<Board[]>({
|
|
138
|
+
method: 'GET',
|
|
139
|
+
endpoint: `/v1/boards/project/${projectId}`,
|
|
140
|
+
params,
|
|
141
|
+
sendJWT: true,
|
|
142
|
+
});
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* List every task in a project across all boards. Use `boardId:
|
|
147
|
+
* 'unassigned'` to fetch only tasks not yet placed on a board.
|
|
148
|
+
*/
|
|
149
|
+
async getProjectTasks(projectId: string, params?: {
|
|
150
|
+
search?: string;
|
|
151
|
+
status?: string;
|
|
152
|
+
boardId?: string | 'unassigned';
|
|
153
|
+
columnId?: string;
|
|
154
|
+
assignedToId?: string;
|
|
155
|
+
visibility?: string;
|
|
156
|
+
tags?: string[];
|
|
157
|
+
page?: number;
|
|
158
|
+
limit?: number;
|
|
159
|
+
sort?: Record<string, 1 | -1>;
|
|
160
|
+
}): Promise<any> {
|
|
161
|
+
if (!projectId) throw new Error('projectId is required.');
|
|
162
|
+
return client._request<any>({
|
|
163
|
+
method: 'GET',
|
|
164
|
+
endpoint: `/v1/boards/project/${projectId}/tasks`,
|
|
165
|
+
params,
|
|
166
|
+
sendJWT: true,
|
|
167
|
+
});
|
|
168
|
+
},
|
|
169
|
+
|
|
170
|
+
/** Fetch a board with its columns and tasks populated. */
|
|
171
|
+
async getBoard(boardId: string): Promise<BoardWithTasks> {
|
|
172
|
+
if (!boardId) throw new Error('boardId is required.');
|
|
173
|
+
return client._request<BoardWithTasks>({
|
|
174
|
+
method: 'GET',
|
|
175
|
+
endpoint: `/v1/boards/${boardId}`,
|
|
176
|
+
sendJWT: true,
|
|
177
|
+
});
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Update a board's metadata. Set `cascade: true` to opt into
|
|
182
|
+
* automatic cleanup of dependent tasks when narrowing visibility;
|
|
183
|
+
* otherwise the server returns 409 with a `blockers` payload.
|
|
184
|
+
*/
|
|
185
|
+
async updateBoard(boardId: string, data: UpdateBoardData): Promise<Board> {
|
|
186
|
+
if (!boardId) throw new Error('boardId is required.');
|
|
187
|
+
return client._request<Board>({
|
|
188
|
+
method: 'PUT',
|
|
189
|
+
endpoint: `/v1/boards/${boardId}`,
|
|
190
|
+
body: data,
|
|
191
|
+
sendJWT: true,
|
|
192
|
+
});
|
|
193
|
+
},
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Delete a board. `disposition` controls what happens to its tasks:
|
|
197
|
+
* `unassign` (default — tasks survive boardless), `delete`, or
|
|
198
|
+
* `reassign` to another board/column.
|
|
199
|
+
*/
|
|
200
|
+
async deleteBoard(
|
|
201
|
+
boardId: string,
|
|
202
|
+
body?: {
|
|
203
|
+
disposition?: 'unassign' | 'delete' | 'reassign';
|
|
204
|
+
targetBoardId?: string;
|
|
205
|
+
targetColumnId?: string;
|
|
206
|
+
}
|
|
207
|
+
): Promise<{ message: string; disposition: string; deletedTaskIds: string[]; reassignedTaskIds: string[] }> {
|
|
208
|
+
if (!boardId) throw new Error('boardId is required.');
|
|
209
|
+
return client._request({
|
|
210
|
+
method: 'DELETE',
|
|
211
|
+
endpoint: `/v1/boards/${boardId}`,
|
|
212
|
+
body: body && Object.keys(body).length > 0 ? body : undefined,
|
|
213
|
+
sendJWT: true,
|
|
214
|
+
});
|
|
215
|
+
},
|
|
216
|
+
|
|
217
|
+
// ========================================================================
|
|
218
|
+
// Column Operations
|
|
219
|
+
// ========================================================================
|
|
220
|
+
|
|
221
|
+
/** Add a column to a board. Appended at the end unless `sortOrder` is provided. */
|
|
222
|
+
async addColumn(boardId: string, data: AddColumnData): Promise<BoardColumn> {
|
|
223
|
+
if (!boardId) throw new Error('boardId is required.');
|
|
224
|
+
if (!data.name) throw new Error('name is required.');
|
|
225
|
+
return client._request<BoardColumn>({
|
|
226
|
+
method: 'POST',
|
|
227
|
+
endpoint: `/v1/boards/${boardId}/columns`,
|
|
228
|
+
body: data,
|
|
229
|
+
sendJWT: true,
|
|
230
|
+
});
|
|
231
|
+
},
|
|
232
|
+
|
|
233
|
+
/** Reorder a board's columns. The request must include every column id. */
|
|
234
|
+
async reorderColumns(boardId: string, data: ReorderColumnsData): Promise<BoardColumn[]> {
|
|
235
|
+
if (!boardId) throw new Error('boardId is required.');
|
|
236
|
+
return client._request<BoardColumn[]>({
|
|
237
|
+
method: 'PUT',
|
|
238
|
+
endpoint: `/v1/boards/${boardId}/columns/reorder`,
|
|
239
|
+
body: data,
|
|
240
|
+
sendJWT: true,
|
|
241
|
+
});
|
|
242
|
+
},
|
|
243
|
+
|
|
244
|
+
/** Update column metadata (name, color, task-status mapping, etc.). */
|
|
245
|
+
async updateColumn(boardId: string, columnId: string, data: UpdateColumnData): Promise<BoardColumn> {
|
|
246
|
+
if (!boardId) throw new Error('boardId is required.');
|
|
247
|
+
if (!columnId) throw new Error('columnId is required.');
|
|
248
|
+
return client._request<BoardColumn>({
|
|
249
|
+
method: 'PUT',
|
|
250
|
+
endpoint: `/v1/boards/${boardId}/columns/${columnId}`,
|
|
251
|
+
body: data,
|
|
252
|
+
sendJWT: true,
|
|
253
|
+
});
|
|
254
|
+
},
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Delete a column. If the column holds tasks, pass `targetColumnId`
|
|
258
|
+
* to move them; otherwise the call fails.
|
|
259
|
+
*/
|
|
260
|
+
async deleteColumn(boardId: string, columnId: string, targetColumnId?: string): Promise<void> {
|
|
261
|
+
if (!boardId) throw new Error('boardId is required.');
|
|
262
|
+
if (!columnId) throw new Error('columnId is required.');
|
|
263
|
+
return client._request<void>({
|
|
264
|
+
method: 'DELETE',
|
|
265
|
+
endpoint: `/v1/boards/${boardId}/columns/${columnId}`,
|
|
266
|
+
body: targetColumnId ? { targetColumnId } : undefined,
|
|
267
|
+
sendJWT: true,
|
|
268
|
+
});
|
|
269
|
+
},
|
|
270
|
+
|
|
271
|
+
// ========================================================================
|
|
272
|
+
// Board Task Operations
|
|
273
|
+
// ========================================================================
|
|
274
|
+
|
|
275
|
+
/** List tasks on a board, optionally narrowed by column / assignee / tag / status / search. */
|
|
276
|
+
async getBoardTasks(
|
|
277
|
+
boardId: string,
|
|
278
|
+
params?: {
|
|
279
|
+
columnId?: string;
|
|
280
|
+
search?: string;
|
|
281
|
+
status?: string;
|
|
282
|
+
assignedToId?: string;
|
|
283
|
+
tags?: string[];
|
|
284
|
+
}
|
|
285
|
+
): Promise<Task[]> {
|
|
286
|
+
if (!boardId) throw new Error('boardId is required.');
|
|
287
|
+
return client._request<Task[]>({
|
|
288
|
+
method: 'GET',
|
|
289
|
+
endpoint: `/v1/boards/${boardId}/tasks`,
|
|
290
|
+
params,
|
|
291
|
+
sendJWT: true,
|
|
292
|
+
});
|
|
293
|
+
},
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Create a task directly on a board. When `announce` is supplied the
|
|
297
|
+
* server also posts a Nu reply in the named chat threaded under the
|
|
298
|
+
* given message, with this task linked via TaskRelation.
|
|
299
|
+
*/
|
|
300
|
+
async createBoardTask(boardId: string, data: CreateBoardTaskData): Promise<Task> {
|
|
301
|
+
if (!boardId) throw new Error('boardId is required.');
|
|
302
|
+
if (!data.subject) throw new Error('subject is required.');
|
|
303
|
+
return client._request<Task>({
|
|
304
|
+
method: 'POST',
|
|
305
|
+
endpoint: `/v1/boards/${boardId}/tasks`,
|
|
306
|
+
body: data,
|
|
307
|
+
sendJWT: true,
|
|
308
|
+
});
|
|
309
|
+
},
|
|
310
|
+
|
|
311
|
+
/** Attach an existing project task to a board (no new task is created). */
|
|
312
|
+
async addExistingTaskToBoard(boardId: string, data: AddExistingTaskData): Promise<Task> {
|
|
313
|
+
if (!boardId) throw new Error('boardId is required.');
|
|
314
|
+
if (!data.taskId) throw new Error('taskId is required.');
|
|
315
|
+
return client._request<Task>({
|
|
316
|
+
method: 'POST',
|
|
317
|
+
endpoint: `/v1/boards/${boardId}/tasks/add`,
|
|
318
|
+
body: data,
|
|
319
|
+
sendJWT: true,
|
|
320
|
+
});
|
|
321
|
+
},
|
|
322
|
+
|
|
323
|
+
/** Move a task to a different column on the same board. */
|
|
324
|
+
async moveTask(boardId: string, taskId: string, data: MoveTaskData): Promise<Task> {
|
|
325
|
+
if (!boardId) throw new Error('boardId is required.');
|
|
326
|
+
if (!taskId) throw new Error('taskId is required.');
|
|
327
|
+
if (!data.columnId) throw new Error('columnId is required.');
|
|
328
|
+
return client._request<Task>({
|
|
329
|
+
method: 'PUT',
|
|
330
|
+
endpoint: `/v1/boards/${boardId}/tasks/${taskId}/move`,
|
|
331
|
+
body: data,
|
|
332
|
+
sendJWT: true,
|
|
333
|
+
});
|
|
334
|
+
},
|
|
335
|
+
|
|
336
|
+
/** Detach a task from a board. The task itself is preserved as boardless. */
|
|
337
|
+
async removeTaskFromBoard(boardId: string, taskId: string): Promise<Task> {
|
|
338
|
+
if (!boardId) throw new Error('boardId is required.');
|
|
339
|
+
if (!taskId) throw new Error('taskId is required.');
|
|
340
|
+
return client._request<Task>({
|
|
341
|
+
method: 'DELETE',
|
|
342
|
+
endpoint: `/v1/boards/${boardId}/tasks/${taskId}`,
|
|
343
|
+
sendJWT: true,
|
|
344
|
+
});
|
|
345
|
+
},
|
|
346
|
+
|
|
347
|
+
// ========================================================================
|
|
348
|
+
// Task Detail Operations
|
|
349
|
+
// ========================================================================
|
|
350
|
+
|
|
351
|
+
// ========================================================================
|
|
352
|
+
// Task Link Operations
|
|
353
|
+
// ========================================================================
|
|
354
|
+
|
|
355
|
+
// ========================================================================
|
|
356
|
+
// Tagging
|
|
357
|
+
// ========================================================================
|
|
358
|
+
|
|
359
|
+
/** Attach a tag to a board. */
|
|
360
|
+
async tagBoard(boardId: string, tagId: string): Promise<Board> {
|
|
361
|
+
return client._request<Board>({
|
|
362
|
+
method: 'PUT',
|
|
363
|
+
endpoint: `/v1/boards/${boardId}/tag`,
|
|
364
|
+
body: { tagId },
|
|
365
|
+
sendJWT: true,
|
|
366
|
+
});
|
|
367
|
+
},
|
|
368
|
+
|
|
369
|
+
/** Detach a tag from a board. */
|
|
370
|
+
async untagBoard(boardId: string, tagId: string): Promise<Board> {
|
|
371
|
+
return client._request<Board>({
|
|
372
|
+
method: 'PUT',
|
|
373
|
+
endpoint: `/v1/boards/${boardId}/untag`,
|
|
374
|
+
body: { tagId },
|
|
375
|
+
sendJWT: true,
|
|
376
|
+
});
|
|
377
|
+
},
|
|
378
|
+
|
|
379
|
+
// ========================================================================
|
|
380
|
+
// Following
|
|
381
|
+
// ========================================================================
|
|
382
|
+
|
|
383
|
+
/** Follow a board to receive notifications about its tasks. */
|
|
384
|
+
async followBoard(boardId: string): Promise<Board> {
|
|
385
|
+
if (!boardId) throw new Error('boardId is required.');
|
|
386
|
+
return client._request<Board>({
|
|
387
|
+
method: 'PUT',
|
|
388
|
+
endpoint: `/v1/boards/${boardId}/follow`,
|
|
389
|
+
sendJWT: true,
|
|
390
|
+
});
|
|
391
|
+
},
|
|
392
|
+
|
|
393
|
+
/** Stop following a board. */
|
|
394
|
+
async unfollowBoard(boardId: string): Promise<Board> {
|
|
395
|
+
if (!boardId) throw new Error('boardId is required.');
|
|
396
|
+
return client._request<Board>({
|
|
397
|
+
method: 'PUT',
|
|
398
|
+
endpoint: `/v1/boards/${boardId}/unfollow`,
|
|
399
|
+
sendJWT: true,
|
|
400
|
+
});
|
|
401
|
+
},
|
|
402
|
+
};
|
|
403
|
+
}
|