@ikatec/digisac-api-sdk 4.5.1 → 4.7.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 (129) hide show
  1. package/README.md +16 -11
  2. package/dist/apis/answers/AnswersApi.cjs +38 -0
  3. package/dist/apis/answers/AnswersApi.cjs.map +1 -1
  4. package/dist/apis/answers/AnswersApi.d.ts +33 -2
  5. package/dist/apis/answers/AnswersApi.d.ts.map +1 -1
  6. package/dist/apis/answers/AnswersApi.mjs +38 -0
  7. package/dist/apis/answers/AnswersApi.mjs.map +1 -1
  8. package/dist/apis/answers/types.d.ts +64 -1
  9. package/dist/apis/answers/types.d.ts.map +1 -1
  10. package/dist/apis/botSimulators/BotSimulatorsApi.cjs +42 -0
  11. package/dist/apis/botSimulators/BotSimulatorsApi.cjs.map +1 -0
  12. package/dist/apis/botSimulators/BotSimulatorsApi.d.ts +31 -0
  13. package/dist/apis/botSimulators/BotSimulatorsApi.d.ts.map +1 -0
  14. package/dist/apis/botSimulators/BotSimulatorsApi.mjs +41 -0
  15. package/dist/apis/botSimulators/BotSimulatorsApi.mjs.map +1 -0
  16. package/dist/apis/botSimulators/index.cjs +4 -0
  17. package/dist/apis/botSimulators/index.d.ts +3 -0
  18. package/dist/apis/botSimulators/index.d.ts.map +1 -0
  19. package/dist/apis/botSimulators/index.mjs +3 -0
  20. package/dist/apis/botSimulators/types.cjs +0 -0
  21. package/dist/apis/botSimulators/types.d.ts +73 -0
  22. package/dist/apis/botSimulators/types.d.ts.map +1 -0
  23. package/dist/apis/botSimulators/types.mjs +0 -0
  24. package/dist/apis/botVersions/BotVersionsApi.cjs +25 -0
  25. package/dist/apis/botVersions/BotVersionsApi.cjs.map +1 -1
  26. package/dist/apis/botVersions/BotVersionsApi.d.ts +18 -0
  27. package/dist/apis/botVersions/BotVersionsApi.d.ts.map +1 -1
  28. package/dist/apis/botVersions/BotVersionsApi.mjs +25 -0
  29. package/dist/apis/botVersions/BotVersionsApi.mjs.map +1 -1
  30. package/dist/apis/botVersions/types.d.ts +4 -0
  31. package/dist/apis/botVersions/types.d.ts.map +1 -1
  32. package/dist/apis/bots/BotsApi.cjs +99 -4
  33. package/dist/apis/bots/BotsApi.cjs.map +1 -1
  34. package/dist/apis/bots/BotsApi.d.ts +78 -5
  35. package/dist/apis/bots/BotsApi.d.ts.map +1 -1
  36. package/dist/apis/bots/BotsApi.mjs +99 -4
  37. package/dist/apis/bots/BotsApi.mjs.map +1 -1
  38. package/dist/apis/bots/types.d.ts +266 -16
  39. package/dist/apis/bots/types.d.ts.map +1 -1
  40. package/dist/apis/index.cjs +3 -0
  41. package/dist/apis/index.d.ts +1 -0
  42. package/dist/apis/index.d.ts.map +1 -1
  43. package/dist/apis/index.mjs +3 -1
  44. package/dist/apis/questions/QuestionsApi.cjs +15 -0
  45. package/dist/apis/questions/QuestionsApi.cjs.map +1 -1
  46. package/dist/apis/questions/QuestionsApi.d.ts +15 -1
  47. package/dist/apis/questions/QuestionsApi.d.ts.map +1 -1
  48. package/dist/apis/questions/QuestionsApi.mjs +15 -0
  49. package/dist/apis/questions/QuestionsApi.mjs.map +1 -1
  50. package/dist/apis/questions/types.d.ts +25 -5
  51. package/dist/apis/questions/types.d.ts.map +1 -1
  52. package/dist/apis/quickReplies/QuickRepliesApi.cjs +16 -0
  53. package/dist/apis/quickReplies/QuickRepliesApi.cjs.map +1 -1
  54. package/dist/apis/quickReplies/QuickRepliesApi.d.ts +15 -2
  55. package/dist/apis/quickReplies/QuickRepliesApi.d.ts.map +1 -1
  56. package/dist/apis/quickReplies/QuickRepliesApi.mjs +16 -0
  57. package/dist/apis/quickReplies/QuickRepliesApi.mjs.map +1 -1
  58. package/dist/apis/quickReplies/types.d.ts +30 -2
  59. package/dist/apis/quickReplies/types.d.ts.map +1 -1
  60. package/dist/apis/schedule/ScheduleApi.cjs +37 -2
  61. package/dist/apis/schedule/ScheduleApi.cjs.map +1 -1
  62. package/dist/apis/schedule/ScheduleApi.d.ts +30 -3
  63. package/dist/apis/schedule/ScheduleApi.d.ts.map +1 -1
  64. package/dist/apis/schedule/ScheduleApi.mjs +37 -2
  65. package/dist/apis/schedule/ScheduleApi.mjs.map +1 -1
  66. package/dist/apis/schedule/types.d.ts +58 -11
  67. package/dist/apis/schedule/types.d.ts.map +1 -1
  68. package/dist/apis/ticketTopics/TicketTopicsApi.cjs +25 -2
  69. package/dist/apis/ticketTopics/TicketTopicsApi.cjs.map +1 -1
  70. package/dist/apis/ticketTopics/TicketTopicsApi.d.ts +18 -4
  71. package/dist/apis/ticketTopics/TicketTopicsApi.d.ts.map +1 -1
  72. package/dist/apis/ticketTopics/TicketTopicsApi.mjs +25 -2
  73. package/dist/apis/ticketTopics/TicketTopicsApi.mjs.map +1 -1
  74. package/dist/apis/ticketTopics/types.d.ts +22 -1
  75. package/dist/apis/ticketTopics/types.d.ts.map +1 -1
  76. package/dist/apis/tickets/TicketsApi.cjs +74 -1
  77. package/dist/apis/tickets/TicketsApi.cjs.map +1 -1
  78. package/dist/apis/tickets/TicketsApi.d.ts +68 -3
  79. package/dist/apis/tickets/TicketsApi.d.ts.map +1 -1
  80. package/dist/apis/tickets/TicketsApi.mjs +74 -1
  81. package/dist/apis/tickets/TicketsApi.mjs.map +1 -1
  82. package/dist/apis/tickets/types.d.ts +69 -8
  83. package/dist/apis/tickets/types.d.ts.map +1 -1
  84. package/dist/core/BaseCrudApi.cjs +5 -2
  85. package/dist/core/BaseCrudApi.cjs.map +1 -1
  86. package/dist/core/BaseCrudApi.d.ts +7 -4
  87. package/dist/core/BaseCrudApi.d.ts.map +1 -1
  88. package/dist/core/BaseCrudApi.mjs +5 -2
  89. package/dist/core/BaseCrudApi.mjs.map +1 -1
  90. package/dist/core/types.d.ts +1 -1
  91. package/dist/core/types.d.ts.map +1 -1
  92. package/dist/incommingWebhooks/index.d.ts +17 -9
  93. package/dist/incommingWebhooks/index.d.ts.map +1 -1
  94. package/package.json +1 -1
  95. package/src/apis/answers/AnswersApi.test.ts +67 -0
  96. package/src/apis/answers/AnswersApi.ts +66 -2
  97. package/src/apis/answers/types.ts +64 -2
  98. package/src/apis/botSimulators/BotSimulatorsApi.test.ts +58 -0
  99. package/src/apis/botSimulators/BotSimulatorsApi.ts +57 -0
  100. package/src/apis/botSimulators/index.ts +2 -0
  101. package/src/apis/botSimulators/types.ts +72 -0
  102. package/src/apis/botVersions/BotVersionsApi.test.ts +51 -0
  103. package/src/apis/botVersions/BotVersionsApi.ts +41 -0
  104. package/src/apis/botVersions/types.ts +4 -0
  105. package/src/apis/bots/BotsApi.test.ts +177 -0
  106. package/src/apis/bots/BotsApi.ts +162 -6
  107. package/src/apis/bots/types.ts +267 -15
  108. package/src/apis/index.ts +1 -0
  109. package/src/apis/payloads.test-d.ts +178 -1
  110. package/src/apis/queryFormat.test.ts +23 -0
  111. package/src/apis/questions/QuestionsApi.test.ts +49 -0
  112. package/src/apis/questions/QuestionsApi.ts +20 -1
  113. package/src/apis/questions/types.ts +25 -6
  114. package/src/apis/quickReplies/QuickRepliesApi.test.ts +69 -0
  115. package/src/apis/quickReplies/QuickRepliesApi.ts +35 -2
  116. package/src/apis/quickReplies/types.ts +34 -2
  117. package/src/apis/schedule/ScheduleApi.test.ts +80 -0
  118. package/src/apis/schedule/ScheduleApi.ts +59 -6
  119. package/src/apis/schedule/types.ts +66 -11
  120. package/src/apis/ticketTopics/TicketTopicsApi.test.ts +40 -0
  121. package/src/apis/ticketTopics/TicketTopicsApi.ts +35 -4
  122. package/src/apis/ticketTopics/types.ts +26 -1
  123. package/src/apis/tickets/TicketsApi.test.ts +142 -5
  124. package/src/apis/tickets/TicketsApi.ts +135 -3
  125. package/src/apis/tickets/types.ts +76 -6
  126. package/src/core/BaseCrudApi.ts +9 -5
  127. package/src/core/types.ts +2 -1
  128. package/src/incommingWebhooks/index.test-d.ts +23 -1
  129. package/src/incommingWebhooks/index.ts +18 -9
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/ticketTopics/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/ticketTopics/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEtD,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IAExB,uGAAuG;IACvG,WAAW,CAAC,EAAE,UAAU,EAAE,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG,aAAa,CAAA;AAEpD;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,SAAS,CAAC,WAAW,CAAC,GAAG;IAC1D,iDAAiD;IACjD,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACjC,sGAAsG;IACtG,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAC9B,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,uFAAuF;IACvF,IAAI,EAAE,MAAM,CAAA;IACZ,6GAA6G;IAC7G,WAAW,EAAE,MAAM,EAAE,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,sEAAsE;IACtE,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;CACvB,CAAA"}
@@ -2,21 +2,94 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_core_BaseCrudApi = require('../../core/BaseCrudApi.cjs');
3
3
 
4
4
  //#region src/apis/tickets/TicketsApi.ts
5
+ /**
6
+ * Tickets. The backend only serves them for reading (`getMany`, `getOne`, `getById`, the counts,
7
+ * the first waiting time and the exports) plus `closeMany`: a ticket is opened and transferred by
8
+ * `ContactsApi.transferTicket`. The reads check no permission (any authenticated user): the
9
+ * `@permissions` of the inherited `getMany`, `getOne` and `getById` do not apply here. `getById`
10
+ * of an unknown id resolves `null`. For a user who is not an admin, `getMany` leaves out the
11
+ * tickets of the contacts of the connections restricted to that user; the counts and `getById`
12
+ * do not.
13
+ */
5
14
  var TicketsApi = class extends require_core_BaseCrudApi.BaseCrudApi {
6
15
  constructor(client) {
7
16
  super(client, "/tickets");
8
17
  }
18
+ /** @deprecated Not served: `POST /tickets` answers 404 `Route not found.`. Open a ticket through `ContactsApi.transferTicket`. */
19
+ create(body, headers) {
20
+ return super.create(body, headers);
21
+ }
22
+ /** @deprecated Not served: `PUT /tickets/{id}` answers 404 `Route not found.`. Transfer through `ContactsApi.transferTicket`, close through `closeMany`. */
23
+ updateById(id, body, headers) {
24
+ return super.updateById(id, body, headers);
25
+ }
26
+ /** @deprecated Not served: `DELETE /tickets/{id}` answers 404 `Route not found.`. */
27
+ deleteById(id, headers) {
28
+ return super.deleteById(id, headers);
29
+ }
9
30
  /**
10
31
  * Closes multiple tickets in a single request. This is the only ticket-close
11
32
  * endpoint exposed by the API — there is no per-ticket close/update route.
12
33
  *
13
34
  * Pass `{ ids }` to close specific tickets, or `{ allContactsSelected: true, query }`
14
- * to close every OPEN ticket matching `query` (the backend forces `isOpen: true`).
35
+ * to close every OPEN ticket matching `query` (the backend forces `isOpen: true`): an empty
36
+ * `where` closes every open ticket of the account. The answer has no body. Ids of closed,
37
+ * unknown or other accounts' tickets are skipped in silence; no id and no
38
+ * `allContactsSelected` answers 400 `ids not found`.
15
39
  * @permissions tickets.close.all OR tickets.close.me
16
40
  */
17
41
  closeMany(payload, headers) {
18
42
  return this.client.put(`${this.basePath}/close-many`, payload, headers);
19
43
  }
44
+ count(query, headers) {
45
+ return this.client.get(`${this.basePath}/count${this.toQueryString(query)}`, headers);
46
+ }
47
+ countPost(body, headers) {
48
+ return this.client.post(`${this.basePath}/count`, body, headers);
49
+ }
50
+ /** Counts the open tickets of the contacts of a connection. An unknown id counts 0. */
51
+ countOpenByService(serviceId, headers) {
52
+ return this.client.get(`${this.basePath}/count-open/${serviceId}`, headers);
53
+ }
54
+ /** Counts the open tickets of a department. An unknown id counts 0. */
55
+ countOpenByDepartment(departmentId, headers) {
56
+ return this.client.get(`${this.basePath}/count-open-by-department/${departmentId}`, headers);
57
+ }
58
+ /** Counts the open tickets assigned to a user. An unknown id counts 0. */
59
+ countOpenByUser(userId, headers) {
60
+ return this.client.get(`${this.basePath}/count-open-by-user/${userId}`, headers);
61
+ }
62
+ /**
63
+ * The first waiting time of the ticket (`metrics.waitingTime`) as `HH:mm:ss`; `'00:00:00'` while
64
+ * it was not measured. The hours wrap every 24 h (a wait of 25 h answers `'01:00:00'`): read
65
+ * `metrics.waitingTime` (seconds) for the full value. An unknown id answers 500.
66
+ */
67
+ getFirstWaitingTime(id, headers) {
68
+ return this.client.get(`${this.basePath}/${id}/first-waiting-time`, headers);
69
+ }
70
+ /**
71
+ * Exports the conversation of a ticket as text, by its protocol (contact, attendants, subjects,
72
+ * summary, dates and the messages without the internal comments), sent as the attachment
73
+ * `<protocol>.txt` (Content-Type `plain/text`). Without a protocol the body is empty
74
+ * (`undefined`); an unknown protocol never answers.
75
+ */
76
+ exportTxt(protocol, headers) {
77
+ return this.client.post(`${this.basePath}/export`, { protocol }, headers);
78
+ }
79
+ /**
80
+ * Exports the tickets matching the query as CSV (`;`, a header of 20 columns in the language of
81
+ * the user, dates in the timezone of the account), streamed without a Content-Type.
82
+ *
83
+ * The query must include `contact` with its `service` (the History screen also includes
84
+ * `contact.tags`, `contact.person`, `user`, `department`, `ticketTopics` and `firstMessage`),
85
+ * and `order` must name unambiguous columns (e.g. `startedAt`): when a row fails after the header
86
+ * is sent, the answer never ends. Leave `page` out: the route pages through every match itself
87
+ * (`perPage` only sets the size of each batch), and a `page` in the query is read on every
88
+ * batch, so its rows are repeated or the CSV comes with the header only.
89
+ */
90
+ exportHistory(query, headers) {
91
+ return this.client.post(`${this.basePath}/export-history${this.toQueryString(query)}`, void 0, headers);
92
+ }
20
93
  };
21
94
 
22
95
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"TicketsApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/tickets/TicketsApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n Ticket,\n CreateTicketPayload,\n UpdateTicketPayload,\n CloseManyTicketsPayload,\n} from './types'\n\nexport class TicketsApi extends BaseCrudApi<Ticket, CreateTicketPayload, UpdateTicketPayload> {\n constructor(client: ApiClient) {\n super(client, '/tickets')\n }\n\n /**\n * Closes multiple tickets in a single request. This is the only ticket-close\n * endpoint exposed by the API — there is no per-ticket close/update route.\n *\n * Pass `{ ids }` to close specific tickets, or `{ allContactsSelected: true, query }`\n * to close every OPEN ticket matching `query` (the backend forces `isOpen: true`).\n * @permissions tickets.close.all OR tickets.close.me\n */\n closeMany(payload: CloseManyTicketsPayload, headers?: Record<string, string>): Promise<unknown> {\n return this.client.put<unknown, CloseManyTicketsPayload>(\n `${this.basePath}/close-many`,\n payload,\n headers,\n )\n }\n}\n"],"mappings":";;;;AASA,IAAa,aAAb,cAAgCA,qCAA8D;CAC5F,YAAY,QAAmB;AAC7B,QAAM,QAAQ,WAAW;;;;;;;;;;CAW3B,UAAU,SAAkC,SAAoD;AAC9F,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,cACjB,SACA,QACD"}
1
+ {"version":3,"file":"TicketsApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/tickets/TicketsApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n Ticket,\n CreateTicketPayload,\n UpdateTicketPayload,\n CloseManyTicketsPayload,\n TicketsCount,\n TicketsCountManyQuery,\n TicketsCountPostPayload,\n TicketsCounts,\n TicketsListQuery,\n} from './types'\n\n/**\n * Tickets. The backend only serves them for reading (`getMany`, `getOne`, `getById`, the counts,\n * the first waiting time and the exports) plus `closeMany`: a ticket is opened and transferred by\n * `ContactsApi.transferTicket`. The reads check no permission (any authenticated user): the\n * `@permissions` of the inherited `getMany`, `getOne` and `getById` do not apply here. `getById`\n * of an unknown id resolves `null`. For a user who is not an admin, `getMany` leaves out the\n * tickets of the contacts of the connections restricted to that user; the counts and `getById`\n * do not.\n */\nexport class TicketsApi extends BaseCrudApi<Ticket, CreateTicketPayload, UpdateTicketPayload> {\n constructor(client: ApiClient) {\n super(client, '/tickets')\n }\n\n /** @deprecated Not served: `POST /tickets` answers 404 `Route not found.`. Open a ticket through `ContactsApi.transferTicket`. */\n override create(body: CreateTicketPayload, headers?: Record<string, string>): Promise<Ticket> {\n return super.create(body, headers)\n }\n\n /** @deprecated Not served: `PUT /tickets/{id}` answers 404 `Route not found.`. Transfer through `ContactsApi.transferTicket`, close through `closeMany`. */\n override updateById(\n id: string,\n body: UpdateTicketPayload,\n headers?: Record<string, string>,\n ): Promise<Ticket> {\n return super.updateById(id, body, headers)\n }\n\n /** @deprecated Not served: `DELETE /tickets/{id}` answers 404 `Route not found.`. */\n override deleteById(id: string, headers?: Record<string, string>): Promise<Ticket> {\n return super.deleteById(id, headers)\n }\n\n /**\n * Closes multiple tickets in a single request. This is the only ticket-close\n * endpoint exposed by the API — there is no per-ticket close/update route.\n *\n * Pass `{ ids }` to close specific tickets, or `{ allContactsSelected: true, query }`\n * to close every OPEN ticket matching `query` (the backend forces `isOpen: true`): an empty\n * `where` closes every open ticket of the account. The answer has no body. Ids of closed,\n * unknown or other accounts' tickets are skipped in silence; no id and no\n * `allContactsSelected` answers 400 `ids not found`.\n * @permissions tickets.close.all OR tickets.close.me\n */\n closeMany(payload: CloseManyTicketsPayload, headers?: Record<string, string>): Promise<void> {\n return this.client.put<void, CloseManyTicketsPayload>(\n `${this.basePath}/close-many`,\n payload,\n headers,\n )\n }\n\n /**\n * Counts the tickets matching the query. With `queries`, answers one count per query, in the\n * same order (the root filters are then ignored).\n */\n count(query: TicketsCountManyQuery, headers?: Record<string, string>): Promise<TicketsCounts>\n count(query?: TicketsListQuery, headers?: Record<string, string>): Promise<TicketsCount>\n count(\n query?: TicketsListQuery | TicketsCountManyQuery,\n headers?: Record<string, string>,\n ): Promise<TicketsCount | TicketsCounts> {\n return this.client.get<TicketsCount | TicketsCounts>(\n `${this.basePath}/count${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * POST variant of `count`, for queries too long for the URL. See {@link TicketsCountPostPayload}:\n * `query` is required.\n */\n countPost(\n body: TicketsCountPostPayload & { query: { queries: TicketsListQuery[] } },\n headers?: Record<string, string>,\n ): Promise<TicketsCounts>\n countPost(body: TicketsCountPostPayload, headers?: Record<string, string>): Promise<TicketsCount>\n countPost(\n body: TicketsCountPostPayload,\n headers?: Record<string, string>,\n ): Promise<TicketsCount | TicketsCounts> {\n return this.client.post<TicketsCount | TicketsCounts, TicketsCountPostPayload>(\n `${this.basePath}/count`,\n body,\n headers,\n )\n }\n\n /** Counts the open tickets of the contacts of a connection. An unknown id counts 0. */\n countOpenByService(serviceId: string, headers?: Record<string, string>): Promise<number> {\n return this.client.get<number>(`${this.basePath}/count-open/${serviceId}`, headers)\n }\n\n /** Counts the open tickets of a department. An unknown id counts 0. */\n countOpenByDepartment(departmentId: string, headers?: Record<string, string>): Promise<number> {\n return this.client.get<number>(\n `${this.basePath}/count-open-by-department/${departmentId}`,\n headers,\n )\n }\n\n /** Counts the open tickets assigned to a user. An unknown id counts 0. */\n countOpenByUser(userId: string, headers?: Record<string, string>): Promise<number> {\n return this.client.get<number>(`${this.basePath}/count-open-by-user/${userId}`, headers)\n }\n\n /**\n * The first waiting time of the ticket (`metrics.waitingTime`) as `HH:mm:ss`; `'00:00:00'` while\n * it was not measured. The hours wrap every 24 h (a wait of 25 h answers `'01:00:00'`): read\n * `metrics.waitingTime` (seconds) for the full value. An unknown id answers 500.\n */\n getFirstWaitingTime(id: string, headers?: Record<string, string>): Promise<string> {\n return this.client.get<string>(`${this.basePath}/${id}/first-waiting-time`, headers)\n }\n\n /**\n * Exports the conversation of a ticket as text, by its protocol (contact, attendants, subjects,\n * summary, dates and the messages without the internal comments), sent as the attachment\n * `<protocol>.txt` (Content-Type `plain/text`). Without a protocol the body is empty\n * (`undefined`); an unknown protocol never answers.\n */\n exportTxt(protocol: string, headers?: Record<string, string>): Promise<string> {\n return this.client.post<string, { protocol: string }>(\n `${this.basePath}/export`,\n { protocol },\n headers,\n )\n }\n\n /**\n * Exports the tickets matching the query as CSV (`;`, a header of 20 columns in the language of\n * the user, dates in the timezone of the account), streamed without a Content-Type.\n *\n * The query must include `contact` with its `service` (the History screen also includes\n * `contact.tags`, `contact.person`, `user`, `department`, `ticketTopics` and `firstMessage`),\n * and `order` must name unambiguous columns (e.g. `startedAt`): when a row fails after the header\n * is sent, the answer never ends. Leave `page` out: the route pages through every match itself\n * (`perPage` only sets the size of each batch), and a `page` in the query is read on every\n * batch, so its rows are repeated or the CSV comes with the header only.\n */\n exportHistory(query: TicketsListQuery, headers?: Record<string, string>): Promise<string> {\n return this.client.post<string>(\n `${this.basePath}/export-history${this.toQueryString(query)}`,\n undefined,\n headers,\n )\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAuBA,IAAa,aAAb,cAAgCA,qCAA8D;CAC5F,YAAY,QAAmB;AAC7B,QAAM,QAAQ,WAAW;;;CAI3B,AAAS,OAAO,MAA2B,SAAmD;AAC5F,SAAO,MAAM,OAAO,MAAM,QAAQ;;;CAIpC,AAAS,WACP,IACA,MACA,SACiB;AACjB,SAAO,MAAM,WAAW,IAAI,MAAM,QAAQ;;;CAI5C,AAAS,WAAW,IAAY,SAAmD;AACjF,SAAO,MAAM,WAAW,IAAI,QAAQ;;;;;;;;;;;;;CActC,UAAU,SAAkC,SAAiD;AAC3F,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,cACjB,SACA,QACD;;CASH,MACE,OACA,SACuC;AACvC,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,QAAQ,KAAK,cAAc,MAAM,IAClD,QACD;;CAYH,UACE,MACA,SACuC;AACvC,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,SACjB,MACA,QACD;;;CAIH,mBAAmB,WAAmB,SAAmD;AACvF,SAAO,KAAK,OAAO,IAAY,GAAG,KAAK,SAAS,cAAc,aAAa,QAAQ;;;CAIrF,sBAAsB,cAAsB,SAAmD;AAC7F,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,4BAA4B,gBAC7C,QACD;;;CAIH,gBAAgB,QAAgB,SAAmD;AACjF,SAAO,KAAK,OAAO,IAAY,GAAG,KAAK,SAAS,sBAAsB,UAAU,QAAQ;;;;;;;CAQ1F,oBAAoB,IAAY,SAAmD;AACjF,SAAO,KAAK,OAAO,IAAY,GAAG,KAAK,SAAS,GAAG,GAAG,sBAAsB,QAAQ;;;;;;;;CAStF,UAAU,UAAkB,SAAmD;AAC7E,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,UACjB,EAAE,UAAU,EACZ,QACD;;;;;;;;;;;;;CAcH,cAAc,OAAyB,SAAmD;AACxF,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,iBAAiB,KAAK,cAAc,MAAM,IAC3D,QACA,QACD"}
@@ -1,16 +1,81 @@
1
1
  import type { ApiClient } from '../../core/ApiClient';
2
2
  import { BaseCrudApi } from '../../core/BaseCrudApi';
3
- import type { Ticket, CreateTicketPayload, UpdateTicketPayload, CloseManyTicketsPayload } from './types';
3
+ import type { Ticket, CreateTicketPayload, UpdateTicketPayload, CloseManyTicketsPayload, TicketsCount, TicketsCountManyQuery, TicketsCountPostPayload, TicketsCounts, TicketsListQuery } from './types';
4
+ /**
5
+ * Tickets. The backend only serves them for reading (`getMany`, `getOne`, `getById`, the counts,
6
+ * the first waiting time and the exports) plus `closeMany`: a ticket is opened and transferred by
7
+ * `ContactsApi.transferTicket`. The reads check no permission (any authenticated user): the
8
+ * `@permissions` of the inherited `getMany`, `getOne` and `getById` do not apply here. `getById`
9
+ * of an unknown id resolves `null`. For a user who is not an admin, `getMany` leaves out the
10
+ * tickets of the contacts of the connections restricted to that user; the counts and `getById`
11
+ * do not.
12
+ */
4
13
  export declare class TicketsApi extends BaseCrudApi<Ticket, CreateTicketPayload, UpdateTicketPayload> {
5
14
  constructor(client: ApiClient);
15
+ /** @deprecated Not served: `POST /tickets` answers 404 `Route not found.`. Open a ticket through `ContactsApi.transferTicket`. */
16
+ create(body: CreateTicketPayload, headers?: Record<string, string>): Promise<Ticket>;
17
+ /** @deprecated Not served: `PUT /tickets/{id}` answers 404 `Route not found.`. Transfer through `ContactsApi.transferTicket`, close through `closeMany`. */
18
+ updateById(id: string, body: UpdateTicketPayload, headers?: Record<string, string>): Promise<Ticket>;
19
+ /** @deprecated Not served: `DELETE /tickets/{id}` answers 404 `Route not found.`. */
20
+ deleteById(id: string, headers?: Record<string, string>): Promise<Ticket>;
6
21
  /**
7
22
  * Closes multiple tickets in a single request. This is the only ticket-close
8
23
  * endpoint exposed by the API — there is no per-ticket close/update route.
9
24
  *
10
25
  * Pass `{ ids }` to close specific tickets, or `{ allContactsSelected: true, query }`
11
- * to close every OPEN ticket matching `query` (the backend forces `isOpen: true`).
26
+ * to close every OPEN ticket matching `query` (the backend forces `isOpen: true`): an empty
27
+ * `where` closes every open ticket of the account. The answer has no body. Ids of closed,
28
+ * unknown or other accounts' tickets are skipped in silence; no id and no
29
+ * `allContactsSelected` answers 400 `ids not found`.
12
30
  * @permissions tickets.close.all OR tickets.close.me
13
31
  */
14
- closeMany(payload: CloseManyTicketsPayload, headers?: Record<string, string>): Promise<unknown>;
32
+ closeMany(payload: CloseManyTicketsPayload, headers?: Record<string, string>): Promise<void>;
33
+ /**
34
+ * Counts the tickets matching the query. With `queries`, answers one count per query, in the
35
+ * same order (the root filters are then ignored).
36
+ */
37
+ count(query: TicketsCountManyQuery, headers?: Record<string, string>): Promise<TicketsCounts>;
38
+ count(query?: TicketsListQuery, headers?: Record<string, string>): Promise<TicketsCount>;
39
+ /**
40
+ * POST variant of `count`, for queries too long for the URL. See {@link TicketsCountPostPayload}:
41
+ * `query` is required.
42
+ */
43
+ countPost(body: TicketsCountPostPayload & {
44
+ query: {
45
+ queries: TicketsListQuery[];
46
+ };
47
+ }, headers?: Record<string, string>): Promise<TicketsCounts>;
48
+ countPost(body: TicketsCountPostPayload, headers?: Record<string, string>): Promise<TicketsCount>;
49
+ /** Counts the open tickets of the contacts of a connection. An unknown id counts 0. */
50
+ countOpenByService(serviceId: string, headers?: Record<string, string>): Promise<number>;
51
+ /** Counts the open tickets of a department. An unknown id counts 0. */
52
+ countOpenByDepartment(departmentId: string, headers?: Record<string, string>): Promise<number>;
53
+ /** Counts the open tickets assigned to a user. An unknown id counts 0. */
54
+ countOpenByUser(userId: string, headers?: Record<string, string>): Promise<number>;
55
+ /**
56
+ * The first waiting time of the ticket (`metrics.waitingTime`) as `HH:mm:ss`; `'00:00:00'` while
57
+ * it was not measured. The hours wrap every 24 h (a wait of 25 h answers `'01:00:00'`): read
58
+ * `metrics.waitingTime` (seconds) for the full value. An unknown id answers 500.
59
+ */
60
+ getFirstWaitingTime(id: string, headers?: Record<string, string>): Promise<string>;
61
+ /**
62
+ * Exports the conversation of a ticket as text, by its protocol (contact, attendants, subjects,
63
+ * summary, dates and the messages without the internal comments), sent as the attachment
64
+ * `<protocol>.txt` (Content-Type `plain/text`). Without a protocol the body is empty
65
+ * (`undefined`); an unknown protocol never answers.
66
+ */
67
+ exportTxt(protocol: string, headers?: Record<string, string>): Promise<string>;
68
+ /**
69
+ * Exports the tickets matching the query as CSV (`;`, a header of 20 columns in the language of
70
+ * the user, dates in the timezone of the account), streamed without a Content-Type.
71
+ *
72
+ * The query must include `contact` with its `service` (the History screen also includes
73
+ * `contact.tags`, `contact.person`, `user`, `department`, `ticketTopics` and `firstMessage`),
74
+ * and `order` must name unambiguous columns (e.g. `startedAt`): when a row fails after the header
75
+ * is sent, the answer never ends. Leave `page` out: the route pages through every match itself
76
+ * (`perPage` only sets the size of each batch), and a `page` in the query is read on every
77
+ * batch, so its rows are repeated or the CSV comes with the header only.
78
+ */
79
+ exportHistory(query: TicketsListQuery, headers?: Record<string, string>): Promise<string>;
15
80
  }
16
81
  //# sourceMappingURL=TicketsApi.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TicketsApi.d.ts","sourceRoot":"","sources":["../../../src/apis/tickets/TicketsApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,EACV,MAAM,EACN,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,SAAS,CAAA;AAEhB,qBAAa,UAAW,SAAQ,WAAW,CAAC,MAAM,EAAE,mBAAmB,EAAE,mBAAmB,CAAC;gBAC/E,MAAM,EAAE,SAAS;IAI7B;;;;;;;OAOG;IACH,SAAS,CAAC,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EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAQ9E;;;;;;;;;;OAUG;IACH,aAAa,CAAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;CAO1F"}
@@ -1,21 +1,94 @@
1
1
  import { BaseCrudApi } from "../../core/BaseCrudApi.mjs";
2
2
 
3
3
  //#region src/apis/tickets/TicketsApi.ts
4
+ /**
5
+ * Tickets. The backend only serves them for reading (`getMany`, `getOne`, `getById`, the counts,
6
+ * the first waiting time and the exports) plus `closeMany`: a ticket is opened and transferred by
7
+ * `ContactsApi.transferTicket`. The reads check no permission (any authenticated user): the
8
+ * `@permissions` of the inherited `getMany`, `getOne` and `getById` do not apply here. `getById`
9
+ * of an unknown id resolves `null`. For a user who is not an admin, `getMany` leaves out the
10
+ * tickets of the contacts of the connections restricted to that user; the counts and `getById`
11
+ * do not.
12
+ */
4
13
  var TicketsApi = class extends BaseCrudApi {
5
14
  constructor(client) {
6
15
  super(client, "/tickets");
7
16
  }
17
+ /** @deprecated Not served: `POST /tickets` answers 404 `Route not found.`. Open a ticket through `ContactsApi.transferTicket`. */
18
+ create(body, headers) {
19
+ return super.create(body, headers);
20
+ }
21
+ /** @deprecated Not served: `PUT /tickets/{id}` answers 404 `Route not found.`. Transfer through `ContactsApi.transferTicket`, close through `closeMany`. */
22
+ updateById(id, body, headers) {
23
+ return super.updateById(id, body, headers);
24
+ }
25
+ /** @deprecated Not served: `DELETE /tickets/{id}` answers 404 `Route not found.`. */
26
+ deleteById(id, headers) {
27
+ return super.deleteById(id, headers);
28
+ }
8
29
  /**
9
30
  * Closes multiple tickets in a single request. This is the only ticket-close
10
31
  * endpoint exposed by the API — there is no per-ticket close/update route.
11
32
  *
12
33
  * Pass `{ ids }` to close specific tickets, or `{ allContactsSelected: true, query }`
13
- * to close every OPEN ticket matching `query` (the backend forces `isOpen: true`).
34
+ * to close every OPEN ticket matching `query` (the backend forces `isOpen: true`): an empty
35
+ * `where` closes every open ticket of the account. The answer has no body. Ids of closed,
36
+ * unknown or other accounts' tickets are skipped in silence; no id and no
37
+ * `allContactsSelected` answers 400 `ids not found`.
14
38
  * @permissions tickets.close.all OR tickets.close.me
15
39
  */
16
40
  closeMany(payload, headers) {
17
41
  return this.client.put(`${this.basePath}/close-many`, payload, headers);
18
42
  }
43
+ count(query, headers) {
44
+ return this.client.get(`${this.basePath}/count${this.toQueryString(query)}`, headers);
45
+ }
46
+ countPost(body, headers) {
47
+ return this.client.post(`${this.basePath}/count`, body, headers);
48
+ }
49
+ /** Counts the open tickets of the contacts of a connection. An unknown id counts 0. */
50
+ countOpenByService(serviceId, headers) {
51
+ return this.client.get(`${this.basePath}/count-open/${serviceId}`, headers);
52
+ }
53
+ /** Counts the open tickets of a department. An unknown id counts 0. */
54
+ countOpenByDepartment(departmentId, headers) {
55
+ return this.client.get(`${this.basePath}/count-open-by-department/${departmentId}`, headers);
56
+ }
57
+ /** Counts the open tickets assigned to a user. An unknown id counts 0. */
58
+ countOpenByUser(userId, headers) {
59
+ return this.client.get(`${this.basePath}/count-open-by-user/${userId}`, headers);
60
+ }
61
+ /**
62
+ * The first waiting time of the ticket (`metrics.waitingTime`) as `HH:mm:ss`; `'00:00:00'` while
63
+ * it was not measured. The hours wrap every 24 h (a wait of 25 h answers `'01:00:00'`): read
64
+ * `metrics.waitingTime` (seconds) for the full value. An unknown id answers 500.
65
+ */
66
+ getFirstWaitingTime(id, headers) {
67
+ return this.client.get(`${this.basePath}/${id}/first-waiting-time`, headers);
68
+ }
69
+ /**
70
+ * Exports the conversation of a ticket as text, by its protocol (contact, attendants, subjects,
71
+ * summary, dates and the messages without the internal comments), sent as the attachment
72
+ * `<protocol>.txt` (Content-Type `plain/text`). Without a protocol the body is empty
73
+ * (`undefined`); an unknown protocol never answers.
74
+ */
75
+ exportTxt(protocol, headers) {
76
+ return this.client.post(`${this.basePath}/export`, { protocol }, headers);
77
+ }
78
+ /**
79
+ * Exports the tickets matching the query as CSV (`;`, a header of 20 columns in the language of
80
+ * the user, dates in the timezone of the account), streamed without a Content-Type.
81
+ *
82
+ * The query must include `contact` with its `service` (the History screen also includes
83
+ * `contact.tags`, `contact.person`, `user`, `department`, `ticketTopics` and `firstMessage`),
84
+ * and `order` must name unambiguous columns (e.g. `startedAt`): when a row fails after the header
85
+ * is sent, the answer never ends. Leave `page` out: the route pages through every match itself
86
+ * (`perPage` only sets the size of each batch), and a `page` in the query is read on every
87
+ * batch, so its rows are repeated or the CSV comes with the header only.
88
+ */
89
+ exportHistory(query, headers) {
90
+ return this.client.post(`${this.basePath}/export-history${this.toQueryString(query)}`, void 0, headers);
91
+ }
19
92
  };
20
93
 
21
94
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"TicketsApi.mjs","names":[],"sources":["../../../src/apis/tickets/TicketsApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n Ticket,\n CreateTicketPayload,\n UpdateTicketPayload,\n CloseManyTicketsPayload,\n} from './types'\n\nexport class TicketsApi extends BaseCrudApi<Ticket, CreateTicketPayload, UpdateTicketPayload> {\n constructor(client: ApiClient) {\n super(client, '/tickets')\n }\n\n /**\n * Closes multiple tickets in a single request. This is the only ticket-close\n * endpoint exposed by the API — there is no per-ticket close/update route.\n *\n * Pass `{ ids }` to close specific tickets, or `{ allContactsSelected: true, query }`\n * to close every OPEN ticket matching `query` (the backend forces `isOpen: true`).\n * @permissions tickets.close.all OR tickets.close.me\n */\n closeMany(payload: CloseManyTicketsPayload, headers?: Record<string, string>): Promise<unknown> {\n return this.client.put<unknown, CloseManyTicketsPayload>(\n `${this.basePath}/close-many`,\n payload,\n headers,\n )\n }\n}\n"],"mappings":";;;AASA,IAAa,aAAb,cAAgC,YAA8D;CAC5F,YAAY,QAAmB;AAC7B,QAAM,QAAQ,WAAW;;;;;;;;;;CAW3B,UAAU,SAAkC,SAAoD;AAC9F,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,cACjB,SACA,QACD"}
1
+ {"version":3,"file":"TicketsApi.mjs","names":[],"sources":["../../../src/apis/tickets/TicketsApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type {\n Ticket,\n CreateTicketPayload,\n UpdateTicketPayload,\n CloseManyTicketsPayload,\n TicketsCount,\n TicketsCountManyQuery,\n TicketsCountPostPayload,\n TicketsCounts,\n TicketsListQuery,\n} from './types'\n\n/**\n * Tickets. The backend only serves them for reading (`getMany`, `getOne`, `getById`, the counts,\n * the first waiting time and the exports) plus `closeMany`: a ticket is opened and transferred by\n * `ContactsApi.transferTicket`. The reads check no permission (any authenticated user): the\n * `@permissions` of the inherited `getMany`, `getOne` and `getById` do not apply here. `getById`\n * of an unknown id resolves `null`. For a user who is not an admin, `getMany` leaves out the\n * tickets of the contacts of the connections restricted to that user; the counts and `getById`\n * do not.\n */\nexport class TicketsApi extends BaseCrudApi<Ticket, CreateTicketPayload, UpdateTicketPayload> {\n constructor(client: ApiClient) {\n super(client, '/tickets')\n }\n\n /** @deprecated Not served: `POST /tickets` answers 404 `Route not found.`. Open a ticket through `ContactsApi.transferTicket`. */\n override create(body: CreateTicketPayload, headers?: Record<string, string>): Promise<Ticket> {\n return super.create(body, headers)\n }\n\n /** @deprecated Not served: `PUT /tickets/{id}` answers 404 `Route not found.`. Transfer through `ContactsApi.transferTicket`, close through `closeMany`. */\n override updateById(\n id: string,\n body: UpdateTicketPayload,\n headers?: Record<string, string>,\n ): Promise<Ticket> {\n return super.updateById(id, body, headers)\n }\n\n /** @deprecated Not served: `DELETE /tickets/{id}` answers 404 `Route not found.`. */\n override deleteById(id: string, headers?: Record<string, string>): Promise<Ticket> {\n return super.deleteById(id, headers)\n }\n\n /**\n * Closes multiple tickets in a single request. This is the only ticket-close\n * endpoint exposed by the API — there is no per-ticket close/update route.\n *\n * Pass `{ ids }` to close specific tickets, or `{ allContactsSelected: true, query }`\n * to close every OPEN ticket matching `query` (the backend forces `isOpen: true`): an empty\n * `where` closes every open ticket of the account. The answer has no body. Ids of closed,\n * unknown or other accounts' tickets are skipped in silence; no id and no\n * `allContactsSelected` answers 400 `ids not found`.\n * @permissions tickets.close.all OR tickets.close.me\n */\n closeMany(payload: CloseManyTicketsPayload, headers?: Record<string, string>): Promise<void> {\n return this.client.put<void, CloseManyTicketsPayload>(\n `${this.basePath}/close-many`,\n payload,\n headers,\n )\n }\n\n /**\n * Counts the tickets matching the query. With `queries`, answers one count per query, in the\n * same order (the root filters are then ignored).\n */\n count(query: TicketsCountManyQuery, headers?: Record<string, string>): Promise<TicketsCounts>\n count(query?: TicketsListQuery, headers?: Record<string, string>): Promise<TicketsCount>\n count(\n query?: TicketsListQuery | TicketsCountManyQuery,\n headers?: Record<string, string>,\n ): Promise<TicketsCount | TicketsCounts> {\n return this.client.get<TicketsCount | TicketsCounts>(\n `${this.basePath}/count${this.toQueryString(query)}`,\n headers,\n )\n }\n\n /**\n * POST variant of `count`, for queries too long for the URL. See {@link TicketsCountPostPayload}:\n * `query` is required.\n */\n countPost(\n body: TicketsCountPostPayload & { query: { queries: TicketsListQuery[] } },\n headers?: Record<string, string>,\n ): Promise<TicketsCounts>\n countPost(body: TicketsCountPostPayload, headers?: Record<string, string>): Promise<TicketsCount>\n countPost(\n body: TicketsCountPostPayload,\n headers?: Record<string, string>,\n ): Promise<TicketsCount | TicketsCounts> {\n return this.client.post<TicketsCount | TicketsCounts, TicketsCountPostPayload>(\n `${this.basePath}/count`,\n body,\n headers,\n )\n }\n\n /** Counts the open tickets of the contacts of a connection. An unknown id counts 0. */\n countOpenByService(serviceId: string, headers?: Record<string, string>): Promise<number> {\n return this.client.get<number>(`${this.basePath}/count-open/${serviceId}`, headers)\n }\n\n /** Counts the open tickets of a department. An unknown id counts 0. */\n countOpenByDepartment(departmentId: string, headers?: Record<string, string>): Promise<number> {\n return this.client.get<number>(\n `${this.basePath}/count-open-by-department/${departmentId}`,\n headers,\n )\n }\n\n /** Counts the open tickets assigned to a user. An unknown id counts 0. */\n countOpenByUser(userId: string, headers?: Record<string, string>): Promise<number> {\n return this.client.get<number>(`${this.basePath}/count-open-by-user/${userId}`, headers)\n }\n\n /**\n * The first waiting time of the ticket (`metrics.waitingTime`) as `HH:mm:ss`; `'00:00:00'` while\n * it was not measured. The hours wrap every 24 h (a wait of 25 h answers `'01:00:00'`): read\n * `metrics.waitingTime` (seconds) for the full value. An unknown id answers 500.\n */\n getFirstWaitingTime(id: string, headers?: Record<string, string>): Promise<string> {\n return this.client.get<string>(`${this.basePath}/${id}/first-waiting-time`, headers)\n }\n\n /**\n * Exports the conversation of a ticket as text, by its protocol (contact, attendants, subjects,\n * summary, dates and the messages without the internal comments), sent as the attachment\n * `<protocol>.txt` (Content-Type `plain/text`). Without a protocol the body is empty\n * (`undefined`); an unknown protocol never answers.\n */\n exportTxt(protocol: string, headers?: Record<string, string>): Promise<string> {\n return this.client.post<string, { protocol: string }>(\n `${this.basePath}/export`,\n { protocol },\n headers,\n )\n }\n\n /**\n * Exports the tickets matching the query as CSV (`;`, a header of 20 columns in the language of\n * the user, dates in the timezone of the account), streamed without a Content-Type.\n *\n * The query must include `contact` with its `service` (the History screen also includes\n * `contact.tags`, `contact.person`, `user`, `department`, `ticketTopics` and `firstMessage`),\n * and `order` must name unambiguous columns (e.g. `startedAt`): when a row fails after the header\n * is sent, the answer never ends. Leave `page` out: the route pages through every match itself\n * (`perPage` only sets the size of each batch), and a `page` in the query is read on every\n * batch, so its rows are repeated or the CSV comes with the header only.\n */\n exportHistory(query: TicketsListQuery, headers?: Record<string, string>): Promise<string> {\n return this.client.post<string>(\n `${this.basePath}/export-history${this.toQueryString(query)}`,\n undefined,\n headers,\n )\n }\n}\n"],"mappings":";;;;;;;;;;;;AAuBA,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Ac,MAAM,IAC3D,QACA,QACD"}
@@ -1,7 +1,10 @@
1
+ import type { ListQuery } from '../../core/types';
2
+ import type { Account } from '../accounts/types';
1
3
  import type { Contact } from '../contacts/types';
2
4
  import type { Department } from '../departments/types';
3
5
  import type { Message } from '../messages/types';
4
6
  import type { Service } from '../services/types';
7
+ import type { TicketTopic } from '../ticketTopics/types';
5
8
  import type { User } from '../users/types';
6
9
  export type TicketOrigin = 'automatic' | 'manual' | 'widget';
7
10
  export type TicketMetrics = {
@@ -20,6 +23,14 @@ export type TicketMetrics = {
20
23
  /** Average waiting time per transfer. */
21
24
  waitingTimeTransfersAvg?: number;
22
25
  isActiveTicket?: boolean;
26
+ /** Longest waiting time in seconds, among the opening and the transfers. */
27
+ maxWaitingTime?: number;
28
+ /** Department where the longest wait happened. */
29
+ maxWaitingTimeDepartmentId?: string;
30
+ /** Name of that department when the wait was measured (the history export prefers the current name). */
31
+ maxWaitingTimeDepartmentName?: string;
32
+ maxWaitingTimeStartedAt?: string;
33
+ maxWaitingTimeEndedAt?: string;
23
34
  };
24
35
  export type TicketTransferAction = 'opened' | 'transferred' | 'closed';
25
36
  /**
@@ -55,6 +66,16 @@ export type TicketTransfer = {
55
66
  firstMessage?: Message | null;
56
67
  lastMessage?: Message | null;
57
68
  };
69
+ /**
70
+ * A ticket as `GET /tickets` and `GET /tickets/{id}` answer it. The relationships come only when
71
+ * asked in `include`, except `firstMessage` and `lastMessage`, which always come: `null` when not
72
+ * included (or when the ticket has no message).
73
+ *
74
+ * The `include` whitelist of the route takes `contact` (and `contact.avatar`, `.thumbAvatar`,
75
+ * `.lastMessage`, `.tags`, `.service`, `.person`), `department`, `user`, `account`, `ticketTopics`,
76
+ * `firstMessage` and `ticketTransfers` (with `fromUser`, `toUser`, `fromDepartment`,
77
+ * `toDepartment`, `byUser`); anything else is dropped in silence.
78
+ */
58
79
  export type Ticket = {
59
80
  id: string;
60
81
  isOpen: boolean;
@@ -64,13 +85,18 @@ export type Ticket = {
64
85
  metrics: TicketMetrics;
65
86
  startedAt: string | null;
66
87
  endedAt: string | null;
67
- isDistributing: boolean;
68
- count: number | null;
88
+ /** Only in the `ticket.*` webhooks (the stored ticket): the routes of `/tickets` never send it. */
89
+ isDistributing?: boolean;
90
+ /** Only in the `ticket.*` webhooks (the stored ticket): the routes of `/tickets` never send it. */
91
+ distributingAt?: string | null;
92
+ /** Only in the `ticket.*` webhooks (the stored ticket): the routes of `/tickets` never send it. */
93
+ count?: number | null;
69
94
  accountId: string;
70
95
  departmentId: string;
71
96
  contactId: string;
72
97
  userId: string | null;
73
- serviceId: string | null;
98
+ /** @deprecated Never comes: a ticket has no connection of its own. Read `contact.serviceId`. */
99
+ serviceId?: string | null;
74
100
  firstMessageId: string | null;
75
101
  lastMessageId: string | null;
76
102
  currentTicketTransferId: string | null;
@@ -79,10 +105,17 @@ export type Ticket = {
79
105
  contact?: Contact;
80
106
  department?: Department;
81
107
  user?: User | null;
108
+ account?: Account;
109
+ ticketTopics?: TicketTopic[];
110
+ firstMessage?: Message | null;
111
+ /** @deprecated Always `null`: `lastMessage` is out of the include whitelist. Include `contact.lastMessage`. */
112
+ lastMessage?: Message | null;
113
+ /** @deprecated Never comes: `service` is out of the include whitelist. Include `contact.service`. */
82
114
  service?: Service | null;
83
115
  ticketTransfers?: TicketTransfer[];
84
116
  };
85
- export type TicketRelationships = 'contact' | 'department' | 'user' | 'service' | 'ticketTransfers';
117
+ export type TicketRelationships = 'contact' | 'department' | 'user' | 'account' | 'ticketTopics' | 'firstMessage' | 'lastMessage' | 'service' | 'ticketTransfers';
118
+ /** @deprecated Not served: the backend has no `POST /tickets`. A ticket is opened by `ContactsApi.transferTicket`. */
86
119
  export type CreateTicketPayload = {
87
120
  contactId: string;
88
121
  departmentId: string;
@@ -90,12 +123,20 @@ export type CreateTicketPayload = {
90
123
  comments?: string;
91
124
  origin?: TicketOrigin;
92
125
  };
126
+ /** @deprecated Not served: the backend has no `PUT /tickets/{id}`. Transfer through `ContactsApi.transferTicket`, close through `TicketsApi.closeMany`. */
93
127
  export type UpdateTicketPayload = {
94
128
  departmentId?: string;
95
129
  userId?: string | null;
96
130
  comments?: string | null;
97
131
  isOpen?: boolean;
98
132
  };
133
+ /** What `closeMany` records on every ticket it closes. */
134
+ export type CloseTicketsData = {
135
+ /** Subjects of the closing (one id or a list). */
136
+ ticketTopicIds?: string[] | string;
137
+ /** Summary of the closing, stored in `comments`. */
138
+ comments?: string;
139
+ };
99
140
  /**
100
141
  * Body for `PUT /tickets/close-many`.
101
142
  *
@@ -104,14 +145,34 @@ export type UpdateTicketPayload = {
104
145
  * `query` field is a JSON-stringified list query (e.g. `JSON.stringify({ where: {} })`);
105
146
  * the backend always forces `where.isOpen = true`.
106
147
  */
107
- export type CloseManyTicketsPayload = {
148
+ export type CloseManyTicketsPayload = ({
108
149
  ids: string[];
109
- ticketTopicIds?: string[] | string;
110
- comments?: string;
111
- } | {
150
+ } & CloseTicketsData) | ({
112
151
  allContactsSelected: true;
113
152
  query: {
114
153
  query: string;
115
154
  };
155
+ } & CloseTicketsData);
156
+ /** A list query of tickets, as `count` and `exportHistory` take it. */
157
+ export type TicketsListQuery = ListQuery<Ticket>;
158
+ /** `count` with `queries`: one count per query, in the same order. */
159
+ export type TicketsCountManyQuery = TicketsListQuery & {
160
+ queries: TicketsListQuery[];
161
+ };
162
+ /**
163
+ * Body of `POST /tickets/count`. The filters go at the root, as in a list query, and `query` is
164
+ * required: without it the route answers 500. `query: {}` counts the root filters into
165
+ * `{ count }`; `query: { queries }` ignores them and answers `{ counts }`, one per query.
166
+ */
167
+ export type TicketsCountPostPayload = TicketsListQuery & {
168
+ query: {
169
+ queries?: TicketsListQuery[];
170
+ };
171
+ };
172
+ export type TicketsCount = {
173
+ count: number;
174
+ };
175
+ export type TicketsCounts = {
176
+ counts: number[];
116
177
  };
117
178
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/apis/tickets/types.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AAS,CAAC,MAAM,CAAC,CAAA;AAEhD,sEAAsE;AACtE,MAAM,MAAM,qBAAqB,GAAG,gBAAgB,GAAG;IAAE,OAAO,EAAE,gBAAgB,EAAE,CAAA;CAAE,CAAA;AAEtF;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG,gBAAgB,GAAG;IACvD,KAAK,EAAE;QAAE,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAA;KAAE,CAAA;CACxC,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAE5C,MAAM,MAAM,aAAa,GAAG;IAAE,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAAA"}
@@ -2,7 +2,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_core_BaseReadApi = require('./BaseReadApi.cjs');
3
3
 
4
4
  //#region src/core/BaseCrudApi.ts
5
- /** Generic CRUD resource: the reads of `BaseReadApi` plus `create`, `updateById` and `deleteById`. */
5
+ /**
6
+ * Generic CRUD resource: the reads of `BaseReadApi` plus `create`, `updateById` and `deleteById`.
7
+ * `TDeleteResponse` is what `deleteById` resolves to (most routes answer the text `'OK'`).
8
+ */
6
9
  var BaseCrudApi = class extends require_core_BaseReadApi.BaseReadApi {
7
10
  /**
8
11
  * Creates a new resource.
@@ -20,7 +23,7 @@ var BaseCrudApi = class extends require_core_BaseReadApi.BaseReadApi {
20
23
  }
21
24
  /**
22
25
  * Deletes a resource by ID.
23
- * @permissions $resourceName.delete
26
+ * @permissions $resourceName.destroy
24
27
  */
25
28
  deleteById(id, headers) {
26
29
  return this.client.delete(`${this.basePath}/${id}`, headers);
@@ -1 +1 @@
1
- {"version":3,"file":"BaseCrudApi.cjs","names":["BaseReadApi"],"sources":["../../src/core/BaseCrudApi.ts"],"sourcesContent":["import { BaseReadApi } from './BaseReadApi'\nimport type { CrudApi, ListQuery } from './types'\nexport type {\n WhereClause,\n IncludeItem,\n ListQuery,\n GetByIdQuery,\n Paginated,\n HasGetMany,\n HasGetById,\n HasCreate,\n HasUpdateById,\n HasDeleteById,\n CrudApi,\n} from './types'\n\n/** Generic CRUD resource: the reads of `BaseReadApi` plus `create`, `updateById` and `deleteById`. */\nexport class BaseCrudApi<\n TResponse,\n TCreate,\n TUpdate = TCreate,\n TQuery extends ListQuery<TResponse> = ListQuery<TResponse>,\n>\n extends BaseReadApi<TResponse, TQuery>\n implements CrudApi<TResponse, TCreate, TUpdate, TQuery>\n{\n /**\n * Creates a new resource.\n * @permissions $resourceName.create\n */\n create(body: TCreate, headers?: Record<string, string>): Promise<TResponse> {\n return this.client.post<TResponse, TCreate>(this.basePath, body, headers)\n }\n\n /**\n * Updates an existing resource by ID.\n * @permissions $resourceName.update\n */\n updateById(id: string, body: TUpdate, headers?: Record<string, string>): Promise<TResponse> {\n return this.client.put<TResponse, TUpdate>(`${this.basePath}/${id}`, body, headers)\n }\n\n /**\n * Deletes a resource by ID.\n * @permissions $resourceName.delete\n */\n deleteById(id: string, headers?: Record<string, string>): Promise<TResponse> {\n return this.client.delete<TResponse>(`${this.basePath}/${id}`, headers)\n }\n}\n"],"mappings":";;;;;AAiBA,IAAa,cAAb,cAMUA,qCAEV;;;;;CAKE,OAAO,MAAe,SAAsD;AAC1E,SAAO,KAAK,OAAO,KAAyB,KAAK,UAAU,MAAM,QAAQ;;;;;;CAO3E,WAAW,IAAY,MAAe,SAAsD;AAC1F,SAAO,KAAK,OAAO,IAAwB,GAAG,KAAK,SAAS,GAAG,MAAM,MAAM,QAAQ;;;;;;CAOrF,WAAW,IAAY,SAAsD;AAC3E,SAAO,KAAK,OAAO,OAAkB,GAAG,KAAK,SAAS,GAAG,MAAM,QAAQ"}
1
+ {"version":3,"file":"BaseCrudApi.cjs","names":["BaseReadApi"],"sources":["../../src/core/BaseCrudApi.ts"],"sourcesContent":["import { BaseReadApi } from './BaseReadApi'\nimport type { CrudApi, ListQuery } from './types'\nexport type {\n WhereClause,\n IncludeItem,\n ListQuery,\n GetByIdQuery,\n Paginated,\n HasGetMany,\n HasGetById,\n HasCreate,\n HasUpdateById,\n HasDeleteById,\n CrudApi,\n} from './types'\n\n/**\n * Generic CRUD resource: the reads of `BaseReadApi` plus `create`, `updateById` and `deleteById`.\n * `TDeleteResponse` is what `deleteById` resolves to (most routes answer the text `'OK'`).\n */\nexport class BaseCrudApi<\n TResponse,\n TCreate,\n TUpdate = TCreate,\n TQuery extends ListQuery<TResponse> = ListQuery<TResponse>,\n TDeleteResponse = TResponse,\n>\n extends BaseReadApi<TResponse, TQuery>\n implements CrudApi<TResponse, TCreate, TUpdate, TQuery, TDeleteResponse>\n{\n /**\n * Creates a new resource.\n * @permissions $resourceName.create\n */\n create(body: TCreate, headers?: Record<string, string>): Promise<TResponse> {\n return this.client.post<TResponse, TCreate>(this.basePath, body, headers)\n }\n\n /**\n * Updates an existing resource by ID.\n * @permissions $resourceName.update\n */\n updateById(id: string, body: TUpdate, headers?: Record<string, string>): Promise<TResponse> {\n return this.client.put<TResponse, TUpdate>(`${this.basePath}/${id}`, body, headers)\n }\n\n /**\n * Deletes a resource by ID.\n * @permissions $resourceName.destroy\n */\n deleteById(id: string, headers?: Record<string, string>): Promise<TDeleteResponse> {\n return this.client.delete<TDeleteResponse>(`${this.basePath}/${id}`, headers)\n }\n}\n"],"mappings":";;;;;;;;AAoBA,IAAa,cAAb,cAOUA,qCAEV;;;;;CAKE,OAAO,MAAe,SAAsD;AAC1E,SAAO,KAAK,OAAO,KAAyB,KAAK,UAAU,MAAM,QAAQ;;;;;;CAO3E,WAAW,IAAY,MAAe,SAAsD;AAC1F,SAAO,KAAK,OAAO,IAAwB,GAAG,KAAK,SAAS,GAAG,MAAM,MAAM,QAAQ;;;;;;CAOrF,WAAW,IAAY,SAA4D;AACjF,SAAO,KAAK,OAAO,OAAwB,GAAG,KAAK,SAAS,GAAG,MAAM,QAAQ"}
@@ -1,8 +1,11 @@
1
1
  import { BaseReadApi } from './BaseReadApi';
2
2
  import type { CrudApi, ListQuery } from './types';
3
3
  export type { WhereClause, IncludeItem, ListQuery, GetByIdQuery, Paginated, HasGetMany, HasGetById, HasCreate, HasUpdateById, HasDeleteById, CrudApi, } from './types';
4
- /** Generic CRUD resource: the reads of `BaseReadApi` plus `create`, `updateById` and `deleteById`. */
5
- export declare class BaseCrudApi<TResponse, TCreate, TUpdate = TCreate, TQuery extends ListQuery<TResponse> = ListQuery<TResponse>> extends BaseReadApi<TResponse, TQuery> implements CrudApi<TResponse, TCreate, TUpdate, TQuery> {
4
+ /**
5
+ * Generic CRUD resource: the reads of `BaseReadApi` plus `create`, `updateById` and `deleteById`.
6
+ * `TDeleteResponse` is what `deleteById` resolves to (most routes answer the text `'OK'`).
7
+ */
8
+ export declare class BaseCrudApi<TResponse, TCreate, TUpdate = TCreate, TQuery extends ListQuery<TResponse> = ListQuery<TResponse>, TDeleteResponse = TResponse> extends BaseReadApi<TResponse, TQuery> implements CrudApi<TResponse, TCreate, TUpdate, TQuery, TDeleteResponse> {
6
9
  /**
7
10
  * Creates a new resource.
8
11
  * @permissions $resourceName.create
@@ -15,8 +18,8 @@ export declare class BaseCrudApi<TResponse, TCreate, TUpdate = TCreate, TQuery e
15
18
  updateById(id: string, body: TUpdate, headers?: Record<string, string>): Promise<TResponse>;
16
19
  /**
17
20
  * Deletes a resource by ID.
18
- * @permissions $resourceName.delete
21
+ * @permissions $resourceName.destroy
19
22
  */
20
- deleteById(id: string, headers?: Record<string, string>): Promise<TResponse>;
23
+ deleteById(id: string, headers?: Record<string, string>): Promise<TDeleteResponse>;
21
24
  }
22
25
  //# sourceMappingURL=BaseCrudApi.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BaseCrudApi.d.ts","sourceRoot":"","sources":["../../src/core/BaseCrudApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;A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AA;AAEhB;;;GAGG;AACH,qBAAa,WAAW,CACtB,SAAS,EACT,OAAO,EACP,OAAO,GAAG,OAAO,EACjB,MAAM,SAAS,SAAS,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC,SAAS,CAAC,EAC1D,eAAe,GAAG,SAAS,CAE3B,SAAQ,WAAW,CAAC,SAAS,EAAE,MAAM,CACrC,YAAW,OAAO,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,CAAC;IAExE;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IAI3E;;;OAGG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IAI3F;;;OAGG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC;CAGnF"}
@@ -1,7 +1,10 @@
1
1
  import { BaseReadApi } from "./BaseReadApi.mjs";
2
2
 
3
3
  //#region src/core/BaseCrudApi.ts
4
- /** Generic CRUD resource: the reads of `BaseReadApi` plus `create`, `updateById` and `deleteById`. */
4
+ /**
5
+ * Generic CRUD resource: the reads of `BaseReadApi` plus `create`, `updateById` and `deleteById`.
6
+ * `TDeleteResponse` is what `deleteById` resolves to (most routes answer the text `'OK'`).
7
+ */
5
8
  var BaseCrudApi = class extends BaseReadApi {
6
9
  /**
7
10
  * Creates a new resource.
@@ -19,7 +22,7 @@ var BaseCrudApi = class extends BaseReadApi {
19
22
  }
20
23
  /**
21
24
  * Deletes a resource by ID.
22
- * @permissions $resourceName.delete
25
+ * @permissions $resourceName.destroy
23
26
  */
24
27
  deleteById(id, headers) {
25
28
  return this.client.delete(`${this.basePath}/${id}`, headers);
@@ -1 +1 @@
1
- {"version":3,"file":"BaseCrudApi.mjs","names":[],"sources":["../../src/core/BaseCrudApi.ts"],"sourcesContent":["import { BaseReadApi } from './BaseReadApi'\nimport type { CrudApi, ListQuery } from './types'\nexport type {\n WhereClause,\n IncludeItem,\n ListQuery,\n GetByIdQuery,\n Paginated,\n HasGetMany,\n HasGetById,\n HasCreate,\n HasUpdateById,\n HasDeleteById,\n CrudApi,\n} from './types'\n\n/** Generic CRUD resource: the reads of `BaseReadApi` plus `create`, `updateById` and `deleteById`. */\nexport class BaseCrudApi<\n TResponse,\n TCreate,\n TUpdate = TCreate,\n TQuery extends ListQuery<TResponse> = ListQuery<TResponse>,\n>\n extends BaseReadApi<TResponse, TQuery>\n implements CrudApi<TResponse, TCreate, TUpdate, TQuery>\n{\n /**\n * Creates a new resource.\n * @permissions $resourceName.create\n */\n create(body: TCreate, headers?: Record<string, string>): Promise<TResponse> {\n return this.client.post<TResponse, TCreate>(this.basePath, body, headers)\n }\n\n /**\n * Updates an existing resource by ID.\n * @permissions $resourceName.update\n */\n updateById(id: string, body: TUpdate, headers?: Record<string, string>): Promise<TResponse> {\n return this.client.put<TResponse, TUpdate>(`${this.basePath}/${id}`, body, headers)\n }\n\n /**\n * Deletes a resource by ID.\n * @permissions $resourceName.delete\n */\n deleteById(id: string, headers?: Record<string, string>): Promise<TResponse> {\n return this.client.delete<TResponse>(`${this.basePath}/${id}`, headers)\n }\n}\n"],"mappings":";;;;AAiBA,IAAa,cAAb,cAMU,YAEV;;;;;CAKE,OAAO,MAAe,SAAsD;AAC1E,SAAO,KAAK,OAAO,KAAyB,KAAK,UAAU,MAAM,QAAQ;;;;;;CAO3E,WAAW,IAAY,MAAe,SAAsD;AAC1F,SAAO,KAAK,OAAO,IAAwB,GAAG,KAAK,SAAS,GAAG,MAAM,MAAM,QAAQ;;;;;;CAOrF,WAAW,IAAY,SAAsD;AAC3E,SAAO,KAAK,OAAO,OAAkB,GAAG,KAAK,SAAS,GAAG,MAAM,QAAQ"}
1
+ {"version":3,"file":"BaseCrudApi.mjs","names":[],"sources":["../../src/core/BaseCrudApi.ts"],"sourcesContent":["import { BaseReadApi } from './BaseReadApi'\nimport type { CrudApi, ListQuery } from './types'\nexport type {\n WhereClause,\n IncludeItem,\n ListQuery,\n GetByIdQuery,\n Paginated,\n HasGetMany,\n HasGetById,\n HasCreate,\n HasUpdateById,\n HasDeleteById,\n CrudApi,\n} from './types'\n\n/**\n * Generic CRUD resource: the reads of `BaseReadApi` plus `create`, `updateById` and `deleteById`.\n * `TDeleteResponse` is what `deleteById` resolves to (most routes answer the text `'OK'`).\n */\nexport class BaseCrudApi<\n TResponse,\n TCreate,\n TUpdate = TCreate,\n TQuery extends ListQuery<TResponse> = ListQuery<TResponse>,\n TDeleteResponse = TResponse,\n>\n extends BaseReadApi<TResponse, TQuery>\n implements CrudApi<TResponse, TCreate, TUpdate, TQuery, TDeleteResponse>\n{\n /**\n * Creates a new resource.\n * @permissions $resourceName.create\n */\n create(body: TCreate, headers?: Record<string, string>): Promise<TResponse> {\n return this.client.post<TResponse, TCreate>(this.basePath, body, headers)\n }\n\n /**\n * Updates an existing resource by ID.\n * @permissions $resourceName.update\n */\n updateById(id: string, body: TUpdate, headers?: Record<string, string>): Promise<TResponse> {\n return this.client.put<TResponse, TUpdate>(`${this.basePath}/${id}`, body, headers)\n }\n\n /**\n * Deletes a resource by ID.\n * @permissions $resourceName.destroy\n */\n deleteById(id: string, headers?: Record<string, string>): Promise<TDeleteResponse> {\n return this.client.delete<TDeleteResponse>(`${this.basePath}/${id}`, headers)\n }\n}\n"],"mappings":";;;;;;;AAoBA,IAAa,cAAb,cAOU,YAEV;;;;;CAKE,OAAO,MAAe,SAAsD;AAC1E,SAAO,KAAK,OAAO,KAAyB,KAAK,UAAU,MAAM,QAAQ;;;;;;CAO3E,WAAW,IAAY,MAAe,SAAsD;AAC1F,SAAO,KAAK,OAAO,IAAwB,GAAG,KAAK,SAAS,GAAG,MAAM,MAAM,QAAQ;;;;;;CAOrF,WAAW,IAAY,SAA4D;AACjF,SAAO,KAAK,OAAO,OAAwB,GAAG,KAAK,SAAS,GAAG,MAAM,QAAQ"}
@@ -107,6 +107,6 @@ export interface HasUpdateById<TResponse, TUpdate> {
107
107
  export interface HasDeleteById<TResponse> {
108
108
  deleteById(id: string, headers?: Record<string, string>): Promise<TResponse>;
109
109
  }
110
- export type CrudApi<TResponse, TCreate, TUpdate = TCreate, TQuery extends ListQuery<TResponse> = ListQuery<TResponse>> = HasGetMany<TResponse, TQuery> & HasGetById<TResponse> & HasCreate<TResponse, TCreate> & HasUpdateById<TResponse, TUpdate> & HasDeleteById<TResponse>;
110
+ export type CrudApi<TResponse, TCreate, TUpdate = TCreate, TQuery extends ListQuery<TResponse> = ListQuery<TResponse>, TDeleteResponse = TResponse> = HasGetMany<TResponse, TQuery> & HasGetById<TResponse> & HasCreate<TResponse, TCreate> & HasUpdateById<TResponse, TUpdate> & HasDeleteById<TDeleteResponse>;
111
111
  export {};
112
112
  //# sourceMappingURL=types.d.ts.map