@ikatec/digisac-api-sdk 4.4.1 → 4.5.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 (49) hide show
  1. package/dist/apis/cards/CardsApi.cjs +70 -0
  2. package/dist/apis/cards/CardsApi.cjs.map +1 -1
  3. package/dist/apis/cards/CardsApi.d.ts +53 -1
  4. package/dist/apis/cards/CardsApi.d.ts.map +1 -1
  5. package/dist/apis/cards/CardsApi.mjs +70 -0
  6. package/dist/apis/cards/CardsApi.mjs.map +1 -1
  7. package/dist/apis/cards/types.d.ts +84 -0
  8. package/dist/apis/cards/types.d.ts.map +1 -1
  9. package/dist/apis/kanbanBoards/types.d.ts +33 -4
  10. package/dist/apis/kanbanBoards/types.d.ts.map +1 -1
  11. package/dist/apis/kanbanCards/KanbanCardsApi.cjs +8 -0
  12. package/dist/apis/kanbanCards/KanbanCardsApi.cjs.map +1 -1
  13. package/dist/apis/kanbanCards/KanbanCardsApi.d.ts +7 -1
  14. package/dist/apis/kanbanCards/KanbanCardsApi.d.ts.map +1 -1
  15. package/dist/apis/kanbanCards/KanbanCardsApi.mjs +8 -0
  16. package/dist/apis/kanbanCards/KanbanCardsApi.mjs.map +1 -1
  17. package/dist/apis/kanbanCards/types.d.ts +17 -5
  18. package/dist/apis/kanbanCards/types.d.ts.map +1 -1
  19. package/dist/apis/kanbanColumns/KanbanColumnsApi.cjs +9 -0
  20. package/dist/apis/kanbanColumns/KanbanColumnsApi.cjs.map +1 -1
  21. package/dist/apis/kanbanColumns/KanbanColumnsApi.d.ts +8 -1
  22. package/dist/apis/kanbanColumns/KanbanColumnsApi.d.ts.map +1 -1
  23. package/dist/apis/kanbanColumns/KanbanColumnsApi.mjs +9 -0
  24. package/dist/apis/kanbanColumns/KanbanColumnsApi.mjs.map +1 -1
  25. package/dist/apis/kanbanColumns/types.d.ts +14 -3
  26. package/dist/apis/kanbanColumns/types.d.ts.map +1 -1
  27. package/dist/apis/pipeline/PipelineApi.cjs +133 -0
  28. package/dist/apis/pipeline/PipelineApi.cjs.map +1 -1
  29. package/dist/apis/pipeline/PipelineApi.d.ts +102 -1
  30. package/dist/apis/pipeline/PipelineApi.d.ts.map +1 -1
  31. package/dist/apis/pipeline/PipelineApi.mjs +133 -0
  32. package/dist/apis/pipeline/PipelineApi.mjs.map +1 -1
  33. package/dist/apis/pipeline/types.d.ts +164 -0
  34. package/dist/apis/pipeline/types.d.ts.map +1 -1
  35. package/package.json +1 -1
  36. package/src/apis/cards/CardsApi.test.ts +128 -0
  37. package/src/apis/cards/CardsApi.ts +124 -1
  38. package/src/apis/cards/types.ts +81 -0
  39. package/src/apis/kanbanBoards/types.ts +36 -4
  40. package/src/apis/kanbanCards/KanbanCardsApi.test.ts +46 -0
  41. package/src/apis/kanbanCards/KanbanCardsApi.ts +23 -1
  42. package/src/apis/kanbanCards/types.ts +18 -5
  43. package/src/apis/kanbanColumns/KanbanColumnsApi.test.ts +46 -0
  44. package/src/apis/kanbanColumns/KanbanColumnsApi.ts +24 -1
  45. package/src/apis/kanbanColumns/types.ts +15 -3
  46. package/src/apis/payloads.test-d.ts +30 -0
  47. package/src/apis/pipeline/PipelineApi.test.ts +193 -0
  48. package/src/apis/pipeline/PipelineApi.ts +274 -1
  49. package/src/apis/pipeline/types.ts +162 -0
@@ -5,6 +5,15 @@ var KanbanColumnsApi = class extends BaseCrudApi {
5
5
  constructor(client) {
6
6
  super(client, "/kanban-columns");
7
7
  }
8
+ /**
9
+ * Moves a column between two neighbours of the same board. Both the column and a neighbour
10
+ * must be draggable; swapped neighbours (`before` after `after`) fail with 500. Resolves to the
11
+ * column with its new `position`.
12
+ * @permissions kanban.columns.update
13
+ */
14
+ reorder(id, body, headers) {
15
+ return this.client.patch(`${this.basePath}/${id}/reorder`, body, headers);
16
+ }
8
17
  };
9
18
 
10
19
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"KanbanColumnsApi.mjs","names":[],"sources":["../../../src/apis/kanbanColumns/KanbanColumnsApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { KanbanColumn, CreateKanbanColumnPayload, UpdateKanbanColumnPayload } from './types'\n\nexport class KanbanColumnsApi extends BaseCrudApi<\n KanbanColumn,\n CreateKanbanColumnPayload,\n UpdateKanbanColumnPayload\n> {\n constructor(client: ApiClient) {\n super(client, '/kanban-columns')\n }\n}\n"],"mappings":";;;AAIA,IAAa,mBAAb,cAAsC,YAIpC;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,kBAAkB"}
1
+ {"version":3,"file":"KanbanColumnsApi.mjs","names":[],"sources":["../../../src/apis/kanbanColumns/KanbanColumnsApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n KanbanColumn,\n CreateKanbanColumnPayload,\n ReorderKanbanColumnPayload,\n UpdateKanbanColumnPayload,\n} from './types'\n\nexport class KanbanColumnsApi extends BaseCrudApi<\n KanbanColumn,\n CreateKanbanColumnPayload,\n UpdateKanbanColumnPayload\n> {\n constructor(client: ApiClient) {\n super(client, '/kanban-columns')\n }\n\n /**\n * Moves a column between two neighbours of the same board. Both the column and a neighbour\n * must be draggable; swapped neighbours (`before` after `after`) fail with 500. Resolves to the\n * column with its new `position`.\n * @permissions kanban.columns.update\n */\n reorder(\n id: string,\n body: ReorderKanbanColumnPayload,\n headers?: Record<string, string>,\n ): Promise<KanbanColumn> {\n return this.client.patch<KanbanColumn, ReorderKanbanColumnPayload>(\n `${this.basePath}/${id}/reorder`,\n body,\n headers,\n )\n }\n}\n"],"mappings":";;;AASA,IAAa,mBAAb,cAAsC,YAIpC;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,kBAAkB;;;;;;;;CASlC,QACE,IACA,MACA,SACuB;AACvB,SAAO,KAAK,OAAO,MACjB,GAAG,KAAK,SAAS,GAAG,GAAG,WACvB,MACA,QACD"}
@@ -12,15 +12,19 @@ export type KanbanColumn = {
12
12
  accountId: string;
13
13
  createdAt: string;
14
14
  updatedAt: string;
15
- deletedAt: string | null;
16
- kanbanBoard?: KanbanBoard;
15
+ board?: KanbanBoard | null;
17
16
  cards?: KanbanCard[];
18
17
  };
19
- export type KanbanColumnRelationships = 'kanbanBoard' | 'cards';
18
+ export type KanbanColumnRelationships = 'cards';
20
19
  export type CreateKanbanColumnPayload = {
21
20
  name: string;
22
21
  kanbanBoardId: string;
22
+ /** A board has one `'initial'` and one `'final'` column (a second one fails). */
23
23
  role?: KanbanColumnRole;
24
+ /**
25
+ * @deprecated Ignored by the backend: the position is computed (`'initial'` first, `'final'`
26
+ * last, other columns just before the final one). Use `reorder` to move a column.
27
+ */
24
28
  position?: string;
25
29
  ticketWaitTimeMinutes?: number;
26
30
  isDraggable?: boolean;
@@ -32,4 +36,11 @@ export type UpdateKanbanColumnPayload = {
32
36
  ticketWaitTimeMinutes?: number | null;
33
37
  isDraggable?: boolean;
34
38
  };
39
+ /** Neighbours of the column after the move (omit both to move it to the middle, `'M'`). */
40
+ export type ReorderKanbanColumnPayload = {
41
+ /** The column that ends up on the left. */
42
+ beforeColumnId?: string;
43
+ /** The column that ends up on the right. */
44
+ afterColumnId?: string;
45
+ };
35
46
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/kanbanColumns/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEtD,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAA;AAE9D,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,gBAAgB,CAAA;IACtB,QAAQ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**
10
+ * Adds a stage (with its statuses and reasons) to a pipeline. Resolves to the stage as stored,
11
+ * without the statuses/reasons, or to a refusal code with 200: `'STAGES_LIMIT'` (the pipeline
12
+ * already has 10 stages) or `'STAGE_ALREADY_EXIST'` (same name).
13
+ * @permissions pipelines.update
14
+ */
15
+ createStage(body, headers) {
16
+ return this.client.post(`${this.basePath}/stage`, body, headers);
17
+ }
18
+ /**
19
+ * Updates a stage. `statuses` and `reasons` replace the whole set: items with `id` are kept
20
+ * and updated, items without it are created and the missing ones are deleted — omitting the
21
+ * lists deletes every status and reason of the stage. Resolves to the stage as stored, or to
22
+ * `'STAGE_ALREADY_EXIST'`.
23
+ * @permissions pipelines.update
24
+ */
25
+ updateStage(id, body, headers) {
26
+ return this.client.put(`${this.basePath}/stage/${id}`, body, headers);
27
+ }
28
+ /**
29
+ * Deletes a stage and moves its cards (see {@link DeletePipelineStagePayload}). Resolves to
30
+ * `'MESSAGE_STAGE_DELETED'`, or to `'PIPELINES_MIN_STAGES'` (nothing deleted) when the pipeline
31
+ * has only 2 stages. The backend also serves this under `PUT /pipelines/delete-stage/{id}`.
32
+ * @permissions pipelines.update
33
+ */
34
+ deleteStage(id, body = {}, headers) {
35
+ return this.client.request("DELETE", `${this.basePath}/stage/${id}`, body, headers);
36
+ }
37
+ /**
38
+ * Lists the statuses of every stage of a pipeline (`[]` for an unknown pipeline).
39
+ * @permissions pipelines.view
40
+ */
41
+ getStatuses(pipelineId, headers) {
42
+ return this.client.get(`${this.basePath}/statuses/${pipelineId}`, headers);
43
+ }
44
+ /**
45
+ * Gets a stage status with the number of cards using it. An unknown id resolves to
46
+ * `{ cardsCount: 0 }` with 200, not to an error.
47
+ * @permissions pipelines.view
48
+ */
49
+ getStatus(id, headers) {
50
+ return this.client.get(`${this.basePath}/status/${id}`, headers);
51
+ }
52
+ /**
53
+ * Deletes a stage status, keeping its cards without status or moving them to another one.
54
+ * Resolves to `'MESSAGE_STATUS_DELETED'`.
55
+ * @permissions pipelines.view
56
+ */
57
+ deleteStatus(id, body, headers) {
58
+ return this.client.post(`${this.basePath}/delete-status/${id}`, body, headers);
59
+ }
60
+ /**
61
+ * Renames a stage status — same route as {@link deleteStatus}, without an `action`.
62
+ * Resolves to `'MESSAGE_STATUS_RENAMED'`; an empty name fails with 500.
63
+ * @permissions pipelines.view
64
+ */
65
+ renameStatus(id, newStatusName, headers) {
66
+ return this.client.post(`${this.basePath}/delete-status/${id}`, { newStatusName }, headers);
67
+ }
68
+ /**
69
+ * Creates an automation of a pipeline. Resolves to the automation as stored.
70
+ * @permissions pipelines.update
71
+ */
72
+ createAutomation(body, headers) {
73
+ return this.client.post(`${this.basePath}/automations`, body, headers);
74
+ }
75
+ /**
76
+ * Updates an automation. Resolves to the automation as stored.
77
+ * @permissions pipelines.update
78
+ */
79
+ updateAutomation(id, body, headers) {
80
+ return this.client.put(`${this.basePath}/automations/${id}`, body, headers);
81
+ }
82
+ /**
83
+ * Deletes an automation. Resolves with no content; an unknown id fails with 500.
84
+ * @permissions pipelines.update
85
+ */
86
+ deleteAutomation(id, headers) {
87
+ return this.client.delete(`${this.basePath}/automations/${id}`, headers);
88
+ }
89
+ /**
90
+ * Gets the automation of a pipeline — a single object (the first one found), or `[]` when
91
+ * the pipeline has none.
92
+ * @permissions pipelines.view
93
+ */
94
+ getAutomation(pipelineId, headers) {
95
+ return this.client.get(`${this.basePath}/automations/${pipelineId}`, headers);
96
+ }
97
+ /**
98
+ * Copies a pipeline as `"<name> (copy)"`, with its stages, statuses, reasons and automations
99
+ * (not its departments). Resolves to the new pipeline as stored, without the stages.
100
+ * @permissions pipelines.view
101
+ */
102
+ duplicate(pipelineId, headers) {
103
+ return this.client.post(`${this.basePath}/duplicate/${pipelineId}`, void 0, headers);
104
+ }
105
+ /**
106
+ * Archives a pipeline. Resolves to the pipeline with its stages and their card totals.
107
+ * @permissions pipelines.update
108
+ */
109
+ archive(id, headers) {
110
+ return this.client.post(`${this.basePath}/${id}/archive`, { archive: true }, headers);
111
+ }
112
+ /**
113
+ * Restores an archived pipeline. Resolves to the pipeline with its stages and their totals.
114
+ * @permissions pipelines.update
115
+ */
116
+ unarchive(id, headers) {
117
+ return this.client.post(`${this.basePath}/${id}/archive`, { archive: false }, headers);
118
+ }
119
+ /**
120
+ * Exports the cards of a pipeline as CSV text (`;` as the delimiter): a summary block
121
+ * followed by one row per card.
122
+ * @permissions pipelines.view
123
+ */
124
+ exportCsv(id, body = {}, headers) {
125
+ return this.client.post(`${this.basePath}/${id}/export`, body, headers);
126
+ }
127
+ /**
128
+ * Lists the pipelines of the account with their stages and card totals. Not paginated.
129
+ * @permissions pipelines.view
130
+ */
131
+ getManyWithTotals(query, headers) {
132
+ return this.client.get(`${this.basePath}/withTotals${this.toQueryString(query)}`, headers);
133
+ }
134
+ /**
135
+ * Gets the card totals of a stage, optionally filtered like the board. Resolves to `null`
136
+ * for an unknown stage.
137
+ * @permissions pipelines.update OR pipelines.opportunity.update
138
+ */
139
+ getStageTotals(stageId, filters = {}, headers) {
140
+ return this.client.post(`${this.basePath}/stage-totals/${stageId}`, filters, headers);
141
+ }
9
142
  };
10
143
 
11
144
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"PipelineApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/pipeline/PipelineApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { Pipeline, CreatePipelinePayload, UpdatePipelinePayload } from './types'\n\nexport class PipelineApi extends BaseCrudApi<\n Pipeline,\n CreatePipelinePayload,\n UpdatePipelinePayload\n> {\n constructor(client: ApiClient) {\n super(client, '/pipelines')\n }\n}\n"],"mappings":";;;;AAIA,IAAa,cAAb,cAAiCA,qCAI/B;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,aAAa"}
1
+ {"version":3,"file":"PipelineApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/pipeline/PipelineApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n CreatePipelineAutomationPayload,\n CreatePipelinePayload,\n CreatePipelineStagePayload,\n DeletePipelineStagePayload,\n DeletePipelineStageResult,\n DeletePipelineStatusPayload,\n ExportPipelinePayload,\n Pipeline,\n PipelineAutomation,\n PipelineRecord,\n PipelineStage,\n PipelineStageRefusal,\n PipelineStageStatusWithCount,\n PipelineStageTotals,\n PipelineStageTotalsFilters,\n PipelineStatusRef,\n PipelinesWithTotals,\n PipelinesWithTotalsQuery,\n UpdatePipelineAutomationPayload,\n UpdatePipelinePayload,\n UpdatePipelineStagePayload,\n} from './types'\n\nexport class PipelineApi extends BaseCrudApi<\n Pipeline,\n CreatePipelinePayload,\n UpdatePipelinePayload\n> {\n constructor(client: ApiClient) {\n super(client, '/pipelines')\n }\n\n /**\n * Adds a stage (with its statuses and reasons) to a pipeline. Resolves to the stage as stored,\n * without the statuses/reasons, or to a refusal code with 200: `'STAGES_LIMIT'` (the pipeline\n * already has 10 stages) or `'STAGE_ALREADY_EXIST'` (same name).\n * @permissions pipelines.update\n */\n createStage(\n body: CreatePipelineStagePayload,\n headers?: Record<string, string>,\n ): Promise<PipelineStage | PipelineStageRefusal> {\n return this.client.post<PipelineStage | PipelineStageRefusal, CreatePipelineStagePayload>(\n `${this.basePath}/stage`,\n body,\n headers,\n )\n }\n\n /**\n * Updates a stage. `statuses` and `reasons` replace the whole set: items with `id` are kept\n * and updated, items without it are created and the missing ones are deleted — omitting the\n * lists deletes every status and reason of the stage. Resolves to the stage as stored, or to\n * `'STAGE_ALREADY_EXIST'`.\n * @permissions pipelines.update\n */\n updateStage(\n id: string,\n body: UpdatePipelineStagePayload,\n headers?: Record<string, string>,\n ): Promise<PipelineStage | 'STAGE_ALREADY_EXIST'> {\n return this.client.put<PipelineStage | 'STAGE_ALREADY_EXIST', UpdatePipelineStagePayload>(\n `${this.basePath}/stage/${id}`,\n body,\n headers,\n )\n }\n\n /**\n * Deletes a stage and moves its cards (see {@link DeletePipelineStagePayload}). Resolves to\n * `'MESSAGE_STAGE_DELETED'`, or to `'PIPELINES_MIN_STAGES'` (nothing deleted) when the pipeline\n * has only 2 stages. The backend also serves this under `PUT /pipelines/delete-stage/{id}`.\n * @permissions pipelines.update\n */\n deleteStage(\n id: string,\n body: DeletePipelineStagePayload = {},\n headers?: Record<string, string>,\n ): Promise<DeletePipelineStageResult> {\n return this.client.request<DeletePipelineStageResult, DeletePipelineStagePayload>(\n 'DELETE',\n `${this.basePath}/stage/${id}`,\n body,\n headers,\n )\n }\n\n /**\n * Lists the statuses of every stage of a pipeline (`[]` for an unknown pipeline).\n * @permissions pipelines.view\n */\n getStatuses(pipelineId: string, headers?: Record<string, string>): Promise<PipelineStatusRef[]> {\n return this.client.get<PipelineStatusRef[]>(`${this.basePath}/statuses/${pipelineId}`, headers)\n }\n\n /**\n * Gets a stage status with the number of cards using it. An unknown id resolves to\n * `{ cardsCount: 0 }` with 200, not to an error.\n * @permissions pipelines.view\n */\n getStatus(\n id: string,\n headers?: Record<string, string>,\n ): Promise<PipelineStageStatusWithCount | { cardsCount: 0 }> {\n return this.client.get<PipelineStageStatusWithCount | { cardsCount: 0 }>(\n `${this.basePath}/status/${id}`,\n headers,\n )\n }\n\n /**\n * Deletes a stage status, keeping its cards without status or moving them to another one.\n * Resolves to `'MESSAGE_STATUS_DELETED'`.\n * @permissions pipelines.view\n */\n deleteStatus(\n id: string,\n body: DeletePipelineStatusPayload,\n headers?: Record<string, string>,\n ): Promise<'MESSAGE_STATUS_DELETED'> {\n return this.client.post<'MESSAGE_STATUS_DELETED', DeletePipelineStatusPayload>(\n `${this.basePath}/delete-status/${id}`,\n body,\n headers,\n )\n }\n\n /**\n * Renames a stage status — same route as {@link deleteStatus}, without an `action`.\n * Resolves to `'MESSAGE_STATUS_RENAMED'`; an empty name fails with 500.\n * @permissions pipelines.view\n */\n renameStatus(\n id: string,\n newStatusName: string,\n headers?: Record<string, string>,\n ): Promise<'MESSAGE_STATUS_RENAMED'> {\n return this.client.post<'MESSAGE_STATUS_RENAMED', { newStatusName: string }>(\n `${this.basePath}/delete-status/${id}`,\n { newStatusName },\n headers,\n )\n }\n\n /**\n * Creates an automation of a pipeline. Resolves to the automation as stored.\n * @permissions pipelines.update\n */\n createAutomation(\n body: CreatePipelineAutomationPayload,\n headers?: Record<string, string>,\n ): Promise<PipelineAutomation> {\n return this.client.post<PipelineAutomation, CreatePipelineAutomationPayload>(\n `${this.basePath}/automations`,\n body,\n headers,\n )\n }\n\n /**\n * Updates an automation. Resolves to the automation as stored.\n * @permissions pipelines.update\n */\n updateAutomation(\n id: string,\n body: UpdatePipelineAutomationPayload,\n headers?: Record<string, string>,\n ): Promise<PipelineAutomation> {\n return this.client.put<PipelineAutomation, UpdatePipelineAutomationPayload>(\n `${this.basePath}/automations/${id}`,\n body,\n headers,\n )\n }\n\n /**\n * Deletes an automation. Resolves with no content; an unknown id fails with 500.\n * @permissions pipelines.update\n */\n deleteAutomation(id: string, headers?: Record<string, string>): Promise<void> {\n return this.client.delete<void>(`${this.basePath}/automations/${id}`, headers)\n }\n\n /**\n * Gets the automation of a pipeline — a single object (the first one found), or `[]` when\n * the pipeline has none.\n * @permissions pipelines.view\n */\n getAutomation(\n pipelineId: string,\n headers?: Record<string, string>,\n ): Promise<PipelineAutomation | []> {\n return this.client.get<PipelineAutomation | []>(\n `${this.basePath}/automations/${pipelineId}`,\n headers,\n )\n }\n\n /**\n * Copies a pipeline as `\"<name> (copy)\"`, with its stages, statuses, reasons and automations\n * (not its departments). Resolves to the new pipeline as stored, without the stages.\n * @permissions pipelines.view\n */\n duplicate(pipelineId: string, headers?: Record<string, string>): Promise<PipelineRecord> {\n return this.client.post<PipelineRecord>(\n `${this.basePath}/duplicate/${pipelineId}`,\n undefined,\n headers,\n )\n }\n\n /**\n * Archives a pipeline. Resolves to the pipeline with its stages and their card totals.\n * @permissions pipelines.update\n */\n archive(id: string, headers?: Record<string, string>): Promise<Pipeline> {\n return this.client.post<Pipeline, { archive: boolean }>(\n `${this.basePath}/${id}/archive`,\n { archive: true },\n headers,\n )\n }\n\n /**\n * Restores an archived pipeline. Resolves to the pipeline with its stages and their totals.\n * @permissions pipelines.update\n */\n unarchive(id: string, headers?: Record<string, string>): Promise<Pipeline> {\n return this.client.post<Pipeline, { archive: boolean }>(\n `${this.basePath}/${id}/archive`,\n { archive: false },\n headers,\n )\n }\n\n /**\n * Exports the cards of a pipeline as CSV text (`;` as the delimiter): a summary block\n * followed by one row per card.\n * @permissions pipelines.view\n */\n exportCsv(\n id: string,\n body: ExportPipelinePayload = {},\n headers?: Record<string, string>,\n ): Promise<string> {\n return this.client.post<string, ExportPipelinePayload>(\n `${this.basePath}/${id}/export`,\n body,\n headers,\n )\n }\n\n /**\n * Lists the pipelines of the account with their stages and card totals. Not paginated.\n * @permissions pipelines.view\n */\n getManyWithTotals(\n query?: PipelinesWithTotalsQuery,\n headers?: Record<string, string>,\n ): Promise<PipelinesWithTotals> {\n return this.client.get<PipelinesWithTotals>(\n `${this.basePath}/withTotals${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * Gets the card totals of a stage, optionally filtered like the board. Resolves to `null`\n * for an unknown stage.\n * @permissions pipelines.update OR pipelines.opportunity.update\n */\n getStageTotals(\n stageId: string,\n filters: PipelineStageTotalsFilters = {},\n headers?: Record<string, string>,\n ): Promise<PipelineStageTotals | null> {\n return this.client.post<PipelineStageTotals | null, PipelineStageTotalsFilters>(\n `${this.basePath}/stage-totals/${stageId}`,\n filters,\n headers,\n )\n }\n}\n"],"mappings":";;;;AA0BA,IAAa,cAAb,cAAiCA,qCAI/B;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,aAAa;;;;;;;;CAS7B,YACE,MACA,SAC+C;AAC/C,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,SACjB,MACA,QACD;;;;;;;;;CAUH,YACE,IACA,MACA,SACgD;AAChD,SAAO,KAAK,OAAO,IACjB,GAAG,KAA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AY,SAAqD;AACzE,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,GAAG,GAAG,WACvB,EAAE,SAAS,OAAO,EAClB,QACD;;;;;;;CAQH,UACE,IACA,OAA8B,EAAE,EAChC,SACiB;AACjB,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,GAAG,GAAG,UACvB,MACA,QACD;;;;;;CAOH,kBACE,OACA,SAC8B;AAC9B,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,aAAa,KAAK,cAAc,MAAM,IACvD,QACD;;;;;;;CAQH,eACE,SACA,UAAsC,EAAE,EACxC,SACqC;AACrC,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,gBAAgB,WACjC,SACA,QACD"}
@@ -1,7 +1,108 @@
1
1
  import type { ApiClient } from '../../core/ApiClient';
2
2
  import { BaseCrudApi } from '../../core/BaseCrudApi';
3
- import type { Pipeline, CreatePipelinePayload, UpdatePipelinePayload } from './types';
3
+ import type { CreatePipelineAutomationPayload, CreatePipelinePayload, CreatePipelineStagePayload, DeletePipelineStagePayload, DeletePipelineStageResult, DeletePipelineStatusPayload, ExportPipelinePayload, Pipeline, PipelineAutomation, PipelineRecord, PipelineStage, PipelineStageRefusal, PipelineStageStatusWithCount, PipelineStageTotals, PipelineStageTotalsFilters, PipelineStatusRef, PipelinesWithTotals, PipelinesWithTotalsQuery, UpdatePipelineAutomationPayload, UpdatePipelinePayload, UpdatePipelineStagePayload } from './types';
4
4
  export declare class PipelineApi extends BaseCrudApi<Pipeline, CreatePipelinePayload, UpdatePipelinePayload> {
5
5
  constructor(client: ApiClient);
6
+ /**
7
+ * Adds a stage (with its statuses and reasons) to a pipeline. Resolves to the stage as stored,
8
+ * without the statuses/reasons, or to a refusal code with 200: `'STAGES_LIMIT'` (the pipeline
9
+ * already has 10 stages) or `'STAGE_ALREADY_EXIST'` (same name).
10
+ * @permissions pipelines.update
11
+ */
12
+ createStage(body: CreatePipelineStagePayload, headers?: Record<string, string>): Promise<PipelineStage | PipelineStageRefusal>;
13
+ /**
14
+ * Updates a stage. `statuses` and `reasons` replace the whole set: items with `id` are kept
15
+ * and updated, items without it are created and the missing ones are deleted — omitting the
16
+ * lists deletes every status and reason of the stage. Resolves to the stage as stored, or to
17
+ * `'STAGE_ALREADY_EXIST'`.
18
+ * @permissions pipelines.update
19
+ */
20
+ updateStage(id: string, body: UpdatePipelineStagePayload, headers?: Record<string, string>): Promise<PipelineStage | 'STAGE_ALREADY_EXIST'>;
21
+ /**
22
+ * Deletes a stage and moves its cards (see {@link DeletePipelineStagePayload}). Resolves to
23
+ * `'MESSAGE_STAGE_DELETED'`, or to `'PIPELINES_MIN_STAGES'` (nothing deleted) when the pipeline
24
+ * has only 2 stages. The backend also serves this under `PUT /pipelines/delete-stage/{id}`.
25
+ * @permissions pipelines.update
26
+ */
27
+ deleteStage(id: string, body?: DeletePipelineStagePayload, headers?: Record<string, string>): Promise<DeletePipelineStageResult>;
28
+ /**
29
+ * Lists the statuses of every stage of a pipeline (`[]` for an unknown pipeline).
30
+ * @permissions pipelines.view
31
+ */
32
+ getStatuses(pipelineId: string, headers?: Record<string, string>): Promise<PipelineStatusRef[]>;
33
+ /**
34
+ * Gets a stage status with the number of cards using it. An unknown id resolves to
35
+ * `{ cardsCount: 0 }` with 200, not to an error.
36
+ * @permissions pipelines.view
37
+ */
38
+ getStatus(id: string, headers?: Record<string, string>): Promise<PipelineStageStatusWithCount | {
39
+ cardsCount: 0;
40
+ }>;
41
+ /**
42
+ * Deletes a stage status, keeping its cards without status or moving them to another one.
43
+ * Resolves to `'MESSAGE_STATUS_DELETED'`.
44
+ * @permissions pipelines.view
45
+ */
46
+ deleteStatus(id: string, body: DeletePipelineStatusPayload, headers?: Record<string, string>): Promise<'MESSAGE_STATUS_DELETED'>;
47
+ /**
48
+ * Renames a stage status — same route as {@link deleteStatus}, without an `action`.
49
+ * Resolves to `'MESSAGE_STATUS_RENAMED'`; an empty name fails with 500.
50
+ * @permissions pipelines.view
51
+ */
52
+ renameStatus(id: string, newStatusName: string, headers?: Record<string, string>): Promise<'MESSAGE_STATUS_RENAMED'>;
53
+ /**
54
+ * Creates an automation of a pipeline. Resolves to the automation as stored.
55
+ * @permissions pipelines.update
56
+ */
57
+ createAutomation(body: CreatePipelineAutomationPayload, headers?: Record<string, string>): Promise<PipelineAutomation>;
58
+ /**
59
+ * Updates an automation. Resolves to the automation as stored.
60
+ * @permissions pipelines.update
61
+ */
62
+ updateAutomation(id: string, body: UpdatePipelineAutomationPayload, headers?: Record<string, string>): Promise<PipelineAutomation>;
63
+ /**
64
+ * Deletes an automation. Resolves with no content; an unknown id fails with 500.
65
+ * @permissions pipelines.update
66
+ */
67
+ deleteAutomation(id: string, headers?: Record<string, string>): Promise<void>;
68
+ /**
69
+ * Gets the automation of a pipeline — a single object (the first one found), or `[]` when
70
+ * the pipeline has none.
71
+ * @permissions pipelines.view
72
+ */
73
+ getAutomation(pipelineId: string, headers?: Record<string, string>): Promise<PipelineAutomation | []>;
74
+ /**
75
+ * Copies a pipeline as `"<name> (copy)"`, with its stages, statuses, reasons and automations
76
+ * (not its departments). Resolves to the new pipeline as stored, without the stages.
77
+ * @permissions pipelines.view
78
+ */
79
+ duplicate(pipelineId: string, headers?: Record<string, string>): Promise<PipelineRecord>;
80
+ /**
81
+ * Archives a pipeline. Resolves to the pipeline with its stages and their card totals.
82
+ * @permissions pipelines.update
83
+ */
84
+ archive(id: string, headers?: Record<string, string>): Promise<Pipeline>;
85
+ /**
86
+ * Restores an archived pipeline. Resolves to the pipeline with its stages and their totals.
87
+ * @permissions pipelines.update
88
+ */
89
+ unarchive(id: string, headers?: Record<string, string>): Promise<Pipeline>;
90
+ /**
91
+ * Exports the cards of a pipeline as CSV text (`;` as the delimiter): a summary block
92
+ * followed by one row per card.
93
+ * @permissions pipelines.view
94
+ */
95
+ exportCsv(id: string, body?: ExportPipelinePayload, headers?: Record<string, string>): Promise<string>;
96
+ /**
97
+ * Lists the pipelines of the account with their stages and card totals. Not paginated.
98
+ * @permissions pipelines.view
99
+ */
100
+ getManyWithTotals(query?: PipelinesWithTotalsQuery, headers?: Record<string, string>): Promise<PipelinesWithTotals>;
101
+ /**
102
+ * Gets the card totals of a stage, optionally filtered like the board. Resolves to `null`
103
+ * for an unknown stage.
104
+ * @permissions pipelines.update OR pipelines.opportunity.update
105
+ */
106
+ getStageTotals(stageId: string, filters?: PipelineStageTotalsFilters, headers?: Record<string, string>): Promise<PipelineStageTotals | null>;
6
107
  }
7
108
  //# sourceMappingURL=PipelineApi.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PipelineApi.d.ts","sourceRoot":"","sources":["../../../src/apis/pipeline/PipelineApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAErF,qBAAa,WAAY,SAAQ,WAAW,CAC1C,QAAQ,EACR,qBAAqB,EACrB,qBAAqB,CACtB;gBACa,MAAM,EAAE,SAAS;CAG9B"}
1
+ {"version":3,"file":"PipelineApi.d.ts","sourceRoot":"","sources":["../../../src/apis/pipeline/PipelineApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,EACV,+BAA+B,EAC/B,qBAAqB,EACrB,0BAA0B,EAC1B,0BAA0B,EAC1B,yBAAyB,EACzB,2BAA2B,EAC3B,qBAAqB,EACrB,QAAQ,EACR,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,4BAA4B,EAC5B,mBAAmB,EACnB,0BAA0B,EAC1B,iBAAiB,EACjB,mBAAmB,EACnB,wBAAwB,EACxB,+BA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E,qBAA0B,EAChC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,MAAM,CAAC;IAQlB;;;OAGG;IACH,iBAAiB,CACf,KAAK,CAAC,EAAE,wBAAwB,EAChC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,mBAAmB,CAAC;IAO/B;;;;OAIG;IACH,cAAc,CACZ,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,0BAA+B,EACxC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;CAOvC"}
@@ -5,6 +5,139 @@ var PipelineApi = class extends BaseCrudApi {
5
5
  constructor(client) {
6
6
  super(client, "/pipelines");
7
7
  }
8
+ /**
9
+ * Adds a stage (with its statuses and reasons) to a pipeline. Resolves to the stage as stored,
10
+ * without the statuses/reasons, or to a refusal code with 200: `'STAGES_LIMIT'` (the pipeline
11
+ * already has 10 stages) or `'STAGE_ALREADY_EXIST'` (same name).
12
+ * @permissions pipelines.update
13
+ */
14
+ createStage(body, headers) {
15
+ return this.client.post(`${this.basePath}/stage`, body, headers);
16
+ }
17
+ /**
18
+ * Updates a stage. `statuses` and `reasons` replace the whole set: items with `id` are kept
19
+ * and updated, items without it are created and the missing ones are deleted — omitting the
20
+ * lists deletes every status and reason of the stage. Resolves to the stage as stored, or to
21
+ * `'STAGE_ALREADY_EXIST'`.
22
+ * @permissions pipelines.update
23
+ */
24
+ updateStage(id, body, headers) {
25
+ return this.client.put(`${this.basePath}/stage/${id}`, body, headers);
26
+ }
27
+ /**
28
+ * Deletes a stage and moves its cards (see {@link DeletePipelineStagePayload}). Resolves to
29
+ * `'MESSAGE_STAGE_DELETED'`, or to `'PIPELINES_MIN_STAGES'` (nothing deleted) when the pipeline
30
+ * has only 2 stages. The backend also serves this under `PUT /pipelines/delete-stage/{id}`.
31
+ * @permissions pipelines.update
32
+ */
33
+ deleteStage(id, body = {}, headers) {
34
+ return this.client.request("DELETE", `${this.basePath}/stage/${id}`, body, headers);
35
+ }
36
+ /**
37
+ * Lists the statuses of every stage of a pipeline (`[]` for an unknown pipeline).
38
+ * @permissions pipelines.view
39
+ */
40
+ getStatuses(pipelineId, headers) {
41
+ return this.client.get(`${this.basePath}/statuses/${pipelineId}`, headers);
42
+ }
43
+ /**
44
+ * Gets a stage status with the number of cards using it. An unknown id resolves to
45
+ * `{ cardsCount: 0 }` with 200, not to an error.
46
+ * @permissions pipelines.view
47
+ */
48
+ getStatus(id, headers) {
49
+ return this.client.get(`${this.basePath}/status/${id}`, headers);
50
+ }
51
+ /**
52
+ * Deletes a stage status, keeping its cards without status or moving them to another one.
53
+ * Resolves to `'MESSAGE_STATUS_DELETED'`.
54
+ * @permissions pipelines.view
55
+ */
56
+ deleteStatus(id, body, headers) {
57
+ return this.client.post(`${this.basePath}/delete-status/${id}`, body, headers);
58
+ }
59
+ /**
60
+ * Renames a stage status — same route as {@link deleteStatus}, without an `action`.
61
+ * Resolves to `'MESSAGE_STATUS_RENAMED'`; an empty name fails with 500.
62
+ * @permissions pipelines.view
63
+ */
64
+ renameStatus(id, newStatusName, headers) {
65
+ return this.client.post(`${this.basePath}/delete-status/${id}`, { newStatusName }, headers);
66
+ }
67
+ /**
68
+ * Creates an automation of a pipeline. Resolves to the automation as stored.
69
+ * @permissions pipelines.update
70
+ */
71
+ createAutomation(body, headers) {
72
+ return this.client.post(`${this.basePath}/automations`, body, headers);
73
+ }
74
+ /**
75
+ * Updates an automation. Resolves to the automation as stored.
76
+ * @permissions pipelines.update
77
+ */
78
+ updateAutomation(id, body, headers) {
79
+ return this.client.put(`${this.basePath}/automations/${id}`, body, headers);
80
+ }
81
+ /**
82
+ * Deletes an automation. Resolves with no content; an unknown id fails with 500.
83
+ * @permissions pipelines.update
84
+ */
85
+ deleteAutomation(id, headers) {
86
+ return this.client.delete(`${this.basePath}/automations/${id}`, headers);
87
+ }
88
+ /**
89
+ * Gets the automation of a pipeline — a single object (the first one found), or `[]` when
90
+ * the pipeline has none.
91
+ * @permissions pipelines.view
92
+ */
93
+ getAutomation(pipelineId, headers) {
94
+ return this.client.get(`${this.basePath}/automations/${pipelineId}`, headers);
95
+ }
96
+ /**
97
+ * Copies a pipeline as `"<name> (copy)"`, with its stages, statuses, reasons and automations
98
+ * (not its departments). Resolves to the new pipeline as stored, without the stages.
99
+ * @permissions pipelines.view
100
+ */
101
+ duplicate(pipelineId, headers) {
102
+ return this.client.post(`${this.basePath}/duplicate/${pipelineId}`, void 0, headers);
103
+ }
104
+ /**
105
+ * Archives a pipeline. Resolves to the pipeline with its stages and their card totals.
106
+ * @permissions pipelines.update
107
+ */
108
+ archive(id, headers) {
109
+ return this.client.post(`${this.basePath}/${id}/archive`, { archive: true }, headers);
110
+ }
111
+ /**
112
+ * Restores an archived pipeline. Resolves to the pipeline with its stages and their totals.
113
+ * @permissions pipelines.update
114
+ */
115
+ unarchive(id, headers) {
116
+ return this.client.post(`${this.basePath}/${id}/archive`, { archive: false }, headers);
117
+ }
118
+ /**
119
+ * Exports the cards of a pipeline as CSV text (`;` as the delimiter): a summary block
120
+ * followed by one row per card.
121
+ * @permissions pipelines.view
122
+ */
123
+ exportCsv(id, body = {}, headers) {
124
+ return this.client.post(`${this.basePath}/${id}/export`, body, headers);
125
+ }
126
+ /**
127
+ * Lists the pipelines of the account with their stages and card totals. Not paginated.
128
+ * @permissions pipelines.view
129
+ */
130
+ getManyWithTotals(query, headers) {
131
+ return this.client.get(`${this.basePath}/withTotals${this.toQueryString(query)}`, headers);
132
+ }
133
+ /**
134
+ * Gets the card totals of a stage, optionally filtered like the board. Resolves to `null`
135
+ * for an unknown stage.
136
+ * @permissions pipelines.update OR pipelines.opportunity.update
137
+ */
138
+ getStageTotals(stageId, filters = {}, headers) {
139
+ return this.client.post(`${this.basePath}/stage-totals/${stageId}`, filters, headers);
140
+ }
8
141
  };
9
142
 
10
143
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"PipelineApi.mjs","names":[],"sources":["../../../src/apis/pipeline/PipelineApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { Pipeline, CreatePipelinePayload, UpdatePipelinePayload } from './types'\n\nexport class PipelineApi extends BaseCrudApi<\n Pipeline,\n CreatePipelinePayload,\n UpdatePipelinePayload\n> {\n constructor(client: ApiClient) {\n super(client, '/pipelines')\n }\n}\n"],"mappings":";;;AAIA,IAAa,cAAb,cAAiC,YAI/B;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,aAAa"}
1
+ {"version":3,"file":"PipelineApi.mjs","names":[],"sources":["../../../src/apis/pipeline/PipelineApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n CreatePipelineAutomationPayload,\n CreatePipelinePayload,\n CreatePipelineStagePayload,\n DeletePipelineStagePayload,\n DeletePipelineStageResult,\n DeletePipelineStatusPayload,\n ExportPipelinePayload,\n Pipeline,\n PipelineAutomation,\n PipelineRecord,\n PipelineStage,\n PipelineStageRefusal,\n PipelineStageStatusWithCount,\n PipelineStageTotals,\n PipelineStageTotalsFilters,\n PipelineStatusRef,\n PipelinesWithTotals,\n PipelinesWithTotalsQuery,\n UpdatePipelineAutomationPayload,\n UpdatePipelinePayload,\n UpdatePipelineStagePayload,\n} from './types'\n\nexport class PipelineApi extends BaseCrudApi<\n Pipeline,\n CreatePipelinePayload,\n UpdatePipelinePayload\n> {\n constructor(client: ApiClient) {\n super(client, '/pipelines')\n }\n\n /**\n * Adds a stage (with its statuses and reasons) to a pipeline. Resolves to the stage as stored,\n * without the statuses/reasons, or to a refusal code with 200: `'STAGES_LIMIT'` (the pipeline\n * already has 10 stages) or `'STAGE_ALREADY_EXIST'` (same name).\n * @permissions pipelines.update\n */\n createStage(\n body: CreatePipelineStagePayload,\n headers?: Record<string, string>,\n ): Promise<PipelineStage | PipelineStageRefusal> {\n return this.client.post<PipelineStage | PipelineStageRefusal, CreatePipelineStagePayload>(\n `${this.basePath}/stage`,\n body,\n headers,\n )\n }\n\n /**\n * Updates a stage. `statuses` and `reasons` replace the whole set: items with `id` are kept\n * and updated, items without it are created and the missing ones are deleted — omitting the\n * lists deletes every status and reason of the stage. Resolves to the stage as stored, or to\n * `'STAGE_ALREADY_EXIST'`.\n * @permissions pipelines.update\n */\n updateStage(\n id: string,\n body: UpdatePipelineStagePayload,\n headers?: Record<string, string>,\n ): Promise<PipelineStage | 'STAGE_ALREADY_EXIST'> {\n return this.client.put<PipelineStage | 'STAGE_ALREADY_EXIST', UpdatePipelineStagePayload>(\n `${this.basePath}/stage/${id}`,\n body,\n headers,\n )\n }\n\n /**\n * Deletes a stage and moves its cards (see {@link DeletePipelineStagePayload}). Resolves to\n * `'MESSAGE_STAGE_DELETED'`, or to `'PIPELINES_MIN_STAGES'` (nothing deleted) when the pipeline\n * has only 2 stages. The backend also serves this under `PUT /pipelines/delete-stage/{id}`.\n * @permissions pipelines.update\n */\n deleteStage(\n id: string,\n body: DeletePipelineStagePayload = {},\n headers?: Record<string, string>,\n ): Promise<DeletePipelineStageResult> {\n return this.client.request<DeletePipelineStageResult, DeletePipelineStagePayload>(\n 'DELETE',\n `${this.basePath}/stage/${id}`,\n body,\n headers,\n )\n }\n\n /**\n * Lists the statuses of every stage of a pipeline (`[]` for an unknown pipeline).\n * @permissions pipelines.view\n */\n getStatuses(pipelineId: string, headers?: Record<string, string>): Promise<PipelineStatusRef[]> {\n return this.client.get<PipelineStatusRef[]>(`${this.basePath}/statuses/${pipelineId}`, headers)\n }\n\n /**\n * Gets a stage status with the number of cards using it. An unknown id resolves to\n * `{ cardsCount: 0 }` with 200, not to an error.\n * @permissions pipelines.view\n */\n getStatus(\n id: string,\n headers?: Record<string, string>,\n ): Promise<PipelineStageStatusWithCount | { cardsCount: 0 }> {\n return this.client.get<PipelineStageStatusWithCount | { cardsCount: 0 }>(\n `${this.basePath}/status/${id}`,\n headers,\n )\n }\n\n /**\n * Deletes a stage status, keeping its cards without status or moving them to another one.\n * Resolves to `'MESSAGE_STATUS_DELETED'`.\n * @permissions pipelines.view\n */\n deleteStatus(\n id: string,\n body: DeletePipelineStatusPayload,\n headers?: Record<string, string>,\n ): Promise<'MESSAGE_STATUS_DELETED'> {\n return this.client.post<'MESSAGE_STATUS_DELETED', DeletePipelineStatusPayload>(\n `${this.basePath}/delete-status/${id}`,\n body,\n headers,\n )\n }\n\n /**\n * Renames a stage status — same route as {@link deleteStatus}, without an `action`.\n * Resolves to `'MESSAGE_STATUS_RENAMED'`; an empty name fails with 500.\n * @permissions pipelines.view\n */\n renameStatus(\n id: string,\n newStatusName: string,\n headers?: Record<string, string>,\n ): Promise<'MESSAGE_STATUS_RENAMED'> {\n return this.client.post<'MESSAGE_STATUS_RENAMED', { newStatusName: string }>(\n `${this.basePath}/delete-status/${id}`,\n { newStatusName },\n headers,\n )\n }\n\n /**\n * Creates an automation of a pipeline. Resolves to the automation as stored.\n * @permissions pipelines.update\n */\n createAutomation(\n body: CreatePipelineAutomationPayload,\n headers?: Record<string, string>,\n ): Promise<PipelineAutomation> {\n return this.client.post<PipelineAutomation, CreatePipelineAutomationPayload>(\n `${this.basePath}/automations`,\n body,\n headers,\n )\n }\n\n /**\n * Updates an automation. Resolves to the automation as stored.\n * @permissions pipelines.update\n */\n updateAutomation(\n id: string,\n body: UpdatePipelineAutomationPayload,\n headers?: Record<string, string>,\n ): Promise<PipelineAutomation> {\n return this.client.put<PipelineAutomation, UpdatePipelineAutomationPayload>(\n `${this.basePath}/automations/${id}`,\n body,\n headers,\n )\n }\n\n /**\n * Deletes an automation. Resolves with no content; an unknown id fails with 500.\n * @permissions pipelines.update\n */\n deleteAutomation(id: string, headers?: Record<string, string>): Promise<void> {\n return this.client.delete<void>(`${this.basePath}/automations/${id}`, headers)\n }\n\n /**\n * Gets the automation of a pipeline — a single object (the first one found), or `[]` when\n * the pipeline has none.\n * @permissions pipelines.view\n */\n getAutomation(\n pipelineId: string,\n headers?: Record<string, string>,\n ): Promise<PipelineAutomation | []> {\n return this.client.get<PipelineAutomation | []>(\n `${this.basePath}/automations/${pipelineId}`,\n headers,\n )\n }\n\n /**\n * Copies a pipeline as `\"<name> (copy)\"`, with its stages, statuses, reasons and automations\n * (not its departments). Resolves to the new pipeline as stored, without the stages.\n * @permissions pipelines.view\n */\n duplicate(pipelineId: string, headers?: Record<string, string>): Promise<PipelineRecord> {\n return this.client.post<PipelineRecord>(\n `${this.basePath}/duplicate/${pipelineId}`,\n undefined,\n headers,\n )\n }\n\n /**\n * Archives a pipeline. Resolves to the pipeline with its stages and their card totals.\n * @permissions pipelines.update\n */\n archive(id: string, headers?: Record<string, string>): Promise<Pipeline> {\n return this.client.post<Pipeline, { archive: boolean }>(\n `${this.basePath}/${id}/archive`,\n { archive: true },\n headers,\n )\n }\n\n /**\n * Restores an archived pipeline. Resolves to the pipeline with its stages and their totals.\n * @permissions pipelines.update\n */\n unarchive(id: string, headers?: Record<string, string>): Promise<Pipeline> {\n return this.client.post<Pipeline, { archive: boolean }>(\n `${this.basePath}/${id}/archive`,\n { archive: false },\n headers,\n )\n }\n\n /**\n * Exports the cards of a pipeline as CSV text (`;` as the delimiter): a summary block\n * followed by one row per card.\n * @permissions pipelines.view\n */\n exportCsv(\n id: string,\n body: ExportPipelinePayload = {},\n headers?: Record<string, string>,\n ): Promise<string> {\n return this.client.post<string, ExportPipelinePayload>(\n `${this.basePath}/${id}/export`,\n body,\n headers,\n )\n }\n\n /**\n * Lists the pipelines of the account with their stages and card totals. Not paginated.\n * @permissions pipelines.view\n */\n getManyWithTotals(\n query?: PipelinesWithTotalsQuery,\n headers?: Record<string, string>,\n ): Promise<PipelinesWithTotals> {\n return this.client.get<PipelinesWithTotals>(\n `${this.basePath}/withTotals${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * Gets the card totals of a stage, optionally filtered like the board. Resolves to `null`\n * for an unknown stage.\n * @permissions pipelines.update OR pipelines.opportunity.update\n */\n getStageTotals(\n stageId: string,\n filters: PipelineStageTotalsFilters = {},\n headers?: Record<string, string>,\n ): Promise<PipelineStageTotals | null> {\n return this.client.post<PipelineStageTotals | null, PipelineStageTotalsFilters>(\n `${this.basePath}/stage-totals/${stageId}`,\n filters,\n headers,\n )\n }\n}\n"],"mappings":";;;AA0BA,IAAa,cAAb,cAAiC,YAI/B;CACA,YAAY,QAAmB;AAC7B,QAAM,QAAQ,aAAa;;;;;;;;CAS7B,YACE,MACA,SAC+C;AAC/C,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,SACjB,MACA,QACD;;;;;;;;;CAUH,YACE,IACA,MACA,SACgD;AAChD,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,SAAS,MAC1B,MACA,QACD;;;;;;;;CASH,YACE,IACA,OAAmC,EAAE,EACrC,SACoC;AACpC,SAAO,KAAK,OAAO,QACjB,UACA,GAAG,KAAK,SAAS,SAAS,MAC1B,MACA,QACD;;;;;;CAOH,YAAY,YAAoB,SAAgE;AAC9F,SAAO,KAAK,OAAO,IAAyB,GAAG,KAAK,SAAS,YAAY,cAAc,QAAQ;;;;;;;CAQjG,UACE,IACA,SAC2D;AAC3D,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,UAAU,MAC3B,QACD;;;;;;;CAQH,aACE,IACA,MACA,SACmC;AACnC,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,iBAAiB,MAClC,MACA,QACD;;;;;;;CAQH,aACE,IACA,eACA,SACmC;AACnC,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,iBAAiB,MAClC,EAAE,eAAe,EACjB,QACD;;;;;;CAOH,iBACE,MACA,SAC6B;AAC7B,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,eACjB,MACA,QACD;;;;;;CAOH,iBACE,IACA,MACA,SAC6B;AAC7B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