@ikatec/digisac-api-sdk 3.1.0 → 4.1.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 (139) hide show
  1. package/README.md +71 -9
  2. package/dist/apis/authHistory/AuthHistoryApi.cjs +3 -9
  3. package/dist/apis/authHistory/AuthHistoryApi.cjs.map +1 -1
  4. package/dist/apis/authHistory/AuthHistoryApi.d.ts +3 -4
  5. package/dist/apis/authHistory/AuthHistoryApi.d.ts.map +1 -1
  6. package/dist/apis/authHistory/AuthHistoryApi.mjs +3 -7
  7. package/dist/apis/authHistory/AuthHistoryApi.mjs.map +1 -1
  8. package/dist/apis/clientFeedback/ClientFeedbackApi.cjs +2 -5
  9. package/dist/apis/clientFeedback/ClientFeedbackApi.cjs.map +1 -1
  10. package/dist/apis/clientFeedback/ClientFeedbackApi.d.ts +2 -4
  11. package/dist/apis/clientFeedback/ClientFeedbackApi.d.ts.map +1 -1
  12. package/dist/apis/clientFeedback/ClientFeedbackApi.mjs +3 -5
  13. package/dist/apis/clientFeedback/ClientFeedbackApi.mjs.map +1 -1
  14. package/dist/apis/contacts/ContactsApi.cjs +2 -2
  15. package/dist/apis/contacts/ContactsApi.cjs.map +1 -1
  16. package/dist/apis/contacts/ContactsApi.mjs +2 -2
  17. package/dist/apis/contacts/ContactsApi.mjs.map +1 -1
  18. package/dist/apis/me/MeApi.cjs +2 -5
  19. package/dist/apis/me/MeApi.cjs.map +1 -1
  20. package/dist/apis/me/MeApi.d.ts +2 -4
  21. package/dist/apis/me/MeApi.d.ts.map +1 -1
  22. package/dist/apis/me/MeApi.mjs +3 -5
  23. package/dist/apis/me/MeApi.mjs.map +1 -1
  24. package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.cjs +3 -9
  25. package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.cjs.map +1 -1
  26. package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.d.ts +3 -4
  27. package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.d.ts.map +1 -1
  28. package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.mjs +3 -7
  29. package/dist/apis/serviceAccessManagement/ServiceAccessManagementApi.mjs.map +1 -1
  30. package/dist/apis/stickerUsers/StickerUsersApi.cjs +3 -9
  31. package/dist/apis/stickerUsers/StickerUsersApi.cjs.map +1 -1
  32. package/dist/apis/stickerUsers/StickerUsersApi.d.ts +3 -4
  33. package/dist/apis/stickerUsers/StickerUsersApi.d.ts.map +1 -1
  34. package/dist/apis/stickerUsers/StickerUsersApi.mjs +3 -7
  35. package/dist/apis/stickerUsers/StickerUsersApi.mjs.map +1 -1
  36. package/dist/apis/terms/TermsApi.cjs +3 -12
  37. package/dist/apis/terms/TermsApi.cjs.map +1 -1
  38. package/dist/apis/terms/TermsApi.d.ts +2 -4
  39. package/dist/apis/terms/TermsApi.d.ts.map +1 -1
  40. package/dist/apis/terms/TermsApi.mjs +3 -10
  41. package/dist/apis/terms/TermsApi.mjs.map +1 -1
  42. package/dist/apis/transcripts/TranscriptsApi.cjs +2 -5
  43. package/dist/apis/transcripts/TranscriptsApi.cjs.map +1 -1
  44. package/dist/apis/transcripts/TranscriptsApi.d.ts +2 -4
  45. package/dist/apis/transcripts/TranscriptsApi.d.ts.map +1 -1
  46. package/dist/apis/transcripts/TranscriptsApi.mjs +3 -5
  47. package/dist/apis/transcripts/TranscriptsApi.mjs.map +1 -1
  48. package/dist/core/ApiClient.d.ts +3 -0
  49. package/dist/core/ApiClient.d.ts.map +1 -1
  50. package/dist/core/ArchivableCrudApi.cjs +0 -2
  51. package/dist/core/ArchivableCrudApi.cjs.map +1 -1
  52. package/dist/core/ArchivableCrudApi.d.ts.map +1 -1
  53. package/dist/core/ArchivableCrudApi.mjs +0 -2
  54. package/dist/core/ArchivableCrudApi.mjs.map +1 -1
  55. package/dist/core/BaseApi.cjs +34 -0
  56. package/dist/core/BaseApi.cjs.map +1 -0
  57. package/dist/core/BaseApi.d.ts +20 -0
  58. package/dist/core/BaseApi.d.ts.map +1 -0
  59. package/dist/core/BaseApi.mjs +33 -0
  60. package/dist/core/BaseApi.mjs.map +1 -0
  61. package/dist/core/BaseApiClient.cjs +29 -57
  62. package/dist/core/BaseApiClient.cjs.map +1 -1
  63. package/dist/core/BaseApiClient.d.ts +8 -11
  64. package/dist/core/BaseApiClient.d.ts.map +1 -1
  65. package/dist/core/BaseApiClient.mjs +31 -57
  66. package/dist/core/BaseApiClient.mjs.map +1 -1
  67. package/dist/core/BaseCrudApi.cjs +6 -16
  68. package/dist/core/BaseCrudApi.cjs.map +1 -1
  69. package/dist/core/BaseCrudApi.d.ts +3 -2
  70. package/dist/core/BaseCrudApi.d.ts.map +1 -1
  71. package/dist/core/BaseCrudApi.mjs +6 -14
  72. package/dist/core/BaseCrudApi.mjs.map +1 -1
  73. package/dist/core/bindMethods.cjs +24 -0
  74. package/dist/core/bindMethods.cjs.map +1 -0
  75. package/dist/core/bindMethods.d.ts +7 -0
  76. package/dist/core/bindMethods.d.ts.map +1 -0
  77. package/dist/core/bindMethods.mjs +22 -0
  78. package/dist/core/bindMethods.mjs.map +1 -0
  79. package/dist/core/errors.cjs +192 -0
  80. package/dist/core/errors.cjs.map +1 -0
  81. package/dist/core/errors.d.ts +117 -0
  82. package/dist/core/errors.d.ts.map +1 -0
  83. package/dist/core/errors.mjs +177 -0
  84. package/dist/core/errors.mjs.map +1 -0
  85. package/dist/core/index.cjs +18 -2
  86. package/dist/core/index.d.ts +6 -2
  87. package/dist/core/index.d.ts.map +1 -1
  88. package/dist/core/index.mjs +4 -2
  89. package/dist/core/queryString.cjs +22 -0
  90. package/dist/core/queryString.cjs.map +1 -0
  91. package/dist/core/queryString.d.ts +14 -0
  92. package/dist/core/queryString.d.ts.map +1 -0
  93. package/dist/core/queryString.mjs +18 -0
  94. package/dist/core/queryString.mjs.map +1 -0
  95. package/dist/core/types.d.ts +2 -0
  96. package/dist/core/types.d.ts.map +1 -1
  97. package/dist/core/withQueryFormat.cjs +42 -0
  98. package/dist/core/withQueryFormat.cjs.map +1 -0
  99. package/dist/core/withQueryFormat.d.ts +10 -0
  100. package/dist/core/withQueryFormat.d.ts.map +1 -0
  101. package/dist/core/withQueryFormat.mjs +40 -0
  102. package/dist/core/withQueryFormat.mjs.map +1 -0
  103. package/dist/index.cjs +18 -2
  104. package/dist/index.mjs +4 -2
  105. package/package.json +1 -1
  106. package/src/apis/authHistory/AuthHistoryApi.test.ts +1 -1
  107. package/src/apis/authHistory/AuthHistoryApi.ts +10 -10
  108. package/src/apis/campaigns/CampaignsApi.test.ts +1 -1
  109. package/src/apis/clientFeedback/ClientFeedbackApi.ts +5 -7
  110. package/src/apis/contacts/ContactsApi.test.ts +1 -1
  111. package/src/apis/contacts/ContactsApi.ts +2 -2
  112. package/src/apis/me/MeApi.ts +2 -8
  113. package/src/apis/messages/MessagesApi.test.ts +2 -2
  114. package/src/apis/queryFormat.test.ts +198 -0
  115. package/src/apis/serviceAccessManagement/ServiceAccessManagementApi.test.ts +2 -2
  116. package/src/apis/serviceAccessManagement/ServiceAccessManagementApi.ts +10 -10
  117. package/src/apis/stickerUsers/StickerUsersApi.test.ts +1 -1
  118. package/src/apis/stickerUsers/StickerUsersApi.ts +7 -10
  119. package/src/apis/terms/TermsApi.ts +3 -12
  120. package/src/apis/transcripts/TranscriptsApi.ts +2 -7
  121. package/src/core/ApiClient.ts +4 -0
  122. package/src/core/ArchivableCrudApi.ts +0 -2
  123. package/src/core/BaseApi.test.ts +164 -0
  124. package/src/core/BaseApi.ts +32 -0
  125. package/src/core/BaseApiClient.test.ts +193 -22
  126. package/src/core/BaseApiClient.ts +44 -85
  127. package/src/core/BaseCrudApi.test-d.ts +57 -0
  128. package/src/core/BaseCrudApi.test.ts +252 -31
  129. package/src/core/BaseCrudApi.ts +14 -14
  130. package/src/core/bindMethods.ts +26 -0
  131. package/src/core/errors.test-d.ts +14 -0
  132. package/src/core/errors.test.ts +389 -0
  133. package/src/core/errors.ts +284 -0
  134. package/src/core/index.ts +21 -2
  135. package/src/core/queryString.test.ts +71 -0
  136. package/src/core/queryString.ts +30 -0
  137. package/src/core/types.ts +5 -0
  138. package/src/core/withQueryFormat.test.ts +136 -0
  139. package/src/core/withQueryFormat.ts +47 -0
package/README.md CHANGED
@@ -54,13 +54,14 @@ The SDK is structured in two layers:
54
54
  |---|---|
55
55
  | `ApiClient.ts` | Interface defining `setAccessToken` and HTTP methods (`get`, `post`, `put`, `patch`, `delete`, `request`) |
56
56
  | `BaseApiClient.ts` | `fetch`-based implementation of `ApiClient`. Handles JSON serialization and error parsing into `ApiError`. Automatically injects `Authorization: Bearer` header when an access token is set |
57
- | `BaseCrudApi.ts` | Generic class providing `getMany`, `getById`, `create`, `updateById`, `deleteById` |
57
+ | `BaseApi.ts` | Base of every API class: holds the `client`, binds the methods to the instance (so they can be destructured) and provides `withQueryFormat` |
58
+ | `BaseCrudApi.ts` | Generic class (extends `BaseApi`) providing `getMany`, `getOne`, `getById`, `create`, `updateById`, `deleteById` |
58
59
  | `types.ts` | Shared types: `WhereClause<T>`, `ListQuery<T>`, `Paginated<T>`, `IncludeItem<T>` |
59
60
 
60
61
  ### API Resources (`src/apis/<resource>/`)
61
62
 
62
63
  Each resource has its own folder with:
63
- - `<Resource>Api.ts` — extends `BaseCrudApi` with the resource path and type parameters
64
+ - `<Resource>Api.ts` — extends `BaseCrudApi` with the resource path and type parameters (or `BaseApi` for resources without CRUD routes)
64
65
  - `types.ts` — TypeScript types for the resource model, create payload, and update payload
65
66
  - `index.ts` — barrel file re-exporting the API class and all types
66
67
 
@@ -163,25 +164,85 @@ const result = await people.getMany({
163
164
  | `$between`, `$notBetween` | Range checks |
164
165
  | `$and`, `$or` | Logical combinators |
165
166
 
167
+ ### Query format
168
+
169
+ The client decides how list/get queries (`getMany`, `getOne`, `getById`, ...) are put in the URL:
170
+
171
+ ```typescript
172
+ const client = new BaseApiClient('https://api.digisac.com/v1', token, { queryFormat: 'qs' })
173
+ ```
174
+
175
+ | `queryFormat` | URL | Notes |
176
+ |---|---|---|
177
+ | `'json'` (default) | `?query=%7B%22where%22...` (`?query=<JSON>`) | Keeps `null`, booleans and numbers typed; no nesting limit. Same format as the Digisac web app. |
178
+ | `'qs'` | `?where[name]=x&page=2` | Readable, but the backend reads `null` as `''`, booleans/numbers as strings, and mangles objects nested deeper than 5 levels (e.g. an `include` inside an `include` with a `where`). |
179
+
180
+ To override it for some calls, `withQueryFormat` returns a copy of an API that uses another format (the original is not changed):
181
+
182
+ ```typescript
183
+ const contacts = new ContactsApi(client) // uses the client's format
184
+
185
+ await contacts.withQueryFormat('qs').getMany({ where: { name: 'John' } })
186
+
187
+ const qsContacts = contacts.withQueryFormat('qs') // keep it for several calls
188
+ ```
189
+
190
+ The copy shares the client, so a token set later with `client.setAccessToken()` applies to it too.
191
+
166
192
  ## Error Handling
167
193
 
168
- Failed requests throw an `ApiError` with structured information:
194
+ Every error thrown by the SDK extends `DigisacError`:
195
+
196
+ ```
197
+ DigisacError
198
+ ├── ApiConnectionError no HTTP response (network failure, DNS, connection refused)
199
+ └── ApiError non-2xx response; plain ApiError for unlisted statuses
200
+ ├── BadRequestError 400
201
+ │ └── ValidationError 400 `ValidationError`: field validation failed
202
+ ├── AuthenticationError 401
203
+ ├── PaymentRequiredError 402: out of credits, plan limits
204
+ ├── PermissionDeniedError 403
205
+ ├── NotFoundError 404
206
+ ├── ConflictError 409
207
+ ├── UnprocessableEntityError 422
208
+ ├── RateLimitError 429, with `retryAfter`
209
+ └── InternalServerError 5xx
210
+ ```
211
+
212
+ Errors are classified by HTTP status, plus `ValidationError` for field validation failures. The backend error name is always available as the `errorClass` string.
169
213
 
170
214
  ```typescript
171
- import { ApiError } from '@ikatec/digisac-api-sdk'
215
+ import {
216
+ ApiConnectionError,
217
+ ApiError,
218
+ NotFoundError,
219
+ ValidationError,
220
+ } from '@ikatec/digisac-api-sdk'
172
221
 
173
222
  try {
174
223
  await tickets.create(payload)
175
224
  } catch (error) {
176
- if (error instanceof ApiError) {
177
- console.log(error.message) // Error message from API
178
- console.log(error.status) // HTTP status code
179
- console.log(error.errorClass) // Error class identifier
180
- console.log(error.validationErrors) // Field-level validation errors
225
+ if (error instanceof ValidationError) {
226
+ for (const { field, message, code } of error.validationErrors) {
227
+ console.log(field, message, code) // 'name', 'Required.', 'required'
228
+ }
229
+ } else if (error instanceof NotFoundError) {
230
+ // ...
231
+ } else if (error instanceof ApiError) {
232
+ console.log(error.status) // HTTP status code
233
+ console.log(error.errorClass) // backend error name, e.g. 'HttpError', 'PaymentRequired'
234
+ console.log(error.message) // backend message
235
+ console.log(error.body) // full parsed error body (or raw text)
236
+ console.log(error.headers) // response headers
237
+ } else if (error instanceof ApiConnectionError) {
238
+ console.log(error.cause) // the original fetch error
181
239
  }
182
240
  }
183
241
  ```
184
242
 
243
+ - `validationErrors` is a flat list of `FieldError` (`{ location, field, path, message, code }`), one entry per failed rule, e.g. `{ location: 'body', field: 'name', path: 'body.name', message: 'Required.', code: 'required' }`. On `ValidationError` it is always an array; on other errors it is `null` when the response has no field errors.
244
+ - `RateLimitError.retryAfter` is the number of seconds to wait, read from `Retry-After` or the backend's `X-RateLimit-Reset`, or `null` when the response does not say.
245
+
185
246
  ## Incoming Webhooks
186
247
 
187
248
  The SDK ships a fully-typed `WebhookPayload<E>` envelope and a `WebhookEventPayloadMap` that narrows `data` to the correct resource type for every supported event.
@@ -280,6 +341,7 @@ import type { ApiClient } from '@ikatec/digisac-api-sdk'
280
341
 
281
342
  class MyApiClient implements ApiClient {
282
343
  // Implement setAccessToken, get, post, put, patch, delete, request
344
+ // Optionally set `queryFormat` ('json' when absent)
283
345
  }
284
346
  ```
285
347
 
@@ -1,16 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_chunk = require('../../_chunks/chunk-Dk0Otj32.cjs');
3
- let qs = require("qs");
4
- qs = require_chunk.__toESM(qs);
2
+ const require_core_BaseApi = require('../../core/BaseApi.cjs');
5
3
 
6
4
  //#region src/apis/authHistory/AuthHistoryApi.ts
7
- var AuthHistoryApi = class {
8
- client;
9
- constructor(client) {
10
- this.client = client;
11
- }
5
+ var AuthHistoryApi = class extends require_core_BaseApi.BaseApi {
12
6
  getMany(query, headers) {
13
- const queryString = query ? `?${qs.default.stringify(query)}` : "";
7
+ const queryString = this.toQueryString(query);
14
8
  return this.client.get(`/auth-history${queryString}`, headers);
15
9
  }
16
10
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"AuthHistoryApi.cjs","names":[],"sources":["../../../src/apis/authHistory/AuthHistoryApi.ts"],"sourcesContent":["import qs from 'qs'\nimport type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery, Paginated, HasGetMany, HasGetById } from '../../core/types'\nimport type { AuthHistory } from './types'\n\nexport class AuthHistoryApi implements HasGetMany<AuthHistory>, HasGetById<AuthHistory> {\n private readonly client: ApiClient\n\n constructor(client: ApiClient) {\n this.client = client\n }\n\n /**\n * Returns a paginated list of authentication events (auth, password_change, logout). Non-admin users can only see their own records.\n * @permissions authHistory.view\n */\n getMany(\n query: ListQuery<AuthHistory> & { paginate: false },\n headers?: Record<string, string>,\n ): Promise<AuthHistory[]>\n getMany(\n query?: ListQuery<AuthHistory> & { paginate?: true },\n headers?: Record<string, string>,\n ): Promise<Paginated<AuthHistory>>\n getMany(\n query?: ListQuery<AuthHistory>,\n headers?: Record<string, string>,\n ): Promise<Paginated<AuthHistory> | AuthHistory[]> {\n const queryString = query ? `?${qs.stringify(query)}` : ''\n return this.client.get<Paginated<AuthHistory> | AuthHistory[]>(\n `/auth-history${queryString}`,\n headers,\n )\n }\n\n /**\n * Returns a single authentication event by its ID. Non-admin users can only access their own records.\n * @permissions authHistory.view\n */\n getById(id: string, headers?: Record<string, string>): Promise<AuthHistory> {\n return this.client.get<AuthHistory>(`/auth-history/${id}`, headers)\n }\n}\n"],"mappings":";;;;;;AAKA,IAAa,iBAAb,MAAwF;CACtF,AAAiB;CAEjB,YAAY,QAAmB;AAC7B,OAAK,SAAS;;CAehB,QACE,OACA,SACiD;EACjD,MAAM,cAAc,QAAQ,IAAI,WAAG,UAAU,MAAM,KAAK;AACxD,SAAO,KAAK,OAAO,IACjB,gBAAgB,eAChB,QACD;;;;;;CAOH,QAAQ,IAAY,SAAwD;AAC1E,SAAO,KAAK,OAAO,IAAiB,iBAAiB,MAAM,QAAQ"}
1
+ {"version":3,"file":"AuthHistoryApi.cjs","names":["BaseApi"],"sources":["../../../src/apis/authHistory/AuthHistoryApi.ts"],"sourcesContent":["import { BaseApi } from '../../core/BaseApi'\nimport type { ListQuery, Paginated, HasGetMany, HasGetById } from '../../core/types'\nimport type { AuthHistory } from './types'\n\nexport class AuthHistoryApi\n extends BaseApi\n implements HasGetMany<AuthHistory>, HasGetById<AuthHistory>\n{\n /**\n * Returns a paginated list of authentication events (auth, password_change, logout). Non-admin users can only see their own records.\n * @permissions authHistory.view\n */\n getMany(\n query: ListQuery<AuthHistory> & { paginate: false },\n headers?: Record<string, string>,\n ): Promise<AuthHistory[]>\n getMany(\n query?: ListQuery<AuthHistory> & { paginate?: true },\n headers?: Record<string, string>,\n ): Promise<Paginated<AuthHistory>>\n getMany(\n query?: ListQuery<AuthHistory>,\n headers?: Record<string, string>,\n ): Promise<Paginated<AuthHistory> | AuthHistory[]>\n getMany(\n query?: ListQuery<AuthHistory>,\n headers?: Record<string, string>,\n ): Promise<Paginated<AuthHistory> | AuthHistory[]> {\n const queryString = this.toQueryString(query)\n return this.client.get<Paginated<AuthHistory> | AuthHistory[]>(\n `/auth-history${queryString}`,\n headers,\n )\n }\n\n /**\n * Returns a single authentication event by its ID. Non-admin users can only access their own records.\n * @permissions authHistory.view\n */\n getById(id: string, headers?: Record<string, string>): Promise<AuthHistory> {\n return this.client.get<AuthHistory>(`/auth-history/${id}`, headers)\n }\n}\n"],"mappings":";;;;AAIA,IAAa,iBAAb,cACUA,6BAEV;CAiBE,QACE,OACA,SACiD;EACjD,MAAM,cAAc,KAAK,cAAc,MAAM;AAC7C,SAAO,KAAK,OAAO,IACjB,gBAAgB,eAChB,QACD;;;;;;CAOH,QAAQ,IAAY,SAAwD;AAC1E,SAAO,KAAK,OAAO,IAAiB,iBAAiB,MAAM,QAAQ"}
@@ -1,9 +1,7 @@
1
- import type { ApiClient } from '../../core/ApiClient';
1
+ import { BaseApi } from '../../core/BaseApi';
2
2
  import type { ListQuery, Paginated, HasGetMany, HasGetById } from '../../core/types';
3
3
  import type { AuthHistory } from './types';
4
- export declare class AuthHistoryApi implements HasGetMany<AuthHistory>, HasGetById<AuthHistory> {
5
- private readonly client;
6
- constructor(client: ApiClient);
4
+ export declare class AuthHistoryApi extends BaseApi implements HasGetMany<AuthHistory>, HasGetById<AuthHistory> {
7
5
  /**
8
6
  * Returns a paginated list of authentication events (auth, password_change, logout). Non-admin users can only see their own records.
9
7
  * @permissions authHistory.view
@@ -14,6 +12,7 @@ export declare class AuthHistoryApi implements HasGetMany<AuthHistory>, HasGetBy
14
12
  getMany(query?: ListQuery<AuthHistory> & {
15
13
  paginate?: true;
16
14
  }, headers?: Record<string, string>): Promise<Paginated<AuthHistory>>;
15
+ getMany(query?: ListQuery<AuthHistory>, headers?: Record<string, string>): Promise<Paginated<AuthHistory> | AuthHistory[]>;
17
16
  /**
18
17
  * Returns a single authentication event by its ID. Non-admin users can only access their own records.
19
18
  * @permissions authHistory.view
@@ -1 +1 @@
1
- {"version":3,"file":"AuthHistoryApi.d.ts","sourceRoot":"","sources":["../../../src/apis/authHistory/AuthHistoryApi.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACpF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C,qBAAa,cAAe,YAAW,UAAU,CAAC,WAAW,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC;IACrF,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAW;gBAEtB,MAAM,EAAE,SAAS;IAI7B;;;OAGG;IACH,OAAO,CACL,KAAK,EAAE,SAAS,CAAC,WAAW,CAAC,GAAG;QAAE,QAAQ,EAAE,KAAK,CAAA;KAAE,EACnD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,WAAW,EAAE,CAAC;IACzB,OAAO,CACL,KAAK,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,GAAG;QAAE,QAAQ,CAAC,EAAE,IAAI,CAAA;KAAE,EACpD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAYlC;;;OAGG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC;CAG5E"}
1
+ {"version":3,"file":"AuthHistoryApi.d.ts","sourceRoot":"","sources":["../../../src/apis/authHistory/AuthHistoryApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACpF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C,qBAAa,cACX,SAAQ,OACR,YAAW,UAAU,CAAC,WAAW,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC;IAE3D;;;OAGG;IACH,OAAO,CACL,KAAK,EAAE,SAAS,CAAC,WAAW,CAAC,GAAG;QAAE,QAAQ,EAAE,KAAK,CAAA;KAAE,EACnD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,WAAW,EAAE,CAAC;IACzB,OAAO,CACL,KAAK,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,GAAG;QAAE,QAAQ,CAAC,EAAE,IAAI,CAAA;KAAE,EACpD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAClC,OAAO,CACL,KAAK,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,EAC9B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,WAAW,EAAE,CAAC;IAYlD;;;OAGG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC;CAG5E"}
@@ -1,13 +1,9 @@
1
- import qs from "qs";
1
+ import { BaseApi } from "../../core/BaseApi.mjs";
2
2
 
3
3
  //#region src/apis/authHistory/AuthHistoryApi.ts
4
- var AuthHistoryApi = class {
5
- client;
6
- constructor(client) {
7
- this.client = client;
8
- }
4
+ var AuthHistoryApi = class extends BaseApi {
9
5
  getMany(query, headers) {
10
- const queryString = query ? `?${qs.stringify(query)}` : "";
6
+ const queryString = this.toQueryString(query);
11
7
  return this.client.get(`/auth-history${queryString}`, headers);
12
8
  }
13
9
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"AuthHistoryApi.mjs","names":[],"sources":["../../../src/apis/authHistory/AuthHistoryApi.ts"],"sourcesContent":["import qs from 'qs'\nimport type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery, Paginated, HasGetMany, HasGetById } from '../../core/types'\nimport type { AuthHistory } from './types'\n\nexport class AuthHistoryApi implements HasGetMany<AuthHistory>, HasGetById<AuthHistory> {\n private readonly client: ApiClient\n\n constructor(client: ApiClient) {\n this.client = client\n }\n\n /**\n * Returns a paginated list of authentication events (auth, password_change, logout). Non-admin users can only see their own records.\n * @permissions authHistory.view\n */\n getMany(\n query: ListQuery<AuthHistory> & { paginate: false },\n headers?: Record<string, string>,\n ): Promise<AuthHistory[]>\n getMany(\n query?: ListQuery<AuthHistory> & { paginate?: true },\n headers?: Record<string, string>,\n ): Promise<Paginated<AuthHistory>>\n getMany(\n query?: ListQuery<AuthHistory>,\n headers?: Record<string, string>,\n ): Promise<Paginated<AuthHistory> | AuthHistory[]> {\n const queryString = query ? `?${qs.stringify(query)}` : ''\n return this.client.get<Paginated<AuthHistory> | AuthHistory[]>(\n `/auth-history${queryString}`,\n headers,\n )\n }\n\n /**\n * Returns a single authentication event by its ID. Non-admin users can only access their own records.\n * @permissions authHistory.view\n */\n getById(id: string, headers?: Record<string, string>): Promise<AuthHistory> {\n return this.client.get<AuthHistory>(`/auth-history/${id}`, headers)\n }\n}\n"],"mappings":";;;AAKA,IAAa,iBAAb,MAAwF;CACtF,AAAiB;CAEjB,YAAY,QAAmB;AAC7B,OAAK,SAAS;;CAehB,QACE,OACA,SACiD;EACjD,MAAM,cAAc,QAAQ,IAAI,GAAG,UAAU,MAAM,KAAK;AACxD,SAAO,KAAK,OAAO,IACjB,gBAAgB,eAChB,QACD;;;;;;CAOH,QAAQ,IAAY,SAAwD;AAC1E,SAAO,KAAK,OAAO,IAAiB,iBAAiB,MAAM,QAAQ"}
1
+ {"version":3,"file":"AuthHistoryApi.mjs","names":[],"sources":["../../../src/apis/authHistory/AuthHistoryApi.ts"],"sourcesContent":["import { BaseApi } from '../../core/BaseApi'\nimport type { ListQuery, Paginated, HasGetMany, HasGetById } from '../../core/types'\nimport type { AuthHistory } from './types'\n\nexport class AuthHistoryApi\n extends BaseApi\n implements HasGetMany<AuthHistory>, HasGetById<AuthHistory>\n{\n /**\n * Returns a paginated list of authentication events (auth, password_change, logout). Non-admin users can only see their own records.\n * @permissions authHistory.view\n */\n getMany(\n query: ListQuery<AuthHistory> & { paginate: false },\n headers?: Record<string, string>,\n ): Promise<AuthHistory[]>\n getMany(\n query?: ListQuery<AuthHistory> & { paginate?: true },\n headers?: Record<string, string>,\n ): Promise<Paginated<AuthHistory>>\n getMany(\n query?: ListQuery<AuthHistory>,\n headers?: Record<string, string>,\n ): Promise<Paginated<AuthHistory> | AuthHistory[]>\n getMany(\n query?: ListQuery<AuthHistory>,\n headers?: Record<string, string>,\n ): Promise<Paginated<AuthHistory> | AuthHistory[]> {\n const queryString = this.toQueryString(query)\n return this.client.get<Paginated<AuthHistory> | AuthHistory[]>(\n `/auth-history${queryString}`,\n headers,\n )\n }\n\n /**\n * Returns a single authentication event by its ID. Non-admin users can only access their own records.\n * @permissions authHistory.view\n */\n getById(id: string, headers?: Record<string, string>): Promise<AuthHistory> {\n return this.client.get<AuthHistory>(`/auth-history/${id}`, headers)\n }\n}\n"],"mappings":";;;AAIA,IAAa,iBAAb,cACU,QAEV;CAiBE,QACE,OACA,SACiD;EACjD,MAAM,cAAc,KAAK,cAAc,MAAM;AAC7C,SAAO,KAAK,OAAO,IACjB,gBAAgB,eAChB,QACD;;;;;;CAOH,QAAQ,IAAY,SAAwD;AAC1E,SAAO,KAAK,OAAO,IAAiB,iBAAiB,MAAM,QAAQ"}
@@ -1,12 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_core_BaseApi = require('../../core/BaseApi.cjs');
2
3
 
3
4
  //#region src/apis/clientFeedback/ClientFeedbackApi.ts
4
- var ClientFeedbackApi = class {
5
- client;
5
+ var ClientFeedbackApi = class extends require_core_BaseApi.BaseApi {
6
6
  basePath = "/client-feedback";
7
- constructor(client) {
8
- this.client = client;
9
- }
10
7
  /** Creates a client feedback record for a ticket (accountId, ticketId, and feedback text are required). */
11
8
  create(body, headers) {
12
9
  return this.client.post(this.basePath, body, headers);
@@ -1 +1 @@
1
- {"version":3,"file":"ClientFeedbackApi.cjs","names":[],"sources":["../../../src/apis/clientFeedback/ClientFeedbackApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { HasCreate } from '../../core/types'\nimport type { ClientFeedback, CreateClientFeedbackPayload } from './types'\n\nexport class ClientFeedbackApi implements HasCreate<ClientFeedback, CreateClientFeedbackPayload> {\n private readonly client: ApiClient\n private readonly basePath = '/client-feedback'\n\n constructor(client: ApiClient) {\n this.client = client\n }\n\n /** Creates a client feedback record for a ticket (accountId, ticketId, and feedback text are required). */\n create(\n body: CreateClientFeedbackPayload,\n headers?: Record<string, string>,\n ): Promise<ClientFeedback> {\n return this.client.post<ClientFeedback, CreateClientFeedbackPayload>(\n this.basePath,\n body,\n headers,\n )\n }\n}\n"],"mappings":";;;AAIA,IAAa,oBAAb,MAAiG;CAC/F,AAAiB;CACjB,AAAiB,WAAW;CAE5B,YAAY,QAAmB;AAC7B,OAAK,SAAS;;;CAIhB,OACE,MACA,SACyB;AACzB,SAAO,KAAK,OAAO,KACjB,KAAK,UACL,MACA,QACD"}
1
+ {"version":3,"file":"ClientFeedbackApi.cjs","names":["BaseApi"],"sources":["../../../src/apis/clientFeedback/ClientFeedbackApi.ts"],"sourcesContent":["import { BaseApi } from '../../core/BaseApi'\nimport type { HasCreate } from '../../core/types'\nimport type { ClientFeedback, CreateClientFeedbackPayload } from './types'\n\nexport class ClientFeedbackApi\n extends BaseApi\n implements HasCreate<ClientFeedback, CreateClientFeedbackPayload>\n{\n private readonly basePath = '/client-feedback'\n\n /** Creates a client feedback record for a ticket (accountId, ticketId, and feedback text are required). */\n create(\n body: CreateClientFeedbackPayload,\n headers?: Record<string, string>,\n ): Promise<ClientFeedback> {\n return this.client.post<ClientFeedback, CreateClientFeedbackPayload>(\n this.basePath,\n body,\n headers,\n )\n }\n}\n"],"mappings":";;;;AAIA,IAAa,oBAAb,cACUA,6BAEV;CACE,AAAiB,WAAW;;CAG5B,OACE,MACA,SACyB;AACzB,SAAO,KAAK,OAAO,KACjB,KAAK,UACL,MACA,QACD"}
@@ -1,10 +1,8 @@
1
- import type { ApiClient } from '../../core/ApiClient';
1
+ import { BaseApi } from '../../core/BaseApi';
2
2
  import type { HasCreate } from '../../core/types';
3
3
  import type { ClientFeedback, CreateClientFeedbackPayload } from './types';
4
- export declare class ClientFeedbackApi implements HasCreate<ClientFeedback, CreateClientFeedbackPayload> {
5
- private readonly client;
4
+ export declare class ClientFeedbackApi extends BaseApi implements HasCreate<ClientFeedback, CreateClientFeedbackPayload> {
6
5
  private readonly basePath;
7
- constructor(client: ApiClient);
8
6
  /** Creates a client feedback record for a ticket (accountId, ticketId, and feedback text are required). */
9
7
  create(body: CreateClientFeedbackPayload, headers?: Record<string, string>): Promise<ClientFeedback>;
10
8
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ClientFeedbackApi.d.ts","sourceRoot":"","sources":["../../../src/apis/clientFeedback/ClientFeedbackApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAA;AAE1E,qBAAa,iBAAkB,YAAW,SAAS,CAAC,cAAc,EAAE,2BAA2B,CAAC;IAC9F,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAW;IAClC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqB;gBAElC,MAAM,EAAE,SAAS;IAI7B,2GAA2G;IAC3G,MAAM,CACJ,IAAI,EAAE,2BAA2B,EACjC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,cAAc,CAAC;CAO3B"}
1
+ {"version":3,"file":"ClientFeedbackApi.d.ts","sourceRoot":"","sources":["../../../src/apis/clientFeedback/ClientFeedbackApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAA;AAE1E,qBAAa,iBACX,SAAQ,OACR,YAAW,SAAS,CAAC,cAAc,EAAE,2BAA2B,CAAC;IAEjE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqB;IAE9C,2GAA2G;IAC3G,MAAM,CACJ,IAAI,EAAE,2BAA2B,EACjC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,cAAc,CAAC;CAO3B"}
@@ -1,10 +1,8 @@
1
+ import { BaseApi } from "../../core/BaseApi.mjs";
2
+
1
3
  //#region src/apis/clientFeedback/ClientFeedbackApi.ts
2
- var ClientFeedbackApi = class {
3
- client;
4
+ var ClientFeedbackApi = class extends BaseApi {
4
5
  basePath = "/client-feedback";
5
- constructor(client) {
6
- this.client = client;
7
- }
8
6
  /** Creates a client feedback record for a ticket (accountId, ticketId, and feedback text are required). */
9
7
  create(body, headers) {
10
8
  return this.client.post(this.basePath, body, headers);
@@ -1 +1 @@
1
- {"version":3,"file":"ClientFeedbackApi.mjs","names":[],"sources":["../../../src/apis/clientFeedback/ClientFeedbackApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { HasCreate } from '../../core/types'\nimport type { ClientFeedback, CreateClientFeedbackPayload } from './types'\n\nexport class ClientFeedbackApi implements HasCreate<ClientFeedback, CreateClientFeedbackPayload> {\n private readonly client: ApiClient\n private readonly basePath = '/client-feedback'\n\n constructor(client: ApiClient) {\n this.client = client\n }\n\n /** Creates a client feedback record for a ticket (accountId, ticketId, and feedback text are required). */\n create(\n body: CreateClientFeedbackPayload,\n headers?: Record<string, string>,\n ): Promise<ClientFeedback> {\n return this.client.post<ClientFeedback, CreateClientFeedbackPayload>(\n this.basePath,\n body,\n headers,\n )\n }\n}\n"],"mappings":";AAIA,IAAa,oBAAb,MAAiG;CAC/F,AAAiB;CACjB,AAAiB,WAAW;CAE5B,YAAY,QAAmB;AAC7B,OAAK,SAAS;;;CAIhB,OACE,MACA,SACyB;AACzB,SAAO,KAAK,OAAO,KACjB,KAAK,UACL,MACA,QACD"}
1
+ {"version":3,"file":"ClientFeedbackApi.mjs","names":[],"sources":["../../../src/apis/clientFeedback/ClientFeedbackApi.ts"],"sourcesContent":["import { BaseApi } from '../../core/BaseApi'\nimport type { HasCreate } from '../../core/types'\nimport type { ClientFeedback, CreateClientFeedbackPayload } from './types'\n\nexport class ClientFeedbackApi\n extends BaseApi\n implements HasCreate<ClientFeedback, CreateClientFeedbackPayload>\n{\n private readonly basePath = '/client-feedback'\n\n /** Creates a client feedback record for a ticket (accountId, ticketId, and feedback text are required). */\n create(\n body: CreateClientFeedbackPayload,\n headers?: Record<string, string>,\n ): Promise<ClientFeedback> {\n return this.client.post<ClientFeedback, CreateClientFeedbackPayload>(\n this.basePath,\n body,\n headers,\n )\n }\n}\n"],"mappings":";;;AAIA,IAAa,oBAAb,cACU,QAEV;CACE,AAAiB,WAAW;;CAG5B,OACE,MACA,SACyB;AACzB,SAAO,KAAK,OAAO,KACjB,KAAK,UACL,MACA,QACD"}
@@ -21,7 +21,7 @@ var ContactsApi = class extends require_core_BaseCrudApi.BaseCrudApi {
21
21
  * @permissions contacts.view
22
22
  */
23
23
  count(query, headers) {
24
- const queryString = query ? `?${qs.default.stringify(query)}` : "";
24
+ const queryString = this.toQueryString(query);
25
25
  return this.client.get(`${this.basePath}/count${queryString}`, headers);
26
26
  }
27
27
  /**
@@ -36,7 +36,7 @@ var ContactsApi = class extends require_core_BaseCrudApi.BaseCrudApi {
36
36
  * @permissions contacts.view
37
37
  */
38
38
  forward(query, headers) {
39
- const queryString = query ? `?${qs.default.stringify(query)}` : "";
39
+ const queryString = this.toQueryString(query);
40
40
  return this.client.get(`${this.basePath}/forward${queryString}`, headers);
41
41
  }
42
42
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ContactsApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/contacts/ContactsApi.ts"],"sourcesContent":["import qs from 'qs'\nimport type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { ListQuery, Paginated } from '../../core/types'\nimport type {\n Contact,\n CountContactsQuery,\n CountMediaResult,\n CreateContactPayload,\n ExistsContactsParams,\n ExportTemplatePayload,\n TransferTicketPayload,\n UpdateContactPayload,\n} from './types'\n\nexport class ContactsApi extends BaseCrudApi<Contact, CreateContactPayload, UpdateContactPayload> {\n constructor(client: ApiClient) {\n super(client, '/contacts')\n }\n\n /**\n * Downloads a CSV template for importing contacts, with columns based on the service type.\n * @permissions contacts.view AND contacts.export\n */\n exportTemplate(body: ExportTemplatePayload, headers?: Record<string, string>): Promise<unknown> {\n return this.client.post<unknown, ExportTemplatePayload>(\n `${this.basePath}/export-template`,\n body,\n headers,\n )\n }\n\n /**\n * Returns the total number of contacts matching the given query filters.\n * @permissions contacts.view\n */\n count(query?: CountContactsQuery, headers?: Record<string, string>): Promise<{ count: number }> {\n const queryString = query ? `?${qs.stringify(query)}` : ''\n return this.client.get<{ count: number }>(`${this.basePath}/count${queryString}`, headers)\n }\n\n /**\n * Returns the total number of contacts matching the given filters (POST variant for complex queries).\n * @permissions contacts.view\n */\n countPost(\n body: CountContactsQuery,\n headers?: Record<string, string>,\n ): Promise<{ count: number }> {\n return this.client.post<{ count: number }, CountContactsQuery>(\n `${this.basePath}/count`,\n body,\n headers,\n )\n }\n\n /**\n * Returns a paginated list of contacts available for message forwarding.\n * @permissions contacts.view\n */\n forward(\n query?: ListQuery<Contact>,\n headers?: Record<string, string>,\n ): Promise<Paginated<Contact>> {\n const queryString = query ? `?${qs.stringify(query)}` : ''\n return this.client.get<Paginated<Contact>>(`${this.basePath}/forward${queryString}`, headers)\n }\n\n /**\n * Checks whether contacts exist for the given phone numbers on a specific service. Returns a map of number to boolean.\n * @permissions contacts.view\n */\n exists(\n params: ExistsContactsParams,\n headers?: Record<string, string>,\n ): Promise<Record<string, boolean>> {\n const queryString = `?${qs.stringify(params)}`\n return this.client.get<Record<string, boolean>>(\n `${this.basePath}/exists${queryString}`,\n headers,\n )\n }\n\n /**\n * Returns media counts grouped by type (e.g. image, video, document, link) for a contact.\n * @permissions contacts.view\n */\n countMedia(contactId: string, headers?: Record<string, string>): Promise<CountMediaResult> {\n return this.client.get<CountMediaResult>(`${this.basePath}/${contactId}/media/count`, headers)\n }\n\n /**\n * Returns a paginated list of contacts using POST body for advanced filtering.\n * @permissions contacts.view\n */\n list(\n body: Record<string, unknown>,\n headers?: Record<string, string>,\n ): Promise<Paginated<Contact>> {\n return this.client.post<Paginated<Contact>, Record<string, unknown>>(\n `${this.basePath}/list`,\n body,\n headers,\n )\n }\n\n /**\n * Opens (or transfers) the contact's ticket to a department, and optionally a user.\n * This is the real ticket-open flow used by the UI — there is no `POST /tickets`.\n * @permissions tickets.transfer.all OR tickets.transfer.me\n */\n transferTicket(\n contactId: string,\n payload: TransferTicketPayload,\n headers?: Record<string, string>,\n ): Promise<unknown> {\n return this.client.post<unknown, TransferTicketPayload>(\n `${this.basePath}/${contactId}/ticket/transfer`,\n payload,\n headers,\n )\n }\n}\n"],"mappings":";;;;;;;AAeA,IAAa,cAAb,cAAiCA,qCAAiE;CAChG,YAAY,QAAmB;AAC7B,QAAM,QAAQ,YAAY;;;;;;CAO5B,eAAe,MAA6B,SAAoD;AAC9F,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,mBACjB,MACA,QACD;;;;;;CAOH,MAAM,OAA4B,SAA8D;EAC9F,MAAM,cAAc,QAAQ,IAAI,WAAG,UAAU,MAAM,KAAK;AACxD,SAAO,KAAK,OAAO,IAAuB,GAAG,KAAK,SAAS,QAAQ,eAAe,QAAQ;;;;;;CAO5F,UACE,MACA,SAC4B;AAC5B,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,SACjB,MACA,QACD;;;;;;CAOH,QACE,OACA,SAC6B;EAC7B,MAAM,cAAc,QAAQ,IAAI,WAAG,UAAU,MAAM,KAAK;AACxD,SAAO,KAAK,OAAO,IAAwB,GAAG,KAAK,SAAS,UAAU,eAAe,QAAQ;;;;;;CAO/F,OACE,QACA,SACkC;EAClC,MAAM,cAAc,IAAI,WAAG,UAAU,OAAO;AAC5C,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,SAAS,eAC1B,QACD;;;;;;CAOH,WAAW,WAAmB,SAA6D;AACzF,SAAO,KAAK,OAAO,IAAsB,GAAG,KAAK,SAAS,GAAG,UAAU,eAAe,QAAQ;;;;;;CAOhG,KACE,MACA,SAC6B;AAC7B,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,QACjB,MACA,QACD;;;;;;;CAQH,eACE,WACA,SACA,SACkB;AAClB,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,GAAG,UAAU,mBAC9B,SACA,QACD"}
1
+ {"version":3,"file":"ContactsApi.cjs","names":["BaseCrudApi"],"sources":["../../../src/apis/contacts/ContactsApi.ts"],"sourcesContent":["import qs from 'qs'\nimport type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { ListQuery, Paginated } from '../../core/types'\nimport type {\n Contact,\n CountContactsQuery,\n CountMediaResult,\n CreateContactPayload,\n ExistsContactsParams,\n ExportTemplatePayload,\n TransferTicketPayload,\n UpdateContactPayload,\n} from './types'\n\nexport class ContactsApi extends BaseCrudApi<Contact, CreateContactPayload, UpdateContactPayload> {\n constructor(client: ApiClient) {\n super(client, '/contacts')\n }\n\n /**\n * Downloads a CSV template for importing contacts, with columns based on the service type.\n * @permissions contacts.view AND contacts.export\n */\n exportTemplate(body: ExportTemplatePayload, headers?: Record<string, string>): Promise<unknown> {\n return this.client.post<unknown, ExportTemplatePayload>(\n `${this.basePath}/export-template`,\n body,\n headers,\n )\n }\n\n /**\n * Returns the total number of contacts matching the given query filters.\n * @permissions contacts.view\n */\n count(query?: CountContactsQuery, headers?: Record<string, string>): Promise<{ count: number }> {\n const queryString = this.toQueryString(query)\n return this.client.get<{ count: number }>(`${this.basePath}/count${queryString}`, headers)\n }\n\n /**\n * Returns the total number of contacts matching the given filters (POST variant for complex queries).\n * @permissions contacts.view\n */\n countPost(\n body: CountContactsQuery,\n headers?: Record<string, string>,\n ): Promise<{ count: number }> {\n return this.client.post<{ count: number }, CountContactsQuery>(\n `${this.basePath}/count`,\n body,\n headers,\n )\n }\n\n /**\n * Returns a paginated list of contacts available for message forwarding.\n * @permissions contacts.view\n */\n forward(\n query?: ListQuery<Contact>,\n headers?: Record<string, string>,\n ): Promise<Paginated<Contact>> {\n const queryString = this.toQueryString(query)\n return this.client.get<Paginated<Contact>>(`${this.basePath}/forward${queryString}`, headers)\n }\n\n /**\n * Checks whether contacts exist for the given phone numbers on a specific service. Returns a map of number to boolean.\n * @permissions contacts.view\n */\n exists(\n params: ExistsContactsParams,\n headers?: Record<string, string>,\n ): Promise<Record<string, boolean>> {\n const queryString = `?${qs.stringify(params)}`\n return this.client.get<Record<string, boolean>>(\n `${this.basePath}/exists${queryString}`,\n headers,\n )\n }\n\n /**\n * Returns media counts grouped by type (e.g. image, video, document, link) for a contact.\n * @permissions contacts.view\n */\n countMedia(contactId: string, headers?: Record<string, string>): Promise<CountMediaResult> {\n return this.client.get<CountMediaResult>(`${this.basePath}/${contactId}/media/count`, headers)\n }\n\n /**\n * Returns a paginated list of contacts using POST body for advanced filtering.\n * @permissions contacts.view\n */\n list(\n body: Record<string, unknown>,\n headers?: Record<string, string>,\n ): Promise<Paginated<Contact>> {\n return this.client.post<Paginated<Contact>, Record<string, unknown>>(\n `${this.basePath}/list`,\n body,\n headers,\n )\n }\n\n /**\n * Opens (or transfers) the contact's ticket to a department, and optionally a user.\n * This is the real ticket-open flow used by the UI — there is no `POST /tickets`.\n * @permissions tickets.transfer.all OR tickets.transfer.me\n */\n transferTicket(\n contactId: string,\n payload: TransferTicketPayload,\n headers?: Record<string, string>,\n ): Promise<unknown> {\n return this.client.post<unknown, TransferTicketPayload>(\n `${this.basePath}/${contactId}/ticket/transfer`,\n payload,\n headers,\n )\n }\n}\n"],"mappings":";;;;;;;AAeA,IAAa,cAAb,cAAiCA,qCAAiE;CAChG,YAAY,QAAmB;AAC7B,QAAM,QAAQ,YAAY;;;;;;CAO5B,eAAe,MAA6B,SAAoD;AAC9F,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,mBACjB,MACA,QACD;;;;;;CAOH,MAAM,OAA4B,SAA8D;EAC9F,MAAM,cAAc,KAAK,cAAc,MAAM;AAC7C,SAAO,KAAK,OAAO,IAAuB,GAAG,KAAK,SAAS,QAAQ,eAAe,QAAQ;;;;;;CAO5F,UACE,MACA,SAC4B;AAC5B,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,SACjB,MACA,QACD;;;;;;CAOH,QACE,OACA,SAC6B;EAC7B,MAAM,cAAc,KAAK,cAAc,MAAM;AAC7C,SAAO,KAAK,OAAO,IAAwB,GAAG,KAAK,SAAS,UAAU,eAAe,QAAQ;;;;;;CAO/F,OACE,QACA,SACkC;EAClC,MAAM,cAAc,IAAI,WAAG,UAAU,OAAO;AAC5C,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,SAAS,eAC1B,QACD;;;;;;CAOH,WAAW,WAAmB,SAA6D;AACzF,SAAO,KAAK,OAAO,IAAsB,GAAG,KAAK,SAAS,GAAG,UAAU,eAAe,QAAQ;;;;;;CAOhG,KACE,MACA,SAC6B;AAC7B,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,QACjB,MACA,QACD;;;;;;;CAQH,eACE,WACA,SACA,SACkB;AAClB,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,GAAG,UAAU,mBAC9B,SACA,QACD"}
@@ -18,7 +18,7 @@ var ContactsApi = class extends BaseCrudApi {
18
18
  * @permissions contacts.view
19
19
  */
20
20
  count(query, headers) {
21
- const queryString = query ? `?${qs.stringify(query)}` : "";
21
+ const queryString = this.toQueryString(query);
22
22
  return this.client.get(`${this.basePath}/count${queryString}`, headers);
23
23
  }
24
24
  /**
@@ -33,7 +33,7 @@ var ContactsApi = class extends BaseCrudApi {
33
33
  * @permissions contacts.view
34
34
  */
35
35
  forward(query, headers) {
36
- const queryString = query ? `?${qs.stringify(query)}` : "";
36
+ const queryString = this.toQueryString(query);
37
37
  return this.client.get(`${this.basePath}/forward${queryString}`, headers);
38
38
  }
39
39
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ContactsApi.mjs","names":[],"sources":["../../../src/apis/contacts/ContactsApi.ts"],"sourcesContent":["import qs from 'qs'\nimport type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { ListQuery, Paginated } from '../../core/types'\nimport type {\n Contact,\n CountContactsQuery,\n CountMediaResult,\n CreateContactPayload,\n ExistsContactsParams,\n ExportTemplatePayload,\n TransferTicketPayload,\n UpdateContactPayload,\n} from './types'\n\nexport class ContactsApi extends BaseCrudApi<Contact, CreateContactPayload, UpdateContactPayload> {\n constructor(client: ApiClient) {\n super(client, '/contacts')\n }\n\n /**\n * Downloads a CSV template for importing contacts, with columns based on the service type.\n * @permissions contacts.view AND contacts.export\n */\n exportTemplate(body: ExportTemplatePayload, headers?: Record<string, string>): Promise<unknown> {\n return this.client.post<unknown, ExportTemplatePayload>(\n `${this.basePath}/export-template`,\n body,\n headers,\n )\n }\n\n /**\n * Returns the total number of contacts matching the given query filters.\n * @permissions contacts.view\n */\n count(query?: CountContactsQuery, headers?: Record<string, string>): Promise<{ count: number }> {\n const queryString = query ? `?${qs.stringify(query)}` : ''\n return this.client.get<{ count: number }>(`${this.basePath}/count${queryString}`, headers)\n }\n\n /**\n * Returns the total number of contacts matching the given filters (POST variant for complex queries).\n * @permissions contacts.view\n */\n countPost(\n body: CountContactsQuery,\n headers?: Record<string, string>,\n ): Promise<{ count: number }> {\n return this.client.post<{ count: number }, CountContactsQuery>(\n `${this.basePath}/count`,\n body,\n headers,\n )\n }\n\n /**\n * Returns a paginated list of contacts available for message forwarding.\n * @permissions contacts.view\n */\n forward(\n query?: ListQuery<Contact>,\n headers?: Record<string, string>,\n ): Promise<Paginated<Contact>> {\n const queryString = query ? `?${qs.stringify(query)}` : ''\n return this.client.get<Paginated<Contact>>(`${this.basePath}/forward${queryString}`, headers)\n }\n\n /**\n * Checks whether contacts exist for the given phone numbers on a specific service. Returns a map of number to boolean.\n * @permissions contacts.view\n */\n exists(\n params: ExistsContactsParams,\n headers?: Record<string, string>,\n ): Promise<Record<string, boolean>> {\n const queryString = `?${qs.stringify(params)}`\n return this.client.get<Record<string, boolean>>(\n `${this.basePath}/exists${queryString}`,\n headers,\n )\n }\n\n /**\n * Returns media counts grouped by type (e.g. image, video, document, link) for a contact.\n * @permissions contacts.view\n */\n countMedia(contactId: string, headers?: Record<string, string>): Promise<CountMediaResult> {\n return this.client.get<CountMediaResult>(`${this.basePath}/${contactId}/media/count`, headers)\n }\n\n /**\n * Returns a paginated list of contacts using POST body for advanced filtering.\n * @permissions contacts.view\n */\n list(\n body: Record<string, unknown>,\n headers?: Record<string, string>,\n ): Promise<Paginated<Contact>> {\n return this.client.post<Paginated<Contact>, Record<string, unknown>>(\n `${this.basePath}/list`,\n body,\n headers,\n )\n }\n\n /**\n * Opens (or transfers) the contact's ticket to a department, and optionally a user.\n * This is the real ticket-open flow used by the UI — there is no `POST /tickets`.\n * @permissions tickets.transfer.all OR tickets.transfer.me\n */\n transferTicket(\n contactId: string,\n payload: TransferTicketPayload,\n headers?: Record<string, string>,\n ): Promise<unknown> {\n return this.client.post<unknown, TransferTicketPayload>(\n `${this.basePath}/${contactId}/ticket/transfer`,\n payload,\n headers,\n )\n }\n}\n"],"mappings":";;;;AAeA,IAAa,cAAb,cAAiC,YAAiE;CAChG,YAAY,QAAmB;AAC7B,QAAM,QAAQ,YAAY;;;;;;CAO5B,eAAe,MAA6B,SAAoD;AAC9F,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,mBACjB,MACA,QACD;;;;;;CAOH,MAAM,OAA4B,SAA8D;EAC9F,MAAM,cAAc,QAAQ,IAAI,GAAG,UAAU,MAAM,KAAK;AACxD,SAAO,KAAK,OAAO,IAAuB,GAAG,KAAK,SAAS,QAAQ,eAAe,QAAQ;;;;;;CAO5F,UACE,MACA,SAC4B;AAC5B,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,SACjB,MACA,QACD;;;;;;CAOH,QACE,OACA,SAC6B;EAC7B,MAAM,cAAc,QAAQ,IAAI,GAAG,UAAU,MAAM,KAAK;AACxD,SAAO,KAAK,OAAO,IAAwB,GAAG,KAAK,SAAS,UAAU,eAAe,QAAQ;;;;;;CAO/F,OACE,QACA,SACkC;EAClC,MAAM,cAAc,IAAI,GAAG,UAAU,OAAO;AAC5C,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,SAAS,eAC1B,QACD;;;;;;CAOH,WAAW,WAAmB,SAA6D;AACzF,SAAO,KAAK,OAAO,IAAsB,GAAG,KAAK,SAAS,GAAG,UAAU,eAAe,QAAQ;;;;;;CAOhG,KACE,MACA,SAC6B;AAC7B,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,QACjB,MACA,QACD;;;;;;;CAQH,eACE,WACA,SACA,SACkB;AAClB,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,GAAG,UAAU,mBAC9B,SACA,QACD"}
1
+ {"version":3,"file":"ContactsApi.mjs","names":[],"sources":["../../../src/apis/contacts/ContactsApi.ts"],"sourcesContent":["import qs from 'qs'\nimport type { ApiClient } from '../../core/ApiClient'\nimport { BaseCrudApi } from '../../core/BaseCrudApi'\nimport type { ListQuery, Paginated } from '../../core/types'\nimport type {\n Contact,\n CountContactsQuery,\n CountMediaResult,\n CreateContactPayload,\n ExistsContactsParams,\n ExportTemplatePayload,\n TransferTicketPayload,\n UpdateContactPayload,\n} from './types'\n\nexport class ContactsApi extends BaseCrudApi<Contact, CreateContactPayload, UpdateContactPayload> {\n constructor(client: ApiClient) {\n super(client, '/contacts')\n }\n\n /**\n * Downloads a CSV template for importing contacts, with columns based on the service type.\n * @permissions contacts.view AND contacts.export\n */\n exportTemplate(body: ExportTemplatePayload, headers?: Record<string, string>): Promise<unknown> {\n return this.client.post<unknown, ExportTemplatePayload>(\n `${this.basePath}/export-template`,\n body,\n headers,\n )\n }\n\n /**\n * Returns the total number of contacts matching the given query filters.\n * @permissions contacts.view\n */\n count(query?: CountContactsQuery, headers?: Record<string, string>): Promise<{ count: number }> {\n const queryString = this.toQueryString(query)\n return this.client.get<{ count: number }>(`${this.basePath}/count${queryString}`, headers)\n }\n\n /**\n * Returns the total number of contacts matching the given filters (POST variant for complex queries).\n * @permissions contacts.view\n */\n countPost(\n body: CountContactsQuery,\n headers?: Record<string, string>,\n ): Promise<{ count: number }> {\n return this.client.post<{ count: number }, CountContactsQuery>(\n `${this.basePath}/count`,\n body,\n headers,\n )\n }\n\n /**\n * Returns a paginated list of contacts available for message forwarding.\n * @permissions contacts.view\n */\n forward(\n query?: ListQuery<Contact>,\n headers?: Record<string, string>,\n ): Promise<Paginated<Contact>> {\n const queryString = this.toQueryString(query)\n return this.client.get<Paginated<Contact>>(`${this.basePath}/forward${queryString}`, headers)\n }\n\n /**\n * Checks whether contacts exist for the given phone numbers on a specific service. Returns a map of number to boolean.\n * @permissions contacts.view\n */\n exists(\n params: ExistsContactsParams,\n headers?: Record<string, string>,\n ): Promise<Record<string, boolean>> {\n const queryString = `?${qs.stringify(params)}`\n return this.client.get<Record<string, boolean>>(\n `${this.basePath}/exists${queryString}`,\n headers,\n )\n }\n\n /**\n * Returns media counts grouped by type (e.g. image, video, document, link) for a contact.\n * @permissions contacts.view\n */\n countMedia(contactId: string, headers?: Record<string, string>): Promise<CountMediaResult> {\n return this.client.get<CountMediaResult>(`${this.basePath}/${contactId}/media/count`, headers)\n }\n\n /**\n * Returns a paginated list of contacts using POST body for advanced filtering.\n * @permissions contacts.view\n */\n list(\n body: Record<string, unknown>,\n headers?: Record<string, string>,\n ): Promise<Paginated<Contact>> {\n return this.client.post<Paginated<Contact>, Record<string, unknown>>(\n `${this.basePath}/list`,\n body,\n headers,\n )\n }\n\n /**\n * Opens (or transfers) the contact's ticket to a department, and optionally a user.\n * This is the real ticket-open flow used by the UI — there is no `POST /tickets`.\n * @permissions tickets.transfer.all OR tickets.transfer.me\n */\n transferTicket(\n contactId: string,\n payload: TransferTicketPayload,\n headers?: Record<string, string>,\n ): Promise<unknown> {\n return this.client.post<unknown, TransferTicketPayload>(\n `${this.basePath}/${contactId}/ticket/transfer`,\n payload,\n headers,\n )\n }\n}\n"],"mappings":";;;;AAeA,IAAa,cAAb,cAAiC,YAAiE;CAChG,YAAY,QAAmB;AAC7B,QAAM,QAAQ,YAAY;;;;;;CAO5B,eAAe,MAA6B,SAAoD;AAC9F,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,mBACjB,MACA,QACD;;;;;;CAOH,MAAM,OAA4B,SAA8D;EAC9F,MAAM,cAAc,KAAK,cAAc,MAAM;AAC7C,SAAO,KAAK,OAAO,IAAuB,GAAG,KAAK,SAAS,QAAQ,eAAe,QAAQ;;;;;;CAO5F,UACE,MACA,SAC4B;AAC5B,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,SACjB,MACA,QACD;;;;;;CAOH,QACE,OACA,SAC6B;EAC7B,MAAM,cAAc,KAAK,cAAc,MAAM;AAC7C,SAAO,KAAK,OAAO,IAAwB,GAAG,KAAK,SAAS,UAAU,eAAe,QAAQ;;;;;;CAO/F,OACE,QACA,SACkC;EAClC,MAAM,cAAc,IAAI,GAAG,UAAU,OAAO;AAC5C,SAAO,KAAK,OAAO,IACjB,GAAG,KAAK,SAAS,SAAS,eAC1B,QACD;;;;;;CAOH,WAAW,WAAmB,SAA6D;AACzF,SAAO,KAAK,OAAO,IAAsB,GAAG,KAAK,SAAS,GAAG,UAAU,eAAe,QAAQ;;;;;;CAOhG,KACE,MACA,SAC6B;AAC7B,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,QACjB,MACA,QACD;;;;;;;CAQH,eACE,WACA,SACA,SACkB;AAClB,SAAO,KAAK,OAAO,KACjB,GAAG,KAAK,SAAS,GAAG,UAAU,mBAC9B,SACA,QACD"}
@@ -1,11 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_core_BaseApi = require('../../core/BaseApi.cjs');
2
3
 
3
4
  //#region src/apis/me/MeApi.ts
4
- var MeApi = class {
5
- client;
6
- constructor(client) {
7
- this.client = client;
8
- }
5
+ var MeApi = class extends require_core_BaseApi.BaseApi {
9
6
  /**
10
7
  * Returns the currently authenticated user, including their roles, departments, and timetable.
11
8
  * @permissions users.view
@@ -1 +1 @@
1
- {"version":3,"file":"MeApi.cjs","names":[],"sources":["../../../src/apis/me/MeApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { Account } from '../accounts/types'\nimport type { User } from '../users/types'\nimport type {\n RegisterTokenPayload,\n SetOtpSecretKeyPayload,\n TakeoverPayload,\n UpdateMeAccountPayload,\n UpdateMePayload,\n UpdateMeStatusPayload,\n} from './types'\n\nexport class MeApi {\n protected readonly client: ApiClient\n\n constructor(client: ApiClient) {\n this.client = client\n }\n\n /**\n * Returns the currently authenticated user, including their roles, departments, and timetable.\n * @permissions users.view\n */\n getMe(headers?: Record<string, string>): Promise<User> {\n return this.client.get<User>('/me', headers)\n }\n\n /** Returns the account associated with the currently authenticated user. */\n getAccount(headers?: Record<string, string>): Promise<Account> {\n return this.client.get<Account>('/me/account', headers)\n }\n\n /**\n * Returns credit and usage amounts for the current account.\n * Excludes Digisac's own internal credit amounts.\n */\n getAccountAmounts(headers?: Record<string, string>): Promise<Record<string, unknown>> {\n return this.client.get<Record<string, unknown>>('/me/get-account-amounts', headers)\n }\n\n /**\n * Returns a URL to the Agnus billing/plan management page for the current account.\n * @permissions myAccount.myPlan\n */\n getAgnusMyPlanUrl(headers?: Record<string, string>): Promise<{ url: string }> {\n return this.client.get<{ url: string }>('/me/account/agnus-my-plan-url', headers)\n }\n\n /**\n * Updates the current user's profile fields such as name, language, and preferences.\n * If a new password is provided, it is validated against the last 6 password history entries\n * and all existing access tokens for the user are revoked.\n */\n updateMe(body: UpdateMePayload, headers?: Record<string, string>): Promise<User> {\n return this.client.put<User, UpdateMePayload>('/me', body, headers)\n }\n\n /** Updates account-level settings such as name, settings object, wizard progress, and default department. */\n updateAccount(body: UpdateMeAccountPayload, headers?: Record<string, string>): Promise<Account> {\n return this.client.put<Account, UpdateMeAccountPayload>('/me/account', body, headers)\n }\n\n /**\n * Updates the presence status of the current user (`online`, `offline`, or `away`).\n * If setting to `online`, validates the user's timetable first — if outside working hours,\n * the status is set to `offline` instead.\n */\n updateStatus(body: UpdateMeStatusPayload, headers?: Record<string, string>): Promise<User> {\n return this.client.put<User, UpdateMeStatusPayload>('/me/status', body, headers)\n }\n\n /**\n * Extends the grace period for the current account when it has expired or is about to expire.\n * Returns the updated account.\n */\n extendAccountGracePeriod(headers?: Record<string, string>): Promise<Account> {\n return this.client.post<Account>('/me/account/extend-grace-period', undefined, headers)\n }\n\n /**\n * Registers a OneSignal push notification token for the current user.\n * Used to enable push notifications on mobile/web clients.\n */\n registerToken(body: RegisterTokenPayload, headers?: Record<string, string>): Promise<void> {\n return this.client.post<void, RegisterTokenPayload>(\n '/me/one-signal/register-token',\n body,\n headers,\n )\n }\n\n /** Marks the current user's first login as complete by setting `isFirstLogin` to `false`. */\n reportFirstLogin(headers?: Record<string, string>): Promise<User> {\n return this.client.post<User>('/me/report-login', undefined, headers)\n }\n\n /**\n * Sets the current user's status to `online` for the given client and emits a takeover event,\n * which signals other connected sessions to yield control to this one.\n */\n takeover(body?: TakeoverPayload, headers?: Record<string, string>): Promise<void> {\n return this.client.post<void, TakeoverPayload>('/me/takeover', body, headers)\n }\n\n /**\n * Stores a 16-character OTP secret key on the current user.\n * This must be called before activating OTP authentication via `activateOtpAuth`.\n */\n setOtpSecretKey(body: SetOtpSecretKeyPayload, headers?: Record<string, string>): Promise<void> {\n return this.client.patch<void, SetOtpSecretKeyPayload>('/me/set-otp-secret-key', body, headers)\n }\n\n /**\n * Activates OTP (two-factor) authentication for the current user.\n * Requires the `x-digisac-otp` header with a valid TOTP token generated from the secret key\n * previously set via `setOtpSecretKey`.\n */\n activateOtpAuth(headers?: Record<string, string>): Promise<boolean> {\n return this.client.post<boolean>('/me/activate-otp-auth', undefined, headers)\n }\n}\n"],"mappings":";;;AAYA,IAAa,QAAb,MAAmB;CACjB,AAAmB;CAEnB,YAAY,QAAmB;AAC7B,OAAK,SAAS;;;;;;CAOhB,MAAM,SAAiD;AACrD,SAAO,KAAK,OAAO,IAAU,OAAO,QAAQ;;;CAI9C,WAAW,SAAoD;AAC7D,SAAO,KAAK,OAAO,IAAa,eAAe,QAAQ;;;;;;CAOzD,kBAAkB,SAAoE;AACpF,SAAO,KAAK,OAAO,IAA6B,2BAA2B,QAAQ;;;;;;CAOrF,kBAAkB,SAA4D;AAC5E,SAAO,KAAK,OAAO,IAAqB,iCAAiC,QAAQ;;;;;;;CAQnF,SAAS,MAAuB,SAAiD;AAC/E,SAAO,KAAK,OAAO,IAA2B,OAAO,MAAM,QAAQ;;;CAIrE,cAAc,MAA8B,SAAoD;AAC9F,SAAO,KAAK,OAAO,IAAqC,eAAe,MAAM,QAAQ;;;;;;;CAQvF,aAAa,MAA6B,SAAiD;AACzF,SAAO,KAAK,OAAO,IAAiC,cAAc,MAAM,QAAQ;;;;;;CAOlF,yBAAyB,SAAoD;AAC3E,SAAO,KAAK,OAAO,KAAc,mCAAmC,QAAW,QAAQ;;;;;;CAOzF,cAAc,MAA4B,SAAiD;AACzF,SAAO,KAAK,OAAO,KACjB,iCACA,MACA,QACD;;;CAIH,iBAAiB,SAAiD;AAChE,SAAO,KAAK,OAAO,KAAW,oBAAoB,QAAW,QAAQ;;;;;;CAOvE,SAAS,MAAwB,SAAiD;AAChF,SAAO,KAAK,OAAO,KAA4B,gBAAgB,MAAM,QAAQ;;;;;;CAO/E,gBAAgB,MAA8B,SAAiD;AAC7F,SAAO,KAAK,OAAO,MAAoC,0BAA0B,MAAM,QAAQ;;;;;;;CAQjG,gBAAgB,SAAoD;AAClE,SAAO,KAAK,OAAO,KAAc,yBAAyB,QAAW,QAAQ"}
1
+ {"version":3,"file":"MeApi.cjs","names":["BaseApi"],"sources":["../../../src/apis/me/MeApi.ts"],"sourcesContent":["import { BaseApi } from '../../core/BaseApi'\nimport type { Account } from '../accounts/types'\nimport type { User } from '../users/types'\nimport type {\n RegisterTokenPayload,\n SetOtpSecretKeyPayload,\n TakeoverPayload,\n UpdateMeAccountPayload,\n UpdateMePayload,\n UpdateMeStatusPayload,\n} from './types'\n\nexport class MeApi extends BaseApi {\n /**\n * Returns the currently authenticated user, including their roles, departments, and timetable.\n * @permissions users.view\n */\n getMe(headers?: Record<string, string>): Promise<User> {\n return this.client.get<User>('/me', headers)\n }\n\n /** Returns the account associated with the currently authenticated user. */\n getAccount(headers?: Record<string, string>): Promise<Account> {\n return this.client.get<Account>('/me/account', headers)\n }\n\n /**\n * Returns credit and usage amounts for the current account.\n * Excludes Digisac's own internal credit amounts.\n */\n getAccountAmounts(headers?: Record<string, string>): Promise<Record<string, unknown>> {\n return this.client.get<Record<string, unknown>>('/me/get-account-amounts', headers)\n }\n\n /**\n * Returns a URL to the Agnus billing/plan management page for the current account.\n * @permissions myAccount.myPlan\n */\n getAgnusMyPlanUrl(headers?: Record<string, string>): Promise<{ url: string }> {\n return this.client.get<{ url: string }>('/me/account/agnus-my-plan-url', headers)\n }\n\n /**\n * Updates the current user's profile fields such as name, language, and preferences.\n * If a new password is provided, it is validated against the last 6 password history entries\n * and all existing access tokens for the user are revoked.\n */\n updateMe(body: UpdateMePayload, headers?: Record<string, string>): Promise<User> {\n return this.client.put<User, UpdateMePayload>('/me', body, headers)\n }\n\n /** Updates account-level settings such as name, settings object, wizard progress, and default department. */\n updateAccount(body: UpdateMeAccountPayload, headers?: Record<string, string>): Promise<Account> {\n return this.client.put<Account, UpdateMeAccountPayload>('/me/account', body, headers)\n }\n\n /**\n * Updates the presence status of the current user (`online`, `offline`, or `away`).\n * If setting to `online`, validates the user's timetable first — if outside working hours,\n * the status is set to `offline` instead.\n */\n updateStatus(body: UpdateMeStatusPayload, headers?: Record<string, string>): Promise<User> {\n return this.client.put<User, UpdateMeStatusPayload>('/me/status', body, headers)\n }\n\n /**\n * Extends the grace period for the current account when it has expired or is about to expire.\n * Returns the updated account.\n */\n extendAccountGracePeriod(headers?: Record<string, string>): Promise<Account> {\n return this.client.post<Account>('/me/account/extend-grace-period', undefined, headers)\n }\n\n /**\n * Registers a OneSignal push notification token for the current user.\n * Used to enable push notifications on mobile/web clients.\n */\n registerToken(body: RegisterTokenPayload, headers?: Record<string, string>): Promise<void> {\n return this.client.post<void, RegisterTokenPayload>(\n '/me/one-signal/register-token',\n body,\n headers,\n )\n }\n\n /** Marks the current user's first login as complete by setting `isFirstLogin` to `false`. */\n reportFirstLogin(headers?: Record<string, string>): Promise<User> {\n return this.client.post<User>('/me/report-login', undefined, headers)\n }\n\n /**\n * Sets the current user's status to `online` for the given client and emits a takeover event,\n * which signals other connected sessions to yield control to this one.\n */\n takeover(body?: TakeoverPayload, headers?: Record<string, string>): Promise<void> {\n return this.client.post<void, TakeoverPayload>('/me/takeover', body, headers)\n }\n\n /**\n * Stores a 16-character OTP secret key on the current user.\n * This must be called before activating OTP authentication via `activateOtpAuth`.\n */\n setOtpSecretKey(body: SetOtpSecretKeyPayload, headers?: Record<string, string>): Promise<void> {\n return this.client.patch<void, SetOtpSecretKeyPayload>('/me/set-otp-secret-key', body, headers)\n }\n\n /**\n * Activates OTP (two-factor) authentication for the current user.\n * Requires the `x-digisac-otp` header with a valid TOTP token generated from the secret key\n * previously set via `setOtpSecretKey`.\n */\n activateOtpAuth(headers?: Record<string, string>): Promise<boolean> {\n return this.client.post<boolean>('/me/activate-otp-auth', undefined, headers)\n }\n}\n"],"mappings":";;;;AAYA,IAAa,QAAb,cAA2BA,6BAAQ;;;;;CAKjC,MAAM,SAAiD;AACrD,SAAO,KAAK,OAAO,IAAU,OAAO,QAAQ;;;CAI9C,WAAW,SAAoD;AAC7D,SAAO,KAAK,OAAO,IAAa,eAAe,QAAQ;;;;;;CAOzD,kBAAkB,SAAoE;AACpF,SAAO,KAAK,OAAO,IAA6B,2BAA2B,QAAQ;;;;;;CAOrF,kBAAkB,SAA4D;AAC5E,SAAO,KAAK,OAAO,IAAqB,iCAAiC,QAAQ;;;;;;;CAQnF,SAAS,MAAuB,SAAiD;AAC/E,SAAO,KAAK,OAAO,IAA2B,OAAO,MAAM,QAAQ;;;CAIrE,cAAc,MAA8B,SAAoD;AAC9F,SAAO,KAAK,OAAO,IAAqC,eAAe,MAAM,QAAQ;;;;;;;CAQvF,aAAa,MAA6B,SAAiD;AACzF,SAAO,KAAK,OAAO,IAAiC,cAAc,MAAM,QAAQ;;;;;;CAOlF,yBAAyB,SAAoD;AAC3E,SAAO,KAAK,OAAO,KAAc,mCAAmC,QAAW,QAAQ;;;;;;CAOzF,cAAc,MAA4B,SAAiD;AACzF,SAAO,KAAK,OAAO,KACjB,iCACA,MACA,QACD;;;CAIH,iBAAiB,SAAiD;AAChE,SAAO,KAAK,OAAO,KAAW,oBAAoB,QAAW,QAAQ;;;;;;CAOvE,SAAS,MAAwB,SAAiD;AAChF,SAAO,KAAK,OAAO,KAA4B,gBAAgB,MAAM,QAAQ;;;;;;CAO/E,gBAAgB,MAA8B,SAAiD;AAC7F,SAAO,KAAK,OAAO,MAAoC,0BAA0B,MAAM,QAAQ;;;;;;;CAQjG,gBAAgB,SAAoD;AAClE,SAAO,KAAK,OAAO,KAAc,yBAAyB,QAAW,QAAQ"}
@@ -1,10 +1,8 @@
1
- import type { ApiClient } from '../../core/ApiClient';
1
+ import { BaseApi } from '../../core/BaseApi';
2
2
  import type { Account } from '../accounts/types';
3
3
  import type { User } from '../users/types';
4
4
  import type { RegisterTokenPayload, SetOtpSecretKeyPayload, TakeoverPayload, UpdateMeAccountPayload, UpdateMePayload, UpdateMeStatusPayload } from './types';
5
- export declare class MeApi {
6
- protected readonly client: ApiClient;
7
- constructor(client: ApiClient);
5
+ export declare class MeApi extends BaseApi {
8
6
  /**
9
7
  * Returns the currently authenticated user, including their roles, departments, and timetable.
10
8
  * @permissions users.view
@@ -1 +1 @@
1
- {"version":3,"file":"MeApi.d.ts","sourceRoot":"","sources":["../../../src/apis/me/MeApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAEhB,qBAAa,KAAK;IAChB,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAA;gBAExB,MAAM,EAAE,SAAS;IAI7B;;;OAGG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAItD,4EAA4E;IAC5E,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAI9D;;;OAGG;IACH,iBAAiB,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAIrF;;;OAGG;IACH,iBAAiB,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAI7E;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhF,6GAA6G;IAC7G,aAAa,CAAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAI/F;;;;OAIG;IACH,YAAY,CAAC,IAAI,EAAE,qBAAqB,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1F;;;OAGG;IACH,wBAAwB,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAI5E;;;OAGG;IACH,aAAa,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ1F,6FAA6F;IAC7F,gBAAgB,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjE;;;OAGG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjF;;;OAGG;IACH,eAAe,CAAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9F;;;;OAIG;IACH,eAAe,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;CAGpE"}
1
+ {"version":3,"file":"MeApi.d.ts","sourceRoot":"","sources":["../../../src/apis/me/MeApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAEhB,qBAAa,KAAM,SAAQ,OAAO;IAChC;;;OAGG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAItD,4EAA4E;IAC5E,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAI9D;;;OAGG;IACH,iBAAiB,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAIrF;;;OAGG;IACH,iBAAiB,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAI7E;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhF,6GAA6G;IAC7G,aAAa,CAAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAI/F;;;;OAIG;IACH,YAAY,CAAC,IAAI,EAAE,qBAAqB,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1F;;;OAGG;IACH,wBAAwB,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAI5E;;;OAGG;IACH,aAAa,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ1F,6FAA6F;IAC7F,gBAAgB,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjE;;;OAGG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjF;;;OAGG;IACH,eAAe,CAAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9F;;;;OAIG;IACH,eAAe,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;CAGpE"}
@@ -1,9 +1,7 @@
1
+ import { BaseApi } from "../../core/BaseApi.mjs";
2
+
1
3
  //#region src/apis/me/MeApi.ts
2
- var MeApi = class {
3
- client;
4
- constructor(client) {
5
- this.client = client;
6
- }
4
+ var MeApi = class extends BaseApi {
7
5
  /**
8
6
  * Returns the currently authenticated user, including their roles, departments, and timetable.
9
7
  * @permissions users.view
@@ -1 +1 @@
1
- {"version":3,"file":"MeApi.mjs","names":[],"sources":["../../../src/apis/me/MeApi.ts"],"sourcesContent":["import type { ApiClient } from '../../core/ApiClient'\nimport type { Account } from '../accounts/types'\nimport type { User } from '../users/types'\nimport type {\n RegisterTokenPayload,\n SetOtpSecretKeyPayload,\n TakeoverPayload,\n UpdateMeAccountPayload,\n UpdateMePayload,\n UpdateMeStatusPayload,\n} from './types'\n\nexport class MeApi {\n protected readonly client: ApiClient\n\n constructor(client: ApiClient) {\n this.client = client\n }\n\n /**\n * Returns the currently authenticated user, including their roles, departments, and timetable.\n * @permissions users.view\n */\n getMe(headers?: Record<string, string>): Promise<User> {\n return this.client.get<User>('/me', headers)\n }\n\n /** Returns the account associated with the currently authenticated user. */\n getAccount(headers?: Record<string, string>): Promise<Account> {\n return this.client.get<Account>('/me/account', headers)\n }\n\n /**\n * Returns credit and usage amounts for the current account.\n * Excludes Digisac's own internal credit amounts.\n */\n getAccountAmounts(headers?: Record<string, string>): Promise<Record<string, unknown>> {\n return this.client.get<Record<string, unknown>>('/me/get-account-amounts', headers)\n }\n\n /**\n * Returns a URL to the Agnus billing/plan management page for the current account.\n * @permissions myAccount.myPlan\n */\n getAgnusMyPlanUrl(headers?: Record<string, string>): Promise<{ url: string }> {\n return this.client.get<{ url: string }>('/me/account/agnus-my-plan-url', headers)\n }\n\n /**\n * Updates the current user's profile fields such as name, language, and preferences.\n * If a new password is provided, it is validated against the last 6 password history entries\n * and all existing access tokens for the user are revoked.\n */\n updateMe(body: UpdateMePayload, headers?: Record<string, string>): Promise<User> {\n return this.client.put<User, UpdateMePayload>('/me', body, headers)\n }\n\n /** Updates account-level settings such as name, settings object, wizard progress, and default department. */\n updateAccount(body: UpdateMeAccountPayload, headers?: Record<string, string>): Promise<Account> {\n return this.client.put<Account, UpdateMeAccountPayload>('/me/account', body, headers)\n }\n\n /**\n * Updates the presence status of the current user (`online`, `offline`, or `away`).\n * If setting to `online`, validates the user's timetable first — if outside working hours,\n * the status is set to `offline` instead.\n */\n updateStatus(body: UpdateMeStatusPayload, headers?: Record<string, string>): Promise<User> {\n return this.client.put<User, UpdateMeStatusPayload>('/me/status', body, headers)\n }\n\n /**\n * Extends the grace period for the current account when it has expired or is about to expire.\n * Returns the updated account.\n */\n extendAccountGracePeriod(headers?: Record<string, string>): Promise<Account> {\n return this.client.post<Account>('/me/account/extend-grace-period', undefined, headers)\n }\n\n /**\n * Registers a OneSignal push notification token for the current user.\n * Used to enable push notifications on mobile/web clients.\n */\n registerToken(body: RegisterTokenPayload, headers?: Record<string, string>): Promise<void> {\n return this.client.post<void, RegisterTokenPayload>(\n '/me/one-signal/register-token',\n body,\n headers,\n )\n }\n\n /** Marks the current user's first login as complete by setting `isFirstLogin` to `false`. */\n reportFirstLogin(headers?: Record<string, string>): Promise<User> {\n return this.client.post<User>('/me/report-login', undefined, headers)\n }\n\n /**\n * Sets the current user's status to `online` for the given client and emits a takeover event,\n * which signals other connected sessions to yield control to this one.\n */\n takeover(body?: TakeoverPayload, headers?: Record<string, string>): Promise<void> {\n return this.client.post<void, TakeoverPayload>('/me/takeover', body, headers)\n }\n\n /**\n * Stores a 16-character OTP secret key on the current user.\n * This must be called before activating OTP authentication via `activateOtpAuth`.\n */\n setOtpSecretKey(body: SetOtpSecretKeyPayload, headers?: Record<string, string>): Promise<void> {\n return this.client.patch<void, SetOtpSecretKeyPayload>('/me/set-otp-secret-key', body, headers)\n }\n\n /**\n * Activates OTP (two-factor) authentication for the current user.\n * Requires the `x-digisac-otp` header with a valid TOTP token generated from the secret key\n * previously set via `setOtpSecretKey`.\n */\n activateOtpAuth(headers?: Record<string, string>): Promise<boolean> {\n return this.client.post<boolean>('/me/activate-otp-auth', undefined, headers)\n }\n}\n"],"mappings":";AAYA,IAAa,QAAb,MAAmB;CACjB,AAAmB;CAEnB,YAAY,QAAmB;AAC7B,OAAK,SAAS;;;;;;CAOhB,MAAM,SAAiD;AACrD,SAAO,KAAK,OAAO,IAAU,OAAO,QAAQ;;;CAI9C,WAAW,SAAoD;AAC7D,SAAO,KAAK,OAAO,IAAa,eAAe,QAAQ;;;;;;CAOzD,kBAAkB,SAAoE;AACpF,SAAO,KAAK,OAAO,IAA6B,2BAA2B,QAAQ;;;;;;CAOrF,kBAAkB,SAA4D;AAC5E,SAAO,KAAK,OAAO,IAAqB,iCAAiC,QAAQ;;;;;;;CAQnF,SAAS,MAAuB,SAAiD;AAC/E,SAAO,KAAK,OAAO,IAA2B,OAAO,MAAM,QAAQ;;;CAIrE,cAAc,MAA8B,SAAoD;AAC9F,SAAO,KAAK,OAAO,IAAqC,eAAe,MAAM,QAAQ;;;;;;;CAQvF,aAAa,MAA6B,SAAiD;AACzF,SAAO,KAAK,OAAO,IAAiC,cAAc,MAAM,QAAQ;;;;;;CAOlF,yBAAyB,SAAoD;AAC3E,SAAO,KAAK,OAAO,KAAc,mCAAmC,QAAW,QAAQ;;;;;;CAOzF,cAAc,MAA4B,SAAiD;AACzF,SAAO,KAAK,OAAO,KACjB,iCACA,MACA,QACD;;;CAIH,iBAAiB,SAAiD;AAChE,SAAO,KAAK,OAAO,KAAW,oBAAoB,QAAW,QAAQ;;;;;;CAOvE,SAAS,MAAwB,SAAiD;AAChF,SAAO,KAAK,OAAO,KAA4B,gBAAgB,MAAM,QAAQ;;;;;;CAO/E,gBAAgB,MAA8B,SAAiD;AAC7F,SAAO,KAAK,OAAO,MAAoC,0BAA0B,MAAM,QAAQ;;;;;;;CAQjG,gBAAgB,SAAoD;AAClE,SAAO,KAAK,OAAO,KAAc,yBAAyB,QAAW,QAAQ"}
1
+ {"version":3,"file":"MeApi.mjs","names":[],"sources":["../../../src/apis/me/MeApi.ts"],"sourcesContent":["import { BaseApi } from '../../core/BaseApi'\nimport type { Account } from '../accounts/types'\nimport type { User } from '../users/types'\nimport type {\n RegisterTokenPayload,\n SetOtpSecretKeyPayload,\n TakeoverPayload,\n UpdateMeAccountPayload,\n UpdateMePayload,\n UpdateMeStatusPayload,\n} from './types'\n\nexport class MeApi extends BaseApi {\n /**\n * Returns the currently authenticated user, including their roles, departments, and timetable.\n * @permissions users.view\n */\n getMe(headers?: Record<string, string>): Promise<User> {\n return this.client.get<User>('/me', headers)\n }\n\n /** Returns the account associated with the currently authenticated user. */\n getAccount(headers?: Record<string, string>): Promise<Account> {\n return this.client.get<Account>('/me/account', headers)\n }\n\n /**\n * Returns credit and usage amounts for the current account.\n * Excludes Digisac's own internal credit amounts.\n */\n getAccountAmounts(headers?: Record<string, string>): Promise<Record<string, unknown>> {\n return this.client.get<Record<string, unknown>>('/me/get-account-amounts', headers)\n }\n\n /**\n * Returns a URL to the Agnus billing/plan management page for the current account.\n * @permissions myAccount.myPlan\n */\n getAgnusMyPlanUrl(headers?: Record<string, string>): Promise<{ url: string }> {\n return this.client.get<{ url: string }>('/me/account/agnus-my-plan-url', headers)\n }\n\n /**\n * Updates the current user's profile fields such as name, language, and preferences.\n * If a new password is provided, it is validated against the last 6 password history entries\n * and all existing access tokens for the user are revoked.\n */\n updateMe(body: UpdateMePayload, headers?: Record<string, string>): Promise<User> {\n return this.client.put<User, UpdateMePayload>('/me', body, headers)\n }\n\n /** Updates account-level settings such as name, settings object, wizard progress, and default department. */\n updateAccount(body: UpdateMeAccountPayload, headers?: Record<string, string>): Promise<Account> {\n return this.client.put<Account, UpdateMeAccountPayload>('/me/account', body, headers)\n }\n\n /**\n * Updates the presence status of the current user (`online`, `offline`, or `away`).\n * If setting to `online`, validates the user's timetable first — if outside working hours,\n * the status is set to `offline` instead.\n */\n updateStatus(body: UpdateMeStatusPayload, headers?: Record<string, string>): Promise<User> {\n return this.client.put<User, UpdateMeStatusPayload>('/me/status', body, headers)\n }\n\n /**\n * Extends the grace period for the current account when it has expired or is about to expire.\n * Returns the updated account.\n */\n extendAccountGracePeriod(headers?: Record<string, string>): Promise<Account> {\n return this.client.post<Account>('/me/account/extend-grace-period', undefined, headers)\n }\n\n /**\n * Registers a OneSignal push notification token for the current user.\n * Used to enable push notifications on mobile/web clients.\n */\n registerToken(body: RegisterTokenPayload, headers?: Record<string, string>): Promise<void> {\n return this.client.post<void, RegisterTokenPayload>(\n '/me/one-signal/register-token',\n body,\n headers,\n )\n }\n\n /** Marks the current user's first login as complete by setting `isFirstLogin` to `false`. */\n reportFirstLogin(headers?: Record<string, string>): Promise<User> {\n return this.client.post<User>('/me/report-login', undefined, headers)\n }\n\n /**\n * Sets the current user's status to `online` for the given client and emits a takeover event,\n * which signals other connected sessions to yield control to this one.\n */\n takeover(body?: TakeoverPayload, headers?: Record<string, string>): Promise<void> {\n return this.client.post<void, TakeoverPayload>('/me/takeover', body, headers)\n }\n\n /**\n * Stores a 16-character OTP secret key on the current user.\n * This must be called before activating OTP authentication via `activateOtpAuth`.\n */\n setOtpSecretKey(body: SetOtpSecretKeyPayload, headers?: Record<string, string>): Promise<void> {\n return this.client.patch<void, SetOtpSecretKeyPayload>('/me/set-otp-secret-key', body, headers)\n }\n\n /**\n * Activates OTP (two-factor) authentication for the current user.\n * Requires the `x-digisac-otp` header with a valid TOTP token generated from the secret key\n * previously set via `setOtpSecretKey`.\n */\n activateOtpAuth(headers?: Record<string, string>): Promise<boolean> {\n return this.client.post<boolean>('/me/activate-otp-auth', undefined, headers)\n }\n}\n"],"mappings":";;;AAYA,IAAa,QAAb,cAA2B,QAAQ;;;;;CAKjC,MAAM,SAAiD;AACrD,SAAO,KAAK,OAAO,IAAU,OAAO,QAAQ;;;CAI9C,WAAW,SAAoD;AAC7D,SAAO,KAAK,OAAO,IAAa,eAAe,QAAQ;;;;;;CAOzD,kBAAkB,SAAoE;AACpF,SAAO,KAAK,OAAO,IAA6B,2BAA2B,QAAQ;;;;;;CAOrF,kBAAkB,SAA4D;AAC5E,SAAO,KAAK,OAAO,IAAqB,iCAAiC,QAAQ;;;;;;;CAQnF,SAAS,MAAuB,SAAiD;AAC/E,SAAO,KAAK,OAAO,IAA2B,OAAO,MAAM,QAAQ;;;CAIrE,cAAc,MAA8B,SAAoD;AAC9F,SAAO,KAAK,OAAO,IAAqC,eAAe,MAAM,QAAQ;;;;;;;CAQvF,aAAa,MAA6B,SAAiD;AACzF,SAAO,KAAK,OAAO,IAAiC,cAAc,MAAM,QAAQ;;;;;;CAOlF,yBAAyB,SAAoD;AAC3E,SAAO,KAAK,OAAO,KAAc,mCAAmC,QAAW,QAAQ;;;;;;CAOzF,cAAc,MAA4B,SAAiD;AACzF,SAAO,KAAK,OAAO,KACjB,iCACA,MACA,QACD;;;CAIH,iBAAiB,SAAiD;AAChE,SAAO,KAAK,OAAO,KAAW,oBAAoB,QAAW,QAAQ;;;;;;CAOvE,SAAS,MAAwB,SAAiD;AAChF,SAAO,KAAK,OAAO,KAA4B,gBAAgB,MAAM,QAAQ;;;;;;CAO/E,gBAAgB,MAA8B,SAAiD;AAC7F,SAAO,KAAK,OAAO,MAAoC,0BAA0B,MAAM,QAAQ;;;;;;;CAQjG,gBAAgB,SAAoD;AAClE,SAAO,KAAK,OAAO,KAAc,yBAAyB,QAAW,QAAQ"}
@@ -1,16 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_chunk = require('../../_chunks/chunk-Dk0Otj32.cjs');
3
- let qs = require("qs");
4
- qs = require_chunk.__toESM(qs);
2
+ const require_core_BaseApi = require('../../core/BaseApi.cjs');
5
3
 
6
4
  //#region src/apis/serviceAccessManagement/ServiceAccessManagementApi.ts
7
- var ServiceAccessManagementApi = class {
8
- client;
9
- constructor(client) {
10
- this.client = client;
11
- }
5
+ var ServiceAccessManagementApi = class extends require_core_BaseApi.BaseApi {
12
6
  getMany(query, headers) {
13
- const queryString = query ? `?${qs.default.stringify(query)}` : "";
7
+ const queryString = this.toQueryString(query);
14
8
  return this.client.get(`/service-access-management${queryString}`, headers);
15
9
  }
16
10
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ServiceAccessManagementApi.cjs","names":[],"sources":["../../../src/apis/serviceAccessManagement/ServiceAccessManagementApi.ts"],"sourcesContent":["import qs from 'qs'\nimport type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery, Paginated, HasGetMany } from '../../core/types'\nimport type { ServiceAccessManagement } from './types'\n\nexport class ServiceAccessManagementApi implements HasGetMany<ServiceAccessManagement> {\n private readonly client: ApiClient\n\n constructor(client: ApiClient) {\n this.client = client\n }\n\n /** Returns a paginated list of which users have access to which services. */\n getMany(\n query: ListQuery<ServiceAccessManagement> & { paginate: false },\n headers?: Record<string, string>,\n ): Promise<ServiceAccessManagement[]>\n getMany(\n query?: ListQuery<ServiceAccessManagement> & { paginate?: true },\n headers?: Record<string, string>,\n ): Promise<Paginated<ServiceAccessManagement>>\n getMany(\n query?: ListQuery<ServiceAccessManagement>,\n headers?: Record<string, string>,\n ): Promise<Paginated<ServiceAccessManagement> | ServiceAccessManagement[]> {\n const queryString = query ? `?${qs.stringify(query)}` : ''\n return this.client.get<Paginated<ServiceAccessManagement> | ServiceAccessManagement[]>(\n `/service-access-management${queryString}`,\n headers,\n )\n }\n}\n"],"mappings":";;;;;;AAKA,IAAa,6BAAb,MAAuF;CACrF,AAAiB;CAEjB,YAAY,QAAmB;AAC7B,OAAK,SAAS;;CAYhB,QACE,OACA,SACyE;EACzE,MAAM,cAAc,QAAQ,IAAI,WAAG,UAAU,MAAM,KAAK;AACxD,SAAO,KAAK,OAAO,IACjB,6BAA6B,eAC7B,QACD"}
1
+ {"version":3,"file":"ServiceAccessManagementApi.cjs","names":["BaseApi"],"sources":["../../../src/apis/serviceAccessManagement/ServiceAccessManagementApi.ts"],"sourcesContent":["import { BaseApi } from '../../core/BaseApi'\nimport type { ListQuery, Paginated, HasGetMany } from '../../core/types'\nimport type { ServiceAccessManagement } from './types'\n\nexport class ServiceAccessManagementApi\n extends BaseApi\n implements HasGetMany<ServiceAccessManagement>\n{\n /** Returns a paginated list of which users have access to which services. */\n getMany(\n query: ListQuery<ServiceAccessManagement> & { paginate: false },\n headers?: Record<string, string>,\n ): Promise<ServiceAccessManagement[]>\n getMany(\n query?: ListQuery<ServiceAccessManagement> & { paginate?: true },\n headers?: Record<string, string>,\n ): Promise<Paginated<ServiceAccessManagement>>\n getMany(\n query?: ListQuery<ServiceAccessManagement>,\n headers?: Record<string, string>,\n ): Promise<Paginated<ServiceAccessManagement> | ServiceAccessManagement[]>\n getMany(\n query?: ListQuery<ServiceAccessManagement>,\n headers?: Record<string, string>,\n ): Promise<Paginated<ServiceAccessManagement> | ServiceAccessManagement[]> {\n const queryString = this.toQueryString(query)\n return this.client.get<Paginated<ServiceAccessManagement> | ServiceAccessManagement[]>(\n `/service-access-management${queryString}`,\n headers,\n )\n }\n}\n"],"mappings":";;;;AAIA,IAAa,6BAAb,cACUA,6BAEV;CAcE,QACE,OACA,SACyE;EACzE,MAAM,cAAc,KAAK,cAAc,MAAM;AAC7C,SAAO,KAAK,OAAO,IACjB,6BAA6B,eAC7B,QACD"}
@@ -1,9 +1,7 @@
1
- import type { ApiClient } from '../../core/ApiClient';
1
+ import { BaseApi } from '../../core/BaseApi';
2
2
  import type { ListQuery, Paginated, HasGetMany } from '../../core/types';
3
3
  import type { ServiceAccessManagement } from './types';
4
- export declare class ServiceAccessManagementApi implements HasGetMany<ServiceAccessManagement> {
5
- private readonly client;
6
- constructor(client: ApiClient);
4
+ export declare class ServiceAccessManagementApi extends BaseApi implements HasGetMany<ServiceAccessManagement> {
7
5
  /** Returns a paginated list of which users have access to which services. */
8
6
  getMany(query: ListQuery<ServiceAccessManagement> & {
9
7
  paginate: false;
@@ -11,5 +9,6 @@ export declare class ServiceAccessManagementApi implements HasGetMany<ServiceAcc
11
9
  getMany(query?: ListQuery<ServiceAccessManagement> & {
12
10
  paginate?: true;
13
11
  }, headers?: Record<string, string>): Promise<Paginated<ServiceAccessManagement>>;
12
+ getMany(query?: ListQuery<ServiceAccessManagement>, headers?: Record<string, string>): Promise<Paginated<ServiceAccessManagement> | ServiceAccessManagement[]>;
14
13
  }
15
14
  //# sourceMappingURL=ServiceAccessManagementApi.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ServiceAccessManagementApi.d.ts","sourceRoot":"","sources":["../../../src/apis/serviceAccessManagement/ServiceAccessManagementApi.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACxE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAEtD,qBAAa,0BAA2B,YAAW,UAAU,CAAC,uBAAuB,CAAC;IACpF,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAW;gBAEtB,MAAM,EAAE,SAAS;IAI7B,6EAA6E;IAC7E,OAAO,CACL,KAAK,EAAE,SAAS,CAAC,uBAAuB,CAAC,GAAG;QAAE,QAAQ,EAAE,KAAK,CAAA;KAAE,EAC/D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,uBAAuB,EAAE,CAAC;IACrC,OAAO,CACL,KAAK,CAAC,EAAE,SAAS,CAAC,uBAAuB,CAAC,GAAG;QAAE,QAAQ,CAAC,EAAE,IAAI,CAAA;KAAE,EAChE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC;CAW/C"}
1
+ {"version":3,"file":"ServiceAccessManagementApi.d.ts","sourceRoot":"","sources":["../../../src/apis/serviceAccessManagement/ServiceAccessManagementApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACxE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAEtD,qBAAa,0BACX,SAAQ,OACR,YAAW,UAAU,CAAC,uBAAuB,CAAC;IAE9C,6EAA6E;IAC7E,OAAO,CACL,KAAK,EAAE,SAAS,CAAC,uBAAuB,CAAC,GAAG;QAAE,QAAQ,EAAE,KAAK,CAAA;KAAE,EAC/D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,uBAAuB,EAAE,CAAC;IACrC,OAAO,CACL,KAAK,CAAC,EAAE,SAAS,CAAC,uBAAuB,CAAC,GAAG;QAAE,QAAQ,CAAC,EAAE,IAAI,CAAA;KAAE,EAChE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC;IAC9C,OAAO,CACL,KAAK,CAAC,EAAE,SAAS,CAAC,uBAAuB,CAAC,EAC1C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,SAAS,CAAC,uBAAuB,CAAC,GAAG,uBAAuB,EAAE,CAAC;CAW3E"}
@@ -1,13 +1,9 @@
1
- import qs from "qs";
1
+ import { BaseApi } from "../../core/BaseApi.mjs";
2
2
 
3
3
  //#region src/apis/serviceAccessManagement/ServiceAccessManagementApi.ts
4
- var ServiceAccessManagementApi = class {
5
- client;
6
- constructor(client) {
7
- this.client = client;
8
- }
4
+ var ServiceAccessManagementApi = class extends BaseApi {
9
5
  getMany(query, headers) {
10
- const queryString = query ? `?${qs.stringify(query)}` : "";
6
+ const queryString = this.toQueryString(query);
11
7
  return this.client.get(`/service-access-management${queryString}`, headers);
12
8
  }
13
9
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ServiceAccessManagementApi.mjs","names":[],"sources":["../../../src/apis/serviceAccessManagement/ServiceAccessManagementApi.ts"],"sourcesContent":["import qs from 'qs'\nimport type { ApiClient } from '../../core/ApiClient'\nimport type { ListQuery, Paginated, HasGetMany } from '../../core/types'\nimport type { ServiceAccessManagement } from './types'\n\nexport class ServiceAccessManagementApi implements HasGetMany<ServiceAccessManagement> {\n private readonly client: ApiClient\n\n constructor(client: ApiClient) {\n this.client = client\n }\n\n /** Returns a paginated list of which users have access to which services. */\n getMany(\n query: ListQuery<ServiceAccessManagement> & { paginate: false },\n headers?: Record<string, string>,\n ): Promise<ServiceAccessManagement[]>\n getMany(\n query?: ListQuery<ServiceAccessManagement> & { paginate?: true },\n headers?: Record<string, string>,\n ): Promise<Paginated<ServiceAccessManagement>>\n getMany(\n query?: ListQuery<ServiceAccessManagement>,\n headers?: Record<string, string>,\n ): Promise<Paginated<ServiceAccessManagement> | ServiceAccessManagement[]> {\n const queryString = query ? `?${qs.stringify(query)}` : ''\n return this.client.get<Paginated<ServiceAccessManagement> | ServiceAccessManagement[]>(\n `/service-access-management${queryString}`,\n headers,\n )\n }\n}\n"],"mappings":";;;AAKA,IAAa,6BAAb,MAAuF;CACrF,AAAiB;CAEjB,YAAY,QAAmB;AAC7B,OAAK,SAAS;;CAYhB,QACE,OACA,SACyE;EACzE,MAAM,cAAc,QAAQ,IAAI,GAAG,UAAU,MAAM,KAAK;AACxD,SAAO,KAAK,OAAO,IACjB,6BAA6B,eAC7B,QACD"}
1
+ {"version":3,"file":"ServiceAccessManagementApi.mjs","names":[],"sources":["../../../src/apis/serviceAccessManagement/ServiceAccessManagementApi.ts"],"sourcesContent":["import { BaseApi } from '../../core/BaseApi'\nimport type { ListQuery, Paginated, HasGetMany } from '../../core/types'\nimport type { ServiceAccessManagement } from './types'\n\nexport class ServiceAccessManagementApi\n extends BaseApi\n implements HasGetMany<ServiceAccessManagement>\n{\n /** Returns a paginated list of which users have access to which services. */\n getMany(\n query: ListQuery<ServiceAccessManagement> & { paginate: false },\n headers?: Record<string, string>,\n ): Promise<ServiceAccessManagement[]>\n getMany(\n query?: ListQuery<ServiceAccessManagement> & { paginate?: true },\n headers?: Record<string, string>,\n ): Promise<Paginated<ServiceAccessManagement>>\n getMany(\n query?: ListQuery<ServiceAccessManagement>,\n headers?: Record<string, string>,\n ): Promise<Paginated<ServiceAccessManagement> | ServiceAccessManagement[]>\n getMany(\n query?: ListQuery<ServiceAccessManagement>,\n headers?: Record<string, string>,\n ): Promise<Paginated<ServiceAccessManagement> | ServiceAccessManagement[]> {\n const queryString = this.toQueryString(query)\n return this.client.get<Paginated<ServiceAccessManagement> | ServiceAccessManagement[]>(\n `/service-access-management${queryString}`,\n headers,\n )\n }\n}\n"],"mappings":";;;AAIA,IAAa,6BAAb,cACU,QAEV;CAcE,QACE,OACA,SACyE;EACzE,MAAM,cAAc,KAAK,cAAc,MAAM;AAC7C,SAAO,KAAK,OAAO,IACjB,6BAA6B,eAC7B,QACD"}